mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-07 18:08:50 +01:00
updated do_set, added autoloot, autogold, autosplit, autosac, and autoassist. Removed whitespace from files. --Rumble
This commit is contained in:
parent
2b53a5b375
commit
1d9cff608c
11 changed files with 675 additions and 485 deletions
|
|
@ -1817,7 +1817,14 @@ ACMD(do_toggle)
|
|||
" NoAuction: %-3s "
|
||||
" NoGrats: %-3s\r\n"
|
||||
|
||||
" AFK: %-3s "
|
||||
" AutoLoot: %-3s "
|
||||
" AutoGold: %-3s "
|
||||
" AutoSplit: %-3s\r\n"
|
||||
|
||||
" AutoSac: %-3s "
|
||||
" AutoAssist: %-3s "
|
||||
" AFK: %-3s\r\n"
|
||||
|
||||
" Pagelength: %-3d "
|
||||
" Color: %s \r\n ",
|
||||
|
||||
|
|
@ -1841,7 +1848,14 @@ ACMD(do_toggle)
|
|||
ONOFF(PRF_FLAGGED(ch, PRF_NOAUCT)),
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_NOGRATZ)),
|
||||
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_AUTOLOOT)),
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_AUTOGOLD)),
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_AUTOSPLIT)),
|
||||
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_AUTOSAC)),
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_AUTOASSIST)),
|
||||
ONOFF(PRF_FLAGGED(ch, PRF_AFK)),
|
||||
|
||||
GET_PAGE_LENGTH(ch),
|
||||
types[COLOR_LEV(ch)]);
|
||||
return;
|
||||
|
|
@ -1918,6 +1932,21 @@ ACMD(do_toggle)
|
|||
{"syslog", -1, LVL_IMMORT, "\n", "\n"},
|
||||
{"wimpy", -1, 0, "\n", "\n"},
|
||||
{"pagelength", -1, 0, "\n", "\n"},
|
||||
{"autoloot", PRF_AUTOLOOT, 0,
|
||||
"Autoloot disabled.\r\n",
|
||||
"Autoloot enabled.\r\n"},
|
||||
{"autogold", PRF_AUTOGOLD, 0,
|
||||
"Autogold disabled.\r\n",
|
||||
"Autogold enabled.\r\n"},
|
||||
{"autosplit", PRF_AUTOSPLIT, 0,
|
||||
"Autosplit disabled.\r\n",
|
||||
"Autosplit enabled.\r\n"},
|
||||
{"autosac", PRF_AUTOSAC, 0,
|
||||
"Autosac disabled.\r\n",
|
||||
"Autosac enabled.\r\n"},
|
||||
{"autoassist", PRF_AUTOASSIST, 0,
|
||||
"Autoassist disabled.\r\n",
|
||||
"Autoassist enabled.\r\n"},
|
||||
{"\n", -1, -1, "\n", "\n"} /* must be last */
|
||||
};
|
||||
|
||||
|
|
@ -2027,8 +2056,6 @@ ACMD(do_toggle)
|
|||
if (!*arg2) {
|
||||
TOGGLE_BIT(PRF_FLAGS(ch), tog_messages[toggle].toggle);
|
||||
result = (PRF_FLAGGED(ch, tog_messages[toggle].toggle));
|
||||
// send_to_char(ch, "Value must either be 'on' or 'off'.\r\n");
|
||||
// return;
|
||||
} else if (!strcmp(arg2, "on")) {
|
||||
SET_BIT(PRF_FLAGS(ch), tog_messages[toggle].toggle);
|
||||
result = 1;
|
||||
|
|
|
|||
|
|
@ -986,7 +986,7 @@ ACMD(do_eat)
|
|||
do_drink(ch, argument, 0, SCMD_SIP);
|
||||
return;
|
||||
}
|
||||
if ((GET_OBJ_TYPE(food) != ITEM_FOOD) && (GET_LEVEL(ch) <= LVL_BUILDER)) {
|
||||
if ((GET_OBJ_TYPE(food) != ITEM_FOOD) && (GET_LEVEL(ch) < LVL_IMMORT)) {
|
||||
send_to_char(ch, "You can't eat THAT!\r\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1522,3 +1522,70 @@ ACMD(do_remove)
|
|||
perform_remove(ch, i);
|
||||
}
|
||||
}
|
||||
|
||||
ACMD(do_sac)
|
||||
{
|
||||
char arg[MAX_INPUT_LENGTH];
|
||||
struct obj_data *j, *jj, *next_thing2;
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
if (!*arg) {
|
||||
send_to_char(ch, "Sacrifice what?\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(j = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents)) && (!(j = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))) {
|
||||
send_to_char(ch, "It doesn't seem to be here.\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CAN_WEAR(j, ITEM_WEAR_TAKE)) {
|
||||
send_to_char(ch, "You can't sacrifice that!\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
act("$n sacrifices $p.", FALSE, ch, j, 0, TO_ROOM);
|
||||
|
||||
switch (rand_number(0, 5)) {
|
||||
case 0:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||
GET_GOLD(ch) += 1;
|
||||
break;
|
||||
case 1:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nThe Gods ignore your sacrifice.\r\n", GET_OBJ_SHORT(j));
|
||||
break;
|
||||
case 2:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nZizazat gives you %d experience points.\r\n", GET_OBJ_SHORT(j), (2*GET_OBJ_COST(j)));
|
||||
GET_EXP(ch) += (2*GET_OBJ_COST(j));
|
||||
break;
|
||||
case 3:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive %d experience points.\r\n", GET_OBJ_SHORT(j), GET_OBJ_COST(j));
|
||||
GET_EXP(ch) += GET_OBJ_COST(j);
|
||||
break;
|
||||
case 4:
|
||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins.\r\n", GET_OBJ_COST(j));
|
||||
GET_GOLD(ch) += GET_OBJ_COST(j);
|
||||
break;
|
||||
case 5:
|
||||
send_to_char(ch, "Your sacrifice to the Gods is rewarded with %d gold coins\r\n", (2*GET_OBJ_COST(j)));
|
||||
GET_GOLD(ch) += (2*GET_OBJ_COST(j));
|
||||
break;
|
||||
default:
|
||||
send_to_char(ch, "You sacrifice %s to the Gods.\r\nYou receive one gold coin for your humility.\r\n", GET_OBJ_SHORT(j));
|
||||
GET_GOLD(ch) += 1;
|
||||
break;
|
||||
}
|
||||
for (jj = j->contains; jj; jj = next_thing2) {
|
||||
next_thing2 = jj->next_content; /* Next in inventory */
|
||||
obj_from_obj(jj);
|
||||
|
||||
if (j->carried_by)
|
||||
obj_to_room(jj, IN_ROOM(j));
|
||||
else if (IN_ROOM(j) != NOWHERE)
|
||||
obj_to_room(jj, IN_ROOM(j));
|
||||
else
|
||||
assert(FALSE);
|
||||
}
|
||||
extract_obj(j);
|
||||
}
|
||||
|
|
|
|||
779
src/act.wizard.c
779
src/act.wizard.c
File diff suppressed because it is too large
Load diff
|
|
@ -199,11 +199,11 @@ const char *preference_bits[] = {
|
|||
"CLS",
|
||||
"BLDWLK",
|
||||
"AFK",
|
||||
"UNUSED1",
|
||||
"UNUSED2",
|
||||
"UNUSED3",
|
||||
"UNUSED4",
|
||||
"UNUSED5",
|
||||
"AUTOLOOT",
|
||||
"AUTOGOLD",
|
||||
"AUTOSPLIT",
|
||||
"AUTOSAC",
|
||||
"AUTOASSIST",
|
||||
"\n"
|
||||
};
|
||||
|
||||
|
|
|
|||
49
src/fight.c
49
src/fight.c
|
|
@ -32,6 +32,10 @@ extern struct message_list fight_messages[MAX_MESSAGES];
|
|||
/* External procedures */
|
||||
char *fread_action(FILE *fl, int nr);
|
||||
ACMD(do_flee);
|
||||
ACMD(do_get);
|
||||
ACMD(do_split);
|
||||
ACMD(do_sac);
|
||||
ACMD(do_assist);
|
||||
int backstab_mult(int level);
|
||||
int thaco(int ch_class, int level);
|
||||
int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim);
|
||||
|
|
@ -683,6 +687,11 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
|
|||
*/
|
||||
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype)
|
||||
{
|
||||
long local_gold = 0;
|
||||
char local_buf[256];
|
||||
struct char_data *tmp_char;
|
||||
struct obj_data *corpse_obj, *coin_obj, *next_obj;
|
||||
|
||||
if (GET_POS(victim) <= POS_DEAD) {
|
||||
/* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */
|
||||
if (PLR_FLAGGED(victim, PLR_NOTDEADYET) || MOB_FLAGGED(victim, MOB_NOTDEADYET))
|
||||
|
|
@ -839,7 +848,33 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
|||
if (MOB_FLAGGED(ch, MOB_MEMORY))
|
||||
forget(ch, victim);
|
||||
}
|
||||
/* Cant determine GET_GOLD on corpse, so do now and store */
|
||||
if (IS_NPC(victim)) {
|
||||
local_gold = GET_GOLD(victim);
|
||||
sprintf(local_buf,"%ld", (long)local_gold);
|
||||
}
|
||||
|
||||
die(victim, ch);
|
||||
if (IS_AFFECTED(ch, AFF_GROUP) && (local_gold > 0) && PRF_FLAGGED(ch, PRF_AUTOSPLIT) ) {
|
||||
generic_find("corpse", FIND_OBJ_ROOM, ch, &tmp_char, &corpse_obj);
|
||||
if (corpse_obj) {
|
||||
for (coin_obj = corpse_obj->contains; coin_obj; coin_obj = next_obj) {
|
||||
next_obj = coin_obj->next_content;
|
||||
if (CAN_SEE_OBJ(ch, coin_obj) && isname("coin", coin_obj->name))
|
||||
extract_obj(coin_obj);
|
||||
}
|
||||
do_split(ch,local_buf,0,0);
|
||||
}
|
||||
/* need to remove the gold from the corpse */
|
||||
} else if (!IS_NPC(ch) && (ch != victim) && PRF_FLAGGED(ch, PRF_AUTOGOLD)) {
|
||||
do_get(ch, "all.coin corpse", 0, 0);
|
||||
}
|
||||
if (!IS_NPC(ch) && (ch != victim) && PRF_FLAGGED(ch, PRF_AUTOLOOT)) {
|
||||
do_get(ch, "all corpse", 0, 0);
|
||||
}
|
||||
if (IS_NPC(victim) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOSAC)) {
|
||||
do_sac(ch,"corpse",0,0);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
return (dam);
|
||||
|
|
@ -976,6 +1011,7 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
|
|||
void perform_violence(void)
|
||||
{
|
||||
struct char_data *ch;
|
||||
struct follow_type *k;
|
||||
|
||||
for (ch = combat_list; ch; ch = next_combat_list) {
|
||||
next_combat_list = ch->next_fighting;
|
||||
|
|
@ -1002,6 +1038,19 @@ void perform_violence(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
for (k = ch->followers; k; k=k->next) {
|
||||
/* should followers auto-assist master? */
|
||||
if (!IS_NPC(k->follower) && !FIGHTING(k->follower) && PRF_FLAGGED(k->follower,
|
||||
PRF_AUTOASSIST) && (IN_ROOM(k->follower) == IN_ROOM(ch)))
|
||||
do_assist(k->follower, GET_NAME(ch), 0, 0);
|
||||
}
|
||||
|
||||
/* should master auto-assist followers? */
|
||||
if (ch->master && PRF_FLAGGED(ch->master, PRF_AUTOASSIST) &&
|
||||
FIGHTING(ch) && !FIGHTING(ch->master) &&
|
||||
(IN_ROOM(ch->master) == IN_ROOM(ch)))
|
||||
do_assist(ch->master, GET_NAME(ch), 0, 0);
|
||||
|
||||
hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
|
||||
if (MOB_FLAGGED(ch, MOB_SPEC) && GET_MOB_SPEC(ch) && !MOB_FLAGGED(ch, MOB_NOTDEADYET)) {
|
||||
char actbuf[MAX_INPUT_LENGTH] = "";
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 },
|
||||
{ "pick" , "pi" , POS_STANDING, do_gen_door , 1, SCMD_PICK },
|
||||
{ "practice" , "pr" , POS_RESTING , do_practice , 1, 0 },
|
||||
{ "page" , "pag" , POS_DEAD , do_page , LVL_IMMORT, 0 },
|
||||
{ "page" , "pag" , POS_DEAD , do_page , 1, 0 },
|
||||
{ "pardon" , "pardon" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_PARDON },
|
||||
{ "policy" , "pol" , POS_DEAD , do_gen_ps , 0, SCMD_POLICIES },
|
||||
{ "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR },
|
||||
|
|
@ -619,8 +619,23 @@ void command_interpreter(struct char_data *ch, char *argument)
|
|||
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
||||
break;
|
||||
|
||||
if (*complete_cmd_info[cmd].command == '\n')
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
if (*complete_cmd_info[cmd].command == '\n') {
|
||||
int found = 0;
|
||||
send_to_char(ch, "Huh!?!\r\n");
|
||||
|
||||
for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) {
|
||||
if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch))
|
||||
continue;
|
||||
|
||||
if (levenshtein_distance(arg, (char *) cmd_info[cmd].command) <= 2) {
|
||||
if (!found) {
|
||||
send_to_char(ch, "\r\nDid you mean:\r\n");
|
||||
found = 1;
|
||||
}
|
||||
send_to_char(ch, " %s\r\n", cmd_info[cmd].command);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL)
|
||||
send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n");
|
||||
else if (complete_cmd_info[cmd].command_pointer == NULL)
|
||||
|
|
|
|||
|
|
@ -218,6 +218,11 @@
|
|||
#define PRF_CLS (1 << 23) /* Clear screen in OLC */
|
||||
#define PRF_BUILDWALK (1 << 24) /* Build new rooms while walking ? */
|
||||
#define PRF_AFK (1 << 25) /* AFK flag */
|
||||
#define PRF_AUTOLOOT (1 << 26) /* Loot everything from a corpse */
|
||||
#define PRF_AUTOGOLD (1 << 27) /* Loot gold from a corpse */
|
||||
#define PRF_AUTOSPLIT (1 << 28) /* Split gold with group */
|
||||
#define PRF_AUTOSAC (1 << 29) /* Sacrifice a corpse */
|
||||
#define PRF_AUTOASSIST (1 << 30) /* Auto-assist toggle */
|
||||
|
||||
/* Affect bits: used in char_data.char_specials.saved.affected_by */
|
||||
/* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ void update_pos(struct char_data *victim);
|
|||
GET_OBJ_VAL((obj), 3) == 1)
|
||||
|
||||
#define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part))
|
||||
|
||||
#define GET_OBJ_SHORT(obj) ((obj)->short_description)
|
||||
|
||||
/* compound utilities and other macros **********************************/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue