From b3acd6634d36dd39d56742ae85427f3613116c36 Mon Sep 17 00:00:00 2001 From: Tristan Chin <23557893+maxijonson@users.noreply.github.com> Date: Sat, 14 Dec 2024 02:10:36 -0500 Subject: [PATCH] Fix an exploit where it is possible to duplicate currency rewards when there's an item reward as well --- Quests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Quests.cs b/Quests.cs index d66cf59..4a259cb 100644 --- a/Quests.cs +++ b/Quests.cs @@ -961,6 +961,10 @@ private string GetRewardString(List entry) private bool GiveReward(BasePlayer player, List rewards) { + var countItemRewards = rewards.Count(r => !string.IsNullOrEmpty(r.ShortName)); + var usedItemSlots = player.inventory.containerMain.itemList.Count + player.inventory.containerBelt.itemList.Count; + if (usedItemSlots + countItemRewards > 30) return false; + foreach (var reward in rewards) { if (reward.isCoins && Economics) @@ -981,7 +985,6 @@ private bool GiveReward(BasePlayer player, List rewards) var definition = FindItemDefinition(reward.ShortName); if (definition != null) { - if (player.inventory.AllItems().Count() >= 30) return false; var item = ItemManager.Create(definition, (int)reward.Amount, reward.Skin); if (item != null) {