Commit Graph
9 Commits
Author SHA1 Message Date
Brues ac118d5305 feat(unit): GetShapeshiftForm
Returns the stance-bar index of the active form, walking the bar from the
last entry as 4.3.4's CGSpellBook::GetShapeshiftForm does: count + 1 for a
form not on the bar, 0 for requireForm with no form byte. Each index is
tested through the engine's Script_GetShapeshiftFormInfo, which holds
1.12's only full "bar spell is active" check.

The [stance] / [form] macro conditions now use GetShapeshiftForm(true),
as Blizzard's EvaluateStance does, so a paladin aura no longer counts as
a stance.
2026-10-28 11:35:26 -05:00
Brues 929b6f5c60 feat(spell): add autoStand, autoDismount and autoUnshift
Backports 4.3.4's cast settings. With one set to 1, a cast that 1.12
refuses because the player sits, is mounted, or is in a form that the
spell excludes now stands, dismounts or leaves the form, then casts.

Mirrors 4.3.4's split: the caster check's mount, stand and form rungs
pass when the action is allowed and note it, and the cast request runs
the noted actions once every rung has passed. A form refusal for "only
in form" is never handled, and the usability check honors autoUnshift
so the button stays lit, as Spell_C_IsUsableAction does.

All three default to 0, so 1.12 behavior is unchanged until set.
CancelShapeshiftForm now shares the aura-cancel walk with the dismount.
2026-10-20 17:02:42 -05:00
Brues 993c82cca7 refactor: route unit-token resolution through Game::ResolveUnitToken
Sweep the ~35 modules that each hand-rolled a `ResolveUnitToken_t` typedef
plus `reinterpret_cast<…>(Offsets::FUN_RESOLVE_UNIT_TOKEN)` onto the shared
`Game::ResolveUnitToken` helper. Behavior-identical — it is the same engine
function — and net -87 lines. The typedef now lives in exactly one place
(Game.cpp).

unit/Position.h is a header, so it gains an `#include "Game.h"`; every other
touched file already pulled Game.h in. No offsets, logic, or unrelated
typedefs were changed.
2026-08-30 16:57:04 -05:00
Brues 7f52afeef4 perf(event): fire custom events through O(1) AutoReserve::Slot()
Every custom-event fire resolved its name to a slot via
Event::Custom::Lookup - a linear strcmp scan over the ~46-entry
reservation table, on every single fire. The slot itself was already
cached per table build; only the name->reservation hop was repeated.
On a client that is purely CPU-bound, that is wasted work on paths
that burst exactly when frames are scarce (nameplate churn, cast spam,
loot rolls, mouse/modifier input).

AutoReserve now remembers its reservation index (the ctor's dedup
resolves duplicate names to the same entry) and exposes Slot() - two
loads. Reload safety is unchanged and stays centralized: Slot() reads
through the shared table PrepareForReload/RetryClaims maintain, so the
value can never go stale. Lookup is deleted; LookupByName remains for
engine-defined names.

All fire sites converted to the instance handle:
- CastEvents: the k* name constants become the AutoReserve instances,
  so all 19 fire sites stay textually identical; the Fire/FireReticle/
  FireRemote helpers take the reservation by reference.
- equipmentset: reservations move into Set.h as C++17 inline consts so
  the Data and Api TUs share one handle.
- Cache::QueryLoad::Register takes the AutoReserve pointer instead of
  an event-name string (creature/gameobject callers updated).
- Tts keeps its lazy VanillaTTS-stand-down reservations via
  null-guarded pointers set at registration.
- GlobalMouse/InputEvents/lossofcontrol instances moved above their
  fire sites (static-init list order is irrelevant).
2026-08-24 10:11:10 -05:00
Brues d9102bae3b Relicense source headers from LGPL to GPL v3
The repo was internally inconsistent: the LICENSE file is GPL v3 but every
src/ header carried the LGPL v3 notice and the README said "LGPL v3 or
later". LGPL was also the wrong fit — this is an injected mod plus a
bundled addon, not a library other code links against, so LGPL's linking
exception buys nothing.

It's also required: src/voicechat/Tts.cpp is ported from awesome_wotlk's
VoiceChat.cpp, which is GPL v3, and a derivative of GPL code cannot be
relicensed under more permissive terms. Dependencies stay compatible —
MinHook (BSD-2) and the nampower-mirrored packet shapes (BSD) are
GPL-compatible, and SAPI is covered by the system-library exception.

Swept "GNU Lesser General Public License" -> "GNU General Public License"
across all 257 src/ headers and changed the README license line to match
the GPL v3 LICENSE file. Comment-only; no build impact.
2026-06-29 16:38:16 -05:00
Brues d7ecbd38e5 CancelShapeshiftForm: doc no-op for warrior stances
Vanilla treats warriors as always-in-a-stance — the engine has no "no
stance" state, right-clicking the active stance bar slot does nothing,
and the server rejects CMSG_CANCEL_AURA for stance spells regardless
of how the request is formed. Tried both a looser aura-walk (no
visibility gate) and a form-bar fallback before confirming stances
genuinely aren't cancelable from the client.

All other shapeshift forms (druid, shaman ghost wolf, priest
shadowform / spirit of redemption, rogue stealth) are real visible
buffs and cancel cleanly via the original aura-walk path.
2026-05-21 10:27:49 -05:00
Brues 32f6e342c4 CancelShapeshiftForm
No-arg drop-current-form, polyfilling the modern singular. Walks the
player's buff slots, scans each spell's Spell.dbc EffectApplyAuraName[3]
at +0x16C and EffectMiscValue[3] at +0x1A8 for the
SPELL_AURA_MOD_SHAPESHIFT (0x24) effect whose misc-value matches the
current form byte, and sends CMSG_CANCEL_AURA via FUN_006E7040 for the
owning spellID.

Offsets validated against both 1.12's Script_CastShapeshiftForm
(0x004B4810) — which does the same scan when re-toggling an active form
— and 3.3.5's Script_CancelShapeshiftForm inner FUN_00726CE0. Vanilla's
public Lua surface only exposes the index-based toggle via
CastShapeshiftForm, forcing addons to know which bar slot the current
form occupies before they can cancel it; the no-arg shape is a lot
easier.
2026-05-21 10:14:47 -05:00
Brues 85e4f582e3 UPDATE_SHAPESHIFT_FORM event
Synthesize modern's per-form-change event by hooking the engine's
bonus-action-bar refresh helper at 0x004E4FC0 — fires every relevant
UNIT_BYTES_1 broadcast plus once at post-login. Cached-byte gate on
descriptor[+0x212] filters out the recomputes for non-form bytes
(standstate, etc.) the same helper handles. Sentinel -1 for "player
not resolvable yet" distinguishes early-login transients from real
"left a form" transitions.

Vanilla 1.12 only has UPDATE_SHAPESHIFT_FORMS (plural — list-changed).
2026-05-21 04:19:37 -05:00
Brues dcb00701fd GetShapeshiftFormID 2026-05-21 04:04:01 -05:00