Commit graph

725 commits

Author SHA1 Message Date
Kelsi
d2ff91435a Revert glow pixel detection and forced additive override, add diagnostics
The pixel content glow detection (>60% dark = glow) was too aggressive,
flagging dark metal textures on sconces as glow textures and making
structural geometry transparent. The forced additive blending for
colorKeyBlack batches compounded the issue.

Reverted both. Added per-batch diagnostic logging for models containing
"light", "lamp", or "lantern" to identify the actual blend modes and
material flags on Stormwind bridge lamps.
2026-02-19 18:30:34 -08:00
Kelsi
b2d43f702f Fix Stormwind bridge lamp glow: detect glow textures by pixel content,
force additive blending for colorKeyBlack batches

Two key changes:

1. Detect glow-like textures by analyzing pixel content during loading:
   textures that are >60% near-black with some bright pixels are flagged
   as colorKeyBlack regardless of filename. This catches glow textures
   like Stormwind street lamps whose paths don't contain keywords like
   "lamp" or "lantern".

2. Force additive blending (mode 3) for batches with colorKeyBlack
   textures that have blendMode 1 or 2. These textures are designed for
   additive blending where black = transparent, but some M2 files specify
   Alpha or AlphaKey blend modes which cause black areas to render as
   solid dark disks instead of being invisible.
2026-02-19 18:27:21 -08:00
Kelsi
32cc13d1b2 Fix torch models eaten by glow sprites, fix lantern glow black backgrounds
Two fixes:

1. shouldUseGlowSprite now requires the UNLIT material flag (0x01) for
   the colorKeyBlack+flameLikeModel path. Previously, structural geometry
   (torch handles, sconce brackets) on flame-like models got replaced
   with glow sprites because their texture paths contained keywords like
   "torch" in the directory name, setting colorKeyBlack on non-glow
   textures. Requiring UNLIT ensures only actual glow/emissive batches
   become sprites while lit structural geometry renders normally.

2. Fragment shader now discards near-black (maxRGB < 0.1) for ALL unlit
   non-opaque batches, not just additive blend modes. Glow effects on
   lanterns/lamps that use blendMode 1 (AlphaKey) or 2 (Alpha) instead
   of 3 (Additive) now properly discard their black backgrounds.
2026-02-19 18:23:59 -08:00
Kelsi
cc8b06d1e4 Fix black background on lamp/lantern/torch glow effects
Three-part fix for glow textures showing opaque black rectangles instead
of being transparent:

1. Pass blend mode to fragment shader via uBlendMode uniform. For additive
   blend modes (3=Add, 6=BlendAdd), discard near-black fragments (maxRGB
   < 0.1) since they contribute nothing visually but render as dark
   rectangles against sky/terrain.

2. Expand colorKeyBlack texture keyword detection to include "lamp",
   "lantern", "glow", "flare", "brazier", "campfire", "bonfire" in
   addition to the existing "candle", "flame", "fire", "torch".

3. Expand flameLikeModel detection for glow sprite conversion to include
   "brazier", "campfire", "bonfire". Also compute glow centers for
   colorKeyBlack batches (not just blendMode >= 3) so glow sprites
   position correctly for all flame-like objects.
2026-02-19 18:19:52 -08:00
Kelsi
c89c35ecff Fix item tooltip armor: default to 5 damage entries (correct for all WoW versions)
All WoW versions use exactly 5 damage entries in SMSG_ITEM_QUERY_SINGLE_RESPONSE.
The previous heuristic defaulted to parsed2 (2 entries) and only switched to
parsed5 for armor items based on a non-zero armor check — but that check was
circular: it needed parsed5.armor>0 to switch to parsed5, which only happens
if parsed5 is already the selected result. Flipping the default to parsed5 and
falling back to parsed2 only when parsed2 clearly identifies a weapon item
(damage+delay present, parsed5 doesn't match) fixes armor for armor items
without breaking weapon stat parsing.
2026-02-19 18:10:25 -08:00
Kelsi
e92bea747a Fix item tooltip armor: auto-detect BuyCount in WotLK item query parser
The WotLK item query parser assumed BuyCount is always present as a
separate field (Flags + Flags2 + BuyCount + BuyPrice + SellPrice = 5
fields). Some server variants omit BuyCount, shifting every subsequent
field by 4 bytes and causing armor to be read from the wrong offset.

Now read 5 fields and validate InventoryType (must be 0-28). If it
falls outside that range, rewind and re-parse with 4 fields (no
BuyCount), which recovers correct alignment. Elevated item query log
from DEBUG to INFO so the parsed armor value is visible in output.
2026-02-19 17:54:32 -08:00
Kelsi
208fe0e7e3 Suppress cpp/weak-cryptographic-algorithm via query-filter (protocol-mandated RC4) 2026-02-19 17:49:49 -08:00
Kelsi
20cdff0790 Fix armor stat in character stats panel via UNIT_FIELD_RESISTANCES
The character stats panel was showing Armor: 0 because summing armor
from item query responses is fragile (depends on correct BuyCount/damage
block parsing). Instead, read the server-authoritative total armor
directly from UNIT_FIELD_RESISTANCES (physical resistance, index 0)
in the player entity update fields.

Added UNIT_FIELD_RESISTANCES to the UF enum and all four expansion
JSON files with correct wire indices:
  WotLK 3.3.5a: 99   (NPC_FLAGS=82 + emotestate + stat×5 + posstat×5 + negstat×5)
  TBC 2.4.3:   185   (NPC_FLAGS=168 + same relative layout)
  Classic 1.12: 154  (NPC_FLAGS=147 + emotestate + stat×5, no posstat/negstat)
  Turtle WoW:  154   (same as Classic)

Stats panel uses server armor when > 0, falls back to summed item-query
armor otherwise. Armor rating resets to 0 on world entry and is updated
from both CREATE_OBJECT and VALUES update blocks.
2026-02-19 17:45:09 -08:00
Kelsi
05e2b37894 Show rage/energy bar at same size as mana bar for warriors and rogues
Warriors (rage) and rogues/druids (energy) had no power bar rendered
when maxPower was 0 — the server often omits UNIT_FIELD_MAXPOWER1 for
rage-based classes since rage starts at 0. Rage and energy always cap
at 100, so default maxPower to 100 when the server sends 0 for those
power types. Also unified bar height to 18px (matching health bar) and
added proper power-type colour to the target frame bar (was always blue).
2026-02-19 17:08:53 -08:00
Kelsi
e304931435 Fix CodeQL weak-crypto suppressions: switch lgtm to codeql inline format
The old `// lgtm [cpp/...]` comments used a space (invalid syntax) and
were placed on preceding lines rather than inline with the flagged code.
GitHub's CodeQL action v3 requires `// codeql[query-id]` on the same
line as the flagged expression. All four alert sites updated:

- world_socket.cpp: encryptCipher/decryptCipher.init() (protocol RC4)
- warden_module.cpp: decryptRC4() call (Warden protocol RC4)
- warden_crypto.cpp: initRC4() calls (Warden stream cipher init)
- game_handler.cpp: wardenLoadedModule_->load() (MD5+RC4 via Warden)

All uses are protocol-mandated by Blizzard's WoW/Warden spec and cannot
be replaced without breaking server interoperability.
2026-02-19 17:06:49 -08:00
Kelsi
28b4a3a599 Fix TBC item query parser: add TBC-specific parseItemQueryResponse override
TBC 2.4.3 SMSG_ITEM_QUERY_SINGLE_RESPONSE differs from WotLK: no Flags2,
no BuyCount, statsCount-many stat pairs (not always 10), and no
ScalingStatDistribution/ScalingStatValue. Without this override,
TbcPacketParsers fell back to the WotLK parser and misread stats/armor
with a cascading 16-byte offset. Classic (Vanilla) was already safe via
its own independent ClassicPacketParsers::parseItemQueryResponse().
2026-02-19 16:58:18 -08:00
Kelsi
764f2b8edc Fix missing armor in WotLK item tooltips and character stats
SMSG_ITEM_QUERY_SINGLE_RESPONSE in WotLK 3.3.5a sends BuyCount as a
separate field before BuyPrice. The parser was skipping only one of the
two fields, shifting every subsequent read by 4 bytes. This caused
statsCount to be read from ContainerSlots (always 0 for non-bags) so
no stat pairs were parsed, and the armor field was read from the wrong
offset in the damage block — leaving all stat bonuses and armor at 0.

Also moved armor above stat bonuses in the item tooltip to match WoW's
canonical tooltip layout (armor, then green stat lines).
2026-02-19 16:52:04 -08:00
Kelsi
d7692ab88e Smooth other-player movement with velocity dead reckoning
Previously other players jittered because the entity sat frozen at its
destination between movement packets, then snapped to the new start
position on the next packet (stop-pop-stop-pop at ~10 Hz).

Entity interpolation now tracks a smoothed velocity and dead-reckons
past the end of each packet window, so the entity keeps gliding at the
estimated speed until the next server update arrives. Movement stops
only after two consecutive intervals with no new packet (entity has
genuinely stopped).

Also replaced the raw packet-delta duration with an exponential moving
average (EMA) per player. A single slow or fast packet no longer spikes
the playback speed; the EMA converges on the actual send rate (~100 ms)
and absorbs jitter without adding a fixed input-latency penalty.
2026-02-19 16:45:39 -08:00
Kelsi
2bbd0fdc5f Fix movement desync: strafe animation and missing SET_FACING
Two bugs caused the client to look like a bot to server GMs:

1. Strafe animation played during forward+strafe (W+A) instead of the
   walk/run animation. Added pureStrafe guard so strafe animations only
   play when exclusively strafing (no forward key or auto-run active).

2. CMSG_MOVE_SET_FACING was never sent on mouse-look turns. The server
   predicts movement from the last known facing; without SET_FACING the
   heartbeat position appeared to teleport each time the player changed
   direction. Now sent at up to 10 Hz whenever facing changes >3°,
   skipped while keyboard-turning (handled server-side by TURN flags).
2026-02-19 16:40:17 -08:00
Kelsi
4e5d424b34 Revert "License update: if Turtle WoW bans my account, they don’t get to use my client"
This reverts commit 16f8b0177e.
2026-02-19 16:19:01 -08:00
Kelsi
c69457ae3b apply pending protocol, ui, audio, and CodeQL fixes 2026-02-19 16:17:06 -08:00
Kelsi
586fb88c5f docs+security: sync controls and scope Warden RC4 CodeQL exception 2026-02-19 15:54:35 -08:00
Kelsi
00086c2ad9 Add CI security suite and scrub hardcoded local host/path defaults 2026-02-19 06:46:11 -08:00
Kelsi
550366df07 Fix item destroy packet format and wire destroy confirmation UI 2026-02-19 06:34:06 -08:00
Kelsi
0ea1106b05 Tune M2 lantern flame glow without restoring card artifacts 2026-02-19 06:12:32 -08:00
Kelsi
3c754801c4 Stabilize buyback flow and single-row buyback UI
- keep vendor buyback as one-item LIFO row in vendor window

- add robust pending buyback tracking with wire slot probing (74..85)

- recover from stale optimistic sell/buyback entries and refresh vendor list

- keep buy packet construction branch-compatible (direct packet build)
2026-02-19 05:48:40 -08:00
Kelsi
1fdf450c5e Fix buyback request flow and prune temporary diagnostics
- implement vendor buyback state in GameHandler (buyback item list + pending sell tracking)

- send CMSG_BUYBACK_ITEM with WotLK/AzerothCore absolute buyback slot (74 + ui index)

- consume 0x46A/0x480 vendor side-channel packets safely without relying on token slot mapping

- keep sell/buy failure handling synced with buyback list and chat errors

- remove temporary packet hex/trace logging used during buyback debugging
2026-02-19 05:28:13 -08:00
Kelsi
871da33942 Clean README mentions and finalize current gameplay/UI fixes 2026-02-19 03:31:49 -08:00
Kelsi
16f8b0177e License update: if Turtle WoW bans my account, they don’t get to use my client 2026-02-19 03:22:37 -08:00
Kelsi
630c877830 Fix CI build: avoid missing GameHandler interaction-cast API 2026-02-19 03:17:10 -08:00
Kelsi
19525067cf Fix quest reward selection index mapping for choose-reward 2026-02-19 03:12:57 -08:00
Kelsi
506e841ce0 Handle SMSG_QUESTGIVER_QUEST_LIST (0x185) for questgiver flows 2026-02-19 02:53:44 -08:00
Kelsi
e778e21f6f Fix minimap mute behavior and shallow-water swim trigger 2026-02-19 02:46:52 -08:00
Kelsi
dddd2a71ca Fix creature flame alpha-key rendering and emissive flicker 2026-02-19 02:39:33 -08:00
Kelsi
8d4d9b7169 Fix quest flow regressions, tooltip compare stats, and M2 alpha-key handling 2026-02-19 02:27:01 -08:00
Kelsi
512d60c9be Fix gossip quest flow and questgiver marker state 2026-02-19 02:04:56 -08:00
Kelsi
b3ea6d8e81 Refine bag UI layout and add shift-hover item compare 2026-02-19 01:50:50 -08:00
Kelsi
fc0ac6dd0f Fix combat facing updates and dead-on-spawn creature pose 2026-02-19 01:19:29 -08:00
Kelsi
8efc21115f Fix quest turn-in flow and WoW quest text placeholders 2026-02-19 01:12:14 -08:00
Kelsi
a37004db03 Remove temporary quest query diagnostics 2026-02-19 00:59:46 -08:00
Kelsi
4fcf869e34 Stabilize quest log details loading and turn-in item sync 2026-02-19 00:56:24 -08:00
Kelsi
334d4d3df6 Fix quest log titles and full-row selection behavior 2026-02-19 00:30:21 -08:00
Kelsi
cabf897683 Ignore zero-id forced quest removals to prevent spawn spam 2026-02-18 23:48:11 -08:00
Kelsi
79903cfdd4 Make loot parser tolerant of compact item layouts for quest drops 2026-02-18 23:46:11 -08:00
Kelsi
0c99e2ee95 Suppress remaining unknown Turtle opcodes with safe consume mappings 2026-02-18 23:42:28 -08:00
Kelsi
ddcd2b302e Map and handle additional Turtle combat/movement world opcodes 2026-02-18 23:38:34 -08:00
Kelsi
494a8b5acc Tie opcode handlers into movement, quest log, and world state caches 2026-02-18 23:30:38 -08:00
Kelsi
a1c16762af Handle remaining Turtle world opcodes with safe minimal parsers 2026-02-18 23:26:58 -08:00
Kelsi
e2b3c3c265 Remove leftover compressed update debug trace 2026-02-18 23:16:20 -08:00
Kelsi
4684db10af Reduce unhandled opcode spam and add missing Turtle opcode names 2026-02-18 23:14:01 -08:00
Kelsi
e9732dd9a6 Remove temporary WMO texture diagnostics 2026-02-18 23:10:11 -08:00
Kelsi
340a08f947 Fix WMO texture loading by always wiring asset manager 2026-02-18 23:08:43 -08:00
Kelsi
7f4cd41dfc Retry one-time WMO reload when textures resolve to white 2026-02-18 23:02:59 -08:00
Kelsi
4d2d9a7d6a Fix WMO texture state leakage and remove debug spam 2026-02-18 23:00:46 -08:00
Kelsi
a30525d7c9 Fix WMO visibility culling and renderer initialization guards 2026-02-18 22:41:05 -08:00