Skip to content

Commit

Permalink
add support for ML callout clicks for BetterBags
Browse files Browse the repository at this point in the history
send a mode update to raid on group and loot method updates, when ML
  • Loading branch information
Road-block committed Dec 2, 2024
1 parent e9cfeaa commit b2d3f68
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 14 deletions.
2 changes: 1 addition & 1 deletion BastionLoot.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion BastionLoot_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions BastionLoot_Vanilla.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 23 additions & 0 deletions Modules/PlusRoll/loot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -462,6 +473,7 @@ local bag_addons = {
["tdBag2"] = false,
["Tukui"] = false,
["Baganator"] = false,
["BetterBags"] = false,
}
function bepgp_plusroll_loot:hookBagAddons()
local hook_install = false
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions Modules/loot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -637,6 +648,7 @@ local bag_addons = {
["tdBag2"] = false,
["Tukui"] = false,
["Baganator"] = false,
["BetterBags"] = false,
}
function bepgp_loot:hookBagAddons()
local hook_install = false
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
35 changes: 25 additions & 10 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b2d3f68

Please sign in to comment.