diff --git a/README.md b/README.md
index 9133d999..ca4ac941 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@ reference in **[docs/API.md](docs/API.md)**.
| [Expansion](docs/API.md#expansion) | `ClassicExpansionAtLeast`, `ClassicExpansionAtMost`, `GetClassicExpansionLevel` |
| [Faction](docs/API.md#faction) | `C_Reputation.GetFactionDataByID`, `C_Reputation.GetFactionDataByIndex`, `C_Reputation.GetFactionStandings`, `C_Reputation.GetLastStandingChange`, `C_Reputation.GetWatchedFactionData`, `C_Reputation.IsFactionActive`, `C_Reputation.IsFactionActiveByID`, `C_Reputation.IsFactionInactive`, `C_Reputation.SetFactionActive`, `C_Reputation.SetFactionActiveByID`, `C_Reputation.SetFactionInactive`, `C_Reputation.SetFactionInactiveByID`, `C_Reputation.SetSelectedFaction`, `C_Reputation.SetSelectedFactionByID`, `C_Reputation.SetWatchedFactionByID`, `C_Reputation.ToggleFactionAtWar`, `C_Reputation.ToggleFactionAtWarByID`, `GetFactionIDByIndex`, `GetFactionInfoByID`, `GetFactionParentID` |
| [Focus](docs/API.md#focus) | `ClearFocus`, `FocusUnit` |
-| [Frame](docs/API.md#frame) | `region:SetPoint("point")` (one-arg form), `region:SetSize`, `region:GetSize`, `region:IsMouseOver`, `region:GetRect`, `region:IsDragging`, `GetMouseFoci`, `frame:SetShown`, `fontstring:GetStringHeight`, `fontstring:GetUnboundedStringWidth`, `fontstring:GetWrappedWidth`, `fontstring:GetNumLines`, `fontstring:GetLineHeight`, `fontstring:IsTruncated`, `fontstring:SetMaxLines`, `fontstring:GetMaxLines`, `fontstring:SetFormattedText`, `texture:SetRotation`, `texture:GetRotation`, `texture:SetVertexOffset`, `texture:GetVertexOffset`, `texture:SetColorTexture`, `texture:SetAtlas`, `texture:GetAtlas`, `texture:ResetTexCoord`, `texture:SetSpriteSheetCell`, `texture:SetDesaturation`, `texture:GetDesaturation`, `texture:SetMask`, `frame:CreateMaskTexture`, `texture:AddMaskTexture`, `texture:RemoveMaskTexture`, `texture:GetNumMaskTextures`, `texture:GetMaskTexture`, `fontstring:SetRotation`, `fontstring:GetRotation`, `editBox:SetCursorPosition`, `editBox:GetCursorPosition`, `editBox:GetUTF8CursorPosition`, `editBox:ClearHighlightText`, `editBox:HasFocus`, `editBox:HasText`, `editBox:SetHighlightColor`, `editBox:GetHighlightColor`, `editBox:ClearHistory`, `frame:SetResizeBounds`, `frame:HookScript`, `frame:IsEventRegistered`, `frame:RegisterUnitEvent`, `frame:GetEffectiveAlpha`, `frame:SetAttribute`, `frame:SetAttributeNoHandler`, `frame:ClearAttribute`, `frame:GetAttribute`, `OnAttributeChanged` (script), `SetModernScriptArgs`, `GetModernScriptArgs`, `PreClick` (script), `PostClick` (script), `button:RegisterForClicks("AnyUp"/"AnyDown")`, `GetClickFrame` |
+| [Frame](docs/API.md#frame) | `region:SetPoint("point")` (one-arg form), `region:SetSize`, `region:GetSize`, `region:IsMouseOver`, `region:GetRect`, `region:IsDragging`, `GetMouseFoci`, `frame:SetShown`, `smf:SetHyperlinksEnabled`, `smf:GetHyperlinksEnabled`, `fontstring:GetStringHeight`, `fontstring:GetUnboundedStringWidth`, `fontstring:GetWrappedWidth`, `fontstring:GetNumLines`, `fontstring:GetLineHeight`, `fontstring:IsTruncated`, `fontstring:SetMaxLines`, `fontstring:GetMaxLines`, `fontstring:SetFormattedText`, `texture:SetRotation`, `texture:GetRotation`, `texture:SetVertexOffset`, `texture:GetVertexOffset`, `texture:SetColorTexture`, `texture:SetAtlas`, `texture:GetAtlas`, `texture:ResetTexCoord`, `texture:SetSpriteSheetCell`, `texture:SetDesaturation`, `texture:GetDesaturation`, `texture:SetMask`, `frame:CreateMaskTexture`, `texture:AddMaskTexture`, `texture:RemoveMaskTexture`, `texture:GetNumMaskTextures`, `texture:GetMaskTexture`, `fontstring:SetRotation`, `fontstring:GetRotation`, `editBox:SetCursorPosition`, `editBox:GetCursorPosition`, `editBox:GetUTF8CursorPosition`, `editBox:ClearHighlightText`, `editBox:HasFocus`, `editBox:HasText`, `editBox:SetHighlightColor`, `editBox:GetHighlightColor`, `editBox:ClearHistory`, `frame:SetResizeBounds`, `frame:HookScript`, `frame:IsEventRegistered`, `frame:RegisterUnitEvent`, `frame:GetEffectiveAlpha`, `frame:SetAttribute`, `frame:SetAttributeNoHandler`, `frame:ClearAttribute`, `frame:GetAttribute`, `OnAttributeChanged` (script), `SetModernScriptArgs`, `GetModernScriptArgs`, `PreClick` (script), `PostClick` (script), `button:RegisterForClicks("AnyUp"/"AnyDown")`, `GetClickFrame` |
| [FriendList](docs/API.md#friendlist) | `C_FriendList.GetFriendInfo`, `C_FriendList.GetFriendInfoByIndex`, `C_FriendList.GetNumFriends`, `C_FriendList.GetNumOnlineFriends`, `C_FriendList.GetNumWhoResults`, `C_FriendList.GetWhoInfo`, `C_FriendList.IsFriend`, `C_FriendList.IsIgnored`, `C_FriendList.IsIgnoredByGuid`, `C_FriendList.IsWhoQueryPending`, `C_FriendList.SendWhoQueryByName`, `C_FriendList.SetFriendNotes`, `C_FriendList.SetFriendNotesByIndex` |
| [GameObject](docs/API.md#gameobject) | `C_GameObjectInfo.GetGameObjectInfoByID`, `C_GameObjectInfo.RequestLoadGameObjectByID`, `ClosestGameObjectPosition` |
| [Glue](docs/API.md#glue) | `C_Glue.IsOnGlueScreen` |
diff --git a/docs/API.md b/docs/API.md
index 4b0f7b1b..5ef387b0 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -260,6 +260,7 @@ build instructions.
- [`editBox:ClearHistory()`](#editboxclearhistory)
- [`frame:SetResizeBounds(minWidth, minHeight [, maxWidth, maxHeight])`](#framesetresizeboundsminwidth-minheight--maxwidth-maxheight)
- [`frame:HookScript(scriptType, handler)`](#framehookscriptscripttype-handler)
+ - [`smf:SetHyperlinksEnabled(enabled)` / `smf:GetHyperlinksEnabled()`](#smfsethyperlinksenabledenabled--smfgethyperlinksenabled)
- [`frame:IsEventRegistered(event)`](#frameiseventregisteredevent)
- [`frame:RegisterUnitEvent(event, ...units)`](#frameregisteruniteventevent-units)
- [`frame:GetEffectiveAlpha()`](#framegeteffectivealpha)
@@ -6070,6 +6071,20 @@ button:HookScript("OnEnter", function(self)
end)
```
+### `smf:SetHyperlinksEnabled(enabled)` / `smf:GetHyperlinksEnabled()`
+
+On ScrollingMessageFrame and SimpleHTML frames. With hyperlinks off, the
+frame's `OnHyperlinkEnter` and `OnHyperlinkClick` scripts don't run. The
+links still show in the text. `OnHyperlinkLeave` still runs, so a tooltip
+that was open when you turned hyperlinks off still closes. Hyperlinks are on
+by default. If you call `SetHyperlinksEnabled()` with no argument, it turns
+them on.
+
+```lua
+ChatFrame1:SetHyperlinksEnabled(false) -- links in this chat window stop reacting
+ChatFrame1:GetHyperlinksEnabled() -- false
+```
+
### `frame:IsEventRegistered(event)`
Returns `true` if the frame is registered for `event`, else `false` (also
diff --git a/src/Offsets.h b/src/Offsets.h
index e1315153..1472d3f8 100644
--- a/src/Offsets.h
+++ b/src/Offsets.h
@@ -2661,6 +2661,24 @@ enum Offsets {
// Frame::Modern's GetEffectiveAlpha up the parent chain.
FUN_SCRIPT_FRAME_GETALPHA = 0x00774DC0,
FUN_SCRIPT_REGION_GETPARENT = 0x007A1460,
+
+ // Hyperlink scripts. ScrollingMessageFrame and SimpleHTML share a base
+ // whose GetScriptByName override (0x007A3700, in the vtables at slots
+ // 0x0081D03C and 0x0081D68C) adds OnHyperlinkEnter / Leave / Click, held
+ // at +0x320 / +0x328 / +0x330. Each fires through its own vtable function
+ // (Enter 0x007A3780, Leave 0x007A37B0, Click 0x007A37E0), which runs the
+ // script through the input-script forwarder 0x007026F0 →
+ // FUN_FRAME_RUN_SCRIPT_WITH_CONTEXT with slotPtr = frame + the slot below,
+ // only when one is set. `Frame::HyperlinksEnabled` gates them there, as a
+ // `Frame::RunnerHook` subscriber.
+ OFF_HYPERLINK_ENTER_SLOT = 0x320,
+ OFF_HYPERLINK_LEAVE_SLOT = 0x328,
+ OFF_HYPERLINK_CLICK_SLOT = 0x330,
+ // Method registries (the Ctx of each class's method table): the
+ // ScrollingMessageFrame table 0x0087B5C0 (AddMessage, ScrollUp, SetMaxLines,
+ // ...), the SimpleHTML table 0x0087BA80 (SetText, SetHyperlinkFormat, ...).
+ VAR_SCROLLINGMESSAGEFRAME_METHOD_REGISTRY = 0x00CF5294,
+ VAR_SIMPLEHTML_METHOD_REGISTRY = 0x00CF5328,
FUN_SCRIPT_TEXTURE_SHOW = 0x0079B770,
FUN_SCRIPT_TEXTURE_HIDE = 0x0079B830,
FUN_SCRIPT_FONTSTRING_SHOW = 0x0079CDB0,
diff --git a/src/frame/HyperlinksEnabled.cpp b/src/frame/HyperlinksEnabled.cpp
new file mode 100644
index 00000000..be81174b
--- /dev/null
+++ b/src/frame/HyperlinksEnabled.cpp
@@ -0,0 +1,109 @@
+// This file is part of ClassicAPI.
+//
+// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software Foundation, either
+// version 3 of the License, or (at your option) any later version.
+//
+// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// ClassicAPI. If not, see .
+
+// `SetHyperlinksEnabled(enabled)` / `GetHyperlinksEnabled()` on
+// ScrollingMessageFrame and SimpleHTML, the two types 3.3.5 has them on.
+//
+// Both types run OnHyperlinkEnter, OnHyperlinkLeave and OnHyperlinkClick
+// when the mouse meets a link in their text. Later clients can switch that
+// off per frame: 3.3.5's chat frames do it for a chat window set to not
+// take the mouse. Vanilla always runs them. Zygor Guides Viewer 2.0 turns
+// hyperlinks off on the step lines it fills with its Gold Guide's item
+// lists, and back on when those lines show guide steps again.
+//
+// The flag is kept per frame, default on. All three scripts fire through
+// FUN_FRAME_RUN_SCRIPT_WITH_CONTEXT with the script's slot on the frame, so a
+// `Frame::RunnerHook` subscriber skips Enter and Click while the frame's flag
+// is off — no hook of our own.
+//
+// Leave is never skipped. 3.3.5's setter (0x00973C40) doesn't gate the
+// scripts: it stores the flag (+0x348) and calls 0x009699C0, which destroys
+// the frame's link hit-regions and rebuilds them only while enabled. 1.12's
+// hit-regions can't be removed that way, and skipping Leave would strand
+// whatever Enter showed (a GameTooltip) when a frame is disabled while a
+// link is hovered. A Leave with no Enter before it is harmless.
+//
+// The argument is parsed with the engine's loose boolean, default on — the
+// same helper and default 3.3.5's setter uses (0x00815500(L, 2, 1)), so a
+// bare `SetHyperlinksEnabled()` enables and `SetHyperlinksEnabled(0)`
+// disables.
+
+#include "Game.h"
+#include "Offsets.h"
+#include "frame/RunnerHook.h"
+
+#include
+#include
+
+namespace Frame::HyperlinksEnabled {
+
+namespace {
+
+// Frames with hyperlinks switched off. Every frame is rebuilt on /reload, so
+// the set is cleared then. Only ScrollingMessageFrame / SimpleHTML frames get
+// in (the methods live on those registries alone), which is what makes the
+// slot-offset test below safe: on other frame types those offsets hold
+// other things.
+std::unordered_set g_disabled;
+
+using LooseBool_t = int(__fastcall *)(void *L, int idx, int defaultValue);
+
+bool OnRun(void *frame, uint32_t *slotPtr, const char * /*fmt*/, void * /*varargs*/) {
+ if (g_disabled.empty() || g_disabled.count(frame) == 0)
+ return false;
+ const uintptr_t off = reinterpret_cast(slotPtr) - reinterpret_cast(frame);
+ return off == Offsets::OFF_HYPERLINK_ENTER_SLOT || off == Offsets::OFF_HYPERLINK_CLICK_SLOT;
+}
+
+const Frame::RunnerHook::AutoSubscribe _runnerSub{&OnRun};
+
+int __fastcall Script_SetHyperlinksEnabled(void *L) {
+ void *frame = Game::Lua::ResolveFrame(L);
+ if (frame == nullptr)
+ return 0;
+ if (reinterpret_cast(Offsets::FUN_LUA_TO_BOOLEAN_LOOSE)(L, 2, 1) != 0)
+ g_disabled.erase(frame);
+ else
+ g_disabled.insert(frame);
+ return 0;
+}
+
+int __fastcall Script_GetHyperlinksEnabled(void *L) {
+ void *frame = Game::Lua::ResolveFrame(L);
+ if (frame == nullptr)
+ return 0;
+ Game::Lua::PushBool(L, g_disabled.count(frame) == 0);
+ return 1;
+}
+
+void PrepareForReload() { g_disabled.clear(); }
+
+const Game::Lua::FrameMethodEntry g_methods[] = {
+ {"SetHyperlinksEnabled", &Script_SetHyperlinksEnabled},
+ {"GetHyperlinksEnabled", &Script_GetHyperlinksEnabled},
+};
+
+void RegisterLuaFunctions() {
+ for (const uintptr_t registry : {static_cast(Offsets::VAR_SCROLLINGMESSAGEFRAME_METHOD_REGISTRY),
+ static_cast(Offsets::VAR_SIMPLEHTML_METHOD_REGISTRY)}) {
+ Game::Lua::RegisterFrameMethods(reinterpret_cast(registry), g_methods,
+ static_cast(sizeof(g_methods) / sizeof(g_methods[0])));
+ }
+}
+
+const Game::ModuleAutoRegister _autoreg{&RegisterLuaFunctions};
+const Game::ReloadAutoRegister _reload{&PrepareForReload};
+
+} // namespace
+
+} // namespace Frame::HyperlinksEnabled
diff --git a/src/frame/RunnerHook.h b/src/frame/RunnerHook.h
index b8276c67..ac6f7ff3 100644
--- a/src/frame/RunnerHook.h
+++ b/src/frame/RunnerHook.h
@@ -27,7 +27,8 @@
// MinHook allows ONE hook per address, and more than one feature needs this
// runner: `Frame::ClickEvents` brackets OnClick with PreClick/PostClick, and
// `Frame::UnitEvent` suppresses OnEvent fires that a RegisterUnitEvent filter
-// rejects. So — exactly like `Event::SignalHook` and `Tick::WorldTick` — this
+// rejects, `Frame::HyperlinksEnabled` suppresses OnHyperlinkEnter/Click on
+// frames with hyperlinks off. So — exactly like `Event::SignalHook` and `Tick::WorldTick` — this
// module owns the single hook and fans out. Declare a file-scope
// static const Frame::RunnerHook::AutoSubscribe _sub{&interceptor};
//