Commit Graph
24 Commits
Author SHA1 Message Date
Brues 8592254b2d Fixed items equipped string in SetEquipmentSet tooltip 2026-05-30 13:59:28 -05:00
Brues 5982b85c75 Add GameTooltip:SetEquipmentSet with localized output
Registers `SetEquipmentSet` on the GameTooltip method registry,
mirroring the 4.3.4 implementation at 0x0046E690. Builds a tooltip
with header + counts (equipped / in inventory / ignored) + one line
per missing item.

Storage format now persists itemID alongside GUID per slot
(`slot N guid=0xHEX item=ID`), so missing items can be looked up by
name in the item cache even when the live CGItem is no longer in the
client's object map. Backward compat: pre-itemID files load fine and
fall back to a `%d missing` summary line for those slots.

Adds `Game::Lua::PushLocalizedString` and `PushLocalizedFormatInt`
helpers — generic lookup of `_G[name]` with a C-string fallback for
servers stripped of standard GlobalStrings. The tooltip uses these
for the four count lines via Blizzard's `ITEMS_VARIABLE_QUANTITY`,
`ITEMS_EQUIPPED`, `ITEMS_IN_INVENTORY`, `ITEM_SLOTS_IGNORED` keys,
and for the per-missing-item line via `ITEM_MISSING`.

AddOn side: a `GlobalStrings.lua` companion provides English defaults
for those five keys plus a `ShowEquipmentSet()` test helper in
Constants.lua.

First implementation passed `nargs=4` to `lua_call` where the stack
needed 5 (self + text + r + g + b for `tooltip:SetText`) — Lua then
treated `self` as the function, surfacing as
`<in C code>: in function 'SetEquipmentSet'` with no Lua frame above.
Fixed before this commit.
2026-05-18 15:13:36 -05:00
Brues cd6da18687 Add GlueModuleAutoRegister + FUN_LOAD_GLUE_SCRIPT_FUNCTIONS hook
Module-self-registration pattern for the glue Lua state, mirroring the
existing in-game ModuleAutoRegister. Modules opt in with a file-scope
GlueModuleAutoRegister; the hook on FUN_0046ABB0 (master glue init,
single caller, 35-byte linear function) fires their callbacks after
the engine finishes registering its own 109 glue functions onto the
freshly-created glue state.

Prior attempt hooked the inner FUN_0046DDF0 60-fn batch trampoline and
crashed on Octo, likely from sibling-DLL collision on a small target.
The linear caller is larger and less obvious; no crash, hook fires
cleanly on initial launch and every world->glue return.
2026-05-17 02:29:27 -05:00
Brues 24ed233c4f Add Game::Lua::SetGlobalNumber, move CLASSIC_API_VERSION to its own module
Three sites were doing the same 3-call (PushString + PushNumber + SetTable
on GLOBALS_INDEX) to declare integer globals. Promote to a shared helper
that uses RawSet (globals have no __newindex in vanilla 1.12, so the
metatable check SetTable does is dead).

Also lift CLASSIC_API_VERSION out of DllMain.cpp into api/Version.cpp
so it self-registers via ModuleAutoRegister like every other Lua surface,
instead of being a special case wired into FrameScript_Initialize_h.
2026-05-16 20:50:48 -05:00
Brues 37a1c46c0a ResolveObject added instead of calling raw assembly 2026-05-16 17:38:11 -05:00
Brues 4fba5d6f24 cleanup 2026-05-16 16:35:52 -05:00
Brues 76e2e7ac66 Found the correct offset for lua_pushvalue a while ago 2026-05-16 16:32:52 -05:00
Brues 2cc6cfda86 EncodingUtil 2026-05-15 23:12:16 -05:00
Brues f8a84d7cf9 C_AddOns fixes 2026-05-14 15:08:40 -05:00
Brues ef7ccb4723 Lua SetField cleanup 2026-05-14 14:05:27 -05:00
Brues 1914eb7ddd PLAYER_STARTED_MOVING / PLAYER_STOPPED_MOVING 2026-05-13 18:43:32 -05:00
Brues 013ad5914d table.wipe 2026-05-12 21:51:46 -05:00
Brues cec21c177a GetCurrentChatGUID 2026-05-11 13:57:48 -05:00
Brues 976ef735c3 UnitIsInMyGuild(unitOrName) 2026-05-10 23:52:10 -05:00
Brues bef40ab877 hooksecurefunc 2026-05-10 14:24:46 -05:00
Brues c03385acd2 set CLASSIC_API_VERSION directly through C++
No more running FrameScript_Execute
2026-05-09 10:12:15 -05:00
Brues 3262f6c70e IsSpellKnown(spellID, [isPet]) 2026-05-08 17:12:22 -05:00
Brues e580bed5f8 restructure how module register themselves 2026-05-07 20:20:35 -05:00
Brues 62017dca06 C_Item.GetItemInfoInstant 2026-05-07 18:11:38 -05:00
Brues 2a84c56603 Properly create namespace in C++ rather than using FrameScript_Execute 2026-05-07 17:28:11 -05:00
Brues 17a64d5bbb restructure project 2026-05-07 13:36:45 -05:00
Brues ffa9559e1b GetSpellInfo 2026-05-07 12:57:45 -05:00
Brues cfe5961970 Added GetQuestIDFromLogIndex 2026-05-07 12:01:28 -05:00
Brues 4737a947a8 Initialize
Currently only GameTooltip:SetSpell is supported
2026-05-07 10:47:34 -05:00