Add ClassicAPI AoE Loot module

This commit is contained in:
Dusk-92
2026-09-01 17:18:06 +02:00
parent d9eef56498
commit 1833555767
3 changed files with 70 additions and 0 deletions
+3
View File
@@ -124,6 +124,7 @@ Other modules can also benefit indirectly from ClassicAPI through shared ShaguTw
### Loot
- AoE Loot
- Improved Roll Frames
- Loot Cursor
@@ -174,6 +175,8 @@ Additional maintenance and Turtle WoW work by **paokkerkir**.
ClassicAPI compatibility fork maintained by **Dusk-92**.
Special thanks to **Sandrea** for providing **AoELoot**, adapted here as the **AoE Loot** module.
Additional code and ideas from **pfUI** and **zUI**.
Extended Movable Unit Frames support adapted from **TokensWorth/ShaguTweaks-mods**, originally released under MIT by **GryllsAddons**. See `THIRD_PARTY_NOTICES.md`.
+1
View File
@@ -91,6 +91,7 @@ mods\turtle-wow.lua
mods\superwow.lua
mods\reduced-actionbar.lua
mods\no-toggle.lua
mods\aoe-loot.lua
mods\loot-cursor.lua
mods\improved-roll-frames.lua
mods\improved-castbar.lua
+66
View File
@@ -0,0 +1,66 @@
-- Adapted from AoELoot by Sandrea / ChatGPT for ShaguTweaks-ClassicAPI.
local T = ShaguTweaks.T
local module = ShaguTweaks:register({
title = T["AoE Loot"],
description = T["Automatically loots all nearby corpses using ClassicAPI. Leaves Master Loot untouched."],
expansions = { ["vanilla"] = true },
category = T["Loot"],
enabled = nil,
})
module.enable = function(self)
local frame = CreateFrame("Frame", "ShaguTweaksAoELoot")
local pending = false
local function IsMasterLootActive()
if not GetLootMethod then return false end
return GetLootMethod() == "master"
end
local function CanStartAoELoot()
if IsMasterLootActive() then return false end
if not C_Loot or not C_Loot.LootAllCorpses then return false end
if C_Loot.IsScanInProgress and C_Loot.IsScanInProgress() then
return false
end
return true
end
local function StartAoELoot()
-- Defer for one frame so the normal loot session can close cleanly.
frame:SetScript("OnUpdate", nil)
if CanStartAoELoot() then
C_Loot.LootAllCorpses()
end
end
frame:RegisterEvent("LOOT_OPENED")
frame:RegisterEvent("LOOT_CLOSED")
frame:SetScript("OnEvent", function()
if event == "LOOT_OPENED" then
-- The master looter must keep the normal window to inspect and assign loot.
if IsMasterLootActive() then
pending = false
frame:SetScript("OnUpdate", nil)
return
end
if pending or not CanStartAoELoot() then return end
pending = true
CloseLoot()
return
end
if event == "LOOT_CLOSED" and pending then
pending = false
frame:SetScript("OnUpdate", StartAoELoot)
end
end)
end