Commit Graph
14 Commits
Author SHA1 Message Date
Brues e8a03d584b spell: add GetSpellBonusDamage / GetSpellBonusHealing
GetSpellBonusDamage(school) reads the player's per-school spell damage
directly from the CGPlayer sub-struct at [player+0xE68]+0xFD4 (POS) / +0xFF0
(NEG), net = POS-NEG. That field isn't in the broadcast descriptor (+0x110
reads zero — the vanilla server never sends it there), but the client keeps a
fully-computed copy at +0xE68 with gear/enchants/buffs/talents/sets baked in.
Same source nampower's GetSpellPower reads; verified 613 generic / 647 Fire on
a geared mage. 1-based school, matching 3.3.5's Script_GetSpellBonusDamage.

GetSpellBonusHealing() has no such field (vanilla lacks a healing-done field
entirely), so it's derived to mirror the server's SpellBaseHealingBonusDone:
  - flat healing: SPELL_AURA_MOD_HEALING_DONE (135) off gear equip-effects,
    item enchants, random suffixes, and active buffs
  - Spirit conversion: SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT (175) x
    total Spirit / 100  (Priest Spiritual Guidance)
  - Armor conversion: SPELL_AURA_MOD_SPELL_HEALING_OF_ARMOR_PERCENT (199) x
    armor / 100  (Turtle Ironclad)
Percents are read straight from Spell.dbc, so it's generic across any
aura-175/199 talent/buff including Turtle customs, and gated on SPELL_ATTR_
PASSIVE for the known-spell-bitmap walk. Spirit/Armor come from UNIT_FIELD_
STAT4 (+0x250) / UNIT_FIELD_RESISTANCES[0] (+0x254).

Item flat healing routes through the shared Item::StatAccum engine rather than
re-implementing the item spell/suffix/enchant walk: extract a reusable
ApplyEnchant() (from ApplyRandomSuffix) plus a Value() reader, and read
ITEM_MOD_SPELL_HEALING_DONE_SHORT.

The healing sum is expensive (StatAccum over 19 items + buff table + the 27k
known-spell bitmap), so it's cached and recomputed only when a player stat
input changes. New Player::StatSignal (a pull-based epoch) is bumped from the
aura hooks (player-guarded), the equipment observer, and the spell learn/
unlearn writers (0x4B25B0 / 0x4B2C50) -- so buffs, gear, and talent respecs
all invalidate instantly. A coarse world-tick recompute remains only as a
backstop against a missed signal.
2026-07-18 03:51:20 -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 855d4109c0 C_Spell.*: accept spellIdentifier (number / link / name)
Propagates Spell::Arg::ResolveSpellID through every C_Spell.*
table-namespace endpoint that previously accepted only a number:

  C_Spell.GetSpellInfo
  C_Spell.GetSpellName
  C_Spell.GetSpellTexture
  C_Spell.GetSpellLink
  C_Spell.GetSpellDescription
  C_Spell.IsSpellPassive
  C_Spell.IsSpellHarmful
  C_Spell.IsSpellHelpful
  C_Spell.IsSpellUsable

All three identifier forms now work uniformly across the namespace:
spellID number, |Hspell:N|h hyperlink (`GetSpellLink` round-trips
cleanly back into any of these), and known-spellbook spell name
(rank-suffix tolerant via the engine's FUN_004B3950 parser).

Behavior change: invalid input no longer raises a Lua usage error.
Modern WoW C_Spell.* convention is permissive (return nil for
unknown/garbage input, no error), so calls like
C_Spell.GetSpellName("not a spell") or C_Spell.GetSpellName(nil)
now silently return nil. Matches the existing C_Item.* convention.

Legacy globals (GetSpellInfo, IsPassiveSpell, IsHarmfulSpell,
IsUsableSpell) are unchanged — they keep their (slot, bookType)
overload via the existing ResolveLuaArgsToSpellID path. Only the
C_Spell.* table-namespace surface is broadened.
2026-05-21 14:12:06 -05:00
Brues 90a580d75d Add Game::Lua::PushBool helper, sweep condition ? 1 : 0 patterns
PushBool(L, bool) wraps lua_pushboolean and centralizes the bool→int
conversion the engine ABI requires. All ~50 sites doing
`PushBoolean(L, condition ? 1 : 0)` collapse to `PushBool(L, condition)`.
Non-PushBoolean callers passing bool→int (Fire_*, FireGetItemInfoReceived,
etc.) switched to `static_cast<int>(...)`. NameCache settings file output
relies on the default ostream bool→"0"/"1" formatting.

Literal `PushBoolean(L, 0)` / `PushBoolean(L, 1)` left alone — they're
already explicit int values.
2026-05-16 21:39:46 -05:00
Brues ee84019c85 IsHarmfulSpell(spell) / IsHelpfulSpell(spell) 2026-05-15 00:09:33 -05:00
Brues 3262f6c70e IsSpellKnown(spellID, [isPet]) 2026-05-08 17:12:22 -05:00
Brues e6095f62d3 IsPlayerSpell(spellID) 2026-05-08 14:17:38 -05:00
Brues f7d3b8bd64 IsPassiveSpell / C_Spell.IsSpellPassive 2026-05-08 12:33:29 -05:00
Brues 473681416e GetSpellLink(spellID) / C_Spell.GetSpellLink(spellID) 2026-05-08 00:36:54 -05:00
Brues 2b9a164bd1 FindSpellBookSlotByID(spellID) 2026-05-08 00:27:52 -05:00
Brues 9d0c19cf22 C_Spell.GetSpellName(spellID) and C_Spell.GetSpellTexture(spellID) 2026-05-07 23:11:31 -05:00
Brues 81924e5c95 GetSpellInfo (with (slot, bookType) overload), C_Spell.GetSpellInfo 2026-05-07 23:06:37 -05:00
Brues e580bed5f8 restructure how module register themselves 2026-05-07 20:20:35 -05:00
Brues 17a64d5bbb restructure project 2026-05-07 13:36:45 -05:00