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.34 by root, Mon Feb 5 01:24:46 2007 UTC vs.
Revision 1.41 by root, Wed Mar 14 04:12:29 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
173 172
174 become_follower (ob, god); 173 become_follower (ob, god);
175 return 1; 174 return 1;
176} 175}
177 176
178/** 177// TODO: Rewrite banish in perl and get rid of the following two functions
179 * Add player's IP to ban_file and kick them off the server
180 * I know most people have dynamic IPs but this is more of a short term
181 * solution if they have to get a new IP to play maybe they'll calm down.
182 * This uses the banish_file in the local directory *not* the ban_file
183 * The action is logged with a ! for easy searching. -tm
184 */
185int
186command_banish (object *op, char *params)
187{
188 player *pl;
189 FILE *banishfile;
190 char buf[MAX_BUF];
191 time_t now;
192
193 if (!params)
194 {
195 new_draw_info (NDI_UNIQUE, 0, op, "Usage: banish <player>.");
196 return 1;
197 }
198
199 pl = get_other_player_from_name (op, params);
200 if (!pl)
201 return 1;
202
203 sprintf (buf, "%s/%s", settings.localdir, BANISHFILE);
204
205 if ((banishfile = fopen (buf, "a")) == NULL)
206 {
207 LOG (llevDebug, "Could not find file banish_file.\n");
208 new_draw_info (NDI_UNIQUE, 0, op, "Could not find banish_file.");
209 return 0;
210 }
211
212 now = time (NULL);
213 /*
214 * Record this as a comment - then we don't have to worry about changing
215 * the parsing code.
216 */
217 fprintf (banishfile, "# %s (%s) banned by %s at %s\n", &pl->ob->name, pl->ns->host, &op->name, ctime (&now));
218 fprintf (banishfile, "*@%s\n", pl->ns->host);
219 fclose (banishfile);
220
221 LOG (llevDebug, "! %s banned %s from IP: %s.\n", &op->name, &pl->ob->name, pl->ns->host);
222 new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op, "You banish %s", &pl->ob->name);
223 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);
225 return 1;
226}
227
228int 178int
229command_kick (object *op, char *params) 179command_kick (object *op, char *params)
230{ 180{
231 for_all_players (pl) 181 for_all_players (pl)
232 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) 182 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params)))
266 ready_map_name (op->map->path, 0); 216 ready_map_name (op->map->path, 0);
267 217
268 return 1; 218 return 1;
269} 219}
270#endif 220#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 221
287int 222int
288command_freeze (object *op, char *params) 223command_freeze (object *op, char *params)
289{ 224{
290 int ticks; 225 int ticks;
815 new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original"); 750 new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original");
816 751
817 return 1; 752 return 1;
818} 753}
819 754
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 755int
924command_patch (object *op, char *params) 756command_patch (object *op, char *params)
925{ 757{
926 char *arg, *arg2; 758 char *arg, *arg2;
927 object *tmp; 759 object *tmp;
1111int 943int
1112command_abil (object *op, char *params) 944command_abil (object *op, char *params)
1113{ 945{
1114 char thing[20], thing2[20]; 946 char thing[20], thing2[20];
1115 int iii; 947 int iii;
1116 player *pl;
1117 char buf[MAX_BUF]; 948 char buf[MAX_BUF];
1118 949
1119 iii = 0; 950 iii = 0;
1120 thing[0] = '\0'; 951 thing[0] = '\0';
1121 thing2[0] = '\0'; 952 thing2[0] = '\0';
1168 return 1; 999 return 1;
1169} 1000}
1170 1001
1171int 1002int
1172command_nowiz (object *op, char *params) 1003command_nowiz (object *op, char *params)
1173{ /* 'noadm' is alias */ 1004{ /* 'nodm' is alias */
1174 CLEAR_FLAG (op, FLAG_WIZ); 1005 CLEAR_FLAG (op, FLAG_WIZ);
1175 CLEAR_FLAG (op, FLAG_WIZPASS); 1006 CLEAR_FLAG (op, FLAG_WIZPASS);
1176 CLEAR_FLAG (op, FLAG_WIZCAST); 1007 CLEAR_FLAG (op, FLAG_WIZCAST);
1177 1008
1178 if (settings.real_wiz == TRUE) 1009 if (settings.real_wiz == TRUE)
1293command_invisible (object *op, char *params) 1124command_invisible (object *op, char *params)
1294{ 1125{
1295 if (op) 1126 if (op)
1296 { 1127 {
1297 op->invisible += 100; 1128 op->invisible += 100;
1298 update_object (op, UP_OBJ_FACE); 1129 update_object (op, UP_OBJ_CHANGE);
1299 new_draw_info (NDI_UNIQUE, 0, op, "You turn invisible."); 1130 new_draw_info (NDI_UNIQUE, 0, op, "You turn invisible.");
1300 } 1131 }
1301 1132
1302 return 0; 1133 return 0;
1303} 1134}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines