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.41 by root, Wed Mar 14 04:12:29 2007 UTC vs.
Revision 1.44 by root, Mon May 28 21:28:36 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * Crossfire TRT is free software; you can redistribute it and/or modify it
9 * it under the terms of the GNU General Public License as published by 9 * under the terms of the GNU General Public License as published by the Free
10 * the Free Software Foundation; either version 2 of the License, or 10 * Software Foundation; either version 2 of the License, or (at your option)
11 * (at your option) any later version. 11 * any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful, but
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * GNU General Public License for more details. 16 * for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License along
19 * along with this program; if not, write to the Free Software 19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 21 *
22 * The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */ 23 */
24 24
25#include <global.h> 25#include <global.h>
26#include <sproto.h> 26#include <sproto.h>
27#include <spells.h> 27#include <spells.h>
454 new_draw_info_format (NDI_UNIQUE, 0, op, "No artifact list for type %d\n", at->clone.type); 454 new_draw_info_format (NDI_UNIQUE, 0, op, "No artifact list for type %d\n", at->clone.type);
455 else 455 else
456 { 456 {
457 art = find_artifactlist (at->clone.type)->items; 457 art = find_artifactlist (at->clone.type)->items;
458 458
459 do 459 while (art)
460 { 460 {
461 if (!strcmp (art->item->name, cp)) 461 if (!strcmp (art->item->name, cp))
462 break; 462 break;
463
463 art = art->next; 464 art = art->next;
464 } 465 }
465 while (art != NULL);
466 466
467 if (!art) 467 if (!art)
468 new_draw_info_format (NDI_UNIQUE, 0, op, "No such artifact ([%d] of %s)", at->clone.type, cp); 468 new_draw_info_format (NDI_UNIQUE, 0, op, "No such artifact ([%d] of %s)", at->clone.type, cp);
469 } 469 }
470 470
483 * Rather than have two different blocks with a lot of similar code, 483 * Rather than have two different blocks with a lot of similar code,
484 * just create one object, do all the processing, and then determine 484 * just create one object, do all the processing, and then determine
485 * if that one object should be inserted or if we need to make copies. 485 * if that one object should be inserted or if we need to make copies.
486 */ 486 */
487 tmp = arch_to_object (at); 487 tmp = arch_to_object (at);
488
489 if (settings.real_wiz == FALSE)
490 SET_FLAG (tmp, FLAG_WAS_WIZ);
491 488
492 if (set_magic) 489 if (set_magic)
493 set_abs_magic (tmp, magic); 490 set_abs_magic (tmp, magic);
494 491
495 if (art) 492 if (art)
620 { 617 {
621 head = dup; 618 head = dup;
622 tmp->copy_to (dup); 619 tmp->copy_to (dup);
623 } 620 }
624 621
625 if (settings.real_wiz == FALSE)
626 SET_FLAG (dup, FLAG_WAS_WIZ);
627
628 dup->x = op->x + dup->arch->clone.x; 622 dup->x = op->x + dup->arch->clone.x;
629 dup->y = op->y + dup->arch->clone.y; 623 dup->y = op->y + dup->arch->clone.y;
630 dup->map = op->map; 624 dup->map = op->map;
631 625
632 if (head != dup) 626 if (head != dup)
771 return 1; 765 return 1;
772 } 766 }
773 767
774 if ((arg2 = strchr (arg, ' '))) 768 if ((arg2 = strchr (arg, ' ')))
775 arg2++; 769 arg2++;
776 if (settings.real_wiz == FALSE) 770
777 SET_FLAG (tmp, FLAG_WAS_WIZ); /* To avoid cheating */
778 if (set_variable (tmp, arg) == -1) 771 if (set_variable (tmp, arg) == -1)
779 new_draw_info_format (NDI_UNIQUE, 0, op, "Unknown variable %s", arg); 772 new_draw_info_format (NDI_UNIQUE, 0, op, "Unknown variable %s", arg);
780 else 773 else
781 {
782 new_draw_info_format (NDI_UNIQUE, 0, op, "(%s#%d)->%s=%s", &tmp->name, tmp->count, arg, arg2); 774 new_draw_info_format (NDI_UNIQUE, 0, op, "(%s#%d)->%s=%s", &tmp->name, tmp->count, arg, arg2);
783 }
784 775
785 return 1; 776 return 1;
786} 777}
787 778
788int 779int
882 } 873 }
883 874
884 pl->ob->stats.exp += i; 875 pl->ob->stats.exp += i;
885 calc_perm_exp (pl->ob); 876 calc_perm_exp (pl->ob);
886 player_lvl_adj (pl->ob, NULL); 877 player_lvl_adj (pl->ob, NULL);
887
888 if (settings.real_wiz == FALSE)
889 SET_FLAG (pl->ob, FLAG_WAS_WIZ);
890 878
891 return 1; 879 return 1;
892 } 880 }
893 881
894 new_draw_info (NDI_UNIQUE, 0, op, "No such player."); 882 new_draw_info (NDI_UNIQUE, 0, op, "No such player.");
970 958
971 for_all_players (pl) 959 for_all_players (pl)
972 { 960 {
973 if (!strcmp (pl->ob->name, thing)) 961 if (!strcmp (pl->ob->name, thing))
974 { 962 {
975 if (settings.real_wiz == FALSE)
976 SET_FLAG (pl->ob, FLAG_WAS_WIZ);
977 if (!strcmp ("str", thing2))
978 pl->ob->stats.Str = iii, pl->orig_stats.Str = iii; 963 if (!strcmp ("str", thing2)) pl->ob->stats.Str = iii, pl->orig_stats.Str = iii;
979 if (!strcmp ("dex", thing2))
980 pl->ob->stats.Dex = iii, pl->orig_stats.Dex = iii; 964 if (!strcmp ("dex", thing2)) pl->ob->stats.Dex = iii, pl->orig_stats.Dex = iii;
981 if (!strcmp ("con", thing2))
982 pl->ob->stats.Con = iii, pl->orig_stats.Con = iii; 965 if (!strcmp ("con", thing2)) pl->ob->stats.Con = iii, pl->orig_stats.Con = iii;
983 if (!strcmp ("wis", thing2))
984 pl->ob->stats.Wis = iii, pl->orig_stats.Wis = iii; 966 if (!strcmp ("wis", thing2)) pl->ob->stats.Wis = iii, pl->orig_stats.Wis = iii;
985 if (!strcmp ("cha", thing2))
986 pl->ob->stats.Cha = iii, pl->orig_stats.Cha = iii; 967 if (!strcmp ("cha", thing2)) pl->ob->stats.Cha = iii, pl->orig_stats.Cha = iii;
987 if (!strcmp ("int", thing2))
988 pl->ob->stats.Int = iii, pl->orig_stats.Int = iii; 968 if (!strcmp ("int", thing2)) pl->ob->stats.Int = iii, pl->orig_stats.Int = iii;
989 if (!strcmp ("pow", thing2))
990 pl->ob->stats.Pow = iii, pl->orig_stats.Pow = iii; 969 if (!strcmp ("pow", thing2)) pl->ob->stats.Pow = iii, pl->orig_stats.Pow = iii;
970
991 sprintf (buf, "%s has been altered.", &pl->ob->name); 971 sprintf (buf, "%s has been altered.", &pl->ob->name);
992 new_draw_info (NDI_UNIQUE, 0, op, buf); 972 new_draw_info (NDI_UNIQUE, 0, op, buf);
993 pl->ob->update_stats (); 973 pl->ob->update_stats ();
994 return 1; 974 return 1;
995 } 975 }
1004{ /* 'nodm' is alias */ 984{ /* 'nodm' is alias */
1005 CLEAR_FLAG (op, FLAG_WIZ); 985 CLEAR_FLAG (op, FLAG_WIZ);
1006 CLEAR_FLAG (op, FLAG_WIZPASS); 986 CLEAR_FLAG (op, FLAG_WIZPASS);
1007 CLEAR_FLAG (op, FLAG_WIZCAST); 987 CLEAR_FLAG (op, FLAG_WIZCAST);
1008 988
1009 if (settings.real_wiz == TRUE)
1010 CLEAR_FLAG (op, FLAG_WAS_WIZ);
1011 if (op->contr->hidden) 989 if (op->contr->hidden)
1012 { 990 {
1013 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); 991 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players");
1014 op->map->players++; 992 op->map->players++;
1015 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &op->name); 993 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &op->name);
1077 } 1055 }
1078 1056
1079 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host)) 1057 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host))
1080 { 1058 {
1081 SET_FLAG (op, FLAG_WIZ); 1059 SET_FLAG (op, FLAG_WIZ);
1082 SET_FLAG (op, FLAG_WAS_WIZ);
1083 SET_FLAG (op, FLAG_WIZPASS); 1060 SET_FLAG (op, FLAG_WIZPASS);
1084 SET_FLAG (op, FLAG_WIZCAST); 1061 SET_FLAG (op, FLAG_WIZCAST);
1062
1085 new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); 1063 new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!");
1086 /* 1064 /*
1087 * Remove setting flying here - that won't work, because next 1065 * Remove setting flying here - that won't work, because next
1088 * fix_player() is called that will get cleared - proper solution 1066 * fix_player() is called that will get cleared - proper solution
1089 * is probably something like a wiz_force which gives that and any 1067 * is probably something like a wiz_force which gives that and any

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines