Skip to content

Commit

Permalink
Pending reserve actions will time out after 30 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Aug 6, 2024
1 parent 3ad71a5 commit 8df56f1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ LootReserve.Client =

ReservableIDs = { },
PendingItems = { },
PendingTimers = { },
PendingOpt = nil,
PendingOpen = false,
SkipOpen = false,
Expand Down Expand Up @@ -417,6 +418,11 @@ function LootReserve.Client:ResetSession(refresh)
self.Multireserve = 1;
self.PendingItems = { };
self.PendingOpts = nil;

for _, timer in pairs(self.PendingTimers) do
timer:Cancel();
end
wipe(self.PendingTimers);

if not refresh then
self:StopCategoryFlashing();
Expand Down Expand Up @@ -454,6 +460,16 @@ function LootReserve.Client:IsItemPending(itemID)
end
function LootReserve.Client:SetItemPending(itemID, pending)
self.PendingItems[itemID] = pending or nil;
if self.PendingTimers[itemID] then
self.PendingTimers[itemID]:Cancel();
self.PendingTimers[itemID] = nil;
end
if pending then
self.PendingTimers[itemID] = C_Timer.NewTimer(30, function()
LootReserve.Client:SetItemPending(itemID, false);
LootReserve.Client:UpdateReserveStatus();
end);
end
end

function LootReserve.Client:Reserve(itemID)
Expand Down

0 comments on commit 8df56f1

Please sign in to comment.