Skip to content

Commit

Permalink
Standard builders can add quest item rewards, but they show up on audit
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Jun 30, 2024
1 parent 607fca8 commit 15c8745
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
23 changes: 7 additions & 16 deletions src/act.wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8621,7 +8621,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
// Flag invalid Johnsons
if (quest->johnson <= 0 || johnson_rnum <= 0) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yinvalid Johnson %ld^n.\r\n", quest->johnson);

issues++;
}

Expand All @@ -8633,7 +8632,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
// invalid object
if (real_object(quest->obj[obj_idx].vnum) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - obj objective #%d: ^yinvalid object %ld^n.\r\n", obj_idx, quest->obj[obj_idx].vnum);

issues++;
}

Expand All @@ -8646,7 +8644,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
|| quest->obj[obj_idx].l_data >= quest->num_mobs
|| real_mobile(quest->mob[quest->obj[obj_idx].l_data].vnum) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - obj objective #%d: ^yinvalid load mobile M%ld^n.\r\n", obj_idx, quest->obj[obj_idx].l_data);

issues++;
}
break;
Expand All @@ -8659,30 +8656,26 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
&& real_mobile(quest->obj[obj_idx].o_data) <= -1)
{
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - obj objective #%d: ^yinvalid dest mobile M%ld^n.\r\n", obj_idx, quest->obj[obj_idx].o_data);

issues++;
}
break;
case QOO_LOCATION:
if (real_room(quest->obj[obj_idx].o_data) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - obj objective #%d: ^yinvalid room %ld^n.\r\n", obj_idx, quest->obj[obj_idx].o_data);

issues++;
}
break;
case QOO_RETURN_PAY:
case QOO_UPLOAD:
if (real_host(quest->obj[obj_idx].o_data) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - obj objective #%d: ^yinvalid host %ld^n.\r\n", obj_idx, quest->obj[obj_idx].o_data);

issues++;
}

{
struct obj_data *loaded = read_object(quest->obj[obj_idx].vnum, VIRTUAL);
if (GET_OBJ_TYPE(loaded) != ITEM_DECK_ACCESSORY) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - obj objective #%d: obj %ld is not a deck accessory ^y(it can't be uploaded)^n.\r\n", obj_idx, quest->obj[obj_idx].vnum);

issues++;
}
extract_obj(loaded);
Expand All @@ -8699,7 +8692,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
// Check for invalid mob.
if (real_mobile(quest->mob[mob_idx].vnum) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - mob objective #%d: ^yinvalid mobile %ld^n.\r\n", mob_idx, quest->mob[mob_idx].vnum);

issues++;
}

Expand All @@ -8708,7 +8700,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
case QML_LOCATION:
if (real_room(quest->mob[mob_idx].l_data) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - mob objective #%d: ^yinvalid load room %ld^n.\r\n", mob_idx, quest->mob[mob_idx].l_data);

issues++;
}
break;
Expand All @@ -8718,14 +8709,12 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
case QMO_LOCATION:
if (real_room(quest->mob[mob_idx].o_data) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - mob objective #%d: ^yinvalid destination room %ld^n.\r\n", mob_idx, quest->mob[mob_idx].o_data);

issues++;
}
break;
case QMO_KILL_ESCORTEE:
if (real_room(quest->mob[mob_idx].o_data) <= -1) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - mob objective #%d: ^yinvalid escortee %ld^n.\r\n", mob_idx, quest->mob[mob_idx].o_data);

issues++;
}
break;
Expand All @@ -8736,15 +8725,20 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
payout_karma *= KARMA_GAIN_MULTIPLIER;
if (payout_karma > 600) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - karma payout after multiplier is at least ^c%.2f^n.\r\n", ((float) payout_karma) / 100);

issues++;
}

// Flag high payouts - nuyen.
payout_nuyen *= NUYEN_GAIN_MULTIPLIER;
if (payout_nuyen > 10000) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - nuyen payout after multiplier is at least ^c%d^n.\r\n", payout_nuyen);

issues++;
}

// Flag item rewards.
if (quest->reward > 0){
rnum_t quest_reward_rnum = real_object(quest->reward);
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yitem reward^n ^c%ld^n (%s^n).\r\n", quest->reward, quest_reward_rnum >= 0 ? GET_OBJ_NAME(&obj_proto[quest_reward_rnum]) : "<invalid>");
issues++;
}

Expand All @@ -8756,7 +8750,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
} else {
if (!ispunct(get_final_character_from_string(quest->intro))) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yintro string does not end in punctuation^n.\r\n");

issues++;
}
}
Expand All @@ -8768,7 +8761,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
} else {
if (!ispunct(get_final_character_from_string(quest->decline))) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^ydecline string does not end in punctuation^n.\r\n");

issues++;
}
}
Expand All @@ -8780,7 +8772,6 @@ int audit_zone_quests_(struct char_data *ch, int zone_num, bool verbose) {
} else {
if (!ispunct(get_final_character_from_string(quest->finish))) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yfinish string does not end in punctuation^n.\r\n");

issues++;
}
}
Expand Down
33 changes: 21 additions & 12 deletions src/quest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ACMD_DECLARE(do_new_echo);

