Added AutoLoot and AutoDrain functionality

This commit is contained in:
Polonkai Gergely 2012-03-05 17:29:53 +00:00
parent 9c8a3e2255
commit a8bca76fe1
7 changed files with 37 additions and 4 deletions

View File

@ -1611,10 +1611,12 @@ ACMD(do_toggle)
" Deaf: %-3s "
" Wimp Level: %-3s\r\n"
" Gossip Channel: %-3s "
"Auction Channel: %-3s "
" Grats Channel: %-3s\r\n"
" Auto Loot: %-3s "
" Auto Drain: %-3s "
" Gossip Channel: %-3s\r\n"
"Auction Channel: %-3s "
" Grats Channel: %-3s "
" Color Level: %s\r\n",
ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)),
@ -1632,6 +1634,8 @@ ACMD(do_toggle)
ONOFF(PRF_FLAGGED(ch, PRF_AUTOEXIT)),
YESNO(PRF_FLAGGED(ch, PRF_DEAF)),
buf2,
ONOFF(PRF_FLAGGED(ch, PRF_AUTOLOOT)),
ONOFF(PRF_FLAGGED(ch, PRF_AUTODRAIN)),
ONOFF(!PRF_FLAGGED(ch, PRF_NOGOSS)),
ONOFF(!PRF_FLAGGED(ch, PRF_NOAUCT)),

View File

@ -913,7 +913,11 @@ ACMD(do_gen_tog)
{"Autoexits disabled.\r\n",
"Autoexits enabled.\r\n"},
{"Will no longer track through doors.\r\n",
"Will now track through doors.\r\n"}
"Will now track through doors.\r\n"},
{"AutoLoot disabled.\r\n",
"AutoLoot enabled.\r\n"},
{"AutoDrain disabled.\r\n",
"AutoDrain enabled.\r\n"}
};
@ -969,6 +973,12 @@ ACMD(do_gen_tog)
case SCMD_AUTOEXIT:
result = PRF_TOG_CHK(ch, PRF_AUTOEXIT);
break;
case SCMD_AUTOLOOT:
result = PRF_TOG_CHK(ch, PRF_AUTOLOOT);
break;
case SCMD_AUTODRAIN:
result = PRF_TOG_CHK(ch, PRF_AUTODRAIN);
break;
case SCMD_TRACK:
result = (track_through_doors = !track_through_doors);
break;

View File

@ -184,6 +184,8 @@ const char *preference_bits[] = {
"NO_GOS",
"NO_GTZ",
"RMFLG",
"AUTOLOOT",
"AUTODRAIN",
"\n"
};

View File

@ -36,6 +36,8 @@ extern int max_npc_corpse_time, max_pc_corpse_time;
/* External procedures */
char *fread_action(FILE *fl, int nr);
ACMD(do_flee);
ACMD(do_get);
ACMD(do_drain);
int backstab_mult(int level);
int thaco(int ch_class, int level);
int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim);
@ -832,6 +834,15 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
forget(ch, victim);
}
die(victim);
/* If AUTOLOOT is enabled, loot everything from corpse */
if (IS_NPC(victim) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOLOOT))
do_get(ch, "all corpse", 0, 0);
/* IF AUTODRAIN is enabled, drain corpse */
if (IS_NPC(victim) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTODRAIN))
do_drain(ch, "corpse", 0, 0);
return (-1);
}
return (dam);

View File

@ -223,6 +223,8 @@ cpp_extern const struct command_info cmd_info[] = {
{ "ask" , POS_RESTING , do_spec_comm, 0, SCMD_ASK },
{ "auction" , POS_SLEEPING, do_gen_comm , 0, SCMD_AUCTION },
{ "autoexit" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOEXIT },
{ "autoloot" , POS_DEAD , do_gen_tog , 0, SCMD_AUTOLOOT },
{ "autodrain", POS_DEAD , do_gen_tog , 0, SCMD_AUTODRAIN },
{ "bounce" , POS_STANDING, do_action , 0, 0 },
{ "backstab" , POS_STANDING, do_backstab , 1, 0 },

View File

@ -119,6 +119,8 @@ struct alias_data {
#define SCMD_SLOWNS 14
#define SCMD_AUTOEXIT 15
#define SCMD_TRACK 16
#define SCMD_AUTOLOOT 17
#define SCMD_AUTODRAIN 18
/* do_wizutil */
#define SCMD_REROLL 0

View File

@ -215,6 +215,8 @@
#define PRF_NOGRATZ (1 << 20) /* Can't hear grats channel */
#define PRF_ROOMFLAGS (1 << 21) /* Can see room flags (ROOM_x) */
#define PRF_DISPAUTO (1 << 22) /* Show prompt HP, MP, MV when < 30%. */
#define PRF_AUTOLOOT (1 << 23) /* Automatically loot corpses */
#define PRF_AUTODRAIN (1 << 24) /* Automatically drain corpses */
/* Affect bits: used in char_data.char_specials.saved.affected_by */
/* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */