Shadow-and-Light / shadow-and-light

19 stars 10 forks source link

[Feature Request] Ability to hide chat panels in pet battle #24

Closed leemitchell25 closed 3 months ago

leemitchell25 commented 3 years ago

Hi there,

Recently changed my ElvUI and the chat panel placement now interferes with the Pet Battle UI. Noticed that Shadow & Light can hide the panels in combat so I figured out a way to have it also hide them in pet battles. I think it would be great if this was implemented in future versions of Shadow & Light for other users.

The modifications I made are as follows.


In defaults\profile.lua add the following code under line 294:

["petbattlehide"] = "NONE",

In modules\chat\chat.lua in function C:Initialize add the following after the --Combat Hide code:

--PetBattle Hide
self:RegisterEvent('PET_BATTLE_OPENING_START', 'PetBattle')
self:RegisterEvent('PET_BATTLE_CLOSE', 'PetBattle')

In modules\chat\chat.lua add the following function after the C:Combat(event) function:

function C:PetBattle(event)
    if event == 'PET_BATTLE_OPENING_START' then
        if E.db.sle.chat.petbattlehide == 'BOTH' or E.db.sle.chat.petbattlehide == 'RIGHT' then
            RightChatPanel:Hide()
            RightChatToggleButton:Hide()
        end
        if E.db.sle.chat.petbattlehide == 'BOTH' or E.db.sle.chat.petbattlehide == 'LEFT' then
            LeftChatPanel:Hide()
            LeftChatToggleButton:Hide()
        end
    elseif event == 'PET_BATTLE_CLOSE' then
        if not RightChatPanel:IsShown() then
            RightChatPanel:Show()
            RightChatToggleButton:Show()
        end
        if not LeftChatPanel:IsShown() then
            LeftChatPanel:Show()
            LeftChatToggleButton:Show()
        end
    end
end

In option\chat\chat_c.lua in function configTable() add the following code after the combathide options:

petbattlehide = {
    order = 10, type = "select",
    name = L["Hide In Pet Battle"],
    get = function(info) return E.db.sle.chat.petbattlehide end,
    set = function(info, value) E.db.sle.chat.petbattlehide = value end,
    values = {
        ["NONE"] = NONE,
        ["BOTH"] = L["Both"],
        ["LEFT"] = L["Left"],
        ["RIGHT"] = L["Right"],
    }
},

And finally, in option\chat\chat_c.lua in function configTable() change the order for the setupDelay options from 10 to 11.


Thank you for all your hard work on Shadow & Light. It's an awesome addition to ElvUI. :)

brett1337 commented 3 months ago

Also the RMBA interface next to the minimap stays open in a pet battle when it shouldn't

Repooc commented 3 months ago

Also the RMBA interface next to the minimap stays open in a pet battle when it shouldn't

The what? I don't pet battle other than to test something specific to it.

brett1337 commented 3 months ago

Ah, sorry I guess it's not always the same letters. There are 4 letter buttons that I'm not sure what all of them do, but they persist during pet battles, when all UI elements are supposed to hide. Here it is CASR, and the number is the addons list button.

image

Repooc commented 3 months ago

ahh ui buttons

Repooc commented 3 months ago

Ah, sorry I guess it's not always the same letters. There are 4 letter buttons that I'm not sure what all of them do, but they persist during pet battles, when all UI elements are supposed to hide. Here it is CASR, and the number is the addons list button.

image

u can use the visibility section to hide them during petbattle, put [petbattle] hide; show

brett1337 commented 3 months ago

cool, done. by the way i never knew what the ui buttons did until i just went into the menu right now, i think it would be cool to put tooltips on each UI button (im going to use the addons one all the time now) but its just a passing thought, thanks for the help!