Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
Lacustat
2026-10-29 23:56:45 +01:00
co-authored by Claude Sonnet 5.5
parent f6061b92f2
commit 86df8d52f5
3 changed files with 48 additions and 11 deletions
+43 -7
View File
@@ -276,12 +276,49 @@ function Codex.ReputationRequirement(data)
return false
end
-- Ohne C_TooltipInfo (Vanilla-Client mit ClassicAPI): Tooltip des Haendlerfensters ueber einen eigenen, unsichtbaren GameTooltip lesen.
-- Ergebnis im selben Format wie C_TooltipInfo: { lines = { { leftText, leftColor = { r, g, b } } } }
local scanTip
local function ScanTooltip()
if scanTip then return scanTip end
if not (_G.CreateFrame and _G.UIParent) then return nil end
local ok, tt = pcall(_G.CreateFrame, "GameTooltip", "FreewoodMerchantScan", _G.UIParent, "GameTooltipTemplate")
if not ok or not tt then return nil end
scanTip = tt
return tt
end
local function MerchantTooltipLegacy(i)
local tt = ScanTooltip()
if not (tt and tt.SetMerchantItem and tt.NumLines) then return nil end
if tt.SetOwner then tt:SetOwner(_G.UIParent, "ANCHOR_NONE") end
if tt.ClearLines then tt:ClearLines() end
local ok = pcall(tt.SetMerchantItem, tt, i)
if not ok then return nil end
local lines = {}
for k = 1, tt:NumLines() or 0 do
local fs = _G["FreewoodMerchantScanTextLeft" .. k]
local text = fs and fs.GetText and fs:GetText()
if type(text) == "string" and text ~= "" then
local r, g, b = 1, 1, 1
if fs.GetTextColor then r, g, b = fs:GetTextColor() end
lines[#lines + 1] = { leftText = text, leftColor = { r = r, g = g, b = b } }
end
end
if #lines == 0 then return nil end -- Daten noch nicht da: beim naechsten Haendler-Ereignis erneut versuchen
return { lines = lines }
end
local function MerchantTooltip(i)
if not (C_TooltipInfo and C_TooltipInfo.GetMerchantItem) then return nil end
local ok, data = pcall(C_TooltipInfo.GetMerchantItem, i)
if not ok or type(data) ~= "table" or Util.IsSecret(data) then return nil end
if TooltipUtil and TooltipUtil.SurfaceArgs then pcall(TooltipUtil.SurfaceArgs, data) end
return data
if C_TooltipInfo and C_TooltipInfo.GetMerchantItem then
local ok, data = pcall(C_TooltipInfo.GetMerchantItem, i)
if ok and type(data) == "table" and not Util.IsSecret(data) then
if TooltipUtil and TooltipUtil.SurfaceArgs then pcall(TooltipUtil.SurfaceArgs, data) end
return data
end
return nil
end
return MerchantTooltipLegacy(i)
end
-- /fwruf: zeigt fuer die ersten Waren des offenen Haendlers die Tooltip-Zeilen und was daraus gelesen wurde
@@ -291,8 +328,7 @@ function Roles.RepDiag()
return
end
if not (C_TooltipInfo and C_TooltipInfo.GetMerchantItem) then
FW:Print("Ruf: C_TooltipInfo.GetMerchantItem gibt es hier nicht - Ruf-Zeilen koennen nicht gelesen werden.")
return
FW:Print("Ruf: C_TooltipInfo.GetMerchantItem gibt es hier nicht - es wird der Tooltip des Haendlerfensters gelesen.")
end
FW:Print("Ruf: Muster = " .. tostring(_G.ITEM_REQ_REPUTATION) .. " | Stufen: " .. tostring(_G.FACTION_STANDING_LABEL5) .. ", " .. tostring(_G.FACTION_STANDING_LABEL6))
local shown = 0