From 4c104443bc16f4caf2e43bfb4458d80e5674b578 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 1 Apr 2024 23:31:55 -0700 Subject: [PATCH] fix non-unique team rewards --- src/SendCommands.cc | 7 ++++++- system/config.example.json | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SendCommands.cc b/src/SendCommands.cc index 0afca9f2..2176139b 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -4012,11 +4012,16 @@ void send_team_reward_list(shared_ptr c, bool show_purchased) { } auto s = c->require_server_state(); + // Hide item rewards if the player's bank is full bool show_item_rewards = show_purchased || (c->current_bank().num_items < 200); vector entries; for (const auto& reward : s->team_index->reward_definitions()) { - if (team->has_reward(reward.key) != show_purchased) { + // In the buy menu, hide rewards that can't be bought again (that is, unique + // rewards that the team already has). In the bought menu, hide rewards that + // the team does not have. + bool has_reward = team->has_reward(reward.key); + if (show_purchased ? (!has_reward) : (has_reward && reward.is_unique)) { continue; } if (!show_item_rewards && !reward.reward_item.empty()) { diff --git a/system/config.example.json b/system/config.example.json index c2fe0c73..c082c00a 100644 --- a/system/config.example.json +++ b/system/config.example.json @@ -905,7 +905,6 @@ "Description": "Create a Union Guard\nshield", "IsUnique": false, "Points": 100, - // TODO: There are 4 of these in names-v4.json; which should we use? "RewardItem": "010295", }, { "Key": "Ticket500",