Skip to content

Commit

Permalink
Improve removing reserves on items that can't be reserved
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Aug 6, 2024
1 parent 8df56f1 commit bc3d381
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bc3d381

Please sign in to comment.