… | |
… | |
66 | * This table translates the attack numbers as used within the |
66 | * This table translates the attack numbers as used within the |
67 | * program to the value we use when sending STATS command to the |
67 | * program to the value we use when sending STATS command to the |
68 | * client. If a value is -1, then we don't send that to the |
68 | * client. If a value is -1, then we don't send that to the |
69 | * client. |
69 | * client. |
70 | */ |
70 | */ |
71 | short atnr_cs_stat[NROFATTACKS] = { CS_STAT_RES_PHYS, |
71 | static short atnr_cs_stat[NROFATTACKS] = { CS_STAT_RES_PHYS, |
72 | CS_STAT_RES_MAG, CS_STAT_RES_FIRE, CS_STAT_RES_ELEC, |
72 | CS_STAT_RES_MAG, CS_STAT_RES_FIRE, CS_STAT_RES_ELEC, |
73 | CS_STAT_RES_COLD, CS_STAT_RES_CONF, CS_STAT_RES_ACID, |
73 | CS_STAT_RES_COLD, CS_STAT_RES_CONF, CS_STAT_RES_ACID, |
74 | CS_STAT_RES_DRAIN, -1 /* weaponmagic */ , |
74 | CS_STAT_RES_DRAIN, -1 /* weaponmagic */ , |
75 | CS_STAT_RES_GHOSTHIT, CS_STAT_RES_POISON, |
75 | CS_STAT_RES_GHOSTHIT, CS_STAT_RES_POISON, |
76 | CS_STAT_RES_SLOW, CS_STAT_RES_PARA, CS_STAT_TURN_UNDEAD, |
76 | CS_STAT_RES_SLOW, CS_STAT_RES_PARA, CS_STAT_TURN_UNDEAD, |
… | |
… | |
217 | socket.floorbox_reset (); |
217 | socket.floorbox_reset (); |
218 | } |
218 | } |
219 | |
219 | |
220 | socket.current_x = ob->x; |
220 | socket.current_x = ob->x; |
221 | socket.current_y = ob->y; |
221 | socket.current_y = ob->y; |
|
|
222 | } |
|
|
223 | |
|
|
224 | /** |
|
|
225 | * This sends the skill number to name mapping. We ignore |
|
|
226 | * the params - we always send the same info no matter what. |
|
|
227 | */ |
|
|
228 | void |
|
|
229 | send_skill_info (client *ns, char *params) |
|
|
230 | { |
|
|
231 | packet sl; |
|
|
232 | sl << "replyinfo skill_info\n"; |
|
|
233 | |
|
|
234 | for (int i = 1; i < NUM_SKILLS; i++) |
|
|
235 | sl.printf ("%d:%s\n", i + CS_STAT_SKILLINFO, &skill_names [i]); |
|
|
236 | |
|
|
237 | if (sl.length () > MAXSOCKBUF) |
|
|
238 | { |
|
|
239 | LOG (llevError, "Buffer overflow in send_skill_info!\n"); |
|
|
240 | fatal (0); |
|
|
241 | } |
|
|
242 | |
|
|
243 | ns->send_packet (sl); |
|
|
244 | } |
|
|
245 | |
|
|
246 | /** |
|
|
247 | * This sends the spell path to name mapping. We ignore |
|
|
248 | * the params - we always send the same info no matter what. |
|
|
249 | */ |
|
|
250 | void |
|
|
251 | send_spell_paths (client * ns, char *params) |
|
|
252 | { |
|
|
253 | packet sl; |
|
|
254 | |
|
|
255 | sl << "replyinfo spell_paths\n"; |
|
|
256 | |
|
|
257 | for (int i = 0; i < NRSPELLPATHS; i++) |
|
|
258 | sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]); |
|
|
259 | |
|
|
260 | if (sl.length () > MAXSOCKBUF) |
|
|
261 | { |
|
|
262 | LOG (llevError, "Buffer overflow in send_spell_paths!\n"); |
|
|
263 | fatal (0); |
|
|
264 | } |
|
|
265 | |
|
|
266 | ns->send_packet (sl); |
222 | } |
267 | } |
223 | |
268 | |
224 | /** |
269 | /** |
225 | * RequestInfo is sort of a meta command. There is some specific |
270 | * RequestInfo is sort of a meta command. There is some specific |
226 | * request of information, but we call other functions to provide |
271 | * request of information, but we call other functions to provide |
… | |
… | |
1233 | { |
1278 | { |
1234 | pl->contr->ns->send_packet (buf); |
1279 | pl->contr->ns->send_packet (buf); |
1235 | } |
1280 | } |
1236 | |
1281 | |
1237 | /** |
1282 | /** |
1238 | * This sends the skill number to name mapping. We ignore |
|
|
1239 | * the params - we always send the same info no matter what. |
|
|
1240 | */ |
|
|
1241 | void |
|
|
1242 | send_skill_info (client *ns, char *params) |
|
|
1243 | { |
|
|
1244 | packet sl; |
|
|
1245 | sl << "replyinfo skill_info\n"; |
|
|
1246 | |
|
|
1247 | for (int i = 1; i < NUM_SKILLS; i++) |
|
|
1248 | sl.printf ("%d:%s\n", i + CS_STAT_SKILLINFO, &skill_names [i]); |
|
|
1249 | |
|
|
1250 | if (sl.length () > MAXSOCKBUF) |
|
|
1251 | { |
|
|
1252 | LOG (llevError, "Buffer overflow in send_skill_info!\n"); |
|
|
1253 | fatal (0); |
|
|
1254 | } |
|
|
1255 | |
|
|
1256 | ns->send_packet (sl); |
|
|
1257 | } |
|
|
1258 | |
|
|
1259 | /** |
|
|
1260 | * This sends the spell path to name mapping. We ignore |
|
|
1261 | * the params - we always send the same info no matter what. |
|
|
1262 | */ |
|
|
1263 | void |
|
|
1264 | send_spell_paths (client * ns, char *params) |
|
|
1265 | { |
|
|
1266 | packet sl; |
|
|
1267 | |
|
|
1268 | sl << "replyinfo spell_paths\n"; |
|
|
1269 | |
|
|
1270 | for (int i = 0; i < NRSPELLPATHS; i++) |
|
|
1271 | sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]); |
|
|
1272 | |
|
|
1273 | if (sl.length () > MAXSOCKBUF) |
|
|
1274 | { |
|
|
1275 | LOG (llevError, "Buffer overflow in send_spell_paths!\n"); |
|
|
1276 | fatal (0); |
|
|
1277 | } |
|
|
1278 | |
|
|
1279 | ns->send_packet (sl); |
|
|
1280 | } |
|
|
1281 | |
|
|
1282 | /** |
|
|
1283 | * This looks for any spells the player may have that have changed their stats. |
1283 | * This looks for any spells the player may have that have changed their stats. |
1284 | * it then sends an updspell packet for each spell that has changed in this way |
1284 | * it then sends an updspell packet for each spell that has changed in this way |
1285 | */ |
1285 | */ |
1286 | void |
1286 | void |
1287 | esrv_update_spells (player *pl) |
1287 | esrv_update_spells (player *pl) |