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

Comparing deliantra/server/server/c_wiz.C (file contents):
Revision 1.32 by pippijn, Mon Jan 15 21:06:20 2007 UTC vs.
Revision 1.39 by pippijn, Fri Mar 2 15:04:35 2007 UTC

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
178int
179command_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
228int
229command_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
250int 250int
251command_save_overlay (object *op, char *params) 251command_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
272int
273command_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
287int 272int
288command_freeze (object *op, char *params) 273command_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++;
815 new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original"); 800 new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original");
816 801
817 return 1; 802 return 1;
818} 803}
819 804
820/**
821 * When DM is possessing a monster, flip aggression on and off, to allow
822 * better motion.
823 */
824int
825command_mon_aggr (object *op, char *params)
826{
827 if (op->enemy || !QUERY_FLAG (op, FLAG_UNAGGRESSIVE))
828 {
829 op->enemy = NULL;
830 SET_FLAG (op, FLAG_UNAGGRESSIVE);
831 new_draw_info (NDI_UNIQUE, 0, op, "Aggression turned OFF");
832 }
833 else
834 {
835 CLEAR_FLAG (op, FLAG_FRIENDLY);
836 CLEAR_FLAG (op, FLAG_UNAGGRESSIVE);
837 new_draw_info (NDI_UNIQUE, 0, op, "Aggression turned ON");
838 }
839
840 return 1;
841}
842
843/** DM can possess a monster. Basically, this tricks the client into thinking
844 * a given monster, is actually the player it controls. This allows a DM
845 * to inhabit a monster's body, and run around the game with it.
846 * This function is severely broken - it has tons of hardcoded values,
847 */
848int
849command_possess (object *op, char *params)
850{
851 object *victim, *curinv, *nextinv;
852 player *pl;
853 int i;
854 char buf[MAX_BUF];
855
856 victim = NULL;
857 if (params != NULL)
858 {
859 if (sscanf (params, "%d", &i))
860 victim = find_object (i);
861 else if (sscanf (params, "%s", buf))
862 victim = find_object_name (buf);
863 }
864 if (victim == NULL)
865 {
866 new_draw_info (NDI_UNIQUE, 0, op, "Patch what object (nr)?");
867 return 1;
868 }
869
870 if (victim == op)
871 {
872 new_draw_info (NDI_UNIQUE, 0, op, "As insane as you are, I cannot " "allow you to possess yourself.");
873 return 1;
874 }
875
876 /* clear out the old inventory */
877 curinv = op->inv;
878 while (curinv != NULL)
879 {
880 nextinv = curinv->below;
881 esrv_del_item (op->contr, curinv->count);
882 curinv = nextinv;
883 }
884
885 /* make the switch */
886 pl = op->contr;
887 victim->contr = pl;
888 pl->ob = victim;
889 victim->type = PLAYER;
890 SET_FLAG (victim, FLAG_WIZ);
891
892 /* send the inventory to the client */
893 curinv = victim->inv;
894 while (curinv != NULL)
895 {
896 nextinv = curinv->below;
897 esrv_send_item (victim, curinv);
898 curinv = nextinv;
899 }
900 /* basic patchup */
901 /* The use of hard coded values is terrible. Note
902 * that really, to be fair, this shouldn't get changed at
903 * all - if you are possessing a kobold, you should have the
904 * same limitations. As it is, as more body locations are added,
905 * this will give this player more locations than perhaps
906 * they should be allowed.
907 */
908 for (i = 0; i < NUM_BODY_LOCATIONS; i++)
909 if (i == 1 || i == 6 || i == 8 || i == 9)
910 victim->body_info[i] = 2;
911 else
912 victim->body_info[i] = 1;
913
914 esrv_new_player (pl, 80); /* just pick a wieght, we don't care */
915 esrv_send_inventory (victim, victim);
916
917 victim->update_stats ();
918
919 do_some_living (victim);
920 return 1;
921}
922
923int 805int
924command_patch (object *op, char *params) 806command_patch (object *op, char *params)
925{ 807{
926 char *arg, *arg2; 808 char *arg, *arg2;
927 object *tmp; 809 object *tmp;
1004 } 886 }
1005 887
1006 if (from != STACK_FROM_STACK) 888 if (from != STACK_FROM_STACK)
1007 /* Item is either stack top, or is a number thus is now stack top, let's remove it */ 889 /* Item is either stack top, or is a number thus is now stack top, let's remove it */
1008 dm_stack_pop (op->contr); 890 dm_stack_pop (op->contr);
1009
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 891
1016 if (tmp->head) 892 if (tmp->head)
1017 tmp = tmp->head; 893 tmp = tmp->head;
1018 894
1019 tmp->destroy (); 895 tmp->destroy ();
1117int 993int
1118command_abil (object *op, char *params) 994command_abil (object *op, char *params)
1119{ 995{
1120 char thing[20], thing2[20]; 996 char thing[20], thing2[20];
1121 int iii; 997 int iii;
1122 player *pl;
1123 char buf[MAX_BUF]; 998 char buf[MAX_BUF];
1124 999
1125 iii = 0; 1000 iii = 0;
1126 thing[0] = '\0'; 1001 thing[0] = '\0';
1127 thing2[0] = '\0'; 1002 thing2[0] = '\0';
1174 return 1; 1049 return 1;
1175} 1050}
1176 1051
1177int 1052int
1178command_nowiz (object *op, char *params) 1053command_nowiz (object *op, char *params)
1179{ /* 'noadm' is alias */ 1054{ /* 'nodm' is alias */
1180 CLEAR_FLAG (op, FLAG_WIZ); 1055 CLEAR_FLAG (op, FLAG_WIZ);
1181 CLEAR_FLAG (op, FLAG_WIZPASS); 1056 CLEAR_FLAG (op, FLAG_WIZPASS);
1182 CLEAR_FLAG (op, FLAG_WIZCAST); 1057 CLEAR_FLAG (op, FLAG_WIZCAST);
1183 1058
1184 if (settings.real_wiz == TRUE) 1059 if (settings.real_wiz == TRUE)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines