From 44f462fcc69db2057d8d24f9ecb20387813089e8 Mon Sep 17 00:00:00 2001 From: Lucien Date: Thu, 8 Feb 2024 16:07:26 -0800 Subject: [PATCH] Economy tracking --- src/spec_procs.cpp | 13 +++++++++++++ src/utils.hpp | 1 + 2 files changed, 14 insertions(+) diff --git a/src/spec_procs.cpp b/src/spec_procs.cpp index a88e70094..511fe1019 100644 --- a/src/spec_procs.cpp +++ b/src/spec_procs.cpp @@ -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); @@ -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; } } @@ -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 diff --git a/src/utils.hpp b/src/utils.hpp index a8752d3d6..a59c6c120 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -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))