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.54 by root, Tue Apr 22 07:01:47 2008 UTC vs.
Revision 1.67 by root, Thu Jan 1 16:05:13 2009 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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
178command_kick (object *op, char *params) 178command_kick (object *op, char *params)
179{ 179{
180 for_all_players (pl) 180 for_all_players (pl)
181 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) 181 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params)))
182 { 182 {
183 object *op = pl->ob; 183 object *plop = pl->ob;
184 184
185 if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) 185 if (!QUERY_FLAG (plop, FLAG_REMOVED) && !QUERY_FLAG (plop, FLAG_FREED))
186 { 186 {
187 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name); 187 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &plop->name);
188 strcpy (op->contr->killer, "kicked"); 188 plop->contr->killer = op;
189 } 189 }
190 190
191 pl->ns->destroy (); 191 pl->ns->destroy ();
192 } 192 }
193 193
279 /* we have nowhere to send the prisoner.... */ 279 /* we have nowhere to send the prisoner.... */
280 new_draw_info (NDI_UNIQUE, 0, op, "can't jail player, there is no map to hold them"); 280 new_draw_info (NDI_UNIQUE, 0, op, "can't jail player, there is no map to hold them");
281 return 0; 281 return 0;
282 } 282 }
283 283
284 pl->ob->enter_exit (dummy); 284 pl->ob->player_goto (dummy->slaying, dummy->stats.hp, dummy->stats.sp);//TODO
285 dummy->destroy (); 285 dummy->destroy ();
286
286 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested."); 287 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested.");
287 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 288 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
288 LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name); 289 LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name);
289 return 1; 290 return 1;
290} 291}
314 { 315 {
315 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); 316 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player.");
316 return 1; 317 return 1;
317 } 318 }
318 319
319 dummy = object::create (); 320 pl->ob->player_goto (op->map->path, op->x + freearr_x[i], op->y + freearr_y[i]);
320 EXIT_PATH (dummy) = op->map->path;
321 EXIT_X (dummy) = op->x + freearr_x[i];
322 EXIT_Y (dummy) = op->y + freearr_y[i];
323 pl->ob->enter_exit (dummy);
324 dummy->destroy ();
325 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); 321 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
326 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 322 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
327 323
328 return 1; 324 return 1;
329} 325}
455 { 451 {
456 art = find_artifactlist (at->type)->items; 452 art = find_artifactlist (at->type)->items;
457 453
458 while (art) 454 while (art)
459 { 455 {
460 if (!strcmp (art->item->name, cp)) 456 if (!strcmp (&art->item->name, cp))
461 break; 457 break;
462 458
463 art = art->next; 459 art = art->next;
464 } 460 }
465 461
893 new_draw_info (NDI_UNIQUE, 0, op, "Who?"); 889 new_draw_info (NDI_UNIQUE, 0, op, "Who?");
894 return 1; 890 return 1;
895 } 891 }
896 892
897 for_all_players (pl) 893 for_all_players (pl)
898 if (!strcmp (pl->ob->name, thing)) 894 if (!strcmp (&pl->ob->name, thing))
899 { 895 {
900 sprintf (buf, "Str : %-2d H.P. : %-4d MAX : %d", pl->ob->stats.Str, pl->ob->stats.hp, pl->ob->stats.maxhp); 896 sprintf (buf, "Str : %-2d H.P. : %-4d MAX : %d", pl->ob->stats.Str, pl->ob->stats.hp, pl->ob->stats.maxhp);
901 new_draw_info (NDI_UNIQUE, 0, op, buf); 897 new_draw_info (NDI_UNIQUE, 0, op, buf);
902 sprintf (buf, "Dex : %-2d S.P. : %-4d MAX : %d", pl->ob->stats.Dex, pl->ob->stats.sp, pl->ob->stats.maxsp); 898 sprintf (buf, "Dex : %-2d S.P. : %-4d MAX : %d", pl->ob->stats.Dex, pl->ob->stats.sp, pl->ob->stats.maxsp);
903 new_draw_info (NDI_UNIQUE, 0, op, buf); 899 new_draw_info (NDI_UNIQUE, 0, op, buf);
946 return 1; 942 return 1;
947 } 943 }
948 944
949 for_all_players (pl) 945 for_all_players (pl)
950 { 946 {
951 if (!strcmp (pl->ob->name, thing)) 947 if (!strcmp (&pl->ob->name, thing))
952 { 948 {
953 if (!strcmp ("str", thing2)) pl->ob->stats.Str = iii, pl->orig_stats.Str = iii; 949 if (!strcmp ("str", thing2)) pl->ob->stats.Str = iii, pl->orig_stats.Str = iii;
954 if (!strcmp ("dex", thing2)) pl->ob->stats.Dex = iii, pl->orig_stats.Dex = iii; 950 if (!strcmp ("dex", thing2)) pl->ob->stats.Dex = iii, pl->orig_stats.Dex = iii;
955 if (!strcmp ("con", thing2)) pl->ob->stats.Con = iii, pl->orig_stats.Con = iii; 951 if (!strcmp ("con", thing2)) pl->ob->stats.Con = iii, pl->orig_stats.Con = iii;
956 if (!strcmp ("wis", thing2)) pl->ob->stats.Wis = iii, pl->orig_stats.Wis = iii; 952 if (!strcmp ("wis", thing2)) pl->ob->stats.Wis = iii, pl->orig_stats.Wis = iii;
973command_nowiz (object *op, char *params) 969command_nowiz (object *op, char *params)
974{ /* 'nodm' is alias */ 970{ /* 'nodm' is alias */
975 CLEAR_FLAG (op, FLAG_WIZ); 971 CLEAR_FLAG (op, FLAG_WIZ);
976 CLEAR_FLAG (op, FLAG_WIZPASS); 972 CLEAR_FLAG (op, FLAG_WIZPASS);
977 CLEAR_FLAG (op, FLAG_WIZCAST); 973 CLEAR_FLAG (op, FLAG_WIZCAST);
974 CLEAR_FLAG (op, FLAG_WIZLOOK);
975 op->contr->do_los = 1;
978 976
979 if (op->contr->hidden) 977 if (op->contr->hidden)
980 { 978 {
981 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); 979 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players");
982 op->map->players++; 980 op->map->players++;
984 op->contr->hidden = 0; 982 op->contr->hidden = 0;
985 op->invisible = 1; 983 op->invisible = 1;
986 } 984 }
987 else 985 else
988 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone.."); 986 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone..");
987
989 return 1; 988 return 1;
990} 989}
991 990
992/** 991/**
993 * object *op is trying to become dm. 992 * object *op is trying to become dm.
1047 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host)) 1046 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host))
1048 { 1047 {
1049 SET_FLAG (op, FLAG_WIZ); 1048 SET_FLAG (op, FLAG_WIZ);
1050 SET_FLAG (op, FLAG_WIZPASS); 1049 SET_FLAG (op, FLAG_WIZPASS);
1051 SET_FLAG (op, FLAG_WIZCAST); 1050 SET_FLAG (op, FLAG_WIZCAST);
1051 SET_FLAG (op, FLAG_WIZLOOK);
1052 op->contr->do_los = 1;
1052 1053
1053 new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); 1054 new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!");
1054 /*
1055 * Remove setting flying here - that won't work, because next
1056 * fix_player() is called that will get cleared - proper solution
1057 * is probably something like a wiz_force which gives that and any
1058 * other desired abilities.
1059 */
1060 clear_los (op->contr);
1061 op->contr->write_buf[0] = '\0'; 1055 op->contr->write_buf[0] = '\0';
1062 1056
1063 if (!silent) 1057 if (!silent)
1064 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); 1058 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!");
1065 1059
1105 * Returns spell object (from archetypes) by name. 1099 * Returns spell object (from archetypes) by name.
1106 * Returns NULL if 0 or more than one spell matches. 1100 * Returns NULL if 0 or more than one spell matches.
1107 * Used for wizard's learn spell/prayer. 1101 * Used for wizard's learn spell/prayer.
1108 * 1102 *
1109 * op is the player issuing the command. 1103 * op is the player issuing the command.
1110 *
1111 * Ignores archetypes "spelldirect_xxx" since these archetypes are not used
1112 * anymore (but may still be present in some player's inventories and thus
1113 * cannot be removed). We have to ignore them here since they have the same
1114 * name than other "spell_xxx" archetypes and would always conflict.
1115 */ 1104 */
1116static object * 1105static object *
1117get_spell_by_name (object *op, const char *spell_name) 1106get_spell_by_name (object *op, shstr_cmp spell_name)
1118{ 1107{
1119 archetype *at; 1108 archetype *at;
1120 archetype *found; 1109 archetype *found;
1121 int conflict_found; 1110 int conflict_found;
1122 size_t spell_name_length; 1111 size_t spell_name_length;
1127 for_all_archetypes (at) 1116 for_all_archetypes (at)
1128 { 1117 {
1129 if (at->type != SPELL) 1118 if (at->type != SPELL)
1130 continue; 1119 continue;
1131 1120
1132 if (strncmp (at->archname, "spelldirect_", 12) == 0) 1121 if (at->object::name != spell_name)
1133 continue; 1122 continue;
1134 1123
1135 if (strcmp (at->object::name, spell_name) != 0)
1136 continue;
1137
1138 if (found != NULL) 1124 if (found)
1139 { 1125 {
1140 if (!conflict_found) 1126 if (!conflict_found)
1141 { 1127 {
1142 conflict_found = 1; 1128 conflict_found = 1;
1143 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", spell_name); 1129 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", &spell_name);
1144 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->archname); 1130 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->archname);
1145 } 1131 }
1146 1132
1147 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->archname); 1133 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->archname);
1148 continue; 1134 continue;
1177 if (found != NULL) 1163 if (found != NULL)
1178 { 1164 {
1179 if (!conflict_found) 1165 if (!conflict_found)
1180 { 1166 {
1181 conflict_found = 1; 1167 conflict_found = 1;
1182 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", spell_name); 1168 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", &spell_name);
1183 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->object::name); 1169 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->object::name);
1184 } 1170 }
1185 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->object::name); 1171 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->object::name);
1186 continue; 1172 continue;
1187 } 1173 }
1196 /* Return if exactly one archetype matches. */ 1182 /* Return if exactly one archetype matches. */
1197 if (found != NULL) 1183 if (found != NULL)
1198 return arch_to_object (found); 1184 return arch_to_object (found);
1199 1185
1200 /* No spell found: just print an error message. */ 1186 /* No spell found: just print an error message. */
1201 new_draw_info_format (NDI_UNIQUE, 0, op, "The spell %s does not exist.", spell_name); 1187 new_draw_info_format (NDI_UNIQUE, 0, op, "The spell %s does not exist.", &spell_name);
1202 return NULL; 1188 return NULL;
1203} 1189}
1204 1190
1205static int 1191static int
1206command_learn_spell_or_prayer (object *op, char *params, int special_prayer) 1192command_learn_spell_or_prayer (object *op, char *params, int special_prayer)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines