diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index 895b352..7872eac 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -1783,6 +1783,7 @@ function LeaPlusLC:Isolated() LeaPlusLC:MakeTx(FasterLootPanel, "Settings", 16, -72) LeaPlusLC:MakeCB(FasterLootPanel, "SmallerErrorFrame", "Smaller Error Frame", 16, -92, false, "If checked, your red error text frame, will be only one line long.") LeaPlusLC:MakeCB(FasterLootPanel, "FasterErrorFrame", "Faster Error Frame", 16, -112, false, "If checked, your red error text frame, will be faster to fade|n(1 second instead of 5).") + LeaPlusLC:MakeCB(FasterLootPanel, "NoLootWorldforged", "Skip auto-loot for Worldforged items", 16, -132, false, "If checked, worldforged items will be left in the loot window instead of being auto-looted, so you can decide which ones to keep.") LeaPlusLC:MakeTx(FasterLootPanel, "Full Inventory Sound", 356, -72) LeaPlusLC:MakeSL(FasterLootPanel, "FullInvSound", "Drag to set the desired sound played when your inventory is Full. Set 0 to disable sound.", 0, 3, 1, 356, -92, "%.0f") @@ -1846,6 +1847,7 @@ function LeaPlusLC:Isolated() -- Reset checkboxes LeaPlusLC["SmallerErrorFrame"] = "Off" LeaPlusLC["FasterErrorFrame"] = "Off" + LeaPlusLC["NoLootWorldforged"] = "Off" LeaPlusLC["FullInvSound"] = 1 UIErrorsFrame:SetHeight(60) UIErrorsFrame:SetTimeVisible(5) @@ -2013,9 +2015,39 @@ function LeaPlusLC:Isolated() + -- CoA: tooltip-scanner to detect Worldforged items. + -- Worldforged items show a green "Worldforged" line below the item name. + -- They aren't distinguishable by item ID alone (rolled drops use synthetic + -- IDs in the 1.5b+ range, but base items can also be Worldforged), so we + -- scan the tooltip and cache the result per itemLink. + local wfTooltip = CreateFrame("GameTooltip", "LeaPlusWorldforgedScanner", nil, "GameTooltipTemplate") + wfTooltip:SetOwner(WorldFrame, "ANCHOR_NONE") + local wfCache = {} + local function IsWorldforgedLink(itemLink) + if not itemLink then return false end + local cached = wfCache[itemLink] + if cached ~= nil then return cached end + wfTooltip:ClearLines() + wfTooltip:SetHyperlink(itemLink) + local found = false + for j = 2, math.min(wfTooltip:NumLines(), 5) do + local line = _G["LeaPlusWorldforgedScannerTextLeft" .. j] + if line then + local text = line:GetText() + if text and text:find("Worldforged") then + found = true + break + end + end + end + wfCache[itemLink] = found + return found + end + function AutoLoot:LootItems(numItems) local lootThreshold = (self.isClassic and select(2, GetLootMethod()) == 0) and GetLootThreshold() or 10 + local skipWorldforged = LeaPlusLC["NoLootWorldforged"] == "On" for i = numItems, 1, -1 do local itemLink = GetLootSlotLink(i) @@ -2027,6 +2059,11 @@ function LeaPlusLC:Isolated() -- print("item is locked") self.isItemLocked = true + elseif skipWorldforged and IsWorldforgedLink(itemLink) then + + -- CoA: leave worldforged in the loot window for manual review + self.isItemLocked = true + else --===== FIX ME =====-- @@ -17046,6 +17083,7 @@ local function eventHandler(self, event, arg1, arg2, ...) LeaPlusLC:LoadVarNum("FullInvSound", 1, 0, 3) LeaPlusLC:LoadVarChk("SmallerErrorFrame", "Off") -- Release in PvP Exclude Alterac Valley LeaPlusLC:LoadVarChk("FasterErrorFrame", "Off") -- Release in PvP Exclude Alterac Valley + LeaPlusLC:LoadVarChk("NoLootWorldforged", "Off") -- CoA: skip auto-loot for worldforged items LeaPlusLC:LoadVarChk("NoRestedEmotes", "Off") -- Silence rested emotes @@ -17498,6 +17536,7 @@ local function eventHandler(self, event, arg1, arg2, ...) LeaPlusDB["FullInvSound"] = LeaPlusLC["FullInvSound"] LeaPlusDB["SmallerErrorFrame"] = LeaPlusLC["SmallerErrorFrame"] LeaPlusDB["FasterErrorFrame"] = LeaPlusLC["SmallerErrorFrame"] + LeaPlusDB["NoLootWorldforged"] = LeaPlusLC["NoLootWorldforged"] LeaPlusDB["NoRestedEmotes"] = LeaPlusLC["NoRestedEmotes"] LeaPlusDB["MuteGameSounds"] = LeaPlusLC["MuteGameSounds"]