Jaliborc / Combuctor

Single window displays for you items
42 stars 18 forks source link

Bag will not autoclose in combat engagement. I am unable to close the addon in combat with the X button either. #163

Open Coffeechan opened 3 years ago

Coffeechan commented 3 years ago

Running Software (issues missing this information will be deleted):

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Error Logs Type /console scriptErrors 1 in the chat and reload the game. If an error window appears, write here the message with ID: 1 (labelled 1/X). This is generally NOT the message that the window shows by default.

Additional context Add any other context about the problem here.

SwimmingTiger commented 3 years ago

I know the problem is because HideUIPanel() is protected and cannot be called during combat.

Patch 8.2.0/API changes

  • ShowUIPanel() and HideUIPanel() are now protected, they can no longer be called by addons while in combat.

I couldn't find a normal solution because I can't find how HideUIPanel() is triggered. But I found a workaround with it. Add this code to any Lua file and the problem will disappear:

hooksecurefunc("HideUIPanel", function(ui)
    if InCombatLockdown() and type(ui) == 'table' and ui.bagToggle then
        ui:Hide()
    end
end)

It will use the ui:Hide() method to close the bag in battle, which is not affected by the combat lockdown.

Coffeechan commented 3 years ago

Thanks

On Tue, Jul 6, 2021, 2:05 PM 老虎会游泳 @.***> wrote:

I know the problem is because HideUIPanel() is protected and cannot be called during combat.

Patch 8.2.0/API changes https://wowpedia.fandom.com/wiki/Patch_8.2.0/API_changes

  • ShowUIPanel() and HideUIPanel() are now protected, they can no longer be called by addons while in combat.

I couldn't find a normal solution because I can't find how HideUIPanel() is triggered, but I found a workaround. Add this code to any Lua file and the problem will disappear:

hooksecurefunc("HideUIPanel", function(ui) if InCombatLockdown() and type(ui) == 'table' and ui.bagToggle then ui:Hide() end end)

It will use the ui:Hide() method to close the bag in battle, which is not affected by the combat lockdown.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tullamods/Combuctor/issues/163#issuecomment-875011233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUVIPY2KXEJSLK2KIW2N46TTWNHZHANCNFSM47QKKPMQ .

Genetic91 commented 3 years ago

I know the problem is because HideUIPanel() is protected and cannot be called during combat.

Patch 8.2.0/API changes

  • ShowUIPanel() and HideUIPanel() are now protected, they can no longer be called by addons while in combat.

I couldn't find a normal solution because I can't find how HideUIPanel() is triggered. But I found a workaround with it. Add this code to any Lua file and the problem will disappear:

hooksecurefunc("HideUIPanel", function(ui)
    if InCombatLockdown() and type(ui) == 'table' and ui.bagToggle then
        ui:Hide()
    end
end)

It will use the ui:Hide() method to close the bag in battle, which is not affected by the combat lockdown.

Could you explain what "Add this code to any Lua file and the problem will disappear:" means? Just add id to "every" of the 20+ LUA files? Just add it to the end of every LUA file?

Sorry I don't know a thing about grogramming.