From bc3d38199e2738982750ed2dec25e6b2766602a6 Mon Sep 17 00:00:00 2001 From: Anonomit Date: Tue, 6 Aug 2024 17:15:12 -0400 Subject: [PATCH] Improve removing reserves on items that can't be reserved --- Server.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Server.lua b/Server.lua index 8245a4b..0678b4c 100644 --- a/Server.lua +++ b/Server.lua @@ -1567,7 +1567,9 @@ function LootReserve.Server:PrepareSession() if self.ReservableRewardIDs[itemID] then itemID = LootReserve.Data:GetToken(itemID); end - if self.ReservableIDs[itemID] then + if command == "cancel" and self.CurrentSession.Members[sender] and LootReserve:Contains(self.CurrentSession.Members[sender].ReservedItems, itemID) then + self:CancelReserve(sender, itemID, count, true); + elseif self.ReservableIDs[itemID] then if command == "reserve" then LootReserve.ItemCache(itemID):OnCache(function() self:Reserve(sender, itemID, count, true); @@ -2454,6 +2456,10 @@ function LootReserve.Server:CancelReserve(player, itemID, count, chat, forced, w return Failure(LootReserve.Constants.CancelReserveResult.Locked, "#"); end + if not self.ReservableIDs[itemID] and not LootReserve:Contains(member.ReservedItems, itemID) then + return Failure(LootReserve.Constants.CancelReserveResult.ItemNotReservable, member.ReservesLeft); + end + if not LootReserve:Contains(member.ReservedItems, itemID) then return Failure(LootReserve.Constants.CancelReserveResult.NotReserved, member.ReservesLeft); end