Skip to content

Commit

Permalink
Economy tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Feb 9, 2024
1 parent b578119 commit 44f462f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/spec_procs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7660,6 +7660,7 @@ SPECIAL(pocsec_unlocker) {
return FALSE;
}

long total_amount_removed_from_economy_by_slots = 0;
void payout_slots(struct obj_data *slots) {
if (!slots->in_room) {
mudlog("SYSERR: Entered payout_slots() with a slot machine that has no room!", NULL, LOG_SYSLOG, TRUE);
Expand Down Expand Up @@ -7718,6 +7719,9 @@ void payout_slots(struct obj_data *slots) {
GET_SLOTMACHINE_LAST_SPENT(slots),
GET_OBJ_NAME(slots),
payout_multiplier);

GET_SLOTMACHINE_MONEY_EXTRACTED(slots) -= amount_to_pay;
total_amount_removed_from_economy_by_slots -= amount_to_pay;
return;
}
}
Expand Down Expand Up @@ -7810,10 +7814,19 @@ SPECIAL(slot_machine) {

GET_SLOTMACHINE_PLAY_TICKS(slots) = 3;
GET_SLOTMACHINE_LAST_SPENT(slots) = spend_amount;
GET_SLOTMACHINE_MONEY_EXTRACTED(slots) += spend_amount;
total_amount_removed_from_economy_by_slots += spend_amount;
GET_SLOTMACHINE_PLAYER_ID(slots) = GET_IDNUM_EVEN_IF_PROJECTING(ch);
return TRUE;
}

if (CMD_IS("value") && IS_SENATOR(ch)) {
send_to_char(ch, "This slot machine has removed %d nuyen from the economy. Globally, slots have removed %ld nuyen.\r\n",
GET_SLOTMACHINE_MONEY_EXTRACTED(slots),
total_amount_removed_from_economy_by_slots);
return TRUE;
}

return FALSE;
}
#undef MINIMUM_SLOT_SPEND_AMOUNT
Expand Down
1 change: 1 addition & 0 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,7 @@ bool is_weapon_focus_usable_by(struct obj_data *focus, struct char_data *ch);
#define GET_SLOTMACHINE_LAST_SPENT(obj) (GET_OBJ_VAL((obj), 0))
#define GET_SLOTMACHINE_PLAYER_ID(obj) (GET_OBJ_VAL((obj), 1))
#define GET_SLOTMACHINE_PLAY_TICKS(obj) (GET_OBJ_VAL((obj), 2))
#define GET_SLOTMACHINE_MONEY_EXTRACTED(obj) (GET_OBJ_VAL((obj), 9))

// ITEM_MAGIC_TOOL convenience defines
#define GET_MAGIC_TOOL_TYPE(tool) (GET_OBJ_VAL((tool), 0))
Expand Down

0 comments on commit 44f462f

Please sign in to comment.