3 Commits

Author SHA1 Message Date
Thomas Arp
a40e8d3f97 Find the correct corpse when autosplitting and sac-ing.
Fixes #147
2025-07-16 21:31:25 +02:00
Thomas Arp
56312d7fe6 kaizen ignore CLion Cmake files 2025-07-16 20:26:54 +02:00
Thomas Arp
670e2331fc kaizen remove removed file from util/CMakeLists.txt 2025-07-16 20:19:29 +02:00
15 changed files with 119 additions and 184 deletions

2
.gitignore vendored
View File

@@ -11,6 +11,8 @@ src/.accepted
src/depend src/depend
src/util/depend src/util/depend
build/* build/*
# generated by CLion
cmake-build-*
# Do not commit files from players # Do not commit files from players
lib/plrfiles/A-E/* lib/plrfiles/A-E/*

View File

@@ -700,8 +700,8 @@ trigger variables.
4.15. I want to expand the ability to pk in my MUD, allowing ASSASSINS 4.15. I want to expand the ability to pk in my MUD, allowing ASSASSINS
that'll be able to PK without getting flagged. How can I do this? that'll be able to PK without getting flagged. How can I do this?
With tbaMUD simply enter Cedit (configuration editor), select Game Play With tbaMUD simply enter Cedit (configuration editor) and select Game Play
(G). Select Player Killing Allowed (A) and choose (3) 'Free for all!'. Options. Then enable Player Killing.
4.16. Why does it say ``Connection closed by foreign host.'' and not 4.16. Why does it say ``Connection closed by foreign host.'' and not
display the ``Byebye!'' message I'm trying to send before cutting display the ``Byebye!'' message I'm trying to send before cutting

View File

@@ -54,7 +54,7 @@ ACMD(do_assist)
else if (!CAN_SEE(ch, opponent)) else if (!CAN_SEE(ch, opponent))
act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR); act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
/* prevent accidental pkill */ /* prevent accidental pkill */
else if (!pk_allowed(ch, opponent)) else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent))
send_to_char(ch, "You cannot kill other players.\r\n"); send_to_char(ch, "You cannot kill other players.\r\n");
else { else {
send_to_char(ch, "You join the fight!\r\n"); send_to_char(ch, "You join the fight!\r\n");
@@ -82,10 +82,8 @@ ACMD(do_hit)
} else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict)) } else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict))
act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR); act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR);
else { else {
if (!pk_allowed(ch, vict)) { if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch))
send_to_char(ch, "Player killing is not allowed.\r\n"); check_killer(ch, vict);
return;
}
if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) { if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) {
if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */ if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */

View File

@@ -154,7 +154,6 @@ ACMD(do_steal)
send_to_char(ch, "You have no idea how to do that.\r\n"); send_to_char(ch, "You have no idea how to do that.\r\n");
return; return;
} }
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) { if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {
send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n"); send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
return; return;
@@ -170,26 +169,20 @@ ACMD(do_steal)
return; return;
} }
/* Check if player stealing is allowed */
if (!IS_NPC(vict)) {
if (CONFIG_PT_SETTING == CONFIG_PT_OFF) {
send_to_char(ch, "Stealing from players is not allowed.\r\n");
return;
}
pcsteal = (CONFIG_PT_SETTING == CONFIG_PT_LIMITED);
}
/* 101% is a complete failure */ /* 101% is a complete failure */
percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket; percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket;
if (GET_POS(vict) < POS_SLEEPING) if (GET_POS(vict) < POS_SLEEPING)
percent = -1; /* ALWAYS SUCCESS, unless heavy object. */ percent = -1; /* ALWAYS SUCCESS, unless heavy object. */
if (!CONFIG_PT_ALLOWED && !IS_NPC(vict))
pcsteal = 1;
if (!AWAKE(vict)) /* Easier to steal from sleeping people. */ if (!AWAKE(vict)) /* Easier to steal from sleeping people. */
percent -= 50; percent -= 50;
/* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */ /* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */
if (GET_LEVEL(vict) >= LVL_IMMORT || GET_MOB_SPEC(vict) == shop_keeper) if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper)
percent = 101; /* Failure */ percent = 101; /* Failure */
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) { if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) {
@@ -228,12 +221,6 @@ ACMD(do_steal)
if (percent > GET_SKILL(ch, SKILL_STEAL)) { if (percent > GET_SKILL(ch, SKILL_STEAL)) {
ohoh = TRUE; ohoh = TRUE;
send_to_char(ch, "Oops..\r\n"); send_to_char(ch, "Oops..\r\n");
/* Player got caught and stealing is limited via cedit */
if ( (pcsteal) && (!PLR_FLAGGED(ch, PLR_THIEF))) {
SET_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
}
act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT); act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT);
act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT); act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
} else { /* Steal the item */ } else { /* Steal the item */
@@ -255,10 +242,6 @@ ACMD(do_steal)
} else { /* Steal some coins */ } else { /* Steal some coins */
if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) { if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) {
ohoh = TRUE; ohoh = TRUE;
/* Player got caught and stealing is limited via cedit */
if ( (pcsteal) && (!PLR_FLAGGED(ch, PLR_THIEF))) {
SET_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
}
send_to_char(ch, "Oops..\r\n"); send_to_char(ch, "Oops..\r\n");
act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, vict, TO_VICT); act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, vict, TO_VICT);
act("$n tries to steal gold from $N.", TRUE, ch, 0, vict, TO_NOTVICT); act("$n tries to steal gold from $N.", TRUE, ch, 0, vict, TO_NOTVICT);

