ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/request.C
(Generate patch)

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.171 by root, Sun Apr 11 00:34:07 2010 UTC vs.
Revision 1.193 by root, Wed Nov 16 23:42:03 2016 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001 Mark Wedel 5 * Copyright (©) 2001 Mark Wedel
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25//+GPL 25//+GPL
26 26
65 * This table translates the attack numbers as used within the 65 * This table translates the attack numbers as used within the
66 * program to the value we use when sending STATS command to the 66 * program to the value we use when sending STATS command to the
67 * client. If a value is -1, then we don't send that to the 67 * client. If a value is -1, then we don't send that to the
68 * client. 68 * client.
69 */ 69 */
70static short atnr_cs_stat[NROFATTACKS] = { CS_STAT_RES_PHYS, 70static short atnr_cs_stat[NROFATTACKS] =
71 CS_STAT_RES_MAG, CS_STAT_RES_FIRE, CS_STAT_RES_ELEC, 71{
72 CS_STAT_RES_COLD, CS_STAT_RES_CONF, CS_STAT_RES_ACID, 72 CS_STAT_RES_PHYS,
73 CS_STAT_RES_DRAIN, -1 /* weaponmagic */ , 73 CS_STAT_RES_MAG,
74 CS_STAT_RES_GHOSTHIT, CS_STAT_RES_POISON, 74 CS_STAT_RES_FIRE,
75 CS_STAT_RES_SLOW, CS_STAT_RES_PARA, CS_STAT_TURN_UNDEAD, 75 CS_STAT_RES_ELEC,
76 CS_STAT_RES_FEAR, -1 /* Cancellation */ , 76 CS_STAT_RES_COLD,
77 CS_STAT_RES_DEPLETE, CS_STAT_RES_DEATH, 77 CS_STAT_RES_CONF,
78 -1 /* Chaos */ , -1 /* Counterspell */ , 78 CS_STAT_RES_ACID,
79 -1 /* Godpower */ , CS_STAT_RES_HOLYWORD, 79 CS_STAT_RES_DRAIN,
80 -1 /* weaponmagic */,
81 CS_STAT_RES_GHOSTHIT,
82 CS_STAT_RES_POISON,
83 CS_STAT_RES_SLOW,
84 CS_STAT_RES_PARA,
85 CS_STAT_TURN_UNDEAD,
86 CS_STAT_RES_FEAR,
87 -1 /* Cancellation */,
88 CS_STAT_RES_DEPLETE,
89 CS_STAT_RES_DEATH,
90 -1 /* Chaos */,
91 -1 /* Counterspell */,
92 -1 /* Godpower */,
93 CS_STAT_RES_HOLYWORD,
80 CS_STAT_RES_BLIND, 94 CS_STAT_RES_BLIND,
81 -1, /* Internal */ 95 -1, /* Internal */
82 -1, /* life stealing */ 96 -1, /* life stealing */
83 -1 /* Disease - not fully done yet */ 97 -1 /* Disease - not fully done yet */
84}; 98};
132 pl->ns->mapinfo_queue_clear (); 146 pl->ns->mapinfo_queue_clear ();
133 147
134 memset (&pl->ns->lastmap, 0, sizeof (pl->ns->lastmap)); 148 memset (&pl->ns->lastmap, 0, sizeof (pl->ns->lastmap));
135 149
136 pl->ns->force_newmap = false; 150 pl->ns->force_newmap = false;
137
138 if (pl->ns->newmapcmd == 1)
139 pl->ns->send_packet ("newmap"); 151 pl->ns->send_packet ("newmap");
140
141 pl->ns->floorbox_reset (); 152 pl->ns->floorbox_reset ();
142} 153}
143 154
144static void 155static void
145send_map_info (player *pl) 156send_map_info (player *pl)
147 client &socket = *pl->ns; 158 client &socket = *pl->ns;
148 object *ob = pl->viewpoint; 159 object *ob = pl->viewpoint;
149 160
150 if (socket.mapinfocmd) 161 if (socket.mapinfocmd)
151 { 162 {
152 if (ob->map && ob->map->path[0]) 163 if (ob->map && ob->map->path)
153 { 164 {
154 int flags = 0; 165 int flags = 0;
155 166
167 // due to historical glitches, the bit ordering and map index ordering differs
156 if (ob->map->tile_path[0]) flags |= 1; 168 if (ob->map->tile_path [TILE_NORTH]) flags |= 0x01;
157 if (ob->map->tile_path[1]) flags |= 2; 169 if (ob->map->tile_path [TILE_EAST ]) flags |= 0x02;
158 if (ob->map->tile_path[2]) flags |= 4; 170 if (ob->map->tile_path [TILE_SOUTH]) flags |= 0x04;
159 if (ob->map->tile_path[3]) flags |= 8; 171 if (ob->map->tile_path [TILE_WEST ]) flags |= 0x08;
172 // these two are debatable
173 if (ob->map->tile_path [TILE_UP ]) flags |= 0x10;
174 if (ob->map->tile_path [TILE_DOWN ]) flags |= 0x20;
160 175
161 socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s", 176 socket.send_packet_printf ("mapinfo - spatial %d %d %d %d %d %s",
162 flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, 177 flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y,
163 ob->map->width, ob->map->height, &ob->map->path); 178 ob->map->width, ob->map->height, &ob->map->path);
164 } 179 }
179 { 194 {
180 INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); 195 INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region));
181 socket.current_region = reg; 196 socket.current_region = reg;
182 } 197 }
183 198
184 // first try to aovid a full newmap on tiled map scrolls 199 // first try to avoid a full newmap on tiled map scrolls
185 if (socket.current_map != ob->map && !socket.force_newmap) 200 if (socket.current_map != ob->map && !socket.force_newmap)
186 { 201 {
187 rv_vector rv; 202 rv_vector rv;
188 203
189 get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0); 204 get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0);
228send_skill_info (client *ns, char *params) 243send_skill_info (client *ns, char *params)
229{ 244{
230 packet sl; 245 packet sl;
231 sl << "replyinfo skill_info\n"; 246 sl << "replyinfo skill_info\n";
232 247
233 for (int i = 1; i < NUM_SKILLS; i++) 248 for (int i = 0; i < skillvec.size (); ++i)
234 sl.printf ("%d:%s\n", i + CS_STAT_SKILLINFO, &skill_names [i]); 249 sl.printf ("%d:%s\n", CS_STAT_SKILLINFO + i, &skillvec [i]->name);
235 250
236 if (sl.length () > MAXSOCKBUF) 251 if (sl.length () > MAXSOCKBUF)
237 {
238 LOG (llevError, "Buffer overflow in send_skill_info!\n"); 252 cleanup ("buffer overflow in send_skill_info!");
239 fatal (0);
240 }
241 253
242 ns->send_packet (sl); 254 ns->send_packet (sl);
243} 255}
244 256
245/** 257/**
255 267
256 for (int i = 0; i < NRSPELLPATHS; i++) 268 for (int i = 0; i < NRSPELLPATHS; i++)
257 sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]); 269 sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]);
258 270
259 if (sl.length () > MAXSOCKBUF) 271 if (sl.length () > MAXSOCKBUF)
260 {
261 LOG (llevError, "Buffer overflow in send_spell_paths!\n"); 272 cleanup ("buffer overflow in send_spell_paths!");
262 fatal (0);
263 }
264 273
265 ns->send_packet (sl); 274 ns->send_packet (sl);
266} 275}
267 276
268/** 277/**
269 * RequestInfo is sort of a meta command. There is some specific 278 * RequestInfo is sort of a meta command. There is some specific
270 * request of information, but we call other functions to provide 279 * request of information, but we call other functions to provide
271 * that information. 280 * that information.
281 * requestinfo is completely deprecated, use resource exti request
282 * and the fxix or http protocols.
272 */ 283 */
273void 284void
274RequestInfo (char *buf, int len, client *ns) 285RequestInfo (char *buf, int len, client *ns)
275{ 286{
276 char *params; 287 char *params;
336 347
337 while (*buf && map && max_distance) 348 while (*buf && map && max_distance)
338 { 349 {
339 int dir = *buf++ - '1'; 350 int dir = *buf++ - '1';
340 351
341 if (dir >= 0 && dir <= 3) 352 // due to historical glitches, the mapinfo index and tile index differs
353 static unsigned char dirmap [] = { TILE_NORTH, TILE_EAST, TILE_SOUTH, TILE_WEST, TILE_UP, TILE_DOWN };
354
355 // maybe we should only allow the four flat directions
356 if (IN_RANGE_EXC (dir, 0, array_length (dirmap)))
342 { 357 {
358 dir = dirmap [dir];
359
343 if (!map->tile_path [dir]) 360 if (!map->tile_path [dir])
344 map = 0; 361 map = 0;
345 else if (map->tile_available (dir, false)) 362 else if (map->tile_available (dir, false))
346 { 363 {
347 maptile *neigh = map->tile_map [dir]; 364 maptile *neigh = map->tile_map [dir];
370 send_packet_printf ("mapinfo %s nomap", token); 387 send_packet_printf ("mapinfo %s nomap", token);
371 else 388 else
372 { 389 {
373 int flags = 0; 390 int flags = 0;
374 391
392 // due to historical glitches, the bit ordering and map index ordering differs
375 if (map->tile_path[0]) flags |= 1; 393 if (map->tile_path [TILE_NORTH]) flags |= 0x01;
376 if (map->tile_path[1]) flags |= 2; 394 if (map->tile_path [TILE_EAST ]) flags |= 0x02;
377 if (map->tile_path[2]) flags |= 4; 395 if (map->tile_path [TILE_SOUTH]) flags |= 0x04;
378 if (map->tile_path[3]) flags |= 8; 396 if (map->tile_path [TILE_WEST ]) flags |= 0x08;
397 // these two are debatable
398 if (map->tile_path [TILE_UP ]) flags |= 0x10;
399 if (map->tile_path [TILE_DOWN ]) flags |= 0x20;
379 400
380 send_packet_printf ("mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, &map->path); 401 send_packet_printf ("mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, &map->path);
381 } 402 }
382 403
383 return 1; 404 return 1;
475 * Cleaning up the input should probably be done first - all actions 496 * Cleaning up the input should probably be done first - all actions
476 * for the command that issued the count should be done before any other 497 * for the command that issued the count should be done before any other
477 * commands. 498 * commands.
478 */ 499 */
479 pl->count = 0; 500 pl->count = 0;
480}
481
482/**
483 * This handles the general commands from the client (ie, north, fire, cast,
484 * etc.). It is a lot like PlayerCmd above, but is called with the
485 * 'ncom' method which gives more information back to the client so it
486 * can throttle.
487 */
488void
489NewPlayerCmd (char *buf, int len, player *pl)
490{
491 if (len <= 6)
492 {
493 LOG (llevDebug, "%s: corrupt ncom command <%s>: not long enough (%d) - discarding\n", pl->ns->host, buf, len);
494 return;
495 }
496
497 uint16 cmdid = net_uint16 ((uint8 *)buf);
498 sint32 repeat = net_sint32 ((uint8 *)buf + 2);
499
500 /* -1 is special - no repeat, but don't update */
501 if (repeat != -1)
502 pl->count = repeat;
503
504 buf += 6; //len -= 6;
505
506 execute_newserver_command (pl->ob, buf);
507
508 /* Perhaps something better should be done with a left over count.
509 * Cleaning up the input should probably be done first - all actions
510 * for the command that issued the count should be done before any other
511 * commands.
512 */
513 pl->count = 0;
514
515 //TODO: schmorp thinks whatever this calculates, it makes no sense at all
516 int time = pl->ob->has_active_speed ()
517 ? (int) (MAX_TIME / pl->ob->speed)
518 : MAX_TIME * 100;
519
520 /* Send confirmation of command execution now */
521 packet sl ("comc");
522 sl << uint16 (cmdid) << uint32 (time);
523 pl->ns->send_packet (sl);
524} 501}
525 502
526/** This is a reply to a previous query. */ 503/** This is a reply to a previous query. */
527void 504void
528ReplyCmd (char *buf, int len, client *ns) 505ReplyCmd (char *buf, int len, client *ns)
697 * commands for now. 674 * commands for now.
698 */ 675 */
699void 676void
700esrv_update_stats (player *pl) 677esrv_update_stats (player *pl)
701{ 678{
702 char buf[MAX_BUF];
703 uint16 flags;
704
705 client *ns = pl->ns; 679 client *ns = pl->ns;
706 if (!ns) 680 if (!ns)
707 return; 681 return;
708 682
709 object *ob = pl->observe; 683 object *ob = pl->observe;
726 AddIfShort (ns->last_stats.Int, ob->stats.Int, CS_STAT_INT); 700 AddIfShort (ns->last_stats.Int, ob->stats.Int, CS_STAT_INT);
727 AddIfShort (ns->last_stats.Wis, ob->stats.Wis, CS_STAT_WIS); 701 AddIfShort (ns->last_stats.Wis, ob->stats.Wis, CS_STAT_WIS);
728 AddIfShort (ns->last_stats.Pow, ob->stats.Pow, CS_STAT_POW); 702 AddIfShort (ns->last_stats.Pow, ob->stats.Pow, CS_STAT_POW);
729 AddIfShort (ns->last_stats.Cha, ob->stats.Cha, CS_STAT_CHA); 703 AddIfShort (ns->last_stats.Cha, ob->stats.Cha, CS_STAT_CHA);
730 704
731 for (int s = 0; s < NUM_SKILLS; s++) 705 for (int s = 0; s < CS_NUM_SKILLS; s++)
732 if (object *skill = opl->last_skill_ob [s]) 706 if (object *skill = opl->last_skill_ob [s])
733 if (skill->stats.exp != ns->last_skill_exp [s]) 707 if (skill->stats.exp != ns->last_skill_exp [s])
734 { 708 {
735 ns->last_skill_exp [s] = skill->stats.exp; 709 ns->last_skill_exp [s] = skill->stats.exp;
736 710
737 /* Always send along the level if exp changes. This is only 711 /* Always send along the level if exp changes. This is only
738 * 1 extra byte, but keeps processing simpler. 712 * 1 extra byte, but keeps processing simpler.
739 */ 713 */
740 sl << uint8 (s + CS_STAT_SKILLINFO) 714 sl << uint8 (CS_STAT_SKILLINFO + s)
741 << uint8 (skill->level) 715 << uint8 (skill->level)
742 << uint64 (skill->stats.exp); 716 << uint64 (skill->stats.exp);
743 } 717 }
744 718
745 AddIfInt64 (ns->last_stats.exp, ob->stats.exp, CS_STAT_EXP64); 719 AddIfInt64 (ns->last_stats.exp, ob->stats.exp, CS_STAT_EXP64);
750 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK); 724 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK);
751 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); 725 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD);
752 AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK); 726 AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK);
753 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); 727 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM);
754 728
755 flags = 0; 729 int flags = (opl->fire_on ? SF_FIREON : 0)
756 730 | (opl->run_on ? SF_RUNON : 0);
757 if (opl->fire_on)
758 flags |= SF_FIREON;
759
760 if (opl->run_on)
761 flags |= SF_RUNON;
762 731
763 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS); 732 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS);
764 733
765 for (int i = 0; i < NROFATTACKS; i++) 734 for (int i = 0; i < NROFATTACKS; i++)
766 {
767 /* Skip ones we won't send */ 735 /* Skip ones we won't send */
768 if (atnr_cs_stat[i] == -1) 736 if (atnr_cs_stat[i] >= 0)
769 continue;
770
771 AddIfShort (ns->last_resist[i], ob->resist[i], atnr_cs_stat[i]); 737 AddIfShort (ns->last_resist[i], ob->resist[i], atnr_cs_stat[i]);
772 }
773 738
774 if (pl->ns->monitor_spells) 739 if (pl->ns->monitor_spells)
775 { 740 {
776 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE); 741 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE);
777 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL); 742 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL);
778 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY); 743 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY);
779 } 744 }
780 745
746 char buf[MAX_BUF];
781 rangetostring (opl, buf); /* we want use the new fire & run system in new client */ 747 rangetostring (opl, buf); /* we want use the new fire & run system in new client */
782 AddIfString (ns->stats.range, buf, CS_STAT_RANGE); 748 AddIfString (ns->stats.range, buf, CS_STAT_RANGE);
783 set_title (ob, buf); 749 set_title (ob, buf);
784 AddIfString (ns->stats.title, buf, CS_STAT_TITLE); 750 AddIfString (ns->stats.title, buf, CS_STAT_TITLE);
785 751
879 845
880 /* Nothing changed */ 846 /* Nothing changed */
881 return 0; 847 return 0;
882} 848}
883 849
884//-GPL
885
886// prefetch (and touch) all maps within a specific distancd
887static void
888prefetch_surrounding_maps (maptile *map, int distance)
889{
890 map->touch ();
891
892 if (--distance)
893 for (int dir = 4; dir--; )
894 if (const shstr &path = map->tile_path [dir])
895 if (maptile *&neigh = map->tile_map [dir])
896 prefetch_surrounding_maps (neigh, distance);
897 else
898 neigh = maptile::find_async (path, map);
899}
900
901// prefetch a generous area around the player
902static void
903prefetch_surrounding_maps (object *op)
904{
905 prefetch_surrounding_maps (op->map, 3);
906}
907
908//+GPL
909
910/** 850/**
911 * Draws client map. 851 * Draws client map.
912 */ 852 */
913void 853void
914draw_client_map (player *pl) 854draw_client_map (player *pl)
919 859
920 /* If player is just joining the game, he isn't here yet, so the map 860 /* If player is just joining the game, he isn't here yet, so the map
921 * can get swapped out. If so, don't try to send them a map. All will 861 * can get swapped out. If so, don't try to send them a map. All will
922 * be OK once they really log in. 862 * be OK once they really log in.
923 */ 863 */
924 if (!ob->map || ob->map->in_memory != MAP_ACTIVE) 864 if (!ob->map || ob->map->state != MAP_ACTIVE)
925 return; 865 return;
926 866
927 int startlen, oldlen; 867 int startlen, oldlen;
928 868
929 check_map_change (pl); 869 check_map_change (pl);
930 prefetch_surrounding_maps (pl->ob); 870 pl->ob->prefetch_surrounding_maps ();
931 871
932 /* do LOS after calls to update_position */ 872 /* do LOS after calls to update_position */
933 /* unfortunately, we need to udpate los when observing, currently */ 873 /* unfortunately, we need to udpate los when observing, currently */
934 if (pl->do_los || pl->viewpoint != pl->ob) 874 if (pl->do_los || pl->viewpoint != pl->ob)
935 { 875 {
960 * look like. 900 * look like.
961 */ 901 */
962 902
963 client &socket = *pl->ns; 903 client &socket = *pl->ns;
964 904
965 packet sl (socket.mapmode == Map1Cmd ? "map1" : "map1a"); 905 packet sl ("map1a");
966 906
967 startlen = sl.length (); 907 startlen = sl.length ();
968 908
969 int hx = socket.mapx / 2; 909 int hx = socket.mapx / 2;
970 int hy = socket.mapy / 2; 910 int hy = socket.mapy / 2;
1253 1193
1254/* appends the spell *spell to the Socklist we will send the data to. */ 1194/* appends the spell *spell to the Socklist we will send the data to. */
1255static void 1195static void
1256append_spell (player *pl, packet &sl, object *spell) 1196append_spell (player *pl, packet &sl, object *spell)
1257{ 1197{
1258 int i, skill = 0; 1198 int skill = 0;
1259 1199
1260 if (!(spell->name)) 1200 if (!(spell->name))
1261 { 1201 {
1262 LOG (llevError, "item number %d is a spell with no name.\n", spell->count); 1202 LOG (llevError, "item number %d is a spell with no name.\n", spell->count);
1263 return; 1203 return;
1269 spell->cached_eat = casting_level (pl->ob, spell); 1209 spell->cached_eat = casting_level (pl->ob, spell);
1270 1210
1271 /* figure out which skill it uses, if it uses one */ 1211 /* figure out which skill it uses, if it uses one */
1272 if (spell->skill) 1212 if (spell->skill)
1273 if (object *tmp = pl->find_skill (spell->skill)) 1213 if (object *tmp = pl->find_skill (spell->skill))
1274 skill = tmp->subtype + CS_STAT_SKILLINFO; 1214 skill = CS_STAT_SKILLINFO + SKILL_INDEX (tmp);
1275 1215
1276 // spells better have a face 1216 // spells better have a face
1277 if (!spell->face) 1217 if (!spell->face)
1278 { 1218 {
1279 LOG (llevError, "%s: spell has no face, but face is mandatory.\n", &spell->name); 1219 LOG (llevError, "%s: spell has no face, but face is mandatory.\n", &spell->name);
1290 << uint16 (spell->cached_grace) 1230 << uint16 (spell->cached_grace)
1291 << uint16 (spell->cached_eat) 1231 << uint16 (spell->cached_eat)
1292 << uint8 (skill) 1232 << uint8 (skill)
1293 << uint32 (spell->path_attuned) 1233 << uint32 (spell->path_attuned)
1294 << uint32 (spell->face) 1234 << uint32 (spell->face)
1295 << data8 (spell->name) 1235 << data8 (spell->name);
1236
1237 if (pl->ns->monitor_spells < 2)
1296 << data16 (spell->msg); 1238 sl << data16 (spell->msg);
1297} 1239}
1298 1240
1299/** 1241/**
1300 * This tells the client to add the spell *ob, if *ob is NULL, then add 1242 * This tells the client to add the spell *ob, if *ob is NULL, then add
1301 * all spells in the player's inventory. 1243 * all spells in the player's inventory.
1353 } 1295 }
1354 else 1296 else
1355 append_spell (pl, sl, spell); 1297 append_spell (pl, sl, spell);
1356 1298
1357 if (sl.length () > MAXSOCKBUF) 1299 if (sl.length () > MAXSOCKBUF)
1358 {
1359 LOG (llevError, "Buffer overflow in esrv_add_spells!\n"); 1300 cleanup ("buffer overflow in esrv_add_spells!");
1360 fatal (0);
1361 }
1362 1301
1363 /* finally, we can send the packet */ 1302 /* finally, we can send the packet */
1364 pl->ns->flush_fx (); 1303 pl->ns->flush_fx ();
1365 pl->ns->send_packet (sl); 1304 pl->ns->send_packet (sl);
1366} 1305}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines