From ff118b5dc0f4b0d9bdcf39bcd4285ceb6080fb6a Mon Sep 17 00:00:00 2001 From: Cristian Barzotti <48096588+cbarzotti@users.noreply.github.com> Date: Fri, 27 Jan 2023 23:16:16 +0100 Subject: [PATCH] Added DBM Pull timer, moved around buttons (#28) * Added DBM Pull timer, moved around buttons Added DBM Pull timer button (will do nothing without DBM, calls the command through the chat) and moved around buttons so you have Ready Check and DBM Pull as the last 2 buttons (easier to use imo) * Update RaidUtility.lua Added a check for DBM-Core, has to be loaded for the buttons to show. Split the timers in 2, one for a 10s pull timer and one for a 5s pull timer. Right now it calls the command through the chat box, if I find the correct API from DBM I will make it call that --- ElvUI/Modules/Misc/RaidUtility.lua | 68 +++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/ElvUI/Modules/Misc/RaidUtility.lua b/ElvUI/Modules/Misc/RaidUtility.lua index 84ebd6b..b72fcd8 100644 --- a/ElvUI/Modules/Misc/RaidUtility.lua +++ b/ElvUI/Modules/Misc/RaidUtility.lua @@ -16,7 +16,11 @@ local InCombatLockdown = InCombatLockdown local DoReadyCheck = DoReadyCheck local ToggleFriendsFrame = ToggleFriendsFrame -local PANEL_HEIGHT = 100 +if IsAddOnLoaded("DBM-Core") then + PANEL_HEIGHT = 120 +else + PANEL_HEIGHT = 100 +end local function CheckRaidStatus() local inInstance, instanceType = IsInInstance() @@ -167,30 +171,13 @@ function RU:Initialize() MainAssistButton:SetAttribute("unit", "target") MainAssistButton:SetAttribute("action", "toggle") - self:CreateUtilButton("ReadyCheckButton", RaidUtilityPanel, nil, RaidUtilityPanel:GetWidth() * 0.8, 18, "TOPLEFT", MainTankButton, "BOTTOMLEFT", 0, -5, READY_CHECK, nil) - ReadyCheckButton:SetScript("OnMouseUp", function() - if CheckRaidStatus() then - DoReadyCheck() - end - end) - ReadyCheckButton:SetScript("OnEvent", function(btn) - if not (IsRaidLeader("player") or IsRaidOfficer("player")) then - btn:Disable() - else - btn:Enable() - end - end) - ReadyCheckButton:RegisterEvent("RAID_ROSTER_UPDATE") - ReadyCheckButton:RegisterEvent("PARTY_MEMBERS_CHANGED") - ReadyCheckButton:RegisterEvent("PLAYER_ENTERING_WORLD") - - self:CreateUtilButton("RaidControlButton", RaidUtilityPanel, nil, MainTankButton:GetWidth(), 18, "TOPLEFT", ReadyCheckButton, "BOTTOMLEFT", 0, -5, L["Raid Menu"], nil) + self:CreateUtilButton("RaidControlButton", RaidUtilityPanel, nil, MainTankButton:GetWidth(), 18, "TOPLEFT", MainTankButton, "BOTTOMLEFT", 0, -5, L["Raid Menu"], nil) RaidControlButton:SetScript("OnMouseUp", function() if InCombatLockdown() then E:Print(ERR_NOT_IN_COMBAT) return end ToggleFriendsFrame(5) end) - self:CreateUtilButton("ConvertRaidButton", RaidUtilityPanel, nil, MainAssistButton:GetWidth(), 18, "TOPRIGHT", ReadyCheckButton, "BOTTOMRIGHT", 0, -5, CONVERT_TO_RAID, nil) + self:CreateUtilButton("ConvertRaidButton", RaidUtilityPanel, nil, MainAssistButton:GetWidth(), 18, "TOPRIGHT", MainAssistButton, "BOTTOMRIGHT", 0, -5, CONVERT_TO_RAID, nil) ConvertRaidButton:SetScript("OnMouseUp", function() if CheckRaidStatus() then ConvertToRaid() @@ -212,6 +199,47 @@ function RU:Initialize() ConvertRaidButton:RegisterEvent("PARTY_MEMBERS_CHANGED") ConvertRaidButton:RegisterEvent("PLAYER_ENTERING_WORLD") + + self:CreateUtilButton("ReadyCheckButton", RaidUtilityPanel, nil, RaidUtilityPanel:GetWidth() * 0.8, 18, "TOPLEFT", RaidControlButton, "BOTTOMLEFT", 0, -5, READY_CHECK, nil) + ReadyCheckButton:SetScript("OnMouseUp", function() + if CheckRaidStatus() then + DoReadyCheck() + end + end) + ReadyCheckButton:SetScript("OnEvent", function(btn) + if not (IsRaidLeader("player") or IsRaidOfficer("player")) then + btn:Disable() + else + btn:Enable() + end + end) + ReadyCheckButton:RegisterEvent("RAID_ROSTER_UPDATE") + ReadyCheckButton:RegisterEvent("PARTY_MEMBERS_CHANGED") + ReadyCheckButton:RegisterEvent("PLAYER_ENTERING_WORLD") + + if IsAddOnLoaded("DBM-Core") then + self:CreateUtilButton("DBMPullButton10", RaidUtilityPanel, nil, MainTankButton:GetWidth(), 18, "TOPLEFT", ReadyCheckButton, "BOTTOMLEFT", 0, -5, L["Pull 10"], nil) + DBMPullButton10:SetScript("OnMouseUp", function() + if InCombatLockdown() then E:Print(ERR_NOT_IN_COMBAT) return end + -- Hacked way to make the dbm call, will update if I find the apis for it + local editbox=ChatEdit_ChooseBoxForSend(DEFAULT_CHAT_FRAME) + ChatEdit_ActivateChat(editbox) + editbox:SetText("/dbm pull 10") + ChatEdit_OnEnterPressed(editbox) + end) + + self:CreateUtilButton("DBMPullButton5", RaidUtilityPanel, nil, MainTankButton:GetWidth(), 18, "TOPRIGHT", ReadyCheckButton, "BOTTOMRIGHT", 0, -5, L["Pull 5"], nil) + DBMPullButton5:SetScript("OnMouseUp", function() + if InCombatLockdown() then E:Print(ERR_NOT_IN_COMBAT) return end + -- Hacked way to make the dbm call, will update if I find the apis for it + local editbox=ChatEdit_ChooseBoxForSend(DEFAULT_CHAT_FRAME) + ChatEdit_ActivateChat(editbox) + editbox:SetText("/dbm pull 5") + ChatEdit_OnEnterPressed(editbox) + end) + end + + --Automatically show/hide the frame if we have RaidLeader or RaidOfficer self:RegisterEvent("RAID_ROSTER_UPDATE", "ToggleRaidUtil") self:RegisterEvent("PLAYER_ENTERING_WORLD", "ToggleRaidUtil")