4 Commits

Author SHA1 Message Date
Relationship 1a525a7ebd Update README.md 2026-07-18 18:38:00 +01:00
Relationship b250f0e653 Add files via upload 2026-07-14 14:12:09 +01:00
Relationship b83b6179a6 Add files via upload 2026-07-14 13:40:09 +01:00
Relationship 16babb4892 Update README.md 2026-07-13 13:39:15 +01:00
3 changed files with 141 additions and 8 deletions
+3
View File
@@ -1,3 +1,6 @@
<img src="https://i.postimg.cc/15cJh6y2/hfgh.gif"/>
<img src="https://i.postimg.cc/7ZHXx66D/sdfsdf.gif"/>
# Relationships Quest And Item Browser
A World of Warcraft addon for **OctoWoW** that turns every quest and item link into something you can click, browse, search, and cross-reference — all from a single movable window.
+137 -7
View File
@@ -2484,23 +2484,153 @@ local function RQL_ProcessChatFrame(frame)
end
end
local RQL_PLUS_TIMER = 0
-- Event-driven [+] scanning.
--
-- The old implementation ran a full chat-frame scan ~33 times per second
-- (every 0.03s) regardless of whether chat had changed. On busy zones /
-- raids that constant `frame:GetRegions()` + regex work was a real source
-- of random lag spikes (GC pressure from throwaway region tables).
--
-- Now we scan only when:
-- * a CHAT_MSG_* event arrives (with a tiny delay so the chat frame has
-- laid out the new region before we measure it), or
-- * the user scrolls / resizes a chat frame (hooked below), or
-- * the addon just finished loading (initial pass over existing chat).
--
-- Scans are rate-limited to at most one every RQL_SCAN_MIN_INTERVAL.
-- Near-instant update: [+] icons must track new chat lines the same frame
-- they render. A 0.25s throttle was visibly slow when messages scrolled up
-- and the old [+] drifted with them. We now scan on the very next frame.
-- Tiny throttle: enough to coalesce bursts of chat events (raids, spammy
-- channels) into a single rescan per frame-ish window, but small enough
-- that the [+] still tracks new lines effectively instantly to the eye.
local RQL_SCAN_MIN_INTERVAL = 0.03
local RQL_SCAN_DELAY = 0.01
local RQL_SCAN_PENDING_AT = nil
local RQL_SCAN_LAST_AT = 0
function RQL_SchedulePlusScan(delay)
local now = GetTime()
local at = now + (delay or RQL_SCAN_DELAY)
local earliest = RQL_SCAN_LAST_AT + RQL_SCAN_MIN_INTERVAL
if at < earliest then at = earliest end
if not RQL_SCAN_PENDING_AT or at < RQL_SCAN_PENDING_AT then
RQL_SCAN_PENDING_AT = at
end
end
-- Called every frame from the main OnUpdate. Cheap when idle: two compares
-- and an early return. Only does real work when a scan is due.
function RQL_PlusTick(elapsed)
RQL_PLUS_TIMER = RQL_PLUS_TIMER + (elapsed or 0)
if RQL_PLUS_TIMER < 0.03 then return end
RQL_PLUS_TIMER = 0
if not RQL_SCAN_PENDING_AT then return end
if GetTime() < RQL_SCAN_PENDING_AT then return end
RQL_SCAN_PENDING_AT = nil
RQL_SCAN_LAST_AT = GetTime()
RQL_PoolIndex = 0
local maxFrames = NUM_CHAT_WINDOWS or 7
for i = 1, maxFrames do
local f = getglobal("ChatFrame" .. i)
if f then RQL_ProcessChatFrame(f) end
-- IsVisible() is false for docked tabs that aren't the front tab
-- and for hidden / minimized chat windows, so we naturally skip
-- all of those.
if f and f.IsVisible and f:IsVisible() then
RQL_ProcessChatFrame(f)
end
end
RQL_HideUnusedButtons()
end
-- Watcher frame that listens for chat traffic and requests a rescan.
local RQL_ChatWatch = CreateFrame("Frame", "RQL_ChatWatch")
local RQL_CHAT_EVENTS = {
"CHAT_MSG_SAY", "CHAT_MSG_YELL", "CHAT_MSG_EMOTE", "CHAT_MSG_TEXT_EMOTE",
"CHAT_MSG_WHISPER", "CHAT_MSG_WHISPER_INFORM",
"CHAT_MSG_PARTY", "CHAT_MSG_RAID", "CHAT_MSG_RAID_LEADER", "CHAT_MSG_RAID_WARNING",
"CHAT_MSG_GUILD", "CHAT_MSG_OFFICER",
"CHAT_MSG_CHANNEL",
"CHAT_MSG_SYSTEM", "CHAT_MSG_LOOT", "CHAT_MSG_TRADESKILLS",
"CHAT_MSG_BATTLEGROUND", "CHAT_MSG_BATTLEGROUND_LEADER",
}
for i = 1, table.getn(RQL_CHAT_EVENTS) do
RQL_ChatWatch:RegisterEvent(RQL_CHAT_EVENTS[i])
end
RQL_ChatWatch:SetScript("OnEvent", function()
RQL_SchedulePlusScan()
end)
-- Immediately hide every [+] button in the pool. Used on tab-switch so a
-- stale icon from the previous tab disappears the instant the user clicks
-- a new tab, without waiting for the next scan tick.
local function RQL_HideAllPlusButtons()
local i = 1
while RQL_PLUS_POOL[i] do
RQL_PLUS_POOL[i]:Hide()
RQL_PLUS_POOL[i].rqlEntry = nil
i = i + 1
end
RQL_PoolIndex = 0
end
local function RQL_HookChatLinks()
-- Nothing to hook up-front; the OnUpdate ticker in the event handler
-- calls RQL_PlusTick() every frame and it drives everything else.
-- Chat scrolling / paging moves existing linked lines but doesn't fire
-- an event. Wrap the standard scroll helpers so [+] follows the text.
local names = { "ScrollUp", "ScrollDown", "ScrollToTop",
"ScrollToBottom", "PageUp", "PageDown" }
local maxFrames = NUM_CHAT_WINDOWS or 7
for i = 1, maxFrames do
local f = getglobal("ChatFrame" .. i)
if f then
for j = 1, table.getn(names) do
local n = names[j]
local flag = "_rql_hooked_" .. n
if f[n] and not f[flag] then
local orig = f[n]
f[flag] = orig
f[n] = function()
orig(f)
RQL_SchedulePlusScan()
end
end
end
end
end
-- Hook chat tab clicks so switching tabs instantly clears any stale [+]
-- from the previously-visible tab and re-scans the newly-visible one.
-- Also hook OnShow/OnHide on the frames themselves as a safety net for
-- undock/dock and other visibility changes.
for i = 1, maxFrames do
local tab = getglobal("ChatFrame" .. i .. "Tab")
if tab and not tab._rql_hooked_click then
local origClick = tab:GetScript("OnClick")
tab._rql_hooked_click = true
tab:SetScript("OnClick", function()
if origClick then origClick() end
RQL_HideAllPlusButtons()
RQL_SchedulePlusScan(0)
end)
end
local f = getglobal("ChatFrame" .. i)
if f and not f._rql_hooked_vis then
f._rql_hooked_vis = true
local origShow = f:GetScript("OnShow")
f:SetScript("OnShow", function()
if origShow then origShow() end
RQL_HideAllPlusButtons()
RQL_SchedulePlusScan(0)
end)
local origHide = f:GetScript("OnHide")
f:SetScript("OnHide", function()
if origHide then origHide() end
RQL_HideAllPlusButtons()
RQL_SchedulePlusScan(0)
end)
end
end
-- Do one pass shortly after login so already-visible chat gets [+].
RQL_SchedulePlusScan(0.3)
end
-- ---------- events / slash ----------
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Relationships Quest And Item Browser
## Notes: Click quest and item links in chat, browse and search the full quest and item database.
## Author: Relationship
## Version: 1.0
## Version: 1.1
## SavedVariables: RelationshipsQuestAndItemBrowserDB
RelationshipsQuestAndItemBrowser.xml
RelationshipsQuestAndItemBrowserData_Init.lua