From f9e9f38ee67a44204a296f238a03f01060f1d6b7 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:09:53 +0000 Subject: [PATCH 1/8] Added ViM swap files to gitignore --- src/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.gitignore b/src/.gitignore index 5c530d3..2e23787 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,3 +2,4 @@ conf.h .accepted Makefile *.o +*.swp From 09c274e9c080d51aa3818aae23f7f4bbc1bdb770 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:11:02 +0000 Subject: [PATCH 2/8] Created log/.gitignore, so log directory will be commited, but not anything else from there. --- log/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 log/.gitignore diff --git a/log/.gitignore b/log/.gitignore new file mode 100644 index 0000000..6612bef --- /dev/null +++ b/log/.gitignore @@ -0,0 +1 @@ +syslog* From b39005f561edf332bb10b73e2ff7a4ee4540f2be Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:12:06 +0000 Subject: [PATCH 3/8] Moved *.swp to main .gitignore, and added current syslog to .gitignore --- .gitignore | 2 ++ src/.gitignore | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9eb0607..6945182 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ config.log config.cache config.status +syslog +*.swp diff --git a/src/.gitignore b/src/.gitignore index 2e23787..5c530d3 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,4 +2,3 @@ conf.h .accepted Makefile *.o -*.swp From cd37b1a8b476497d7cd5031527d76530dc90ba1a Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:21:57 +0000 Subject: [PATCH 4/8] Removed files from index that do not need to be tracked --- lib/etc/players | 0 lib/etc/time | 1 - syslog | 1 - 3 files changed, 2 deletions(-) delete mode 100644 lib/etc/players delete mode 100644 lib/etc/time delete mode 100644 syslog diff --git a/lib/etc/players b/lib/etc/players deleted file mode 100644 index e69de29..0000000 diff --git a/lib/etc/time b/lib/etc/time deleted file mode 100644 index 5cb8186..0000000 --- a/lib/etc/time +++ /dev/null @@ -1 +0,0 @@ -650336715 diff --git a/syslog b/syslog deleted file mode 100644 index 177e247..0000000 --- a/syslog +++ /dev/null @@ -1 +0,0 @@ -System messages will end up written here. From b6efb003e6919d3756b3efd02b5bd84c99e0c365 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:27:49 +0000 Subject: [PATCH 5/8] Fixed bury & dig code --- src/act.informative.c | 3 +++ src/act.other.c | 45 ++++++++++++++++++++++++++++--------------- src/structs.h | 2 +- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/act.informative.c b/src/act.informative.c index 3454336..930c635 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -173,6 +173,9 @@ void show_obj_modifiers(struct obj_data *obj, struct char_data *ch) if (OBJ_FLAGGED(obj, ITEM_HUM)) send_to_char(ch, " ..It emits a faint humming sound!"); + + if (IS_BURIED(obj)) + send_to_char(ch, " ... It is buried!"); } diff --git a/src/act.other.c b/src/act.other.c index d2f341c..0d0ec58 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -1091,16 +1091,14 @@ ACMD(do_dig) /* ** search for an object in the room that has a ITEM_BURIED flag */ - obj = world[IN_ROOM(ch)].contents; - - while (obj != NULL) + for (obj = world[IN_ROOM(ch)].contents; obj; obj = obj->next) { if (IS_BURIED(obj)) { /* Remove the buried bit so the player can see it. */ REMOVE_BIT(GET_OBJ_EXTRA(obj), ITEM_BURIED); - if(CAN_SEE_OBJ(ch, obj)) + if (CAN_SEE_OBJ(ch, obj)) { found_item = 1; /* player found something */ @@ -1113,13 +1111,10 @@ ACMD(do_dig) else { /* add the bit back becuase the player can't unbury what - ** what he can't find... */ + ** he can't find... */ SET_BIT(GET_OBJ_EXTRA(obj), ITEM_BURIED); } } - - /* go to the next obj */ - obj = obj->next; } /* if the player didn't find anything */ @@ -1133,7 +1128,8 @@ ACMD(do_drain) struct obj_data *obj; int HIT = 0, MANA = 0, - MOVE = 0; + MOVE = 0, + reward; one_argument(argument, arg); @@ -1150,14 +1146,31 @@ ACMD(do_drain) } act("$n bends down and touches $p which slowly disappears.\r\n", FALSE, ch, obj, NULL, TO_ROOM); - act("You bend down and drain $p.\r\n", FALSE, ch, obj, NULL, TO_ROOM); + act("You bend down and drain $p.\r\n", FALSE, ch, obj, NULL, TO_CHAR); - HIT = rand() % GET_LEVEL(ch) * 2 + 1; - MANA = rand() % GET_LEVEL(ch) + 1; - MOVE = rand() % 15 + 1; - GET_HIT(ch) = GET_HIT(ch) + HIT; - GET_MANA(ch) = GET_MANA(ch) + MANA; - GET_MOVE(ch) = GET_MOVE(ch) + MOVE; + if ((reward = rand_number(1, 2)) == 1) + { + HIT = rand_number(1, GET_LEVEL(ch) * 2); + MANA = rand_number(1, GET_LEVEL(ch)); + MOVE = rand_number(1, 15); + GET_HIT(ch) += HIT; + GET_MANA(ch) += MANA; + GET_MOVE(ch) += MOVE; + send_to_char(ch, "The Gods rewarded you with %dH %dM %dV\r\n", HIT, MANA, MOVE); + } + else if (reward == 2) + { + int amount = rand_number(1, 5); + GET_GOLD(ch) += amount; + send_to_char(ch, "The Gods rewarded you with %d gold coin%s\r\n", amount, (amount > 1) ? "s" : ""); + } + else + { + int amount = rand_number(1, GET_LEVEL(ch) * 5); + + gain_exp(ch, amount); + send_to_char(ch, "The Gods rewarded you with %d experience point%s.\r\n", amount, (amount >1) ? "s" : ""); + } extract_obj(obj); } diff --git a/src/structs.h b/src/structs.h index 9fbf7ac..521a6d8 100644 --- a/src/structs.h +++ b/src/structs.h @@ -314,7 +314,6 @@ #define ITEM_PEN 21 /* Item is a pen */ #define ITEM_BOAT 22 /* Item is a boat */ #define ITEM_FOUNTAIN 23 /* Item is a fountain */ -#define ITEM_BURIED 24 /* Item is buried */ /* Take/Wear flags: used by obj_data.obj_flags.wear_flags */ @@ -353,6 +352,7 @@ #define ITEM_ANTI_THIEF (1 << 14) /* Not usable by thieves */ #define ITEM_ANTI_WARRIOR (1 << 15) /* Not usable by warriors */ #define ITEM_NOSELL (1 << 16) /* Shopkeepers won't touch it */ +#define ITEM_BURIED (1 << 17) /* Item is buried */ /* Modifier constants used with obj affects ('A' fields) */ From 9c8a3e22555061ded1d018d6a4193f76092d21c1 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:28:46 +0000 Subject: [PATCH 6/8] Changed shout level and load behavour in config.c --- src/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index f060abf..f04b1f2 100644 --- a/src/config.c +++ b/src/config.c @@ -58,7 +58,7 @@ int pk_allowed = NO; int pt_allowed = NO; /* minimum level a player must be to shout/holler/gossip/auction */ -int level_can_shout = 1; +int level_can_shout = 2; /* number of movement points it costs to holler */ int holler_move_cost = 20; @@ -93,7 +93,7 @@ int dts_are_dumps = YES; * able to carry around things like boards. That's not necessarily a bad * thing, but this will be left at a default of 'NO' for historic reasons. */ -int load_into_inventory = NO; +int load_into_inventory = YES; /* "okay" etc. */ const char *OK = "Okay.\r\n"; From a8bca76fe1c7dc108e9ae7ee8e40a5d079a6688c Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:29:53 +0000 Subject: [PATCH 7/8] Added AutoLoot and AutoDrain functionality --- src/act.informative.c | 10 +++++++--- src/act.other.c | 12 +++++++++++- src/constants.c | 2 ++ src/fight.c | 11 +++++++++++ src/interpreter.c | 2 ++ src/interpreter.h | 2 ++ src/structs.h | 2 ++ 7 files changed, 37 insertions(+), 4 deletions(-) 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") */ From 4b0989f85b0d2601472747f16187936ea6291e0b Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 5 Mar 2012 17:33:13 +0000 Subject: [PATCH 8/8] Added several more ignored files --- .gitignore | 1 + lib/etc/.gitignore | 1 + lib/plrobjs/.gitignore | 1 + log/.gitignore | 11 +++++++++++ 4 files changed, 14 insertions(+) create mode 100644 lib/plrobjs/.gitignore diff --git a/.gitignore b/.gitignore index 6945182..ee5f064 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ config.log config.cache config.status syslog +syslog.CRASH *.swp diff --git a/lib/etc/.gitignore b/lib/etc/.gitignore index 580a3a3..03dd21c 100644 --- a/lib/etc/.gitignore +++ b/lib/etc/.gitignore @@ -3,3 +3,4 @@ players plrmail badsites board.immort +time diff --git a/lib/plrobjs/.gitignore b/lib/plrobjs/.gitignore new file mode 100644 index 0000000..cd74b2b --- /dev/null +++ b/lib/plrobjs/.gitignore @@ -0,0 +1 @@ +*.objs diff --git a/log/.gitignore b/log/.gitignore index 6612bef..c263b72 100644 --- a/log/.gitignore +++ b/log/.gitignore @@ -1 +1,12 @@ syslog* +badpws +delete +dts +errors +godcmds +levels +newplayers +rentgone +restarts +rip +usage