|
From: <cro...@li...> - 2002-12-18 16:40:03
|
Module Name: crossfire
Committed By: garbled
Date: Wed Dec 18 16:40:00 UTC 2002
Modified Files:
crossfire/include: sproto.h
crossfire/server: c_wiz.c commands.c spell_effect.c
Added Files:
crossfire/lib/wizhelp: mon_aggr possess
Log Message:
Add new DM command "possess". This command allows a DM to possess the body
of a monster.
Also, fix a bug in the new implementation of summon_pet()
Start of context diffs
Index: crossfire/include/sproto.h
diff -c crossfire/include/sproto.h:1.75 crossfire/include/sproto.h:1.76
*** crossfire/include/sproto.h:1.75 Sun Dec 8 20:37:03 2002
--- crossfire/include/sproto.h Wed Dec 18 08:39:56 2002
***************
*** 256,261 ****
--- 256,263 ----
int command_skills(object *op, char *params);
int command_dump(object *op, char *params);
int command_patch(object *op, char *params);
+ int command_mon_aggr (object *op, char *params);
+ int command_possess (object *op, char *params);
int command_remove(object *op, char *params);
int command_free(object *op, char *params);
int command_addexp(object *op, char *params);
Index: crossfire/lib/wizhelp/mon_aggr
diff -c /dev/null crossfire/lib/wizhelp/mon_aggr:1.1
*** /dev/null Wed Dec 18 08:40:00 2002
--- crossfire/lib/wizhelp/mon_aggr Wed Dec 18 08:39:59 2002
***************
*** 0 ****
--- 1,6 ----
+ syntax: mon_aggr
+ notes: Toggles the aggression
+ of the monster you are currently
+ possessing. Not reccomended to
+ be flipped on yourself as a
+ player.
Index: crossfire/server/c_wiz.c
diff -c crossfire/server/c_wiz.c:1.27 crossfire/server/c_wiz.c:1.28
*** crossfire/server/c_wiz.c:1.27 Tue Nov 12 20:57:32 2002
--- crossfire/server/c_wiz.c Wed Dec 18 08:39:58 2002
***************
*** 1,6 ****
/*
* static char *rcsid_c_wiz_c =
! * "$Id: c_wiz.c,v 1.27 2002/11/13 04:57:32 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_c_wiz_c =
! * "$Id: c_wiz.c,v 1.28 2002/12/18 16:39:58 garbled Exp $";
*/
/*
***************
*** 636,641 ****
--- 636,779 ----
new_draw_info(NDI_UNIQUE, 0, op, "Object is marked original");
return 1;
}
+
+ /* When DM is possessing a monster, flip aggression on and off, to allow
+ better motion */
+
+ int command_mon_aggr (object *op, char *params)
+ {
+ if (op->enemy || !QUERY_FLAG(op, FLAG_UNAGGRESSIVE)) {
+ op->enemy = NULL;
+ SET_FLAG(op, FLAG_UNAGGRESSIVE);
+ new_draw_info(NDI_UNIQUE, 0, op, "Agression turned OFF");
+ } else {
+ CLEAR_FLAG(op, FLAG_FRIENDLY);
+ CLEAR_FLAG(op, FLAG_UNAGGRESSIVE);
+ new_draw_info(NDI_UNIQUE, 0, op, "Agression turned ON");
+ }
+ }
+
+ /* DM can possess a monster. Basically, this tricks the client into thinking
+ a given monster, is actually the player it controls. This allows a DM
+ to inhabit a monster's body, and run around the game with it. */
+
+ int command_possess (object *op, char *params)
+ {
+ object *victim, *curinv, *nextinv, *tmp;
+ player *pl;
+ archetype *at;
+ int i;
+ char buf[MAX_BUF];
+
+ victim=NULL;
+ if (params != NULL) {
+ if (sscanf(params, "%d", &i))
+ victim=find_object(i);
+ else if (sscanf(params, "%s", buf))
+ victim=find_object_name(buf);
+ }
+ if (victim==NULL) {
+ new_draw_info(NDI_UNIQUE, 0, op, "Patch what object (nr)?");
+ return 1;
+ }
+ if (victim==op) {
+ new_draw_info(NDI_UNIQUE, 0, op, "As insane as you are, I cannot "
+ "allow you to posess yourself.");
+ return 1;
+ }
+
+ /* clear out the old inventory */
+ curinv = op->inv;
+ while (curinv != NULL) {
+ nextinv = curinv->below;
+ esrv_del_item(op->contr, curinv->count);
+ curinv = nextinv;
+ }
+ /* make the switch */
+ pl = op->contr;
+ victim->contr = pl;
+ pl->ob = victim;
+ victim->type = PLAYER;
+ SET_FLAG(victim, FLAG_WIZ);
+
+ /* exp objects */
+ at = find_archetype("experience_agility");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ at = find_archetype("experience_charisma");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ at = find_archetype("experience_mental");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ at = find_archetype("experience_physical");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ at = find_archetype("experience_power");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ at = find_archetype("experience_wis");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ /* need to add basic skills like melee, bows, set chosen skill */
+ at = find_archetype("skill_punching");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ (void)link_player_skill(victim, tmp);
+ at = find_archetype("skill_melee_weapon");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ (void)link_player_skill(victim, tmp);
+ at = find_archetype("skill_missile_weapon");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ (void)link_player_skill(victim, tmp);
+ at = find_archetype("skill_use_magic_item");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ (void)link_player_skill(victim, tmp);
+ at = find_archetype("skill_spellcasting");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ (void)link_player_skill(victim, tmp);
+ at = find_archetype("skill_praying");
+ tmp = get_object();
+ copy_object(&at->clone, tmp);
+ tmp = insert_ob_in_ob(tmp, victim);
+ (void)link_player_skill(victim, tmp);
+ /* send the inventory to the client */
+ curinv = victim->inv;
+ while (curinv != NULL) {
+ nextinv = curinv->below;
+ esrv_send_item(victim, curinv);
+ curinv = nextinv;
+ }
+ /* basic patchup */
+ for (i=0; i<NUM_BODY_LOCATIONS; i++)
+ if (i == 1 || i == 6 || i == 8 || i == 9)
+ victim->body_info[i] = 2;
+ else
+ victim->body_info[i] = 1;
+
+ esrv_new_player(pl, 80); /* just pick a wieght, we don't care */
+ esrv_send_inventory(victim, victim);
+
+ fix_player(victim);
+
+ do_some_living(victim);
+ }
+
int command_patch (object *op, char *params)
{
Index: crossfire/server/commands.c
diff -c crossfire/server/commands.c:1.29 crossfire/server/commands.c:1.30
*** crossfire/server/commands.c:1.29 Tue Nov 12 21:24:53 2002
--- crossfire/server/commands.c Wed Dec 18 08:39:58 2002
***************
*** 1,6 ****
/*
* static char *rcsid_commands_c =
! * "$Id: commands.c,v 1.29 2002/11/13 05:24:53 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_commands_c =
! * "$Id: commands.c,v 1.30 2002/12/18 16:39:58 garbled Exp $";
*/
/*
***************
*** 242,247 ****
--- 242,249 ----
{"teleport", command_teleport,0.0},
{"wizpass", command_wizpass,0.0},
{"overlay_save", command_save_overlay, 0.0},
+ {"possess", command_possess, 0.0},
+ {"mon_aggr", command_mon_aggr, 0.0},
};
const int WizCommandsSize =sizeof(WizCommands) / sizeof(CommArray_s);
Index: crossfire/server/spell_effect.c
diff -c crossfire/server/spell_effect.c:1.84 crossfire/server/spell_effect.c:1.85
*** crossfire/server/spell_effect.c:1.84 Fri Dec 13 23:04:32 2002
--- crossfire/server/spell_effect.c Wed Dec 18 08:39:59 2002
***************
*** 1,6 ****
/*
* static char *rcsid_spell_effect_c =
! * "$Id: spell_effect.c,v 1.84 2002/12/14 07:04:32 garbled Exp $";
*/
--- 1,6 ----
/*
* static char *rcsid_spell_effect_c =
! * "$Id: spell_effect.c,v 1.85 2002/12/18 16:39:59 garbled Exp $";
*/
***************
*** 1755,1761 ****
int level, number, i;
char *monster;
treasurelist *trlist = NULL;
! treasure *tr, *prevtr;
level = ((op->head?op->head->level:SK_level(op)) / 4);
--- 1755,1761 ----
int level, number, i;
char *monster;
treasurelist *trlist = NULL;
! treasure *tr, *prevtr = NULL;
level = ((op->head?op->head->level:SK_level(op)) / 4);
|