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.18 by pippijn, Sat Dec 9 17:28:37 2006 UTC vs.
Revision 1.26 by root, Fri Dec 22 16:34:00 2006 UTC

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} 80}
79 81
80/** 82/**
81 * Actually hides specified player (obviously a DM). 83 * Actually hides specified player (obviously a DM).
216 now = time (NULL); 218 now = time (NULL);
217 /* 219 /*
218 * 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
219 * the parsing code. 221 * the parsing code.
220 */ 222 */
221 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));
222 fprintf (banishfile, "*@%s\n", pl->socket.host); 224 fprintf (banishfile, "*@%s\n", pl->ns->host);
223 fclose (banishfile); 225 fclose (banishfile);
224 226
225 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);
226 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);
227 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);
228 command_kick (op, (char *) &pl->ob->name); 230 command_kick (op, (char *) &pl->ob->name);
229 return 1; 231 return 1;
230} 232}
241 { 243 {
242 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);
243 strcpy (op->contr->killer, "kicked"); 245 strcpy (op->contr->killer, "kicked");
244 } 246 }
245 247
246 pl->socket.status = Ns_Dead; 248 pl->ns->destroy ();
247 } 249 }
248 250
249 return 1; 251 return 1;
250} 252}
251 253
342 /* we have nowhere to send the prisoner.... */ 344 /* we have nowhere to send the prisoner.... */
343 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");
344 return 0; 346 return 0;
345 } 347 }
346 enter_exit (pl->ob, dummy); 348 enter_exit (pl->ob, dummy);
347 free_object (dummy); 349 dummy->destroy ();
348 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.");
349 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 351 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
350 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);
351 return 1; 353 return 1;
352} 354}
376 { 378 {
377 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.");
378 return 1; 380 return 1;
379 } 381 }
380 382
381 dummy = get_object (); 383 dummy = object::create ();
382 EXIT_PATH (dummy) = op->map->path; 384 EXIT_PATH (dummy) = op->map->path;
383 EXIT_X (dummy) = op->x + freearr_x[i]; 385 EXIT_X (dummy) = op->x + freearr_x[i];
384 EXIT_Y (dummy) = op->y + freearr_y[i]; 386 EXIT_Y (dummy) = op->y + freearr_y[i];
385 enter_exit (pl->ob, dummy); 387 enter_exit (pl->ob, dummy);
386 free_object (dummy); 388 dummy->destroy ();
387 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); 389 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
388 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 390 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
389 391
390 return 1; 392 return 1;
391} 393}
420 { 422 {
421 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.");
422 return 1; 424 return 1;
423 } 425 }
424 426
425 dummy = get_object (); 427 dummy = object::create ();
426 EXIT_PATH (dummy) = pl->ob->map->path; 428 EXIT_PATH (dummy) = pl->ob->map->path;
427 EXIT_X (dummy) = pl->ob->x + freearr_x[i]; 429 EXIT_X (dummy) = pl->ob->x + freearr_x[i];
428 EXIT_Y (dummy) = pl->ob->y + freearr_y[i]; 430 EXIT_Y (dummy) = pl->ob->y + freearr_y[i];
429 enter_exit (op, dummy); 431 enter_exit (op, dummy);
430 free_object (dummy); 432 dummy->destroy ();
431 if (!op->contr->hidden) 433 if (!op->contr->hidden)
432 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.");
433 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 435 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
434 return 1; 436 return 1;
435} 437}
722 * so just copying it over should be fine. 724 * so just copying it over should be fine.
723 */ 725 */
724 if (!head) 726 if (!head)
725 { 727 {
726 head = dup; 728 head = dup;
727 copy_object (tmp, dup); 729 tmp->copy_to (dup);
728 } 730 }
729 731
730 if (settings.real_wiz == FALSE) 732 if (settings.real_wiz == FALSE)
731 SET_FLAG (dup, FLAG_WAS_WIZ); 733 SET_FLAG (dup, FLAG_WAS_WIZ);
732 734
759 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))
760 { 762 {
761 if (head->x < size_x || head->y < size_y) 763 if (head->x < size_x || head->y < size_y)
762 { 764 {
763 dm_stack_pop (op->contr); 765 dm_stack_pop (op->contr);
764 free_object (head); 766 head->destroy ();
765 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.");
766 free_object (tmp); 768 tmp->destroy ();
767 return 1; 769 return 1;
768 } 770 }
769 771
770 check = head; 772 check = head;
771 773
793 795
794 esrv_send_item (op, head); 796 esrv_send_item (op, head);
795 } 797 }
796 798
797 /* free the one we used to copy */ 799 /* free the one we used to copy */
798 free_object (tmp); 800 tmp->destroy ();
799 } 801 }
800 802
801 return 1; 803 return 1;
802} 804}
803 805
952 victim->body_info[i] = 1; 954 victim->body_info[i] = 1;
953 955
954 esrv_new_player (pl, 80); /* just pick a wieght, we don't care */ 956 esrv_new_player (pl, 80); /* just pick a wieght, we don't care */
955 esrv_send_inventory (victim, victim); 957 esrv_send_inventory (victim, victim);
956 958
957 fix_player (victim); 959 victim->update_stats ();
958 960
959 do_some_living (victim); 961 do_some_living (victim);
960 return 1; 962 return 1;
961} 963}
962 964
1023 dm_stack_pop (op->contr); 1025 dm_stack_pop (op->contr);
1024 1026
1025 /* 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 */
1026 if (tmp->head) 1028 if (tmp->head)
1027 tmp = tmp->head; 1029 tmp = tmp->head;
1028 remove_ob (tmp); 1030 tmp->remove ();
1029 return 1; 1031 return 1;
1030} 1032}
1031 1033
1032int 1034int
1033command_free (object *op, char *params) 1035command_free (object *op, char *params)
1048 dm_stack_pop (op->contr); 1050 dm_stack_pop (op->contr);
1049 1051
1050 if (!QUERY_FLAG (tmp, FLAG_REMOVED)) 1052 if (!QUERY_FLAG (tmp, FLAG_REMOVED))
1051 { 1053 {
1052 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.");
1053 remove_ob (tmp); 1055 tmp->remove ();
1054 } 1056 }
1055 1057
1056 if (tmp->head) 1058 if (tmp->head)
1057 tmp = tmp->head; 1059 tmp = tmp->head;
1058 free_object (tmp); 1060
1061 tmp->destroy ();
1059 return 1; 1062 return 1;
1060} 1063}
1061 1064
1062/** 1065/**
1063 * 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.
1142 new_draw_info (NDI_UNIQUE, 0, op, buf); 1145 new_draw_info (NDI_UNIQUE, 0, op, buf);
1143 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);
1144 new_draw_info (NDI_UNIQUE, 0, op, buf); 1147 new_draw_info (NDI_UNIQUE, 0, op, buf);
1145 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);
1146 new_draw_info (NDI_UNIQUE, 0, op, buf); 1149 new_draw_info (NDI_UNIQUE, 0, op, buf);
1147 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);
1148 new_draw_info (NDI_UNIQUE, 0, op, buf); 1151 new_draw_info (NDI_UNIQUE, 0, op, buf);
1149 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);
1150 new_draw_info (NDI_UNIQUE, 0, op, buf); 1153 new_draw_info (NDI_UNIQUE, 0, op, buf);
1151 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);
1152 new_draw_info (NDI_UNIQUE, 0, op, buf); 1155 new_draw_info (NDI_UNIQUE, 0, op, buf);
1206 pl->ob->stats.Int = iii, pl->orig_stats.Int = iii; 1209 pl->ob->stats.Int = iii, pl->orig_stats.Int = iii;
1207 if (!strcmp ("pow", thing2)) 1210 if (!strcmp ("pow", thing2))
1208 pl->ob->stats.Pow = iii, pl->orig_stats.Pow = iii; 1211 pl->ob->stats.Pow = iii, pl->orig_stats.Pow = iii;
1209 sprintf (buf, "%s has been altered.", &pl->ob->name); 1212 sprintf (buf, "%s has been altered.", &pl->ob->name);
1210 new_draw_info (NDI_UNIQUE, 0, op, buf); 1213 new_draw_info (NDI_UNIQUE, 0, op, buf);
1211 fix_player (pl->ob); 1214 pl->ob->update_stats ();
1212 return 1; 1215 return 1;
1213 } 1216 }
1214 } 1217 }
1215 1218
1216 new_draw_info (NDI_UNIQUE, 0, op, "No such player."); 1219 new_draw_info (NDI_UNIQUE, 0, op, "No such player.");
1251 * 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
1252 * players or wiz's. 1255 * players or wiz's.
1253 */ 1256 */
1254 if (op->map == m) 1257 if (op->map == m)
1255 { 1258 {
1256 dummy = get_object (); 1259 dummy = object::create ();
1257 dummy->map = NULL; 1260 dummy->map = NULL;
1258 EXIT_X (dummy) = op->x; 1261 EXIT_X (dummy) = op->x;
1259 EXIT_Y (dummy) = op->y; 1262 EXIT_Y (dummy) = op->y;
1260 EXIT_PATH (dummy) = op->map->path; 1263 EXIT_PATH (dummy) = op->map->path;
1261 remove_ob (op); 1264 op->remove ();
1262 op->map = NULL; 1265 op->map = NULL;
1263 tmp = op; 1266 tmp = op;
1264 } 1267 }
1265 swap_map (m); 1268 swap_map (m);
1266 } 1269 }
1271 1274
1272 /* setting this effectively causes an immediate reload */ 1275 /* setting this effectively causes an immediate reload */
1273 m->reset_time = 1; 1276 m->reset_time = 1;
1274 flush_old_maps (); 1277 flush_old_maps ();
1275 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 1278 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
1279
1276 if (tmp) 1280 if (tmp)
1277 { 1281 {
1278 enter_exit (tmp, dummy); 1282 enter_exit (tmp, dummy);
1279 free_object (dummy); 1283 dummy->destroy ();
1280 } 1284 }
1285
1281 return 1; 1286 return 1;
1282 } 1287 }
1283 else 1288 else
1284 { 1289 {
1285 player *pl; 1290 player *pl;
1287 1292
1288 /* Need to re-insert player if swap failed for some reason */ 1293 /* Need to re-insert player if swap failed for some reason */
1289 if (tmp) 1294 if (tmp)
1290 { 1295 {
1291 insert_ob_in_map (op, m, NULL, 0); 1296 insert_ob_in_map (op, m, NULL, 0);
1292 free_object (dummy); 1297 dummy->destroy ();
1293 } 1298 }
1294 1299
1295 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:");
1296 for (pl = first_player; pl != NULL; pl = pl->next) 1301 for (pl = first_player; pl != NULL; pl = pl->next)
1297 { 1302 {
1382 { 1387 {
1383 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!");
1384 return 0; 1389 return 0;
1385 } 1390 }
1386 1391
1387 if (checkdm (op, op->name, (params ? params : "*"), op->contr->socket.host)) 1392 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host))
1388 { 1393 {
1389 SET_FLAG (op, FLAG_WIZ); 1394 SET_FLAG (op, FLAG_WIZ);
1390 SET_FLAG (op, FLAG_WAS_WIZ); 1395 SET_FLAG (op, FLAG_WAS_WIZ);
1391 SET_FLAG (op, FLAG_WIZPASS); 1396 SET_FLAG (op, FLAG_WIZPASS);
1392 SET_FLAG (op, FLAG_WIZCAST); 1397 SET_FLAG (op, FLAG_WIZCAST);
1563 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);
1564 return 0; 1569 return 0;
1565 } 1570 }
1566 1571
1567 do_learn_spell (op, tmp, special_prayer); 1572 do_learn_spell (op, tmp, special_prayer);
1568 free_object (tmp); 1573 tmp->destroy ();
1569 return 1; 1574 return 1;
1570} 1575}
1571 1576
1572int 1577int
1573command_learn_spell (object *op, char *params) 1578command_learn_spell (object *op, char *params)
1985 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!");
1986 return 0; 1991 return 0;
1987 } 1992 }
1988 1993
1989 if (!QUERY_FLAG (right, FLAG_REMOVED)) 1994 if (!QUERY_FLAG (right, FLAG_REMOVED))
1990 remove_ob (right); 1995 right->remove ();
1991 inserted = insert_ob_in_ob (right, left); 1996 inserted = insert_ob_in_ob (right, left);
1992 if (left->type == PLAYER) 1997 if (left->type == PLAYER)
1993 if (inserted == right) 1998 if (inserted == right)
1994 esrv_send_item (left, right); 1999 esrv_send_item (left, right);
1995 else 2000 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines