… | |
… | |
86 | op->contr->hidden = 0; |
86 | op->contr->hidden = 0; |
87 | op->invisible = 1; |
87 | op->invisible = 1; |
88 | new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); |
88 | new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); |
89 | op->map->players++; |
89 | op->map->players++; |
90 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &op->name); |
90 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &op->name); |
|
|
91 | |
91 | if (!silent_dm) |
92 | if (!silent_dm) |
92 | { |
|
|
93 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); |
93 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); |
94 | } |
|
|
95 | } |
94 | } |
96 | else |
95 | else |
97 | { |
96 | { |
98 | op->contr->hidden = 1; |
97 | op->contr->hidden = 1; |
99 | new_draw_info (NDI_UNIQUE, 0, op, "Other players will no longer see you."); |
98 | new_draw_info (NDI_UNIQUE, 0, op, "Other players will no longer see you."); |
100 | op->map->players--; |
99 | op->map->players--; |
|
|
100 | |
101 | if (!silent_dm) |
101 | if (!silent_dm) |
102 | { |
|
|
103 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone.."); |
102 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone.."); |
104 | } |
103 | |
105 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s leaves the game.", &op->name); |
104 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s leaves the game.", &op->name); |
106 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s left the game.", &op->name); |
105 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s left the game.", &op->name); |
107 | } |
106 | } |
108 | } |
107 | } |
109 | |
108 | |
… | |
… | |
170 | new_draw_info_format (NDI_UNIQUE, 0, op, "No such god %s.", str); |
169 | new_draw_info_format (NDI_UNIQUE, 0, op, "No such god %s.", str); |
171 | return 1; |
170 | return 1; |
172 | } |
171 | } |
173 | |
172 | |
174 | become_follower (ob, god); |
173 | become_follower (ob, god); |
|
|
174 | return 1; |
|
|
175 | } |
|
|
176 | |
|
|
177 | // TODO: Rewrite banish in perl and get rid of the following two functions |
|
|
178 | int |
|
|
179 | command_kick (object *op, char *params) |
|
|
180 | { |
|
|
181 | for_all_players (pl) |
|
|
182 | if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) |
|
|
183 | { |
|
|
184 | object *op = pl->ob; |
|
|
185 | |
|
|
186 | if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) |
|
|
187 | { |
|
|
188 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name); |
|
|
189 | strcpy (op->contr->killer, "kicked"); |
|
|
190 | } |
|
|
191 | |
|
|
192 | pl->ns->destroy (); |
|
|
193 | } |
|
|
194 | |
175 | return 1; |
195 | return 1; |
176 | } |
196 | } |
177 | |
197 | |
178 | /** |
198 | /** |
179 | * Add player's IP to ban_file and kick them off the server |
199 | * Add player's IP to ban_file and kick them off the server |
… | |
… | |
223 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name); |
243 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name); |
224 | command_kick (op, (char *) &pl->ob->name); |
244 | command_kick (op, (char *) &pl->ob->name); |
225 | return 1; |
245 | return 1; |
226 | } |
246 | } |
227 | |
247 | |
228 | int |
|
|
229 | command_kick (object *op, char *params) |
|
|
230 | { |
|
|
231 | for_all_players (pl) |
|
|
232 | if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) |
|
|
233 | { |
|
|
234 | object *op = pl->ob; |
|
|
235 | |
|
|
236 | if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) |
|
|
237 | { |
|
|
238 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name); |
|
|
239 | strcpy (op->contr->killer, "kicked"); |
|
|
240 | } |
|
|
241 | |
|
|
242 | pl->ns->destroy (); |
|
|
243 | } |
|
|
244 | |
|
|
245 | return 1; |
|
|
246 | } |
|
|
247 | |
|
|
248 | //TODO |
248 | //TODO |
249 | #if 0 |
249 | #if 0 |
250 | int |
250 | int |
251 | command_save_overlay (object *op, char *params) |
251 | command_save_overlay (object *op, char *params) |
252 | { |
252 | { |
… | |
… | |
266 | ready_map_name (op->map->path, 0); |
266 | ready_map_name (op->map->path, 0); |
267 | |
267 | |
268 | return 1; |
268 | return 1; |
269 | } |
269 | } |
270 | #endif |
270 | #endif |
271 | |
|
|
272 | int |
|
|
273 | command_shutdown (object *op, char *params) |
|
|
274 | { |
|
|
275 | if (op && !QUERY_FLAG (op, FLAG_WIZ)) |
|
|
276 | { |
|
|
277 | new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
|
|
278 | return 1; |
|
|
279 | } |
|
|
280 | |
|
|
281 | cleanup ("dm initiated shutdown", 0); |
|
|
282 | |
|
|
283 | /* not reached */ |
|
|
284 | return 1; |
|
|
285 | } |
|
|
286 | |
271 | |
287 | int |
272 | int |
288 | command_freeze (object *op, char *params) |
273 | command_freeze (object *op, char *params) |
289 | { |
274 | { |
290 | int ticks; |
275 | int ticks; |
… | |
… | |
492 | at_spell = archetype::find (cp); |
477 | at_spell = archetype::find (cp); |
493 | if (!at_spell || at_spell->clone.type != SPELL) |
478 | if (!at_spell || at_spell->clone.type != SPELL) |
494 | at_spell = find_archetype_by_object_name (cp); |
479 | at_spell = find_archetype_by_object_name (cp); |
495 | if (!at_spell || at_spell->clone.type != SPELL) |
480 | if (!at_spell || at_spell->clone.type != SPELL) |
496 | { |
481 | { |
497 | strcpy (spell_name, cp); |
482 | assign (spell_name, cp); |
498 | fsp = strchr (spell_name, ' '); |
483 | fsp = strchr (spell_name, ' '); |
499 | if (fsp) |
484 | if (fsp) |
500 | { |
485 | { |
501 | *fsp = 0; |
486 | *fsp = 0; |
502 | fsp++; |
487 | fsp++; |
… | |
… | |
1005 | |
990 | |
1006 | if (from != STACK_FROM_STACK) |
991 | if (from != STACK_FROM_STACK) |
1007 | /* Item is either stack top, or is a number thus is now stack top, let's remove it */ |
992 | /* Item is either stack top, or is a number thus is now stack top, let's remove it */ |
1008 | dm_stack_pop (op->contr); |
993 | dm_stack_pop (op->contr); |
1009 | |
994 | |
1010 | if (!QUERY_FLAG (tmp, FLAG_REMOVED)) |
|
|
1011 | { |
|
|
1012 | new_draw_info (NDI_UNIQUE, 0, op, "Warning, item wasn't removed."); |
|
|
1013 | tmp->remove (); |
|
|
1014 | } |
|
|
1015 | |
|
|
1016 | if (tmp->head) |
995 | if (tmp->head) |
1017 | tmp = tmp->head; |
996 | tmp = tmp->head; |
1018 | |
997 | |
1019 | tmp->destroy (); |
998 | tmp->destroy (); |
1020 | return 1; |
999 | return 1; |
… | |
… | |
1117 | int |
1096 | int |
1118 | command_abil (object *op, char *params) |
1097 | command_abil (object *op, char *params) |
1119 | { |
1098 | { |
1120 | char thing[20], thing2[20]; |
1099 | char thing[20], thing2[20]; |
1121 | int iii; |
1100 | int iii; |
1122 | player *pl; |
|
|
1123 | char buf[MAX_BUF]; |
1101 | char buf[MAX_BUF]; |
1124 | |
1102 | |
1125 | iii = 0; |
1103 | iii = 0; |
1126 | thing[0] = '\0'; |
1104 | thing[0] = '\0'; |
1127 | thing2[0] = '\0'; |
1105 | thing2[0] = '\0'; |