Skip to content

Commit 62e5363

Browse files
committed
add favours system for outrepped runs
1 parent bed7418 commit 62e5363

7 files changed

Lines changed: 64 additions & 16 deletions

File tree

src/act.informative.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,10 @@ void list_one_char(struct char_data * i, struct char_data * ch)
14411441
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "^y...%s%s only has work for less-experienced 'runners.^n\r\n",
14421442
HSSH(i),
14431443
already_printed ? " also" : "");
1444+
if (PRF_FLAGGED(ch, PRF_FAVOURS)) {
1445+
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "^y...but %s might need to call in a favor.^n\r\n",
1446+
HSSH(i));
1447+
}
14441448
}
14451449
already_printed = TRUE;
14461450
}
@@ -8554,4 +8558,4 @@ void write_gsgp_file(int player_count, const char *path) {
85548558
fprintf(fl, "}");
85558559

85568560
fclose(fl);
8557-
}
8561+
}

src/act.other.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,9 @@ const char *tog_messages[][2] = {
12181218
{"You will now participate in combat again.\r\n",
12191219
"OK, you will no longer be able to initiate combat or fight back.\r\n"},
12201220
{"You will now see ambiance messages and environmental echoes about traffic.\r\n",
1221-
"You will no longer see ambiance messages and environmental echoes about traffic.\r\n"}
1221+
"You will no longer see ambiance messages and environmental echoes about traffic.\r\n"},
1222+
{"You are no longer interested in doing favors for Johnsons.\r\n",
1223+
"You are now willing to do favors for Johnsons.\r\n"}
12221224
};
12231225

12241226
ACMD(do_toggle)
@@ -1510,6 +1512,9 @@ ACMD(do_toggle)
15101512
} else if (is_abbrev(argument, "traffic") || is_abbrev(argument, "notraffic") || is_abbrev(argument, "no traffic")) {
15111513
result = PRF_TOG_CHK(ch, PRF_NOTRAFFIC);
15121514
mode = 52;
1515+
} else if (is_abbrev(argument, "favors")) {
1516+
result = PRF_TOG_CHK(ch, PRF_FAVOURS);
1517+
mode = 53;
15131518
} else {
15141519
send_to_char("That is not a valid toggle option.\r\n", ch);
15151520
return;

src/awake.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ enum {
488488
#define PRF_NOFOLLOW 69
489489
#define PRF_SUPPRESS_PROMPT_CHANGE 70
490490
#define PRF_PASSIVE_IN_COMBAT 71
491-
#define PRF_MAX 72
491+
#define PRF_FAVOURS 72
492+
#define PRF_MAX 73
492493

493494
/* log watch */
494495

src/config.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ extern const char *CHARACTER_DELETED_NAME_FOR_SQL;
2929
#define KARMA_GAIN_MULTIPLIER 2.0
3030
#define NUYEN_GAIN_MULTIPLIER 2.0
3131
#define GROUP_QUEST_REWARD_MULTIPLIER 1.5
32+
#define FAVOURS_KARMA_MULTIPLIER 0.0
33+
#define FAVOURS_NUYEN_MULTIPLIER 0.0
3234

3335
// How well should markets regenerate over time? (currently every 2 mins)
3436
#define MAX_PAYDATA_MARKET_INCREASE_PER_TICK 250

src/constants.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ struct preference_bit_struct preference_bits_v2[] = {
745745
{ "No Follow" , FALSE, TRUE },
746746
{ "No Prompt Change Message", FALSE, TRUE },
747747
{ "Passive Combat" , FALSE, TRUE },
748+
{ "Johnson Favors" , TRUE , TRUE },
748749
{ "\n" , 0 , 0 }
749750
};
750751

@@ -823,6 +824,7 @@ const char *preference_bits[] =
823824
"NOFOLLOW",
824825
"!PROMPT_CHANGE_MSG",
825826
"PASSIVE_COMBAT",
827+
"FAVOURS",
826828
MAX_FLAG_MARKER
827829
};
828830

src/quest.cpp

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ void award_follower_payout(struct char_data *follower, int karma, int nuyen, str
10461046
GET_IDNUM(questor));
10471047
}
10481048

1049-
void reward(struct char_data *ch, struct char_data *johnson)
1049+
void reward(struct char_data *ch, struct char_data *johnson, bool favour = FALSE)
10501050
{
10511051
if (vnum_from_non_approved_zone(quest_table[GET_QUEST(ch)].vnum)) {
10521052
#ifdef IS_BUILDPORT
@@ -1194,13 +1194,21 @@ void reward(struct char_data *ch, struct char_data *johnson)
11941194
}
11951195
}
11961196

