Skip to content

Commit

Permalink
Merge pull request #30 from Gogo1951/Gogo1951-patch-7
Browse files Browse the repository at this point in the history
Update Open-Sesame.lua
  • Loading branch information
Gogo1951 authored Jan 29, 2025
2 parents 3a7e5bc + 0c6d88c commit 8454d2b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Open-Sesame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ local function GetAvailableBagSlots()
return freeSlots
end

-- Utility Function: Check if the player is casting a spell
local function IsPlayerCasting()
return UnitCastingInfo("player") ~= nil
end

-- Play a race and gender-specific sound for a full inventory
local function PlayInventoryFullSound()
local _, raceFile = UnitRace("player")
Expand All @@ -90,7 +95,7 @@ end

-- Process openable items in the bags
local function ProcessBagItems()
if OpenSesame.isItemProcessing or UnitAffectingCombat("player") then
if OpenSesame.isItemProcessing or UnitAffectingCombat("player") or IsPlayerCasting() then
return
end

Expand Down Expand Up @@ -142,7 +147,7 @@ eventFrame:SetScript(
"OnEvent",
function(self, event, ...)
if event == "BAG_UPDATE" or event == "LOOT_OPENED" then
if not UnitAffectingCombat("player") then
if not UnitAffectingCombat("player") and not IsPlayerCasting() then
ProcessBagItems()
end
elseif event == "PLAYER_REGEN_ENABLED" then
Expand Down Expand Up @@ -171,7 +176,7 @@ eventFrame:SetScript(
"OnUpdate",
function(self, elapsed)
local currentWindowState = IsAnyWindowOpen()
if OpenSesame.lastWindowState and not currentWindowState then
if OpenSesame.lastWindowState and not currentWindowState and not IsPlayerCasting() then
ProcessBagItems()
end
OpenSesame.lastWindowState = currentWindowState
Expand Down

0 comments on commit 8454d2b

Please sign in to comment.