#define DELETE_ENTRY_FROM_VECTOR_PTR(iterator, vector_ptr) {delete [] *(iterator); *(iterator) = NULL; (vector_ptr)->erase((iterator));}

#define LEVEL_REQUIRED_TO_ADD_ITEM_REWARDS LVL_VICEPRES
#define LEVEL_REQUIRED_TO_ADD_ITEM_REWARDS LVL_BUILDER

const char *obj_loads[] =
{
Expand Down Expand Up @@ -1105,9 +1105,15 @@ void reward(struct char_data *ch, struct char_data *johnson)
obj = read_object(rnum, REAL);
obj_to_char(obj, ch);
soulbind_obj_to_char(obj, ch, FALSE);
act("You give $p to $N.", FALSE, johnson, obj, ch, TO_CHAR);
act("$n gives you $p.", FALSE, johnson, obj, ch, TO_VICT);
act("$n gives $p to $N.", TRUE, johnson, obj, ch, TO_NOTVICT);
if (MOB_FLAGGED(johnson, MOB_INANIMATE)) {
act("You dispense $p for $N.", FALSE, johnson, obj, ch, TO_CHAR);
act("$n dispenses $p, and you pick it up.", FALSE, johnson, obj, ch, TO_VICT);
act("$n dispenses $p for $N.", TRUE, johnson, obj, ch, TO_NOTVICT);
} else {
act("You give $p to $N.", FALSE, johnson, obj, ch, TO_CHAR);
act("$n gives you $p.", FALSE, johnson, obj, ch, TO_VICT);
act("$n gives $p to $N.", TRUE, johnson, obj, ch, TO_NOTVICT);
}
}
} else {
#ifdef IS_BUILDPORT
Expand Down Expand Up @@ -1998,13 +2004,16 @@ void list_detailed_quest(struct char_data *ch, long rnum)
"Maximum reputation: [^c%d^n]\r\n", quest_table[rnum].time,
quest_table[rnum].min_rep, quest_table[rnum].max_rep);

snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "Bonus nuyen: [^c%d^n (%d)], Bonus Karma: [^c%0.2f^n (%0.2f)], "
"Reward: [^c%d^n]\r\n",
(int) (quest_table[rnum].nuyen * NUYEN_GAIN_MULTIPLIER),
quest_table[rnum].nuyen,
((float)quest_table[rnum].karma / 100) * KARMA_GAIN_MULTIPLIER,
((float)quest_table[rnum].karma / 100),
quest_table[rnum].reward);

rnum_t quest_reward_rnum = real_object(quest_table[rnum].reward);
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "Bonus nuyen: [^c%d^n (%d)], Bonus Karma: [^c%0.2f^n (%0.2f)], "
"Reward: [^c%ld (%s)^n]\r\n",
(int) (quest_table[rnum].nuyen * NUYEN_GAIN_MULTIPLIER),
quest_table[rnum].nuyen,
((float)quest_table[rnum].karma / 100) * KARMA_GAIN_MULTIPLIER,
((float)quest_table[rnum].karma / 100),
quest_table[rnum].reward,
quest_reward_rnum >= 0 ? GET_OBJ_NAME(&obj_proto[quest_reward_rnum]) : "<invalid>");

for (i = 0; i < quest_table[rnum].num_mobs; i++) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "^mM^n%2d) ^c%d^n (%d) nuyen/^c%0.2f^n (%0.2f) karma: vnum %ld; %s (%ld); %s (%ld)\r\n",
Expand Down Expand Up @@ -2291,7 +2300,7 @@ int write_quests_to_disk(int zone) {
if ((i = real_quest(counter)) > -1) {
wrote_something = TRUE;
fprintf(fp, "#%ld\n", quest_table[i].vnum);
fprintf(fp, "%ld %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %ld %ld %ld\n", quest_table[i].johnson,
fprintf(fp, "%ld %d %d %d %d %d %ld %d %d %d %d %d %d %d %d %d %ld %ld %ld\n", quest_table[i].johnson,
quest_table[i].time, quest_table[i].min_rep,
quest_table[i].max_rep, quest_table[i].nuyen,
quest_table[i].karma, quest_table[i].reward,
Expand Down
3 changes: 2 additions & 1 deletion src/quest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ struct quest_data
unsigned int min_rep, max_rep;
vnum_t prerequisite_quest;
vnum_t disqualifying_quest;
int nuyen, karma, reward;
int nuyen, karma;
vnum_t reward;
struct quest_om_data *obj;
struct quest_om_data *mob;
char *intro;
Expand Down

0 comments on commit 15c8745

Please sign in to comment.