1197+
if (favour) {
1198+
karma = karma * FAVOURS_KARMA_MULTIPLIER;
1199+
nuyen = nuyen * FAVOURS_KARMA_MULTIPLIER;
1200+
}
1201+
11971202
gain_nuyen(ch, nuyen, NUYEN_INCOME_AUTORUNS);
11981203
int gained = gain_karma(ch, karma, TRUE, FALSE, TRUE);
11991204
act("$n gives some nuyen to $N.", TRUE, johnson, 0, ch, TO_NOTVICT);
12001205
act("You give some nuyen to $N.", TRUE, johnson, 0, ch, TO_CHAR);
12011206
snprintf(buf, sizeof(buf), "$n gives you %d nuyen.", nuyen);
12021207
act(buf, FALSE, johnson, 0, ch, TO_VICT);
12031208
send_to_char(ch, "You gain %.2f karma.\r\n", ((float) gained / 100));
1209+
if (favour) {
1210+
send_to_char(ch, "^L[OOC: Karma and nuyen rewards for this run were suppressed as it was a favor.]^n\r\n");
1211+
}
12041212

12051213
mudlog_vfprintf(ch, LOG_GRIDLOG, "%s gains %0.2fk and %dn from job %ld. Elapsed time v2 %0.2f seconds.",
12061214
GET_CHAR_NAME(ch),
@@ -1221,7 +1229,7 @@ bool compareRep(const quest_entry &a, const quest_entry &b)
12211229
//done, and outgrown, sorts it by reputation and returns the lowest
12221230
//rep one first. It returns 0 if no more quests are available or -1 if
12231231
//the johnson is broken.
1224-
int new_quest(struct char_data *mob, struct char_data *ch)
1232+
int new_quest(struct char_data *mob, struct char_data *ch, bool favour = FALSE)
12251233
{
12261234
int num = 0;
12271235
bool allow_disconnected = vnum_from_non_approved_zone(GET_MOB_VNUM(mob));
@@ -1267,7 +1275,7 @@ int new_quest(struct char_data *mob, struct char_data *ch)
12671275
#endif
12681276
}
12691277

1270-
if (rep_too_high(ch, quest_idx)) {
1278+
if (rep_too_high(ch, quest_idx) && !favour) {
12711279
if (access_level(ch, LVL_BUILDER)) {
12721280
send_to_char(ch, "[Skipping quest %ld: You exceed rep cap of %d.]\r\n", quest_table[quest_idx].vnum, quest_table[quest_idx].max_rep);
12731281
}
@@ -1460,7 +1468,7 @@ void handle_info(struct char_data *johnson, int num, struct char_data *target)
14601468
SPECIAL(johnson)
14611469
{
14621470
struct char_data *johnson = (struct char_data *) me, *temp = NULL;
1463-
int i, obj_complete = 0, mob_complete = 0, new_q, cached_new_q = -2, comm = CMD_JOB_NONE;
1471+
int i, obj_complete = 0, mob_complete = 0, new_q, cached_new_q = -2, cached_new_f = -2, comm = CMD_JOB_NONE;
14641472

14651473
if (!IS_NPC(johnson))
14661474
return FALSE;
@@ -1488,6 +1496,7 @@ SPECIAL(johnson)
14881496

14891497
skip_spaces(&argument);
14901498

1499+
bool favour = FALSE;
14911500
bool need_to_speak = FALSE;
14921501
bool need_to_act = FALSE;
14931502
bool is_sayto = CMD_IS("sayto") || CMD_IS("\"") || CMD_IS("ask") || CMD_IS("whisper");
@@ -1524,6 +1533,8 @@ SPECIAL(johnson)
15241533
str_str(argument, "run") || str_str(argument, "shadowrun") ||
15251534
str_str(argument, "job") || str_str(argument, "help"))
15261535
comm = CMD_JOB_START;
1536+
else if (str_str(argument, "favor") || str_str(argument, "favour"))
1537+
comm = CMD_JOB_FAVOUR;
15271538
else if (str_str(argument, "yes") || str_str(argument, "accept") || str_str(argument, "yeah")
15281539
|| str_str(argument, "sure") || str_str(argument, "okay"))
15291540
comm = CMD_JOB_YES;
@@ -1600,6 +1611,8 @@ SPECIAL(johnson)
16001611
if (need_to_act)
16011612
do_action(ch, argument, cmd, 0);
16021613

1614+
bool doing_favours = PRF_FLAGGED(ch, PRF_FAVOURS);
1615+
16031616
switch (comm) {
16041617
case CMD_JOB_QUIT:
16051618
return attempt_quit_job(ch, johnson);
@@ -1671,7 +1684,7 @@ SPECIAL(johnson)
16711684
mudlog(buf, ch, LOG_SYSLOG, TRUE);
16721685
do_say(johnson, "Well done.", 0, 0);
16731686
}
1674-
reward(ch, johnson);
1687+
reward(ch, johnson, quest_table[GET_QUEST(ch)].max_rep < GET_REP(ch));
16751688
forget(johnson, ch);
16761689

16771690
if (GET_QUEST(ch) == QST_MAGE_INTRO && GET_TRADITION(ch) != TRAD_MUNDANE)
@@ -1680,11 +1693,22 @@ SPECIAL(johnson)
16801693
do_say(johnson, "You haven't completed any of your objectives yet.", 0, 0);
16811694

16821695
return TRUE;
1683-
case CMD_JOB_START: {
1696+
case CMD_JOB_START:
1697+
case CMD_JOB_FAVOUR: {
1698+
favour = (comm == CMD_JOB_FAVOUR);
1699+
1700+
if (favour) {
1701+
if (PRF_FLAGGED(ch, PRF_FAVOURS)) {
1702+
do_say(johnson, "Yeah, I might need to call in a favor...", 0, 0);
1703+
} else {
1704+
do_say(johnson, "I don't need any favors from you, come back when you want some real work.", 0, 0);
1705+
return TRUE;
1706+
}
1707+
}
16841708

16851709
// Reject high-rep characters.
16861710
unsigned int johnson_max_rep = get_johnson_overall_max_rep(johnson);
1687-
if (johnson_max_rep < 10000 && johnson_max_rep < GET_REP(ch)) {
1711+
if (johnson_max_rep < 10000 && johnson_max_rep < GET_REP(ch) && !favour) {
16881712
do_say(johnson, "My jobs aren't high-profile enough for someone with your rep!", 0, 0);
16891713
send_to_char(ch, "[OOC: This Johnson caps out at %d reputation, so you won't get any further work from them.]\r\n", johnson_max_rep);
16901714

@@ -1694,11 +1718,14 @@ SPECIAL(johnson)
16941718
return TRUE;
16951719
}
16961720

1697-
new_q = new_quest(johnson, ch);
1721+
new_q = new_quest(johnson, ch, favour);
16981722
//Clever hack to safely save us a call to new_quest() that compiler will be ok with.
16991723
//If we have a cached quest use that and reset the cache integer back to -2 when
17001724
//it is consumed.
1701-
cached_new_q = new_q;
1725+
if (!favour)
1726+
cached_new_q = new_q;
1727+
else
1728+
cached_new_f = new_q;
17021729

17031730
//Handle out of quests and broken johnsons.
17041731
//Calls to new_quest() return 0 when there's no quest left available and
@@ -1829,11 +1856,14 @@ SPECIAL(johnson)
18291856
//Clever hack to safely save us a call to new_quest() that compiler will be ok with.
18301857
//If we have a cached quest use that and reset the cache integer back to -2 when
18311858
//it is consumed.
1832-
if (cached_new_q != -2) {
1859+
if (cached_new_q != -2 && !doing_favours) {
18331860
new_q = cached_new_q;
18341861
cached_new_q = -2;
1862+
} else if (cached_new_f != -2 && doing_favours) {
1863+
new_q = cached_new_f;
1864+
cached_new_f = -2;
18351865
} else {
1836-
new_q = new_quest(johnson, ch);
1866+
new_q = new_quest(johnson, ch, doing_favours);
18371867
}
18381868

18391869
//Handle out of quests and broken johnsons.
@@ -1899,11 +1929,14 @@ SPECIAL(johnson)
18991929
//Clever hack to safely save us a call to new_quest() that compiler will be ok with.
19001930
//If we have a cached quest use that and reset the cache integer back to -2 when
19011931
//it is consumed.
1902-
if (cached_new_q != -2) {
1932+
if (cached_new_q != -2 && !doing_favours) {
19031933
new_q = cached_new_q;
19041934
cached_new_q = -2;
1935+
} else if (cached_new_f != -2 && doing_favours) {
1936+
new_q = cached_new_f;
1937+
cached_new_f = -2;
19051938
} else {
1906-
new_q = new_quest(johnson, ch);
1939+
new_q = new_quest(johnson, ch, doing_favours);
19071940
}
19081941

19091942
//Handle out of quests and broken johnsons.

src/quest.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ struct quest_entry {
123123
#define CMD_JOB_START 3
124124
#define CMD_JOB_YES 4
125125
#define CMD_JOB_NO 5
126+
#define CMD_JOB_FAVOUR 6
126127

127128
void load_quest_targets(struct char_data *johnson, struct char_data *ch);
128129
void handle_info(struct char_data *johnson, int num, struct char_data *target);

0 commit comments

Comments
 (0)