View File

@@ -79,8 +79,8 @@ static void cedit_setup(struct descriptor_data *d)
/* Copy the current configuration from the config_info to this one and copy /* Copy the current configuration from the config_info to this one and copy
* the game play options from the configuration info struct. */ * the game play options from the configuration info struct. */
OLC_CONFIG(d)->play.pk_setting = CONFIG_PK_SETTING; OLC_CONFIG(d)->play.pk_allowed = CONFIG_PK_ALLOWED;
OLC_CONFIG(d)->play.pt_setting = CONFIG_PT_SETTING; OLC_CONFIG(d)->play.pt_allowed = CONFIG_PT_ALLOWED;
OLC_CONFIG(d)->play.level_can_shout = CONFIG_LEVEL_CAN_SHOUT; OLC_CONFIG(d)->play.level_can_shout = CONFIG_LEVEL_CAN_SHOUT;
OLC_CONFIG(d)->play.holler_move_cost = CONFIG_HOLLER_MOVE_COST; OLC_CONFIG(d)->play.holler_move_cost = CONFIG_HOLLER_MOVE_COST;
OLC_CONFIG(d)->play.tunnel_size = CONFIG_TUNNEL_SIZE; OLC_CONFIG(d)->play.tunnel_size = CONFIG_TUNNEL_SIZE;
@@ -183,8 +183,8 @@ static void cedit_save_internally(struct descriptor_data *d)
/* see if we need to reassign spec procs on rooms */ /* see if we need to reassign spec procs on rooms */
int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps); int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps);
/* Copy the data back from the descriptor to the config_info structure. */ /* Copy the data back from the descriptor to the config_info structure. */
CONFIG_PK_SETTING = OLC_CONFIG(d)->play.pk_setting; CONFIG_PK_ALLOWED = OLC_CONFIG(d)->play.pk_allowed;
CONFIG_PT_SETTING = OLC_CONFIG(d)->play.pt_setting; CONFIG_PT_ALLOWED = OLC_CONFIG(d)->play.pt_allowed;
CONFIG_LEVEL_CAN_SHOUT = OLC_CONFIG(d)->play.level_can_shout; CONFIG_LEVEL_CAN_SHOUT = OLC_CONFIG(d)->play.level_can_shout;
CONFIG_HOLLER_MOVE_COST = OLC_CONFIG(d)->play.holler_move_cost; CONFIG_HOLLER_MOVE_COST = OLC_CONFIG(d)->play.holler_move_cost;
CONFIG_TUNNEL_SIZE = OLC_CONFIG(d)->play.tunnel_size; CONFIG_TUNNEL_SIZE = OLC_CONFIG(d)->play.tunnel_size;
@@ -339,9 +339,9 @@ int save_config( IDXTYPE nowhere )
); );
fprintf(fl, "* Is player killing allowed on the mud?\n" fprintf(fl, "* Is player killing allowed on the mud?\n"
"pk_setting = %d\n\n", CONFIG_PK_SETTING); "pk_allowed = %d\n\n", CONFIG_PK_ALLOWED);
fprintf(fl, "* Is player thieving allowed on the mud?\n" fprintf(fl, "* Is player thieving allowed on the mud?\n"
"pt_setting = %d\n\n", CONFIG_PT_SETTING); "pt_allowed = %d\n\n", CONFIG_PT_ALLOWED);
fprintf(fl, "* What is the minimum level a player can shout/gossip/etc?\n" fprintf(fl, "* What is the minimum level a player can shout/gossip/etc?\n"
"level_can_shout = %d\n\n", CONFIG_LEVEL_CAN_SHOUT); "level_can_shout = %d\n\n", CONFIG_LEVEL_CAN_SHOUT);
fprintf(fl, "* How many movement points does shouting cost the player?\n" fprintf(fl, "* How many movement points does shouting cost the player?\n"
@@ -608,10 +608,8 @@ static void cedit_disp_menu(struct descriptor_data *d)
static void cedit_disp_game_play_options(struct descriptor_data *d) static void cedit_disp_game_play_options(struct descriptor_data *d)
{ {
int m_opt, pk_setting, pt_setting; int m_opt;
m_opt = OLC_CONFIG(d)->play.map_option; m_opt = OLC_CONFIG(d)->play.map_option;
pk_setting = OLC_CONFIG(d)->play.pk_setting;
pt_setting = OLC_CONFIG(d)->play.pt_setting;
get_char_colors(d->character); get_char_colors(d->character);
clear_screen(d); clear_screen(d);
@@ -646,8 +644,8 @@ static void cedit_disp_game_play_options(struct descriptor_data *d)
"%s8%s) Scripts on PC's : %s%s\r\n" "%s8%s) Scripts on PC's : %s%s\r\n"
"%sQ%s) Exit To The Main Menu\r\n" "%sQ%s) Exit To The Main Menu\r\n"
"Enter your choice : ", "Enter your choice : ",
grn, nrm, cyn, pk_setting == 0 ? "Off" : (pk_setting == 1 ? "Limited" : (pk_setting == 2 ? "Free-for-all" : "Invalid!")), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.pk_allowed),
grn, nrm, cyn, pt_setting == 0 ? "Off" : (pt_setting == 1 ? "Limited" : (pt_setting == 2 ? "Free-for-all" : "Invalid!")), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.pt_allowed),
grn, nrm, cyn, OLC_CONFIG(d)->play.level_can_shout, grn, nrm, cyn, OLC_CONFIG(d)->play.level_can_shout,
grn, nrm, cyn, OLC_CONFIG(d)->play.holler_move_cost, grn, nrm, cyn, OLC_CONFIG(d)->play.holler_move_cost,
grn, nrm, cyn, OLC_CONFIG(d)->play.tunnel_size, grn, nrm, cyn, OLC_CONFIG(d)->play.tunnel_size,
@@ -885,21 +883,13 @@ void cedit_parse(struct descriptor_data *d, char *arg)
switch (*arg) { switch (*arg) {
case 'a': case 'a':
case 'A': case 'A':
write_to_output(d, "1) No Player Killing\r\n"); TOGGLE_VAR(OLC_CONFIG(d)->play.pk_allowed);
write_to_output(d, "2) Limited Player Killing\r\n"); break;
write_to_output(d, "3) Free-for-all!\r\n");
write_to_output(d, "Enter choice: ");
OLC_MODE(d) = CEDIT_PK_SETTING;
return;
case 'b': case 'b':
case 'B': case 'B':
write_to_output(d, "1) No Player Thieving\r\n"); TOGGLE_VAR(OLC_CONFIG(d)->play.pt_allowed);
write_to_output(d, "2) Limited Player Thieving\r\n"); break;
write_to_output(d, "3) Free-for-all!\r\n");
write_to_output(d, "Enter choice: ");
OLC_MODE(d) = CEDIT_PT_SETTING;
return;
case 'c': case 'c':
case 'C': case 'C':
@@ -1718,30 +1708,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
case CEDIT_PK_SETTING:
if (!*arg || (atoi(arg) < 0) || (atoi(arg) > 3) ) {
write_to_output(d,
"That is an invalid choice!\r\n"
"Select 1, 2 or 3 (0 to cancel) :");
} else {
if ((atoi(arg) >= 1) && (atoi(arg) <= 3))
OLC_CONFIG(d)->play.pk_setting = (atoi(arg) - 1);
cedit_disp_game_play_options(d);
}
break;
case CEDIT_PT_SETTING:
if (!*arg || (atoi(arg) < 0) || (atoi(arg) > 3) ) {
write_to_output(d,
"That is an invalid choice!\r\n"
"Select 1, 2 or 3 (0 to cancel) :");
} else {
if ((atoi(arg) >= 1) && (atoi(arg) <= 3))
OLC_CONFIG(d)->play.pt_setting = (atoi(arg) - 1);
cedit_disp_game_play_options(d);
}
break;
default: /* We should never get here, but just in case... */ default: /* We should never get here, but just in case... */
cleanup_olc(d, CLEANUP_CONFIG); cleanup_olc(d, CLEANUP_CONFIG);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!");

View File

@@ -39,25 +39,15 @@
/* Can Scripts be attached to players? */ /* Can Scripts be attached to players? */
int script_players = NO; int script_players = NO;
/* pk_setting sets the tone of the entire game. /* pk_allowed sets the tone of the entire game. If pk_allowed is set to NO,
* * then players will not be allowed to kill, summon, charm, or sleep other
* CONFIG_PK_OFF 0 Players are prevented from damaging or fighting other players in code * players, as well as a variety of other "asshole player" protections. However,
* CONFIG_PK_LIMITED 1 Players may damage and fight but will be flagged PLR_KILLER * if you decide you want to have an all-out knock-down drag-out PK Mud, just
* CONFIG_PK_FREEFORALL 2 No restrictions or flags for player damaging or killing * set pk_allowed to YES - and anything goes. */
* int pk_allowed = NO;
* If pk_setting is set to 0, then players will not be allowed to kill, summon, charm, or sleep other
* players, as well as a variety of other "asshole player" protections.
* However, if you decide you want to have an all-out knock-down drag-out PK Mud, just
* set pk_setting to 2 - and anything goes. */
int pk_setting = 0;
/* Is playerthieving allowed? /* Is playerthieving allowed? */
* int pt_allowed = NO;
* CONFIG_PT_OFF 0 Players are prevented from stealing from other players in code
* CONFIG_PT_LIMITED 1 Players may steal from other players but will be flagged PLR_THIEF if caught
* CONFIG_PT_FREEFORALL 2 No restrictions or flags for player stealing
*/
int pt_setting = 0;
/* Minimum level a player must be to shout/holler/gossip/auction. */ /* Minimum level a player must be to shout/holler/gossip/auction. */
int level_can_shout = 1; int level_can_shout = 1;

View File

@@ -14,9 +14,9 @@
#define _CONFIG_H_ #define _CONFIG_H_
/* Global variable declarations, all settable by cedit */ /* Global variable declarations, all settable by cedit */
extern int pk_setting; extern int pk_allowed;
extern int script_players; extern int script_players;
extern int pt_setting; extern int pt_allowed;
extern int level_can_shout; extern int level_can_shout;
extern int holler_move_cost; extern int holler_move_cost;
extern int tunnel_size; extern int tunnel_size;

View File

@@ -3838,8 +3838,8 @@ static void load_default_config( void )
/* This function is called only once, at boot-time. We assume config_info is /* This function is called only once, at boot-time. We assume config_info is
* empty. -Welcor */ * empty. -Welcor */
/* Game play options. */ /* Game play options. */
CONFIG_PK_SETTING = pk_setting; CONFIG_PK_ALLOWED = pk_allowed;
CONFIG_PT_SETTING = pt_setting; CONFIG_PT_ALLOWED = pt_allowed;
CONFIG_LEVEL_CAN_SHOUT = level_can_shout; CONFIG_LEVEL_CAN_SHOUT = level_can_shout;
CONFIG_HOLLER_MOVE_COST = holler_move_cost; CONFIG_HOLLER_MOVE_COST = holler_move_cost;
CONFIG_TUNNEL_SIZE = tunnel_size; CONFIG_TUNNEL_SIZE = tunnel_size;
@@ -4113,12 +4113,12 @@ void load_config( void )
break; break;
case 'p': case 'p':
if (!str_cmp(tag, "pk_setting")) if (!str_cmp(tag, "pk_allowed"))
CONFIG_PK_SETTING = num; CONFIG_PK_ALLOWED = num;
else if (!str_cmp(tag, "protocol_negotiation")) else if (!str_cmp(tag, "protocol_negotiation"))
CONFIG_PROTOCOL_NEGOTIATION = num; CONFIG_PROTOCOL_NEGOTIATION = num;
else if (!str_cmp(tag, "pt_setting")) else if (!str_cmp(tag, "pt_allowed"))
CONFIG_PT_SETTING = num; CONFIG_PT_ALLOWED = num;
break; break;
case 'r': case 'r':

View File

@@ -56,7 +56,7 @@ static struct char_data *next_combat_list = NULL;
/* local file scope utility functions */ /* local file scope utility functions */
static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim); static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim);
static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type); static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type);
static void make_corpse(struct char_data *ch); static obj_data *make_corpse(struct char_data *ch);
static void change_alignment(struct char_data *ch, struct char_data *victim); static void change_alignment(struct char_data *ch, struct char_data *victim);
static void group_gain(struct char_data *ch, struct char_data *victim); static void group_gain(struct char_data *ch, struct char_data *victim);
static void solo_gain(struct char_data *ch, struct char_data *victim); static void solo_gain(struct char_data *ch, struct char_data *victim);
@@ -110,13 +110,10 @@ void update_pos(struct char_data *victim)
void check_killer(struct char_data *ch, struct char_data *vict) void check_killer(struct char_data *ch, struct char_data *vict)
{ {
if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF)) { if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF))
return; return;
} if (PLR_FLAGGED(ch, PLR_KILLER) || IS_NPC(ch) || IS_NPC(vict) || ch == vict)
if (PLR_FLAGGED(ch, PLR_KILLER) || IS_NPC(ch) || IS_NPC(vict) || ch == vict){
return; return;
}
SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER); SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
send_to_char(ch, "If you want to be a PLAYER KILLER, so be it...\r\n"); send_to_char(ch, "If you want to be a PLAYER KILLER, so be it...\r\n");
@@ -125,22 +122,6 @@ void check_killer(struct char_data *ch, struct char_data *vict)
GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name); GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name);
} }
bool pk_allowed(struct char_data *ch, struct char_data *victim)
{
/* NPCs are never restricted */
if (IS_NPC(ch) || IS_NPC(victim))
return true;
if (CONFIG_PK_SETTING == CONFIG_PK_OFF)
return false;
if (CONFIG_PK_SETTING == CONFIG_PK_LIMITED)
check_killer(ch, victim);
return true;
}
/* start one char fighting another (yes, it is horrible, I know... ) */ /* start one char fighting another (yes, it is horrible, I know... ) */
void set_fighting(struct char_data *ch, struct char_data *vict) void set_fighting(struct char_data *ch, struct char_data *vict)
{ {
@@ -152,12 +133,6 @@ void set_fighting(struct char_data *ch, struct char_data *vict)
return; return;
} }
if (!pk_allowed(ch, vict)) {
send_to_char(ch, "Player killing is not permitted.\r\n");
return;
}
ch->next_fighting = combat_list; ch->next_fighting = combat_list;
combat_list = ch; combat_list = ch;
@@ -167,6 +142,8 @@ void set_fighting(struct char_data *ch, struct char_data *vict)
FIGHTING(ch) = vict; FIGHTING(ch) = vict;
GET_POS(ch) = POS_FIGHTING; GET_POS(ch) = POS_FIGHTING;
if (!CONFIG_PK_ALLOWED)
check_killer(ch, vict);
} }
/* remove a char from the list of fighting chars */ /* remove a char from the list of fighting chars */
@@ -184,7 +161,7 @@ void stop_fighting(struct char_data *ch)
update_pos(ch); update_pos(ch);
} }
static void make_corpse(struct char_data *ch) static obj_data *make_corpse(struct char_data *ch)
{ {
char buf2[MAX_NAME_LENGTH + 64]; char buf2[MAX_NAME_LENGTH + 64];
struct obj_data *corpse, *o; struct obj_data *corpse, *o;
@@ -252,6 +229,7 @@ static void make_corpse(struct char_data *ch)
IS_CARRYING_W(ch) = 0; IS_CARRYING_W(ch) = 0;
obj_to_room(corpse, IN_ROOM(ch)); obj_to_room(corpse, IN_ROOM(ch));
return corpse;
} }
/* When ch kills victim */ /* When ch kills victim */
@@ -273,9 +251,10 @@ void death_cry(struct char_data *ch)
send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n"); send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n");
} }
void raw_kill(struct char_data * ch, struct char_data * killer) struct obj_data *raw_kill(struct char_data *ch, struct char_data *killer)
{ {
struct char_data *i; struct char_data *i;
obj_data *corpse;
if (FIGHTING(ch)) if (FIGHTING(ch))
stop_fighting(ch); stop_fighting(ch);
@@ -307,23 +286,24 @@ struct char_data *i;
update_pos(ch); update_pos(ch);
make_corpse(ch); corpse = make_corpse(ch);
extract_char(ch); extract_char(ch);
if (killer) { if (killer) {
autoquest_trigger_check(killer, NULL, NULL, AQ_MOB_SAVE); autoquest_trigger_check(killer, NULL, NULL, AQ_MOB_SAVE);
autoquest_trigger_check(killer, NULL, NULL, AQ_ROOM_CLEAR); autoquest_trigger_check(killer, NULL, NULL, AQ_ROOM_CLEAR);
} }
return corpse;
} }
void die(struct char_data * ch, struct char_data * killer) struct obj_data *die(struct char_data *ch, struct char_data *killer)
{ {
gain_exp(ch, -(GET_EXP(ch) / 2)); gain_exp(ch, -(GET_EXP(ch) / 2));
if (!IS_NPC(ch)) { if (!IS_NPC(ch)) {
REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER); REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF); REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
} }
raw_kill(ch, killer); return raw_kill(ch, killer);
} }
static void perform_group_gain(struct char_data *ch, int base, static void perform_group_gain(struct char_data *ch, int base,
@@ -604,16 +584,54 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
return (0); return (0);
} }
static void perform_autohandling(char_data *ch, const char_data *victim, int local_gold, const obj_data *corpse_obj) {
char local_buf[256];
obj_data *i;
int count = 0, found = FALSE;
if (IN_ROOM(ch) == NOWHERE || ch == victim) {
return;
}
// find the last corpse in the room
for (i = world[IN_ROOM(ch)].contents; i ; i = i->next_content) {
if (is_name("corpse", i->name) && CAN_SEE_OBJ(ch, i)) {
count++;
}
if (i == corpse_obj) {
found = TRUE;
break; // stop looking
}
}
if (count == 0 || !found) {
return; // no corpse here - it may have been removed by some other method.
}
if (GROUP(ch) && local_gold > 0 && PRF_FLAGGED(ch, PRF_AUTOSPLIT) ) {
sprintf(local_buf,"all.coin %d.corpse", count);
do_get(ch, local_buf, 0, 0);
sprintf(local_buf,"%d", local_gold);
do_split(ch, local_buf, 0, 0);
} else if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOGOLD)) {
sprintf(local_buf,"all.coin %d.corpse", count);
do_get(ch, local_buf, 0, 0);
}
if (!IS_NPC(ch) && (ch != victim) && PRF_FLAGGED(ch, PRF_AUTOLOOT)) {
sprintf(local_buf,"all %d.corpse", count);
do_get(ch, local_buf, 0, 0);
}
if (IS_NPC(victim) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOSAC)) {
sprintf(local_buf,"%d.corpse", count);
do_sac(ch, local_buf,0,0);
}
}
/* This function returns the following codes: /* This function returns the following codes:
* < 0 Victim died. * < 0 Victim died.
* = 0 No damage. * = 0 No damage.
* > 0 How much damage done. */ * > 0 How much damage done. */
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype) int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype)
{ {
long local_gold = 0, happy_gold = 0; int local_gold = 0, happy_gold = 0;
char local_buf[256]; obj_data *corpse_obj;
struct char_data *tmp_char;
struct obj_data *corpse_obj;
if (GET_POS(victim) <= POS_DEAD) { if (GET_POS(victim) <= POS_DEAD) {
/* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */ /* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */
@@ -626,12 +644,6 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
return (-1); /* -je, 7/7/92 */ return (-1); /* -je, 7/7/92 */
} }
/* Check for PK if this is not a PK MUD */
if (!pk_allowed(ch, victim)) {
send_to_char(ch, "Player killing is not permitted.\r\n");
return (0);
}
/* peaceful rooms */ /* peaceful rooms */
if (ch->nr != real_mobile(DG_CASTER_PROXY) && if (ch->nr != real_mobile(DG_CASTER_PROXY) &&
ch != victim && ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) { ch != victim && ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {
@@ -679,6 +691,13 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
if (AFF_FLAGGED(victim, AFF_SANCTUARY) && dam >= 2) if (AFF_FLAGGED(victim, AFF_SANCTUARY) && dam >= 2)
dam /= 2; dam /= 2;
/* Check for PK if this is not a PK MUD */
if (!CONFIG_PK_ALLOWED) {
check_killer(ch, victim);
if (PLR_FLAGGED(ch, PLR_KILLER) && (ch != victim))
dam = 0;
}
/* Set the maximum damage per round and subtract the hit points */ /* Set the maximum damage per round and subtract the hit points */
dam = MAX(MIN(dam, 100), 0); dam = MAX(MIN(dam, 100), 0);
GET_HIT(victim) -= dam; GET_HIT(victim) -= dam;
@@ -780,31 +799,15 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
if (IS_NPC(victim)) { if (IS_NPC(victim)) {
if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD))
{ {
happy_gold = (long)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100)); happy_gold = (int)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100));
happy_gold = MAX(0, happy_gold); happy_gold = MAX(0, happy_gold);
increase_gold(victim, happy_gold); increase_gold(victim, happy_gold);
} }
local_gold = GET_GOLD(victim); local_gold = GET_GOLD(victim);
sprintf(local_buf,"%ld", (long)local_gold);
} }
die(victim, ch); corpse_obj = die(victim, ch);
if (GROUP(ch) && (local_gold > 0) && PRF_FLAGGED(ch, PRF_AUTOSPLIT) ) { perform_autohandling(ch, victim, local_gold, corpse_obj);
generic_find("corpse", FIND_OBJ_ROOM, ch, &tmp_char, &corpse_obj);
if (corpse_obj) {
do_get(ch, "all.coin corpse", 0, 0);
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 (-1);
} }
return (dam); return (dam);

