From b2d3f68cab6a464bfdfa84cad5ffcd16b89e8478 Mon Sep 17 00:00:00 2001 From: Road-block Date: Mon, 2 Dec 2024 07:48:07 +0200 Subject: [PATCH] add support for ML callout clicks for BetterBags send a mode update to raid on group and loot method updates, when ML --- BastionLoot.toc | 2 +- BastionLoot_Cata.toc | 2 +- BastionLoot_Vanilla.toc | 4 ++-- Modules/PlusRoll/loot.lua | 23 +++++++++++++++++++++++ Modules/loot.lua | 23 +++++++++++++++++++++++ core.lua | 35 +++++++++++++++++++++++++---------- 6 files changed, 75 insertions(+), 14 deletions(-) diff --git a/BastionLoot.toc b/BastionLoot.toc index 87d3ebd..706101e 100644 --- a/BastionLoot.toc +++ b/BastionLoot.toc @@ -2,7 +2,7 @@ ## Author: Roadblock ## Title: BastionLoot ## Notes: In-game EPGP loot helper, supports standby, main/alt shared pool, minEP, offpecGP. Pluggable price list. Alternative +wincount mode. -## Version: 4.3.2 +## Version: 4.3.3 ## X-Alpha: ## X-Website: https://github.com/Road-block/BastionLoot/releases/latest ## OptionalDeps: Ace3, MizusRaidTracker diff --git a/BastionLoot_Cata.toc b/BastionLoot_Cata.toc index 87d3ebd..706101e 100644 --- a/BastionLoot_Cata.toc +++ b/BastionLoot_Cata.toc @@ -2,7 +2,7 @@ ## Author: Roadblock ## Title: BastionLoot ## Notes: In-game EPGP loot helper, supports standby, main/alt shared pool, minEP, offpecGP. Pluggable price list. Alternative +wincount mode. -## Version: 4.3.2 +## Version: 4.3.3 ## X-Alpha: ## X-Website: https://github.com/Road-block/BastionLoot/releases/latest ## OptionalDeps: Ace3, MizusRaidTracker diff --git a/BastionLoot_Vanilla.toc b/BastionLoot_Vanilla.toc index 152745d..11d1465 100644 --- a/BastionLoot_Vanilla.toc +++ b/BastionLoot_Vanilla.toc @@ -1,8 +1,8 @@ -## Interface: 11504 +## Interface: 11505 ## Author: Roadblock ## Title: BastionLoot ## Notes: In-game EPGP loot helper, supports standby, main/alt shared pool, minEP, offpecGP. Pluggable price list. Alternative +wincount mode. -## Version: 2.9.1 +## Version: 2.9.2 ## X-Alpha: ## X-Website: https://github.com/Road-block/BastionLoot/releases/latest ## OptionalDeps: Ace3, MizusRaidTracker diff --git a/Modules/PlusRoll/loot.lua b/Modules/PlusRoll/loot.lua index 7fef566..7cb85dc 100644 --- a/Modules/PlusRoll/loot.lua +++ b/Modules/PlusRoll/loot.lua @@ -442,6 +442,17 @@ function bepgp_plusroll_loot:bidCall(frame, button, context) -- context is one o if bagID and slotID then itemLink = GetContainerItemLink(bagID, slotID) end + else -- BetterBags? + if frame.GetParent then + local bag = frame:GetParent() + if bag.GetID then + bagID = bag:GetID() + end + slotID = frame.GetID and frame:GetID() or nil + if slotID and (bagID >= BACKPACK_CONTAINER and bagID <= NUM_BAG_SLOTS) then + itemLink = GetContainerItemLink(bagID, slotID) + end + end end end if not itemLink then return end @@ -462,6 +473,7 @@ local bag_addons = { ["tdBag2"] = false, ["Tukui"] = false, ["Baganator"] = false, + ["BetterBags"] = false, } function bepgp_plusroll_loot:hookBagAddons() local hook_install = false @@ -507,6 +519,14 @@ function bepgp_plusroll_loot:baganatorHook() end end +function bepgp_plusroll_loot:betterbagsHook() + if not self:IsHooked("ContainerFrameItemButton_OnModifiedClick") then + self:SecureHook("ContainerFrameItemButton_OnModifiedClick", function(frame, button) + bepgp_plusroll_loot:bidCall(frame, button, "container") + end) + end +end + function bepgp_plusroll_loot:clickHandlerBags(id) if tonumber(id) then -- default bags for b = BACKPACK_CONTAINER,NUM_BAG_FRAMES do @@ -582,6 +602,9 @@ function bepgp_plusroll_loot:clickHandlerBags(id) elseif addon == "Baganator" then self:baganatorHook() bag_addons[addon] = true + elseif addon == "BetterBags" then + self:betterbagsHook() + bag_addons[addon] = true end end end diff --git a/Modules/loot.lua b/Modules/loot.lua index 7f236ee..8717ca6 100644 --- a/Modules/loot.lua +++ b/Modules/loot.lua @@ -606,6 +606,17 @@ function bepgp_loot:bidCall(frame, button, context) -- context is one of "master if bagID and slotID then itemLink = GetContainerItemLink(bagID, slotID) end + else -- BetterBags? + if frame.GetParent then + local bag = frame:GetParent() + if bag.GetID then + bagID = bag:GetID() + end + slotID = frame.GetID and frame:GetID() or nil + if slotID and (bagID >= BACKPACK_CONTAINER and bagID <= NUM_BAG_SLOTS) then + itemLink = GetContainerItemLink(bagID, slotID) + end + end end end if not itemLink then return end @@ -637,6 +648,7 @@ local bag_addons = { ["tdBag2"] = false, ["Tukui"] = false, ["Baganator"] = false, + ["BetterBags"] = false, } function bepgp_loot:hookBagAddons() local hook_install = false @@ -682,6 +694,14 @@ function bepgp_loot:baganatorHook() end end +function bepgp_loot:betterbagsHook() + if not self:IsHooked("ContainerFrameItemButton_OnModifiedClick") then + self:SecureHook("ContainerFrameItemButton_OnModifiedClick", function(frame, button) + bepgp_loot:bidCall(frame, button, "container") + end) + end +end + -- /run BastionLoot:GetModule("BastionEPGP_loot"):clickHandlerBags() function bepgp_loot:clickHandlerBags(id) if tonumber(id) then -- default bags @@ -758,6 +778,9 @@ function bepgp_loot:clickHandlerBags(id) elseif addon == "Baganator" then self:baganatorHook() bag_addons[addon] = true + elseif addon == "BetterBags" then + self:betterbagsHook() + bag_addons[addon] = true end end end diff --git a/core.lua b/core.lua index f4eac9d..2da22f8 100644 --- a/core.lua +++ b/core.lua @@ -3425,10 +3425,11 @@ function bepgp:deferredInit(guildname) -- main self:testMain() -- group status change - self:RegisterEvent("GROUP_ROSTER_UPDATE","testLootPrompt") - self:RegisterEvent("GROUP_JOINED","testLootPrompt") - self:RegisterEvent("GROUP_LEFT","testLootPrompt") - self:RegisterEvent("PLAYER_ENTERING_WORLD","testLootPrompt") + self:RegisterEvent("GROUP_ROSTER_UPDATE","groupStatusRouter") + self:RegisterEvent("GROUP_JOINED","groupStatusRouter") + self:RegisterEvent("GROUP_LEFT","groupStatusRouter") + self:RegisterEvent("PLAYER_ENTERING_WORLD","groupStatusRouter") + self:RegisterEvent("PARTY_LOOT_METHOD_CHANGED","groupStatusRouter") -- set price system bepgp:SetPriceSystem() -- register whisper responder @@ -3581,15 +3582,21 @@ function bepgp:AddTipInfo(tooltip,...) end if tipOptionGroup.mlinfo then if roll_admin and is_admin and mode_epgp then - if owner and (owner._bepgpclicks or owner.BGR) then - tooltip:AddDoubleLine(C:Yellow(L["Alt Click"]), C:Orange(L["Call for: MS/OS"])) + if owner then + local ownerName = owner.GetName and owner:GetName() or "" + if owner._bepgpclicks or owner.BGR or strfind(ownerName,"BetterBagsItemButton") then + tooltip:AddDoubleLine(C:Yellow(L["Alt Click"]), C:Orange(L["Call for: MS/OS"])) + end end end end end if tipOptionGroup.mlinfo and (roll_admin and mode_plusroll) then - if owner and (owner._bepgprollclicks or owner.BGR) then - tooltip:AddDoubleLine(C:Yellow(L["Alt Click"]), C:Orange(L["Call for Rolls"])) + if owner then + local ownerName = owner.GetName and owner:GetName() or "" + if owner._bepgprollclicks or owner.BGR or strfind(ownerName,"BetterBagsItemButton") then + tooltip:AddDoubleLine(C:Yellow(L["Alt Click"]), C:Orange(L["Call for Rolls"])) + end end end if tipOptionGroup.favinfo and (owner and (owner.encounterID and owner.itemID)) then -- encounter journal @@ -5385,15 +5392,23 @@ function bepgp:testMain() end end -function bepgp:testLootPrompt(event) +function bepgp:groupStatusRouter(event) raidStatus = (self:GroupStatus() == "RAID") and true or false if (raidStatus == false) and (lastRaidStatus == nil or lastRaidStatus == true) then local hasLoothistory = #(self.db.char.loot) - if hasLoothistory > 0 then + if hasLoothistory > 0 and (event ~= "PARTY_LOOT_METHOD_CHANGED") then LD:Spawn(addonName.."DialogClearLoot",hasLoothistory) end end lastRaidStatus = raidStatus + if (event == "PLAYER_ENTERING_WORLD") or + (event == "PARTY_LOOT_METHOD_CHANGED") or + (event == "GROUP_ROSTER_UPDATE") then + if raidStatus and self:lootMaster() then + local addonMsg = string.format("MODE;%s;%s",self.db.char.mode,self._playerName) + self:addonMessage(addonMsg,"RAID") + end + end end -- parse potential Alt (in-guild) officernote, return Main (in-guild)