From 86df8d52f5025a97ade58bb9031c52cae984556c Mon Sep 17 00:00:00 2001 From: Lacustat Date: Thu, 29 Oct 2026 23:56:45 +0100 Subject: [PATCH] 0.1.187: Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9 --- CodexHints.lua | 7 +++--- CodexRoles.lua | 50 ++++++++++++++++++++++++++++++++------ Freewood-OctoWoW-Codex.toc | 2 +- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/CodexHints.lua b/CodexHints.lua index 26329a5..94b1a60 100644 --- a/CodexHints.lua +++ b/CodexHints.lua @@ -47,7 +47,7 @@ end local function Entry(r) local cost = Codex.ModePrice(r.pr) - return { nm = r.nm or "?", sp = r.sp, rk = r.rk or (r.sp and Codex.SpellRank(r.sp)) or nil, cost = cost } + return { nm = r.nm or "?", sp = r.sp, rk = r.rk or (r.sp and Codex.SpellRank(r.sp)) or nil, cost = cost, ic = r.ic } end -- Fähigkeiten deiner Klasse, die auf dieser Stufe beim Lehrer dazukommen @@ -60,7 +60,7 @@ function Hints.ClassEntries(level) if g then for _, sp in ipairs(g.spells) do if not SpellKnown(sp.sp) then - list[#list + 1] = { nm = sp.nm or "?", sp = sp.sp, rk = sp.rk or (sp.sp and Codex.SpellRank(sp.sp)) or nil, cost = sp.cost } + list[#list + 1] = { nm = sp.nm or "?", sp = sp.sp, rk = sp.rk or (sp.sp and Codex.SpellRank(sp.sp)) or nil, cost = sp.cost, ic = sp.ic } end end end @@ -209,7 +209,8 @@ local function Display(h) for i = 1, MAX_ROWS do local row, e = frame.rows[i], h.entries[i] if e and i <= n then - local icon = e.sp and Codex.SpellIcon(e.sp) or nil + -- Das Symbol vom Lehrer-Fenster (beim Scan gelesen) zuerst; die Zauber-ID taugt auf Vanilla-Clients oft nicht + local icon = e.ic or (e.sp and Codex.SpellIcon(e.sp)) or nil row.icon:SetTexture(icon or "Interface\\Icons\\INV_Misc_QuestionMark") row.icon:Show() row.text:SetText(e.nm .. (e.rk and (" |cff9a9aa3(" .. e.rk .. ")|r") or "")) diff --git a/CodexRoles.lua b/CodexRoles.lua index 390276a..1393587 100644 --- a/CodexRoles.lua +++ b/CodexRoles.lua @@ -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 diff --git a/Freewood-OctoWoW-Codex.toc b/Freewood-OctoWoW-Codex.toc index 0a83e31..331e1ba 100644 --- a/Freewood-OctoWoW-Codex.toc +++ b/Freewood-OctoWoW-Codex.toc @@ -3,7 +3,7 @@ ## Notes: Learns quests, creatures and drops while you play: who gives and takes a quest, rewards, objectives, drop chances. ## Notes-deDE: Lernt beim Spielen Quests, Kreaturen und Beute: wer eine Quest vergibt und annimmt, Belohnungen, Ziele, Drop-Chancen. ## Author: Lacustat -## Version: 0.1.186 +## Version: 0.1.187 ## Dependencies: Freewood-OctoWoW-Core ## OptionalDeps: Freewood-OctoWoW-CodexData, Freewood-OctoWoW-ForeverData