View File

@@ -26,15 +26,16 @@ void check_killer(struct char_data *ch, struct char_data *vict);
int compute_armor_class(struct char_data *ch); int compute_armor_class(struct char_data *ch);
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype); int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype);
void death_cry(struct char_data *ch); void death_cry(struct char_data *ch);
void die(struct char_data * ch, struct char_data * killer);
struct obj_data *die(struct char_data *ch, struct char_data *killer);
void hit(struct char_data *ch, struct char_data *victim, int type); void hit(struct char_data *ch, struct char_data *victim, int type);
void perform_violence(void); void perform_violence(void);
void raw_kill(struct char_data * ch, struct char_data * killer);
struct obj_data *raw_kill(struct char_data *ch, struct char_data *killer);
void set_fighting(struct char_data *ch, struct char_data *victim); void set_fighting(struct char_data *ch, struct char_data *victim);
int skill_message(int dam, struct char_data *ch, struct char_data *vict, int skill_message(int dam, struct char_data *ch, struct char_data *vict,
int attacktype); int attacktype);
void stop_fighting(struct char_data *ch); void stop_fighting(struct char_data *ch);
bool pk_allowed(struct char_data *ch, struct char_data *victim);
/* Global variables */ /* Global variables */

View File

@@ -473,7 +473,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
break; break;
case SPELL_SLEEP: case SPELL_SLEEP:
if ((CONFIG_PK_SETTING == CONFIG_PK_OFF) && !IS_NPC(ch) && !IS_NPC(victim)) if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(victim))
return; return;
if (MOB_FLAGGED(victim, MOB_NOSLEEP)) if (MOB_FLAGGED(victim, MOB_NOSLEEP))
return; return;
@@ -650,7 +650,7 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
continue; continue;
if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT) if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT)
continue; continue;
if ((CONFIG_PK_SETTING == CONFIG_PK_OFF) && !IS_NPC(ch) && !IS_NPC(tch)) if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(tch))
continue; continue;
if (!IS_NPC(ch) && IS_NPC(tch) && AFF_FLAGGED(tch, AFF_CHARM)) if (!IS_NPC(ch) && IS_NPC(tch) && AFF_FLAGGED(tch, AFF_CHARM))
continue; continue;

View File

@@ -380,8 +380,6 @@ extern const char *nrm, *grn, *cyn, *yel;
#define CEDIT_MAP_SIZE 55 #define CEDIT_MAP_SIZE 55
#define CEDIT_MINIMAP_SIZE 56 #define CEDIT_MINIMAP_SIZE 56
#define CEDIT_DEBUG_MODE 57 #define CEDIT_DEBUG_MODE 57
#define CEDIT_PK_SETTING 58
#define CEDIT_PT_SETTING 59
/* Hedit Submodes of connectedness. */ /* Hedit Submodes of connectedness. */
#define HEDIT_CONFIRM_SAVESTRING 0 #define HEDIT_CONFIRM_SAVESTRING 0

View File

@@ -120,7 +120,7 @@ ASPELL(spell_summon)
return; return;
} }
if (CONFIG_PK_SETTING == CONFIG_PK_OFF) { if (!CONFIG_PK_ALLOWED) {
if (MOB_FLAGGED(victim, MOB_AGGRESSIVE)) { if (MOB_FLAGGED(victim, MOB_AGGRESSIVE)) {
act("As the words escape your lips and $N travels\r\n" act("As the words escape your lips and $N travels\r\n"
"through time and space towards you, you realize that $E is\r\n" "through time and space towards you, you realize that $E is\r\n"
@@ -265,7 +265,7 @@ ASPELL(spell_charm)
else if (AFF_FLAGGED(victim, AFF_CHARM) || level < GET_LEVEL(victim)) else if (AFF_FLAGGED(victim, AFF_CHARM) || level < GET_LEVEL(victim))
send_to_char(ch, "You fail.\r\n"); send_to_char(ch, "You fail.\r\n");
/* player charming another player - no legal reason for this */ /* player charming another player - no legal reason for this */
else if ((CONFIG_PK_SETTING == CONFIG_PK_OFF) && !IS_NPC(victim)) else if (!CONFIG_PK_ALLOWED && !IS_NPC(victim))
send_to_char(ch, "You fail - shouldn't be doing it anyway.\r\n"); send_to_char(ch, "You fail - shouldn't be doing it anyway.\r\n");
else if (circle_follow(victim, ch)) else if (circle_follow(victim, ch))
send_to_char(ch, "Sorry, following in circles is not allowed.\r\n"); send_to_char(ch, "Sorry, following in circles is not allowed.\r\n");

View File

@@ -1291,8 +1291,8 @@ struct recent_player
* variables. */ * variables. */
struct game_data struct game_data
{ {
int pk_setting; /**< Is player killing allowed? */ int pk_allowed; /**< Is player killing allowed? */
int pt_setting; /**< Is player thieving allowed? */ int pt_allowed; /**< Is player thieving allowed? */
int level_can_shout; /**< Level player must be to shout. */ int level_can_shout; /**< Level player must be to shout. */
int holler_move_cost; /**< Cost to holler in move points. */ int holler_move_cost; /**< Cost to holler in move points. */
int tunnel_size; /**< Number of people allowed in a tunnel.*/ int tunnel_size; /**< Number of people allowed in a tunnel.*/

View File

@@ -939,15 +939,9 @@ do \
#define CONFIG_CONFFILE config_info.CONFFILE #define CONFIG_CONFFILE config_info.CONFFILE
/** Player killing allowed or not? */ /** Player killing allowed or not? */
#define CONFIG_PK_SETTING config_info.play.pk_setting #define CONFIG_PK_ALLOWED config_info.play.pk_allowed
#define CONFIG_PK_OFF 0 /* Players are prevented from damaging or fighting other players in code */
#define CONFIG_PK_LIMITED 1 /* Players may damage and fight but will be flagged PLR_KILLER */
#define CONFIG_PK_FREEFORALL 2 /* No restrictions or flags for player damaging or killing */
/** Player thieving allowed or not? */ /** Player thieving allowed or not? */
#define CONFIG_PT_SETTING config_info.play.pt_setting #define CONFIG_PT_ALLOWED config_info.play.pt_allowed
#define CONFIG_PT_OFF 0 /* Players are prevented from stealing from other players in code */
#define CONFIG_PT_LIMITED 1 /* Players may steal from other players but will be flagged PLR_THIEF if caught */
#define CONFIG_PT_FREEFORALL 2 /* No restrictions or flags for player stealing */
/** What level to use the shout command? */ /** What level to use the shout command? */
#define CONFIG_LEVEL_CAN_SHOUT config_info.play.level_can_shout #define CONFIG_LEVEL_CAN_SHOUT config_info.play.level_can_shout
/** How many move points does holler cost? */ /** How many move points does holler cost? */