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.38 by pippijn, Fri Mar 2 13:43:59 2007 UTC vs.
Revision 1.39 by pippijn, Fri Mar 2 15:04:35 2007 UTC

800 new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original"); 800 new_draw_info (NDI_UNIQUE, 0, op, "Object is marked original");
801 801
802 return 1; 802 return 1;
803} 803}
804 804
805/**
806 * When DM is possessing a monster, flip aggression on and off, to allow
807 * better motion.
808 */
809int
810command_mon_aggr (object *op, char *params)
811{
812 if (op->enemy || !QUERY_FLAG (op, FLAG_UNAGGRESSIVE))
813 {
814 op->enemy = NULL;
815 SET_FLAG (op, FLAG_UNAGGRESSIVE);
816 new_draw_info (NDI_UNIQUE, 0, op, "Aggression turned OFF");
817 }
818 else
819 {
820 CLEAR_FLAG (op, FLAG_FRIENDLY);
821 CLEAR_FLAG (op, FLAG_UNAGGRESSIVE);
822 new_draw_info (NDI_UNIQUE, 0, op, "Aggression turned ON");
823 }
824
825 return 1;
826}
827
828/** DM can possess a monster. Basically, this tricks the client into thinking
829 * a given monster, is actually the player it controls. This allows a DM
830 * to inhabit a monster's body, and run around the game with it.
831 * This function is severely broken - it has tons of hardcoded values,
832 */
833int
834command_possess (object *op, char *params)
835{
836 object *victim, *curinv, *nextinv;
837 player *pl;
838 int i;
839 char buf[MAX_BUF];
840
841 victim = NULL;
842 if (params != NULL)
843 {
844 if (sscanf (params, "%d", &i))
845 victim = find_object (i);
846 else if (sscanf (params, "%s", buf))
847 victim = find_object_name (buf);
848 }
849 if (victim == NULL)
850 {
851 new_draw_info (NDI_UNIQUE, 0, op, "Patch what object (nr)?");
852 return 1;
853 }
854
855 if (victim == op)
856 {
857 new_draw_info (NDI_UNIQUE, 0, op, "As insane as you are, I cannot " "allow you to possess yourself.");
858 return 1;
859 }
860
861 /* clear out the old inventory */
862 curinv = op->inv;
863 while (curinv != NULL)
864 {
865 nextinv = curinv->below;
866 esrv_del_item (op->contr, curinv->count);
867 curinv = nextinv;
868 }
869
870 /* make the switch */
871 pl = op->contr;
872 victim->contr = pl;
873 pl->ob = victim;
874 victim->type = PLAYER;
875 SET_FLAG (victim, FLAG_WIZ);
876
877 /* send the inventory to the client */
878 curinv = victim->inv;
879 while (curinv != NULL)
880 {
881 nextinv = curinv->below;
882 esrv_send_item (victim, curinv);
883 curinv = nextinv;
884 }
885 /* basic patchup */
886 /* The use of hard coded values is terrible. Note
887 * that really, to be fair, this shouldn't get changed at
888 * all - if you are possessing a kobold, you should have the
889 * same limitations. As it is, as more body locations are added,
890 * this will give this player more locations than perhaps
891 * they should be allowed.
892 */
893 for (i = 0; i < NUM_BODY_LOCATIONS; i++)
894 if (i == 1 || i == 6 || i == 8 || i == 9)
895 victim->body_info[i] = 2;
896 else
897 victim->body_info[i] = 1;
898
899 esrv_new_player (pl, 80); /* just pick a wieght, we don't care */
900 esrv_send_inventory (victim, victim);
901
902 victim->update_stats ();
903
904 do_some_living (victim);
905 return 1;
906}
907
908int 805int
909command_patch (object *op, char *params) 806command_patch (object *op, char *params)
910{ 807{
911 char *arg, *arg2; 808 char *arg, *arg2;
912 object *tmp; 809 object *tmp;
1152 return 1; 1049 return 1;
1153} 1050}
1154 1051
1155int 1052int
1156command_nowiz (object *op, char *params) 1053command_nowiz (object *op, char *params)
1157{ /* 'noadm' is alias */ 1054{ /* 'nodm' is alias */
1158 CLEAR_FLAG (op, FLAG_WIZ); 1055 CLEAR_FLAG (op, FLAG_WIZ);
1159 CLEAR_FLAG (op, FLAG_WIZPASS); 1056 CLEAR_FLAG (op, FLAG_WIZPASS);
1160 CLEAR_FLAG (op, FLAG_WIZCAST); 1057 CLEAR_FLAG (op, FLAG_WIZCAST);
1161 1058
1162 if (settings.real_wiz == TRUE) 1059 if (settings.real_wiz == TRUE)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines