diff --git a/src/act.informative.c b/src/act.informative.c index 930c635..ec62dd9 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -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)), diff --git a/src/act.other.c b/src/act.other.c index 0d0ec58..b61d397 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -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; diff --git a/src/constants.c b/src/constants.c index 4bf4571..a091687 100644 --- a/src/constants.c +++ b/src/constants.c @@ -184,6 +184,8 @@ const char *preference_bits[] = { "NO_GOS", "NO_GTZ", "RMFLG", + "AUTOLOOT", + "AUTODRAIN", "\n" }; diff --git a/src/fight.c b/src/fight.c index 1a321d3..f0583fd 100644 --- a/src/fight.c +++ b/src/fight.c @@ -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); diff --git a/src/interpreter.c b/src/interpreter.c index eb9ae48..44814ca 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -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 }, diff --git a/src/interpreter.h b/src/interpreter.h index 982c5ed..54f342d 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -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 diff --git a/src/structs.h b/src/structs.h index 521a6d8..57bb131 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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") */