… | |
… | |
67 | if (pl->ob == op) |
67 | if (pl->ob == op) |
68 | { |
68 | { |
69 | new_draw_info (NDI_UNIQUE, 0, op, "You can't do that to yourself."); |
69 | new_draw_info (NDI_UNIQUE, 0, op, "You can't do that to yourself."); |
70 | return NULL; |
70 | return NULL; |
71 | } |
71 | } |
|
|
72 | |
72 | if (pl->state != ST_PLAYING) |
73 | if (pl->ns->state != ST_PLAYING) |
73 | { |
74 | { |
74 | new_draw_info (NDI_UNIQUE, 0, op, "That player is in no state for that right now."); |
75 | new_draw_info (NDI_UNIQUE, 0, op, "That player is in no state for that right now."); |
75 | return NULL; |
76 | return NULL; |
76 | } |
77 | } |
|
|
78 | |
77 | return pl; |
79 | return pl; |
78 | } |
|
|
79 | |
|
|
80 | /** |
|
|
81 | * This command will stress server. |
|
|
82 | */ |
|
|
83 | int |
|
|
84 | command_loadtest (object *op, char *params) |
|
|
85 | { |
|
|
86 | uint32 x, y; |
|
|
87 | char buf[1024]; |
|
|
88 | |
|
|
89 | new_draw_info (NDI_UNIQUE, 0, op, "loadtest will stress server through teleporting"); |
|
|
90 | new_draw_info (NDI_UNIQUE, 0, op, "at different map places."); |
|
|
91 | new_draw_info (NDI_UNIQUE, 0, op, "use at your own risks."); |
|
|
92 | new_draw_info (NDI_UNIQUE, 0, op, "Very long loop used so server may have to be reset."); |
|
|
93 | new_draw_info (NDI_UNIQUE, 0, op, "type loadtest TRUE to run"); |
|
|
94 | new_draw_info_format (NDI_UNIQUE, 0, op, "{%s}", params); |
|
|
95 | |
|
|
96 | if (!params) |
|
|
97 | return 0; |
|
|
98 | |
|
|
99 | if (strncmp (params, "TRUE", 4)) |
|
|
100 | return 0; |
|
|
101 | |
|
|
102 | new_draw_info_format (NDI_UNIQUE, 0, op, "gogogo"); |
|
|
103 | |
|
|
104 | for (x = 0; x < settings.worldmaptilesx; x++) |
|
|
105 | { |
|
|
106 | for (y = 0; y < settings.worldmaptilesy; y++) |
|
|
107 | { |
|
|
108 | sprintf (buf, "/world/world_%d_%d", x + settings.worldmapstartx, y + settings.worldmapstarty); |
|
|
109 | command_goto (op, buf); |
|
|
110 | } |
|
|
111 | } |
|
|
112 | |
|
|
113 | return 0; |
|
|
114 | } |
80 | } |
115 | |
81 | |
116 | /** |
82 | /** |
117 | * Actually hides specified player (obviously a DM). |
83 | * Actually hides specified player (obviously a DM). |
118 | * If 'silent_dm' is non zero, other players are informed of DM entering/leaving, |
84 | * If 'silent_dm' is non zero, other players are informed of DM entering/leaving, |
… | |
… | |
252 | now = time (NULL); |
218 | now = time (NULL); |
253 | /* |
219 | /* |
254 | * Record this as a comment - then we don't have to worry about changing |
220 | * Record this as a comment - then we don't have to worry about changing |
255 | * the parsing code. |
221 | * the parsing code. |
256 | */ |
222 | */ |
257 | fprintf (banishfile, "# %s (%s) banned by %s at %s\n", &pl->ob->name, pl->socket.host, &op->name, ctime (&now)); |
223 | fprintf (banishfile, "# %s (%s) banned by %s at %s\n", &pl->ob->name, pl->ns->host, &op->name, ctime (&now)); |
258 | fprintf (banishfile, "*@%s\n", pl->socket.host); |
224 | fprintf (banishfile, "*@%s\n", pl->ns->host); |
259 | fclose (banishfile); |
225 | fclose (banishfile); |
260 | |
226 | |
261 | LOG (llevDebug, "! %s banned %s from IP: %s.\n", &op->name, &pl->ob->name, pl->socket.host); |
227 | LOG (llevDebug, "! %s banned %s from IP: %s.\n", &op->name, &pl->ob->name, pl->ns->host); |
262 | new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op, "You banish %s", &pl->ob->name); |
228 | new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op, "You banish %s", &pl->ob->name); |
263 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name); |
229 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name); |
264 | command_kick (op, (char *) &pl->ob->name); |
230 | command_kick (op, (char *) &pl->ob->name); |
265 | return 1; |
231 | return 1; |
266 | } |
232 | } |
267 | |
233 | |
268 | int |
234 | int |
269 | command_kick (object *op, char *params) |
235 | command_kick (object *op, char *params) |
270 | { |
236 | { |
271 | struct pl *pl; |
|
|
272 | |
|
|
273 | for (pl = first_player; pl != NULL; pl = pl->next) |
237 | for (player *pl = first_player; pl; pl = pl->next) |
274 | if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) |
238 | if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) |
275 | { |
239 | { |
276 | object *op = pl->ob; |
240 | object *op = pl->ob; |
277 | |
241 | |
278 | if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) |
242 | if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) |
279 | { |
243 | { |
280 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name); |
244 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name); |
281 | strcpy (op->contr->killer, "kicked"); |
245 | strcpy (op->contr->killer, "kicked"); |
282 | } |
246 | } |
283 | |
247 | |
284 | pl->socket.status = Ns_Dead; |
248 | pl->ns->destroy (); |
285 | } |
249 | } |
286 | |
250 | |
287 | return 1; |
251 | return 1; |
288 | } |
252 | } |
289 | |
253 | |
… | |
… | |
309 | } |
273 | } |
310 | |
274 | |
311 | int |
275 | int |
312 | command_shutdown (object *op, char *params) |
276 | command_shutdown (object *op, char *params) |
313 | { |
277 | { |
314 | struct pl *pl; |
|
|
315 | |
|
|
316 | if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ)) |
278 | if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ)) |
317 | { |
279 | { |
318 | new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
280 | new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
319 | return 1; |
281 | return 1; |
320 | } |
282 | } |
321 | |
283 | |
322 | cleanup (); |
284 | cleanup (); |
323 | /* not reached */ |
285 | /* not reached */ |
324 | return 1; |
|
|
325 | } |
|
|
326 | |
|
|
327 | int |
|
|
328 | command_goto (object *op, char *params) |
|
|
329 | { |
|
|
330 | char *name; |
|
|
331 | object *dummy; |
|
|
332 | |
|
|
333 | if (!op) |
|
|
334 | return 0; |
|
|
335 | |
|
|
336 | if (params == NULL) |
|
|
337 | { |
|
|
338 | new_draw_info (NDI_UNIQUE, 0, op, "Go to what level?"); |
|
|
339 | return 1; |
|
|
340 | } |
|
|
341 | |
|
|
342 | name = params; |
|
|
343 | dummy = get_object (); |
|
|
344 | dummy->map = op->map; |
|
|
345 | EXIT_PATH (dummy) = name; |
|
|
346 | dummy->name = name; |
|
|
347 | |
|
|
348 | enter_exit (op, dummy); |
|
|
349 | free_object (dummy); |
|
|
350 | if (op->contr->loading == NULL) |
|
|
351 | { |
|
|
352 | new_draw_info_format (NDI_UNIQUE, 0, op, "Difficulty: %d.", op->map->difficulty); |
|
|
353 | } |
|
|
354 | |
|
|
355 | return 1; |
|
|
356 | } |
|
|
357 | |
|
|
358 | /* is this function called from somewhere ? -Tero */ |
|
|
359 | int |
|
|
360 | command_generate (object *op, char *params) |
|
|
361 | { |
|
|
362 | object *tmp; |
|
|
363 | int nr = 1, i, retry; |
|
|
364 | |
|
|
365 | if (!op) |
|
|
366 | return 0; |
|
|
367 | |
|
|
368 | if (params != NULL) |
|
|
369 | sscanf (params, "%d", &nr); |
|
|
370 | for (i = 0; i < nr; i++) |
|
|
371 | { |
|
|
372 | retry = 50; |
|
|
373 | while ((tmp = generate_treasure (0, op->map->difficulty)) == NULL && --retry) |
|
|
374 | ; |
|
|
375 | if (tmp != NULL) |
|
|
376 | { |
|
|
377 | tmp = insert_ob_in_ob (tmp, op); |
|
|
378 | if (op->type == PLAYER) |
|
|
379 | esrv_send_item (op, tmp); |
|
|
380 | } |
|
|
381 | } |
|
|
382 | |
|
|
383 | return 1; |
286 | return 1; |
384 | } |
287 | } |
385 | |
288 | |
386 | int |
289 | int |
387 | command_freeze (object *op, char *params) |
290 | command_freeze (object *op, char *params) |
… | |
… | |
441 | /* we have nowhere to send the prisoner.... */ |
344 | /* we have nowhere to send the prisoner.... */ |
442 | new_draw_info (NDI_UNIQUE, 0, op, "can't jail player, there is no map to hold them"); |
345 | new_draw_info (NDI_UNIQUE, 0, op, "can't jail player, there is no map to hold them"); |
443 | return 0; |
346 | return 0; |
444 | } |
347 | } |
445 | enter_exit (pl->ob, dummy); |
348 | enter_exit (pl->ob, dummy); |
446 | free_object (dummy); |
349 | dummy->destroy (); |
447 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested."); |
350 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested."); |
448 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
351 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
449 | LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name); |
352 | LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name); |
450 | return 1; |
353 | return 1; |
451 | } |
354 | } |
… | |
… | |
475 | { |
378 | { |
476 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); |
379 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); |
477 | return 1; |
380 | return 1; |
478 | } |
381 | } |
479 | |
382 | |
480 | dummy = get_object (); |
383 | dummy = object::create (); |
481 | EXIT_PATH (dummy) = op->map->path; |
384 | EXIT_PATH (dummy) = op->map->path; |
482 | EXIT_X (dummy) = op->x + freearr_x[i]; |
385 | EXIT_X (dummy) = op->x + freearr_x[i]; |
483 | EXIT_Y (dummy) = op->y + freearr_y[i]; |
386 | EXIT_Y (dummy) = op->y + freearr_y[i]; |
484 | enter_exit (pl->ob, dummy); |
387 | enter_exit (pl->ob, dummy); |
485 | free_object (dummy); |
388 | dummy->destroy (); |
486 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
389 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
487 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
390 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
488 | |
391 | |
489 | return 1; |
392 | return 1; |
490 | } |
393 | } |
… | |
… | |
519 | { |
422 | { |
520 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to."); |
423 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to."); |
521 | return 1; |
424 | return 1; |
522 | } |
425 | } |
523 | |
426 | |
524 | dummy = get_object (); |
427 | dummy = object::create (); |
525 | EXIT_PATH (dummy) = pl->ob->map->path; |
428 | EXIT_PATH (dummy) = pl->ob->map->path; |
526 | EXIT_X (dummy) = pl->ob->x + freearr_x[i]; |
429 | EXIT_X (dummy) = pl->ob->x + freearr_x[i]; |
527 | EXIT_Y (dummy) = pl->ob->y + freearr_y[i]; |
430 | EXIT_Y (dummy) = pl->ob->y + freearr_y[i]; |
528 | enter_exit (op, dummy); |
431 | enter_exit (op, dummy); |
529 | free_object (dummy); |
432 | dummy->destroy (); |
530 | if (!op->contr->hidden) |
433 | if (!op->contr->hidden) |
531 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You see a portal open."); |
434 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You see a portal open."); |
532 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
435 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
533 | return 1; |
436 | return 1; |
534 | } |
437 | } |
… | |
… | |
821 | * so just copying it over should be fine. |
724 | * so just copying it over should be fine. |
822 | */ |
725 | */ |
823 | if (!head) |
726 | if (!head) |
824 | { |
727 | { |
825 | head = dup; |
728 | head = dup; |
826 | copy_object (tmp, dup); |
729 | tmp->copy_to (dup); |
827 | } |
730 | } |
828 | |
731 | |
829 | if (settings.real_wiz == FALSE) |
732 | if (settings.real_wiz == FALSE) |
830 | SET_FLAG (dup, FLAG_WAS_WIZ); |
733 | SET_FLAG (dup, FLAG_WAS_WIZ); |
831 | |
734 | |
… | |
… | |
858 | if (out_of_map (op->map, head->x + size_x, head->y + size_y)) |
761 | if (out_of_map (op->map, head->x + size_x, head->y + size_y)) |
859 | { |
762 | { |
860 | if (head->x < size_x || head->y < size_y) |
763 | if (head->x < size_x || head->y < size_y) |
861 | { |
764 | { |
862 | dm_stack_pop (op->contr); |
765 | dm_stack_pop (op->contr); |
863 | free_object (head); |
766 | head->destroy (); |
864 | new_draw_info (NDI_UNIQUE, 0, op, "Object too big to insert in map, or wrong position."); |
767 | new_draw_info (NDI_UNIQUE, 0, op, "Object too big to insert in map, or wrong position."); |
865 | free_object (tmp); |
768 | tmp->destroy (); |
866 | return 1; |
769 | return 1; |
867 | } |
770 | } |
868 | |
771 | |
869 | check = head; |
772 | check = head; |
870 | |
773 | |
… | |
… | |
892 | |
795 | |
893 | esrv_send_item (op, head); |
796 | esrv_send_item (op, head); |
894 | } |
797 | } |
895 | |
798 | |
896 | /* free the one we used to copy */ |
799 | /* free the one we used to copy */ |
897 | free_object (tmp); |
800 | tmp->destroy (); |
898 | } |
801 | } |
899 | |
802 | |
900 | return 1; |
803 | return 1; |
901 | } |
804 | } |
902 | |
805 | |
… | |
… | |
944 | |
847 | |
945 | tmp = get_dm_object (op->contr, ¶ms, NULL); |
848 | tmp = get_dm_object (op->contr, ¶ms, NULL); |
946 | if (!tmp) |
849 | if (!tmp) |
947 | return 1; |
850 | return 1; |
948 | |
851 | |
949 | dump_object (tmp); |
852 | char *dump = dump_object (tmp); |
950 | new_draw_info (NDI_UNIQUE, 0, op, errmsg); |
853 | new_draw_info (NDI_UNIQUE, 0, op, dump); |
|
|
854 | free (dump); |
|
|
855 | |
951 | if (QUERY_FLAG (tmp, FLAG_OBJ_ORIGINAL)) |
856 | if (QUERY_FLAG (tmp, FLAG_OBJ_ORIGINAL)) |
952 | new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original"); |
857 | new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original"); |
|
|
858 | |
953 | return 1; |
859 | return 1; |
954 | } |
860 | } |
955 | |
861 | |
956 | /** |
862 | /** |
957 | * When DM is possessing a monster, flip aggression on and off, to allow |
863 | * When DM is possessing a monster, flip aggression on and off, to allow |
… | |
… | |
1119 | dm_stack_pop (op->contr); |
1025 | dm_stack_pop (op->contr); |
1120 | |
1026 | |
1121 | /* Always work on the head - otherwise object will get in odd state */ |
1027 | /* Always work on the head - otherwise object will get in odd state */ |
1122 | if (tmp->head) |
1028 | if (tmp->head) |
1123 | tmp = tmp->head; |
1029 | tmp = tmp->head; |
1124 | remove_ob (tmp); |
1030 | tmp->remove (); |
1125 | return 1; |
1031 | return 1; |
1126 | } |
1032 | } |
1127 | |
1033 | |
1128 | int |
1034 | int |
1129 | command_free (object *op, char *params) |
1035 | command_free (object *op, char *params) |
… | |
… | |
1144 | dm_stack_pop (op->contr); |
1050 | dm_stack_pop (op->contr); |
1145 | |
1051 | |
1146 | if (!QUERY_FLAG (tmp, FLAG_REMOVED)) |
1052 | if (!QUERY_FLAG (tmp, FLAG_REMOVED)) |
1147 | { |
1053 | { |
1148 | new_draw_info (NDI_UNIQUE, 0, op, "Warning, item wasn't removed."); |
1054 | new_draw_info (NDI_UNIQUE, 0, op, "Warning, item wasn't removed."); |
1149 | remove_ob (tmp); |
1055 | tmp->remove (); |
1150 | } |
1056 | } |
1151 | |
1057 | |
1152 | if (tmp->head) |
1058 | if (tmp->head) |
1153 | tmp = tmp->head; |
1059 | tmp = tmp->head; |
1154 | free_object (tmp); |
1060 | |
|
|
1061 | tmp->destroy (); |
1155 | return 1; |
1062 | return 1; |
1156 | } |
1063 | } |
1157 | |
1064 | |
1158 | /** |
1065 | /** |
1159 | * This adds exp to a player. We now allow adding to a specific skill. |
1066 | * This adds exp to a player. We now allow adding to a specific skill. |
… | |
… | |
1238 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1145 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1239 | sprintf (buf, "Con : %-2d AC : %-4d WC : %d", pl->ob->stats.Con, pl->ob->stats.ac, pl->ob->stats.wc); |
1146 | sprintf (buf, "Con : %-2d AC : %-4d WC : %d", pl->ob->stats.Con, pl->ob->stats.ac, pl->ob->stats.wc); |
1240 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1147 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1241 | sprintf (buf, "Int : %-2d Damage : %d", pl->ob->stats.Int, pl->ob->stats.dam); |
1148 | sprintf (buf, "Int : %-2d Damage : %d", pl->ob->stats.Int, pl->ob->stats.dam); |
1242 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1149 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1243 | sprintf (buf, "Wis : %-2d EXP : %lld", pl->ob->stats.Wis, (long long) pl->ob->stats.exp); |
1150 | sprintf (buf, "Wis : %-2d EXP : %" PRId64, pl->ob->stats.Wis, pl->ob->stats.exp); |
1244 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1151 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1245 | sprintf (buf, "Pow : %-2d Grace : %d", pl->ob->stats.Pow, pl->ob->stats.grace); |
1152 | sprintf (buf, "Pow : %-2d Grace : %d", pl->ob->stats.Pow, pl->ob->stats.grace); |
1246 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1153 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1247 | sprintf (buf, "Cha : %-2d Food : %d", pl->ob->stats.Cha, pl->ob->stats.food); |
1154 | sprintf (buf, "Cha : %-2d Food : %d", pl->ob->stats.Cha, pl->ob->stats.food); |
1248 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1155 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
… | |
… | |
1314 | } |
1221 | } |
1315 | |
1222 | |
1316 | int |
1223 | int |
1317 | command_reset (object *op, char *params) |
1224 | command_reset (object *op, char *params) |
1318 | { |
1225 | { |
1319 | mapstruct *m; |
1226 | maptile *m; |
1320 | object *dummy = NULL, *tmp = NULL; |
1227 | object *dummy = NULL, *tmp = NULL; |
1321 | |
1228 | |
1322 | if (params == NULL) |
1229 | if (params == NULL) |
1323 | { |
1230 | { |
1324 | new_draw_info (NDI_UNIQUE, 0, op, "Reset what map [name]?"); |
1231 | new_draw_info (NDI_UNIQUE, 0, op, "Reset what map [name]?"); |
1325 | return 1; |
1232 | return 1; |
1326 | } |
1233 | } |
1327 | |
1234 | |
1328 | if (strcmp (params, ".") == 0) |
1235 | if (strcmp (params, ".") == 0) |
1329 | params = op->map->path; |
1236 | params = op->map->path; |
|
|
1237 | |
1330 | m = has_been_loaded (params); |
1238 | m = has_been_loaded (params); |
1331 | if (m == NULL) |
1239 | if (m == NULL) |
1332 | { |
1240 | { |
1333 | new_draw_info (NDI_UNIQUE, 0, op, "No such map."); |
1241 | new_draw_info (NDI_UNIQUE, 0, op, "No such map."); |
1334 | return 1; |
1242 | return 1; |
… | |
… | |
1346 | * Only attempt to remove the player that is doing the reset, and not other |
1254 | * Only attempt to remove the player that is doing the reset, and not other |
1347 | * players or wiz's. |
1255 | * players or wiz's. |
1348 | */ |
1256 | */ |
1349 | if (op->map == m) |
1257 | if (op->map == m) |
1350 | { |
1258 | { |
1351 | dummy = get_object (); |
1259 | dummy = object::create (); |
1352 | dummy->map = NULL; |
1260 | dummy->map = NULL; |
1353 | EXIT_X (dummy) = op->x; |
1261 | EXIT_X (dummy) = op->x; |
1354 | EXIT_Y (dummy) = op->y; |
1262 | EXIT_Y (dummy) = op->y; |
1355 | EXIT_PATH (dummy) = op->map->path; |
1263 | EXIT_PATH (dummy) = op->map->path; |
1356 | remove_ob (op); |
1264 | op->remove (); |
1357 | op->map = NULL; |
1265 | op->map = NULL; |
1358 | tmp = op; |
1266 | tmp = op; |
1359 | } |
1267 | } |
1360 | swap_map (m); |
1268 | swap_map (m); |
1361 | } |
1269 | } |
… | |
… | |
1366 | |
1274 | |
1367 | /* setting this effectively causes an immediate reload */ |
1275 | /* setting this effectively causes an immediate reload */ |
1368 | m->reset_time = 1; |
1276 | m->reset_time = 1; |
1369 | flush_old_maps (); |
1277 | flush_old_maps (); |
1370 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
1278 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
|
|
1279 | |
1371 | if (tmp) |
1280 | if (tmp) |
1372 | { |
1281 | { |
1373 | enter_exit (tmp, dummy); |
1282 | enter_exit (tmp, dummy); |
1374 | free_object (dummy); |
1283 | dummy->destroy (); |
1375 | } |
1284 | } |
|
|
1285 | |
1376 | return 1; |
1286 | return 1; |
1377 | } |
1287 | } |
1378 | else |
1288 | else |
1379 | { |
1289 | { |
1380 | player *pl; |
1290 | player *pl; |
… | |
… | |
1382 | |
1292 | |
1383 | /* Need to re-insert player if swap failed for some reason */ |
1293 | /* Need to re-insert player if swap failed for some reason */ |
1384 | if (tmp) |
1294 | if (tmp) |
1385 | { |
1295 | { |
1386 | insert_ob_in_map (op, m, NULL, 0); |
1296 | insert_ob_in_map (op, m, NULL, 0); |
1387 | free_object (dummy); |
1297 | dummy->destroy (); |
1388 | } |
1298 | } |
1389 | |
1299 | |
1390 | new_draw_info (NDI_UNIQUE, 0, op, "Reset failed, couldn't swap map, the following players are on it:"); |
1300 | new_draw_info (NDI_UNIQUE, 0, op, "Reset failed, couldn't swap map, the following players are on it:"); |
1391 | for (pl = first_player; pl != NULL; pl = pl->next) |
1301 | for (pl = first_player; pl != NULL; pl = pl->next) |
1392 | { |
1302 | { |
… | |
… | |
1477 | { |
1387 | { |
1478 | new_draw_info (NDI_UNIQUE, 0, op, "You are already the Dungeon Master!"); |
1388 | new_draw_info (NDI_UNIQUE, 0, op, "You are already the Dungeon Master!"); |
1479 | return 0; |
1389 | return 0; |
1480 | } |
1390 | } |
1481 | |
1391 | |
1482 | if (checkdm (op, op->name, (params ? params : "*"), op->contr->socket.host)) |
1392 | if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host)) |
1483 | { |
1393 | { |
1484 | SET_FLAG (op, FLAG_WIZ); |
1394 | SET_FLAG (op, FLAG_WIZ); |
1485 | SET_FLAG (op, FLAG_WAS_WIZ); |
1395 | SET_FLAG (op, FLAG_WAS_WIZ); |
1486 | SET_FLAG (op, FLAG_WIZPASS); |
1396 | SET_FLAG (op, FLAG_WIZPASS); |
1487 | SET_FLAG (op, FLAG_WIZCAST); |
1397 | SET_FLAG (op, FLAG_WIZCAST); |
… | |
… | |
1658 | new_draw_info_format (NDI_UNIQUE, 0, op, "You already know the spell %s.", &tmp->name); |
1568 | new_draw_info_format (NDI_UNIQUE, 0, op, "You already know the spell %s.", &tmp->name); |
1659 | return 0; |
1569 | return 0; |
1660 | } |
1570 | } |
1661 | |
1571 | |
1662 | do_learn_spell (op, tmp, special_prayer); |
1572 | do_learn_spell (op, tmp, special_prayer); |
1663 | free_object (tmp); |
1573 | tmp->destroy (); |
1664 | return 1; |
1574 | return 1; |
1665 | } |
1575 | } |
1666 | |
1576 | |
1667 | int |
1577 | int |
1668 | command_learn_spell (object *op, char *params) |
1578 | command_learn_spell (object *op, char *params) |
… | |
… | |
2080 | new_draw_info (NDI_UNIQUE, 0, op, "Can't insert a player into something!"); |
1990 | new_draw_info (NDI_UNIQUE, 0, op, "Can't insert a player into something!"); |
2081 | return 0; |
1991 | return 0; |
2082 | } |
1992 | } |
2083 | |
1993 | |
2084 | if (!QUERY_FLAG (right, FLAG_REMOVED)) |
1994 | if (!QUERY_FLAG (right, FLAG_REMOVED)) |
2085 | remove_ob (right); |
1995 | right->remove (); |
2086 | inserted = insert_ob_in_ob (right, left); |
1996 | inserted = insert_ob_in_ob (right, left); |
2087 | if (left->type == PLAYER) |
1997 | if (left->type == PLAYER) |
2088 | if (inserted == right) |
1998 | if (inserted == right) |
2089 | esrv_send_item (left, right); |
1999 | esrv_send_item (left, right); |
2090 | else |
2000 | else |