Compare commits

...

960 commits

Author SHA1 Message Date
Kelsi
ea8b0d9305 fix: reduce warmup ground-check timeout from 20s to 5s
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
The warmup loop waited up to 20 seconds for getHeightAt() to return a
terrain height within 15 units of spawn Z before accepting the ground
as ready. In practice, the terrain was loaded and the character was
visibly standing on it, but the height sample didn't match closely
enough (terrain LOD, chunk boundary, or server Z vs client height
mismatch).

Reduce the tile-count fallback timeout from 20s to 5s: if at least 4
tiles are loaded after 5 seconds, accept the ground as ready. The
exact height check still runs in the first 5 seconds for fast-path
cases where it does match.
2026-03-31 01:27:32 -07:00
Kelsi
5ad225313d fix: revert Warden HASH_RESULT fallback — silence is correct behavior
ChromieCraft/AzerothCore tolerates no HASH_RESULT response (continues
session without Warden checks), but immediately kicks on a WRONG hash.
The previous commit sent a fallback SHA1 which the server rejected,
breaking login that was working before.

Restore the skip behavior for WotLK/TBC: stay silent on HASH_REQUEST
when no CR match exists, and advance to WAIT_CHECKS so the rest of the
session proceeds normally. Turtle/Classic servers still get the fallback
hash since they're lenient about wrong values.
2026-03-31 01:18:58 -07:00
Kelsi
f3f7511105 fix: send Warden HASH_RESULT fallback instead of skipping response
Previously, WotLK/TBC servers with no CR match would skip the
HASH_REQUEST response entirely to "avoid account bans". This caused
a guaranteed kick-on-timeout for ALL WotLK servers including
permissive ones like ChromieCraft/AzerothCore.

Now sends a best-effort fallback hash (SHA1 of module image or raw
data) for all server types. Permissive servers accept this and
continue the session normally. Strict servers (Warmane) will reject
it but only kick — same outcome as the previous skip behavior, just
faster feedback.

For strict servers, the correct fix remains providing a .cr file
with pre-computed seed→reply entries for each module.
2026-03-31 01:10:43 -07:00
Kelsi
681e25a4f2 fix: clean up unused parameter style in entity_controller
Use nameless parameters instead of /*comment*/ syntax for unused
args in IObjectTypeHandler interface defaults and overrides.
2026-03-31 00:55:40 -07:00
Kelsi
11561184e6 fix: silence all -Wunused-parameter warnings in entity_controller
Suppress 9 unused parameter warnings in IObjectTypeHandler interface
methods and their overrides by commenting out parameter names:
- Base class: onCreate/onValuesUpdate/onMovementUpdate default empty
  implementations (parameters intentionally unused in base)
- ItemTypeHandler::onCreate: entity param forwarded only to onCreateItem
  which doesn't need it
- CorpseTypeHandler::onCreate: entity param not needed for corpse spawn

Build now produces zero warnings (excluding third-party stb headers).
2026-03-31 00:48:03 -07:00
Kelsi
32bb0becc8 fix: replace placeholder Warden RSA modulus with real Blizzard key
Replace the incorrectly extracted RSA-2048 modulus (which contained
the exponent bytes embedded inside it) with the verified Blizzard
public key used across all pre-Cataclysm clients (1.12.1, 2.4.3,
3.3.5a).

Key confirmed against two independent sources:
- namreeb/WardenSigning ClientKey.hpp (72 verified sniffed modules)
- SkullSecurity wiki Warden_Modules documentation

The modulus starts with 0x6BCE F52D... and ends with ...03F4 AFC7.
Exponent remains 65537 (0x010001).

Verification algorithm: SHA1(module_data + "MAIEV.MOD"), 0xBB-padded
to 256 bytes, RSA verify-recover with raw (no-padding) mode.

Signature failures are non-fatal (log warning, continue loading) so
private-server modules signed with custom keys still work. This is
necessary because servers like ChromieCraft/AzerothCore may use their
own signing keys.

Also update warden_module.hpp status: all implementation items now .
2026-03-30 22:50:47 -07:00
Kelsi
88d047d2fb feat: implement Warden API binding / IAT patching for module imports
Complete the last major Warden stub — the import table parser that
resolves Windows API calls in loaded modules. This is the critical
missing piece for strict servers like Warmane.

Implementation:
- Parse Warden module import table from decompressed data (after
  relocation entries): alternating libraryName\0 / functionName\0
  pairs, terminated by null library name
- For each import, look up the emulator's pre-registered stub address
  (VirtualAlloc, GetTickCount, ReadProcessMemory, etc.)
- Auto-stub unrecognized APIs with a no-op returning 0 — prevents
  module crashes on unimplemented Windows functions
- Patch each IAT slot (sequential dwords at module image base) with
  the resolved stub address
- Add WardenEmulator::getAPIAddress() public accessor for IAT lookups
- Fix initialization order: bindAPIs() now runs inside initializeModule()
  after emulator setup but before entry point call

The full Warden pipeline is now: RC4 decrypt → RSA verify → zlib
decompress → parse executable → relocate → create emulator → register
API hooks → bind imports (IAT patch) → call entry point → extract
exported functions (packetHandler, tick, generateRC4Keys, unload).
2026-03-30 22:38:05 -07:00
Kelsi
248d131af7 feat: implement Warden module callbacks (sendPacket, validateModule, generateRC4)
Implement the three stubbed Warden module callbacks that were previously
TODO placeholders:

- **sendPacket**: Encrypts module output via WardenCrypto RC4 and sends
  as CMSG_WARDEN_DATA through the game socket. Enables modules to send
  responses back to the server (required for strict servers like Warmane).

- **validateModule**: Compares the module's provided 16-byte MD5 hash
  against the hash received during download. Logs error on mismatch
  (indicates corrupted module transit).

- **generateRC4**: Derives new encrypt/decrypt RC4 keys from a 16-byte
  seed using SHA1Randx, then replaces the active WardenCrypto key state.
  Handles mid-session re-keying requested by the module.

Architecture:
- Add setCallbackDependencies() to inject WardenCrypto* and socket send
  function into WardenModule before load() is called
- Use thread_local WardenModule* so C function pointer callbacks (which
  can't capture state) can reach the module's dependencies during init
- Wire dependencies from WardenHandler before module load

Also update warden_module.hpp status markers — RSA verification, zlib,
executable parsing, relocation, and Unicorn emulation are all implemented
(were incorrectly marked as TODO). Only API binding/IAT patching and
RSA modulus verification against real WoW.exe remain as gaps.
2026-03-30 20:29:26 -07:00
Kelsi
7cfaf2c7e9 refactor: complete OpenGL→Vulkan migration (Phase 7)
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Remove all OpenGL/GLEW code and dependencies. The Vulkan renderer has
been the sole active backend for months; these files were dead code.

Deleted (8 files, 641 lines):
- rendering/mesh.cpp+hpp: OpenGL VAO/VBO/EBO wrapper (never instantiated)
- rendering/shader.cpp+hpp: OpenGL GLSL compiler (replaced by VkShaderModule)
- rendering/scene.cpp+hpp: Scene graph holding Mesh objects (created but
  never populated — all rendering uses Vulkan sub-renderers directly)
- rendering/video_player.cpp+hpp: FFmpeg+GL texture uploader (never
  included by any other file — login video feature can be re-implemented
  with VkTexture when needed)

Cleaned up:
- renderer.hpp: remove Scene forward-decl, getScene() accessor, scene member
- renderer.cpp: remove scene.hpp/shader.hpp includes, Scene create/destroy
- application.cpp: remove stale "GL/glew.h removed" comment
- CMakeLists.txt: remove find_package(OpenGL/GLEW), source/header entries,
  and target_link_libraries for OpenGL::GL and GLEW::GLEW
- PKGBUILD: remove glew dependency
- BUILD_INSTRUCTIONS.md: remove glew from all platform install commands
2026-03-30 19:22:36 -07:00
Kelsi
4b379f6fe9 chore: fix executable permissions on 6 scripts
All had shebangs (#!/usr/bin/env bash/python3) but were missing +x:
- restart-worldserver.sh
- tools/diff_classic_turtle_opcodes.py
- tools/gen_opcode_registry.py
- tools/m2_viewer.py
- tools/opcode_map_utils.py
- tools/validate_opcode_maps.py
2026-03-30 18:55:15 -07:00
Kelsi
1e06ea86d7 chore: remove dead code, document water shader wave parameters
- Delete 4 legacy GLSL 330 shaders (basic.vert/frag, terrain.vert/frag)
  left over from OpenGL→Vulkan migration — Vulkan equivalents exist as
  *.glsl files compiled to SPIR-V by the build system
- Delete orphaned mpq_manager.hpp/cpp (694 lines) — not in CMakeLists,
  not included by any file, unreferenced StormLib integration attempt
- Add comments to water.frag.glsl wave constants explaining the
  multi-octave noise design: non-axis-aligned directions prevent tiling,
  frequency increases and amplitude decreases per octave for natural
  water appearance
2026-03-30 18:50:14 -07:00
Kelsi
529985a961 chore: add vendored library version tracking
Add extern/VERSIONS.md documenting pinned versions of all vendored
third-party libraries: Dear ImGui 1.92.6, VMA 3.4.0, miniaudio 0.11.24,
stb_image 2.30, stb_image_write 1.16, Lua 5.1.5.

Notes that Lua 5.1.5 is intentionally old (WoW addon API compatibility).
Helps maintainers track dependency drift and plan upgrades.
2026-03-30 18:46:34 -07:00
Kelsi
4ea36250be chore: expand gitignore, document PKGBUILD deps, fix branch ref
- .gitignore: add compile_commands.json, language server caches
  (.ccls-cache, .cache/clangd), and tag files (ctags, cscope)
- PKGBUILD: add per-dependency comments explaining purpose (SRP auth,
  Warden emulation, MPQ extraction, shader compilation, etc.)
- PKGBUILD: fix source branch from main → master (matches remote HEAD)
2026-03-30 18:42:02 -07:00
Kelsi
3499a7f0ee docs: rewrite architecture.md to reflect current Vulkan-based codebase
Complete rewrite — the previous version extensively referenced OpenGL
(glClearColor, VAO/VBO/EBO, GLSL shaders) throughout all sections.
The project has used Vulkan exclusively for months.

Key changes:
- Replace all OpenGL references with Vulkan equivalents (VkContext,
  VMA, descriptor sets, pipeline cache, SPIR-V shaders)
- Update system diagram to show actual sub-renderer hierarchy
  (TerrainRenderer, WMORenderer, M2Renderer, CharacterRenderer, etc.)
- Document GameHandler SOLID decomposition (8 domain handlers +
  EntityController + GameServices dependency injection)
- Add Warden 4-layer architecture section
- Add audio system section (miniaudio, 5 sound managers)
- Update opcode count from "100+" to 664+
- Update UI section: talent screen and settings are implemented (not TODO)
- Document threading model (async terrain, GPU upload queue, normal maps)
- Fix dependencies list (Vulkan SDK, VMA, vk-bootstrap, Unicorn, FFmpeg)
- Add container builds and CI platforms
- Remove stale "TODO" items for features that are complete
2026-03-30 18:36:09 -07:00
Kelsi
dab534e631 docs: fix stale references across 10 documentation files
- CONTRIBUTING.md: C++17 → C++20 (matches CMakeLists.txt)
- TROUBLESHOOTING.md: fix log path (~/.wowee/logs/ → logs/wowee.log)
- docs/authentication.md: remove stale "next milestone" (char enum
  and world entry have been working for months)
- docs/srp-implementation.md: update session key status (RC4 encryption
  is implemented), fix file reference to actual src/auth/srp.cpp
- docs/packet-framing.md: remove stale "next steps" (realm list is
  fully implemented), update status with tested servers
- docs/WARDEN_IMPLEMENTATION.md: fix file list — handler is in
  warden_handler.cpp not game_handler.cpp, add warden_memory.hpp/cpp
- docs/WARDEN_QUICK_REFERENCE.md: fix header/source paths (include/
  not src/), add warden_handler and warden_memory
- docs/quickstart.md: fix clone command (--recurse-submodules, WoWee
  not wowee), remove obsolete manual ImGui clone step, fix log path
- docs/server-setup.md: update version to v1.8.9-preview, date to
  2026-03-30, add all supported expansions
- assets/textures/README.md: remove broken doc references
  (TURTLEHD_IMPORT.md, TEXTURE_MANIFEST.txt), update integration
  status to reflect working PNG override pipeline
2026-03-30 18:33:21 -07:00
Kelsi
c103743c3a docs: fix stale keybindings, paths, and API examples
GETTING_STARTED.md:
- Fix keybinding table: T→N for talents, Q→L for quest log, W→M for
  world map, add missing keys (C, I, O, J, Y, K), remove nonexistent
  minimap toggle
- Fix extract_assets.ps1 example param (-WowDirectory → positional)
- Fix Data/ directory tree to match actual manifest layout
- Fix log path: ~/.wowee/logs/ → logs/wowee.log (local directory)

EXPANSION_GUIDE.md:
- Add Turtle WoW 1.17 to supported expansions
- Update code examples to use game_utils.hpp helpers
  (isActiveExpansion/isClassicLikeExpansion/isPreWotlk) instead of
  removed ExpansionProfile::getActive() and GameHandler::getInstance()
- Update packet parser references (WotLK is default in domain handlers,
  not a separate packet_parsers_wotlk.cpp file)
- Update references section with game_utils.hpp
2026-03-30 18:26:47 -07:00
Kelsi
47fe6b8468 docs: update README, CHANGELOG, and status to v1.8.9-preview
- README: update status date to 2026-03-30, version to v1.8.9-preview,
  add container builds line, update current focus to code quality
- CHANGELOG: move v1.8.1 entries to their own section, add v1.8.2-v1.8.9
  unreleased section covering architecture (GameHandler decomposition,
  Docker cross-compilation), bug fixes (7 UB/overflow/safety fixes),
  and code quality (30+ constants, 55+ comments, 8 DRY extractions)
- docs/status.md: update last-updated date to 2026-03-30
2026-03-30 17:40:47 -07:00
Kelsi
cb17c69c40 docs: add why-comments to spellbook icon caching and DBC fallback
- Explain icon load deferral strategy: returning null without caching
  allows retry next frame when budget resets, rather than permanently
  blacklisting icons that were deferred due to rate-limiting
- Explain DBC field fallback logic: hard-coded WotLK indices are a
  safety net when dbc_layouts.json is missing; fieldCount >= 200
  distinguishes WotLK (234 fields) from Classic (148)
2026-03-30 17:32:07 -07:00
Kelsi
1ab254273e docs: add M2 format why-comments to character preview
- Explain M2 version 264 threshold (WotLK stores submesh/bone data
  in external .skin files; Classic/TBC embed it in the M2)
- Explain M2 texture types 1 and 6 (skin and hair/scalp; empty
  filenames resolved via CharSections.dbc at runtime)
- Explain 0x20 anim flag (embedded data; when clear, keyframes live
  in external {Model}{SeqID}-{Var}.anim files)
- Explain geoset ID encoding (group × 100 + variant from
  ItemDisplayInfo.dbc; e.g. 801 = sleeves variant 1)
2026-03-30 17:28:47 -07:00
Kelsi
2c50cc94e1 docs: add why-comments to TBC parsers, bell audio, portrait preview
- packet_parsers_tbc: explain spline waypoint cap (DoS prevention),
  spline compression flags (Catmull-Rom 0x80000 / linear 0x2000 use
  uncompressed format, others use packed delta), spell hit target cap
  (128 >> real AOE max of ~20), guild roster cap (1000 safety limit)
- ambient_sound_manager: explain 1.5s bell toll spacing — matches
  retail WoW cadence, allows each toll to ring out before the next
- character_preview.hpp: explain 4:5 portrait aspect ratio for
  full-body character display in creation/selection screen
2026-03-30 17:26:13 -07:00
Kelsi
92369c1cec docs: add why-comments to rendering, packets, and UI code
- charge_effect: explain inversesqrt guard (prevents NaN on stationary
  character) and dust accumulator rate (30 particles/sec * 16ms)
- swim_effects: explain why insect pipeline disables depth test
  (screen-space sprites must render above water geometry)
- packet_parsers_classic: explain spline waypoint cap (DoS prevention)
  and packed GUID compression format (non-zero bytes only, mask byte)
- talent_screen: explain class ID to bitmask conversion (1-indexed
  WoW class IDs → power-of-2 mask for TalentTab.classMask matching)
- auth_screen: explain login music volume reduction (80% so UI sounds
  remain audible over background track)
2026-03-30 17:23:07 -07:00
Kelsi
e8a4a7402f fix: clamp player percentage stats, add scale field why-comment
- entity_controller: clamp block/dodge/parry/crit/rangedCrit percentage
  fields to [0..100] after memcpy from update fields — guards against
  NaN/Inf from corrupted packets reaching the UI renderer
- entity_controller: add why-comment on OBJECT_FIELD_SCALE_X raw==0
  check — IEEE 754 0.0f is all-zero bits, so raw==0 means the field
  was never populated; keeping default 1.0f prevents invisible entities
2026-03-30 15:48:30 -07:00
Kelsi
4215950dcd refactor: extract class/race restriction helpers, add DBC fallback comment
- inventory_screen: extract renderClassRestriction() and
  renderRaceRestriction() from two identical 40-line blocks in quest
  info and item info tooltips. Both used identical bitmask logic,
  strncat formatting, and player-class/race validation (-49 lines net)
- world_map: add why-comment on AreaTable.dbc fallback field indices —
  explains that incorrect indices silently return wrong data and why
  the WotLK stock layout (ID=0, Parent=2, ExploreFlag=3) is chosen
  as the safest default
2026-03-30 15:45:48 -07:00
Kelsi
af604cc442 fix: UB in mouse button polling, null deref in BigNum formatting
- input: fix undefined behavior in SDL mouse button loop — SDL_BUTTON(0)
  computes (1 << -1) which is UB. Start loop at 1 since SDL button
  indices are 1-based (SDL_BUTTON_LEFT=1, RIGHT=3, MIDDLE=2)
- big_num: guard BN_bn2hex/BN_bn2dec against nullptr return on
  OpenSSL allocation failure — previously constructed std::string
  from nullptr which is undefined behavior
2026-03-30 15:37:38 -07:00
Kelsi
fe7912b5fa fix: prevent buffer overflows in Warden PE parsing
- Add bounds checks to readLE32/readLE16 — malformed Warden modules
  could cause out-of-bounds reads on untrusted PE data
- Fix unsigned underflow in PE section loading: if rawDataOffset or
  virtualAddr exceeds buffer size, the subtraction wrapped to a huge
  uint32_t causing memcpy to read/write far beyond bounds. Now skips
  the section entirely and uses std::min with pre-validated maxima
2026-03-30 15:33:03 -07:00
Kelsi
b39f0f3605 refactor: name GUID type and LFG role constants, add why-comments
- world_packets: name kGuidTypeMask/kGuidTypePet/kGuidTypeVehicle
  for chat receiver GUID type detection, with why-comment explaining
  WoW's bits-48-63 entity type encoding and 0xF0FF mask purpose
- lua_engine: name kRoleTank/kRoleHealer/kRoleDamager (0x02/0x04/0x08)
  for WotLK LFG role bitmask, add context on Leader bit (0x01) and
  source packets (SMSG_GROUP_LIST / SMSG_LFG_ROLE_CHECK_UPDATE)
2026-03-30 15:28:18 -07:00
Kelsi
ff72d23db9 refactor: name lighting time constant, replace PI literal with glm
- Name kHalfMinutesPerDay (2880) replacing 8 bare literals across
  time conversion, modulo clamping, and midnight wrap arithmetic.
  Add why-comment: Light.dbc stores time-of-day as half-minutes
  (24h × 60m × 2 = 2880 ticks per day cycle)
- Replace hardcoded 3.14159f with glm::two_pi<float>() in sun
  direction angle calculations (2 occurrences)
2026-03-30 15:23:58 -07:00
Kelsi
55cac39541 refactor: name random/camera constants, add alpha map static_assert
- terrain_manager: extract kRand16Max (65535.0f) from 8 duplicated
  random normalization expressions — 16-bit mask to [0..1] float
- terrain_manager: add static_assert verifying packed alpha unpacks
  to full alpha map size (ALPHA_MAP_PACKED * 2 == ALPHA_MAP_SIZE)
- camera_controller: name kCameraClipEpsilon (0.1f) with why-comment
  preventing character model clipping at near-minimum distance
2026-03-30 15:17:37 -07:00
Kelsi
a389fd2ef4 refactor: name SRP/Warden crypto constants, add why-comments
- srp: name kEphemeralBytes (19 = 152 bits, matches Blizzard client)
  and kMaxEphemeralAttempts (100) with why-comment explaining A != 0
  mod N requirement and near-zero failure probability
- warden_module: add why-comment on 0x400000 module base (default
  PE image base for 32-bit Windows executables)
- warden_module: name kRsaSignatureSize (256 = RSA-2048) with
  why-comment explaining signature stripping (placeholder modulus
  can't verify Blizzard's signatures)
2026-03-30 15:12:27 -07:00
Kelsi
7b4fdaa277 refactor: name memory/taxi constants, add camera jitter why-comment
- memory_monitor: extract kOneGB and kFallbackRAM constants from 6
  duplicated 1024*1024*1024 expressions; name kFieldPrefixLen for
  /proc/meminfo "MemAvailable:" offset (was bare 13)
- camera: add why-comment on projection matrix jitter — column 2 holds
  NDC x/y offset for TAA/FSR2 sub-pixel sampling
- movement_handler: name kMaxTaxiNodeId (384) with why-comment —
  WotLK TaxiNodes.dbc has 384 entries, bitmask is 12 × uint32
2026-03-30 15:07:55 -07:00
Kelsi
548828f2ee refactor: extract color write mask, name frustum epsilon, add comments
- vk_pipeline: extract kColorWriteAll constant from 4 duplicated RGBA
  bitmask expressions across blend mode functions, with why-comment
- frustum: name kMinNormalLenSq epsilon (1e-8) with why-comment —
  prevents division by zero on degenerate planes
- dbc_loader: add why-comment on DBC field width validation — all
  fields are fixed 4-byte uint32 per format spec
- pin_auth: replace 0x30 hex literal with '0' char constant, add
  why-comment on ASCII encoding for server HMAC compatibility
2026-03-30 15:02:47 -07:00
Kelsi
ef787624fe refactor: name M2 sequence flag, replace empty loop with std::advance
- m2_loader: define kM2SeqFlagEmbeddedData (0x20) with why-comment —
  when clear, keyframe data lives in external .anim files and M2 offsets
  are file-relative (reading them from M2 produces garbage). Replaces
  3 bare hex literals across parseAnimTrack and ribbon emitter parsing
- audio_engine: replace empty for-loop iterator advance with
  std::advance() for clarity
2026-03-30 14:59:03 -07:00
Kelsi
d2a7d79f60 refactor: add why-comments to zone tiles, audio cache, socket buffer
- zone_manager: document tile-to-zone key encoding (tileX * 100 + tileY,
  safe because tileY < 64 < 100) and explain that ranges are empirically
  derived from the retail WoW map grid
- audio_engine: expand sample rate comment — miniaudio defaults to
  device rate causing pitch distortion if not set explicitly; name
  kMaxCachedSounds constant with memory budget explanation
- tcp_socket: add why-comment on 4 KB recv buffer sizing — covers
  typical 20-500 byte packets and worst-case ~2 KB UPDATE_OBJECT
2026-03-30 14:52:51 -07:00
Kelsi
8c7db3e6c8 refactor: name FNV-1a/transport constants, fix dead code, add comments
- vk_context: name FNV-1a hash constants (kFnv1aOffsetBasis/kFnv1aPrime)
  with why-comment on algorithm choice for sampler cache
- transport_manager: collapse redundant if/else that both set
  looping=false into single unconditional assignment, add why-comment
  explaining the time-closed path design
- transport_manager: hoist duplicate kMinFallbackZOffset constants out
  of separate if-blocks, add why-comment on icebreaker Z clamping
- entity: expand velocity smoothing comment — explain 65/35 EMA ratio
  and its tradeoff (jitter suppression vs direction change lag)
2026-03-30 14:48:06 -07:00
Kelsi
a940859e6a refactor: name auth security flags, log JSON parse failures
- auth_handler: define kSecurityFlagPin/MatrixCard/Authenticator
  constants (0x01/0x02/0x04) with why-comment explaining WoW login
  challenge securityFlags byte, replace all bare hex literals
- expansion_profile: log warning on jsonInt() parse failure instead
  of silently returning default — makes malformed expansion.json
  diagnosable without debugger
2026-03-30 14:43:50 -07:00
Kelsi
74f0ba010a fix: remove duplicate zone weather, consolidate RNG, name star constants
- weather: remove duplicate setZoneWeather(15) for Dustwallow Marsh —
  second call silently overwrote the first with different parameters
- weather: replace duplicate static RNG in getRandomPosition() with
  shared weatherRng() to avoid redundant generator state
- starfield: extract day/night cycle thresholds into named constants
  (kDuskStart/kNightStart/kDawnStart/kDawnEnd/kFadeDuration)
- skybox: replace while-loop time wrapping with std::fmod — avoids
  O(n) iterations on large time jumps
2026-03-30 14:38:30 -07:00
Kelsi
086f32174f fix: guard fsPath underflow, name WMO doodad mask, add why-comments
- asset_manager: add size guard before fsPath.substr(size-4) in
  tryLoadPngOverride — resolveFile could theoretically return a
  path shorter than the extension
- wmo_loader: name kDoodadNameIndexMask (0x00FFFFFF) with why-comment
  explaining the 24-bit name index / 8-bit flags packing and MODN
  string table reference
- window: add why-comment on LOG_WARNING usage during shutdown —
  intentionally elevated so teardown progress is visible at default
  log levels for crash diagnosis
2026-03-30 14:33:08 -07:00
Kelsi
1151785381 refactor: name ADT vertex constants, add BLP decompression comments
- adt_loader: replace magic 145 with kMCVTVertexCount and 17 with
  kMCVTRowStride — MCVT height grid is 9 outer + 8 inner vertices
  per row across 9 rows
- adt_loader: replace 999999.0f sentinels with numeric_limits
- blp_loader: add why-comments on RGB565→RGB888 bit layout
  (R=bits[15:11], G=[10:5], B=[4:0])
- blp_loader: explain DXT3 4-bit alpha scaling (n * 255 / 15)
- blp_loader: explain palette 4-bit alpha multiply-by-17 trick
  (equivalent to n * 255 / 15, exact for all 16 values)
2026-03-30 14:28:22 -07:00
Kelsi
683e171fd1 fix: VkTexture move/destroy ownsSampler_ flag, extract finalizeSampler
- Fix move constructor and move assignment: set other.ownsSampler_ to
  false after transfer (was incorrectly set to true, leaving moved-from
  object claiming ownership of a null sampler)
- Fix destroy(): reset ownsSampler_ to false after clearing sampler
  handle (was set to true, inconsistent with null handle state)
- Extract finalizeSampler() from 3 duplicated cache-or-create blocks
  in createSampler() overloads and createShadowSampler() (-24 lines)
- Add SPIR-V alignment why-comment in vk_shader.cpp
2026-03-30 14:24:41 -07:00
Kelsi
28e5cd9281 refactor: replace magic bag slot offset 19 with FIRST_BAG_EQUIP_SLOT
- Add Inventory::FIRST_BAG_EQUIP_SLOT = 19 constant with why-comment
  explaining WoW equip slot layout (bags occupy slots 19-22)
- Replace all 19 occurrences of magic number 19 in bag slot calculations
  across inventory_handler, spell_handler, inventory, and game_handler
- Add UNIT_FIELD_FLAGS / UNIT_FLAG_PVP comment in combat_handler
- Add why-comment on network packet budget constants (prevent server
  data bursts from starving the render loop)
2026-03-30 14:20:39 -07:00
Kelsi
4574d203b5 refactor: name M2 renderer magic constants, add why-comments
- Name portal spin wrap value as kTwoPi constant
- Name particle animTime wrap as kParticleWrapMs (3333ms) with
  why-comment: covers longest known emission cycle (~3s torch/campfire)
  while preventing float precision loss over hours of runtime
- Add FBlock interpolation documentation: explain what FBlocks are
  (particle lifetime curves) and note that float/vec3 variants share
  identical logic and must be updated together
2026-03-30 14:14:27 -07:00
Kelsi
6dfac314ee fix: remove dead code, name constants, add why-comments
- renderer: remove no-op assignment (mountAnims_.stand = 0 when already 0)
- renderer: add why-comments on blacksmith WMO ID 96048 (ambient forge
  sounds) with TODO for other smithy buildings
- terrain_renderer: replace 1e30f sentinel with numeric_limits::max(),
  name terrain view distance constant (1200 units ≈ 9 ADT tiles)
- social_handler: add missing LFG case 15, document case 0 nullptr
  return (success = no error message), add enum name comments
2026-03-30 14:10:32 -07:00
Kelsi
4acebff65c refactor: extract fallback textures, add why-comments, name WMO constant
- character_renderer: extract duplicated fallback texture creation
  (white/transparent/flat-normal) into createFallbackTextures() — was
  copy-pasted between initialize() and clear()
- wmo_renderer: replace magic 8192 with kMaxRetryTracked constant,
  add why-comment explaining the fallback-retry set cap (Dalaran has
  2000+ unique WMO groups)
- quest_handler: add why-comment on reqCount=0 fallback — escort/event
  quests can report kill credit without objective counts in query response
2026-03-30 14:06:30 -07:00
Kelsi
f313eec24e refactor: replace magic slot offset 23 with NUM_EQUIP_SLOTS, simplify channel search
- Replace all 11 occurrences of magic number 23 in backpack slot
  calculations with Inventory::NUM_EQUIP_SLOTS across inventory_handler,
  spell_handler, and inventory.cpp
- Add why-comment to NUM_EQUIP_SLOTS explaining WoW slot layout
  (equipment 0-22, backpack starts at 23 in bag 0xFF)
- Add why-comment on 0x80000000 bit mask in item query response
  (high bit flags negative/missing entry response)
- Replace manual channel membership loops with std::find in
  chat_handler.cpp (YOU_JOINED and PLAYER_ALREADY_MEMBER cases)
- Add why-comment on PLAYER_ALREADY_MEMBER reconnect edge case
2026-03-30 14:01:34 -07:00
Kelsi
a9ce22f315 refactor: extract findOnUseSpellId helper, add warden hash comment
- spell_handler: extract duplicated item on-use spell lookup into
  findOnUseSpellId() — was copy-pasted in useItemBySlot and useItemInBag
- warden_handler: add why-comment explaining the door model HMAC-SHA1
  hash table (wall-hack detection for unmodified 3.3.5a client data)
2026-03-30 13:56:45 -07:00
Kelsi
76f493f7d9 refactor: replace goto with structured control flow
- spell_handler.cpp: replace goto-done with do/while(false) for pet
  spell packet parsing — bail on truncated data while always firing
  events afterward
- water_renderer.cpp: replace goto-found_neighbor with immediately
  invoked lambda to break out of nested neighbor search loops
2026-03-30 13:47:14 -07:00
Kelsi
76d29ad669 fix: address PR #31 and #32 review findings
- Dockerfile: fix LLVM apt repo codename (jammy → noble) for ubuntu:24.04
- build-linux.sh: add missing mkdir -p /wowee-build-src before tar extraction
- Dockerfile: remove dead ENV OSXCROSS_VERSION=1.5 and its unset
- CMakeLists: scope -undefined dynamic_lookup to wowee target only
- GameServices: remove redundant game:: qualifier inside namespace game
- application.cpp: zero out gameServices_ after gameHandler reset in shutdown
2026-03-30 13:40:40 -07:00
Kelsi Rae Davis
fe080bed4b
Merge pull request #31 from ldmonster/chore/break-application-from-gamehandler
[chore] refactor: Break Application::getInstance() from GameHandler
2026-03-30 13:26:29 -07:00
Kelsi Rae Davis
9f87c386f7
Merge pull request #32 from ldmonster/chore/container-build-extended
[feat] add multi-platform Docker build system
2026-03-30 13:26:02 -07:00
Paul
af60fe1edc fix cve 2026-03-30 21:15:41 +03:00
Paul
85f8d05061 feat: add multi-platform Docker build system for Linux, macOS, and Windows
Replace the single Ubuntu-based container build with a dedicated
Dockerfile, build script, and launcher for each target platform.

Infrastructure:
- Add .dockerignore to minimize Docker build context
- Add container/builder-linux.Dockerfile (Ubuntu 24.04, GCC, native build)
- Add container/builder-macos.Dockerfile (multi-stage: SDK fetcher + osxcross/Clang 18)
- Add container/builder-windows.Dockerfile (LLVM-MinGW 20240619, vcpkg)
- Add container/macos/sdk-fetcher.py (auto-fetch macOS SDK from Apple catalog)
- Add container/macos/osxcross-toolchain.cmake (auto-detecting CMake toolchain)
- Add container/macos/triplets/arm64-osx-cross.cmake
- Add container/macos/triplets/x64-osx-cross.cmake
- Remove container/builder-ubuntu.Dockerfile (replaced by per-platform Dockerfiles)
- Remove container/build-in-container.sh and container/build-wowee.sh (replaced)

Build scripts (run inside containers):
- Add container/build-linux.sh (tar copy, FidelityFX clone, cmake/ninja)
- Add container/build-macos.sh (arch detection, vcpkg triplet, cross-compile)
- Add container/build-windows.sh (Vulkan import lib via dlltool, cross-compile)

Launcher scripts (run on host):
- Add container/run-linux.sh, run-macos.sh, run-windows.sh (bash)
- Add container/run-linux.ps1, run-macos.ps1, run-windows.ps1 (PowerShell)

Documentation:
- Add container/README.md (quick start, options, file structure, troubleshooting)
- Add container/FLOW.md (comprehensive build flow for each platform)

CMake changes:
- Add macOS cross-compile support (VulkanHeaders, -undefined dynamic_lookup)
- Add LLVM-MinGW/Windows cross-compile support
- Detect osxcross toolchain and vcpkg triplets

Other:
- Update vcpkg.json with ffmpeg feature flags
- Update resources/wowee.rc version string
2026-03-30 20:17:41 +03:00
Paul
a86efaaa18 [refactor] Break Application::getInstance() from GameHandler
Introduce `GameServices` struct — an explicit dependency bundle that
`Application` populates and passes to `GameHandler` at construction time.
Eliminates all 47 hidden `Application::getInstance()` calls in
`src/game/*.cpp`, completing SOLID-D (dependency-inversion) cleanup.

Changes:
- New `include/game/game_services.hpp` — `struct GameServices` carrying
  pointers to `Renderer`, `AssetManager`, `ExpansionRegistry`, and two
  taxi-mount display IDs
- `GameHandler(GameServices&)` replaces default constructor; exposes
  `services() const` accessor for domain handlers
- `Application` holds `game::GameServices gameServices_`; populates it
  after all subsystems are created, then constructs `GameHandler`
  (fixes latent init-order bug: `GameHandler` was previously created
  before `AssetManager` / `ExpansionRegistry`)
- `game_handler.cpp`: duplicate `isActiveExpansion` / `isClassicLikeExpansion` /
  `isPreWotlk` anonymous-namespace helpers removed; `game_utils.hpp`
  included instead
- All domain handlers (`InventoryHandler`, `SpellHandler`, `MovementHandler`,
  `CombatHandler`, `QuestHandler`, `SocialHandler`, `WardenHandler`) replace
  `Application::getInstance().getXxx()` with `owner_.services().xxx`
2026-03-30 09:17:42 +03:00
Kelsi
169595433a debug: add GO interaction diagnostics at every decision point
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Adds [GO-DIAG] WARNING-level logs at:
- Right-click dispatch (raypick hit / re-interact with target)
- interactWithGameObject entry + all BLOCKED paths
- SMSG_SPELL_GO (wasInTimedCast, lastGoGuid, pendingGoGuid state)
- SMSG_LOOT_RESPONSE (items, gold, guid)
- Raypick candidate GO positions (entity pos + hit center + radius)

These logs will pinpoint exactly where the interaction fails:
- No GO-DIAG lines = GOs not in entity manager / not visible
- Raypick GO pos=(0,0,0) = GO position not set from update block
- BLOCKED = guard condition preventing interaction
- SPELL_GO wasInTimedCast=false = timer race (already fixed)
2026-03-29 23:09:28 -07:00
Kelsi
5e83d04f4a fix: GO cast timer fallback cleared state before SMSG_SPELL_GO arrived
The client-side cast timer expires ~50-200ms before the server sends
SMSG_SPELL_GO (float precision + frame timing). Previously the fallback
called resetCastState() which set casting_=false and currentCastSpellId_
=0. When SMSG_SPELL_GO arrived moments later, wasInTimedCast evaluated
to false (false && spellId==0), so the loot path (CMSG_LOOT via
lastInteractedGoGuid_) was never taken. Quest chests never opened.

Now the fallback skips resetCastState() for GO interaction casts, letting
the cast bar sit at 100% until SMSG_SPELL_GO arrives and handles cleanup
properly with wasInTimedCast=true.
2026-03-29 22:58:49 -07:00
Kelsi
cfbae93ce3 fix: client timer fallback re-sent CMSG_GAMEOBJ_USE and cleared loot guid
When the client-side cast timer expired slightly before SMSG_SPELL_GO
arrived, the fallback at update():1367 called performGameObjectInteraction
Now which sent a DUPLICATE CMSG_GAMEOBJ_USE to the server (confusing its
GO state machine), then resetCastState() cleared lastInteractedGoGuid_.
When SMSG_SPELL_GO finally arrived, the guid was gone so CMSG_LOOT was
never sent — quest chests produced no loot window.

Fix: the fallback no longer re-sends USE (server drives the interaction
via SMSG_SPELL_GO). resetCastState() no longer clears
lastInteractedGoGuid_ so the SMSG_SPELL_GO handler can still send LOOT.
2026-03-29 22:45:17 -07:00
Kelsi
785f03a599 fix: stale GO interaction guard broke future casts; premature LOOT interfered
Two remaining GO interaction bugs:

1. pendingGameObjectInteractGuid_ was never cleared after SMSG_SPELL_GO
   or SMSG_CAST_FAILED, leaving it stale. This suppressed CMSG_CANCEL_CAST
   for ALL subsequent spell casts (not just GO casts), causing the server
   to think the player was still casting when they weren't.

2. For chest-like GOs, CMSG_LOOT was sent simultaneously with
   CMSG_GAMEOBJ_USE. If the server starts a timed cast ("Opening"),
   the GO isn't lootable until the cast completes — the premature LOOT
   gets an empty response or is dropped, potentially corrupting the
   server's loot state. Now defers LOOT to handleSpellGo which sends it
   after the cast completes (via lastInteractedGoGuid_).
2026-03-29 22:36:30 -07:00
Kelsi
6b5e924027 fix: GO interaction casts canceled by any movement — quest credit lost
pendingGameObjectInteractGuid_ was always cleared to 0 right before
the interaction, which defeated the cancel-protection guard in
cancelCast(). Any positional movement (WASD, jump) during a GO
interaction cast (e.g., "Opening" on a quest chest) sent
CMSG_CANCEL_CAST to the server, aborting the interaction and
preventing quest objective credit.

Now sets pendingGameObjectInteractGuid_ to the GO guid so:
1. cancelCast() skips CMSG_CANCEL_CAST for GO-triggered casts
2. The cast-completion fallback can re-trigger loot after timer expires
3. isGameObjectInteractionCasting() returns true during GO casts
2026-03-29 22:22:20 -07:00
Kelsi
c1c28d4216 fix: quest objective GOs never granted credit — REPORT_USE skipped for chests
CMSG_GAMEOBJ_REPORT_USE was only sent for non-chest GOs. Chest-type
(type=3) and name-matched chest-like GOs (Bundle of Wood, etc.) went
through a separate path that sent CMSG_GAMEOBJ_USE + CMSG_LOOT but
skipped REPORT_USE. On AzerothCore, REPORT_USE triggers the server-side
HandleGameobjectReportUse which calls GossipHello on the GO script —
this is where many quest objective scripts grant credit.

Restructured so CMSG_GAMEOBJ_USE is sent first for all GO types,
then chest-like GOs additionally send CMSG_LOOT, and REPORT_USE fires
for everything except mailboxes.
2026-03-29 22:04:23 -07:00
Kelsi
f23a7c06d9 fix: nameplate click hitbox used name text width, not health bar width
The click region for targeting via nameplates was bounded by the name
text (nameX to nameX+textSize.x). Short names like "Wolf" produced a
~30px clickable strip, while the health bar below was 80px wide. Clicks
on the bar outside the name text bounds were ignored. Now uses the wider
of name text or health bar for the horizontal hit area.
2026-03-29 21:54:57 -07:00
Kelsi
8376757f7e cleanup: migrate 20 remaining setReadPos(getSize()) to skipAll()
The Packet::skipAll() method was introduced to replace the verbose
setReadPos(getSize()) pattern. 186 instances were migrated earlier,
but 20 survived in domain handler files created after the migration.
Also removes a redundant single-element for-loop wrapper around
SMSG_LOOT_CLEAR_MONEY registration.
2026-03-29 21:51:03 -07:00
Kelsi
ae32b27d6c fix: misplaced brace included 4 unrelated handlers inside instance-difficulty loop
Same class of bug as inventory_handler fix b9ecc26f. The for-loop over
{SMSG_INSTANCE_DIFFICULTY, MSG_SET_DUNGEON_DIFFICULTY} was missing its
closing brace, so GUILD_DECLINE, RAF_EXPIRED, RAF_FAILURE, and
PVP_AFK_RESULT registrations executed inside the loop body — each
registered twice (once per opcode). Currently harmless since duplicate
registration is idempotent, but structurally wrong.
2026-03-29 21:50:55 -07:00
Kelsi
161b7981f9 fix: video player decode loop could spin indefinitely on corrupt files
The while(true) loop retried av_read_frame after seeking to the start
on error. A corrupt file where read fails but seek succeeds would loop
forever, blocking the main thread. Bounded to 500 attempts with a
warning log on exhaustion.
2026-03-29 21:46:10 -07:00
Kelsi
c8dde0985f fix: detached normal-map thread could deadlock shutdown on exception
If generateNormalHeightMapCPU threw (e.g., bad_alloc), the pending
counter was never decremented, causing shutdown() to block forever
waiting for a count that would never reach zero. Added try-catch to
guarantee the decrement. Also strengthened the increment from relaxed
to acq_rel so shutdown()'s acquire load sees the count before the
thread body begins executing.
2026-03-29 21:36:06 -07:00
Kelsi
01ab2a315c fix: achievement message silently truncated by char[256] snprintf
Long achievement names combined with sender name could exceed 256
bytes, silently cutting the message mid-word in chat. Replaced with
std::string concatenation which grows dynamically.
2026-03-29 21:35:56 -07:00
Kelsi
e42f8f1c03 fix: misleading indentation on reputation addon event dispatch
The two fireAddonEvent calls were indented as if conditional on
repChangeCallback_ but actually execute unconditionally (no braces).
Fixed indentation and added clarifying comment.
2026-03-29 21:35:49 -07:00
Kelsi
bbb560f93c fix: data race on collision query profiling counters
queryTimeMs and queryCallCount on WMORenderer and M2Renderer were plain
mutable doubles/uint32s written by getFloorHeight (dispatched on async
threads from CameraController) and read by the main thread. This is
undefined behavior per C++ — thread sanitizer would flag it. Changed to
std::atomic with relaxed ordering (adequate for diagnostics) and updated
QueryTimer to use atomic fetch_add/compare_exchange.
2026-03-29 21:26:11 -07:00
Kelsi
3dd1128ecf fix: unguarded future::get() crashed on render/floor-query worker exceptions
std::future::get() re-throws any exception from the async task. The 6
call sites in the render pipeline (terrain/WMO/M2 workers + animation
worker) and 2 floor-query sites in camera_controller were unguarded,
so a single bad_alloc in any worker would terminate the process with
no recovery. Now wrapped in try-catch with error logging.
2026-03-29 21:26:01 -07:00
Kelsi
74cc048767 fix: watchdog thread called SDL video functions from non-main thread
SDL2 requires video/window functions to be called from the main thread
(the one that called SDL_Init). The watchdog thread was calling
SDL_SetRelativeMouseMode, SDL_ShowCursor, and SDL_SetWindowGrab directly
on stall detection — undefined behavior on macOS (Cocoa requires main-
thread UI calls) and unsafe on other platforms.

Now the watchdog sets an atomic flag, and the main loop checks it at the
top of each iteration, executing the SDL calls on the correct thread.
2026-03-29 21:15:49 -07:00
Kelsi
5583573beb fix: eliminate last std::rand() calls — music shuffle and UI weather
zone_manager.cpp used std::rand() for music track selection with modulo
bias and global state. game_screen.cpp used std::rand() for rain/snow
particle positions. Both now use local std::mt19937 seeded from
random_device. Also removes the global srand(time(nullptr)) call since
no code depends on the C rand() seed anymore.

No std::rand() or srand() calls remain in the codebase.
2026-03-29 21:01:51 -07:00
Kelsi
a55eacfe70 fix: weather particles and cycle durations deterministic due to unseeded rand()
8 rand() calls in weather.cpp used C rand() which defaults to seed 1.
Weather intensity rolls, cycle durations, and particle Y positions were
identical on every launch. Replaced with a file-local mt19937 seeded
from random_device, matching the RNG already present in getRandomPosition.
2026-03-29 20:53:38 -07:00
Kelsi
294c91d84a fix: migrate 197 unsafe packet bounds checks to hasRemaining/getRemainingSize
All domain handler files used 'packet.getSize() - packet.getReadPos()'
which underflows to ~2^64 when readPos exceeds size (documented in
commit ed63b029). The game_handler.cpp and packet_parsers were migrated
to hasRemaining(N) in an earlier cleanup, but the domain handlers were
created after that migration by the PR #23 split, copying the old
unsafe patterns back in. Now uses hasRemaining(N) for comparisons and
getRemainingSize() for assignments across all 7 handler files.
2026-03-29 20:53:26 -07:00
Kelsi
849542d01d fix: doodad/mount animations synchronized due to unseeded rand()
All 8 rand() calls for animation time offsets and variation timers in
m2_renderer.cpp used C rand() which defaults to seed 1 without srand(),
producing identical sequences every launch. Trees, torches, and grass
all swayed in sync. Replaced with std::mt19937 seeded from
random_device. Same fix for 4 mount idle fidget/sound timer sites in
renderer.cpp which mixed rand() with the mt19937 already present.
2026-03-29 20:42:10 -07:00
Kelsi
16aaf58198 fix: M2 readString uint32 overflow in bounds check
offset + length was computed in uint32_t before comparing to size_t.
A crafted M2 with offset=0xFFFFFFFF, length=2 wraps to 1 in uint32,
passing the check and reading out of bounds. Now uses size_t arithmetic,
matching the readArray fix from an earlier round.
2026-03-29 20:41:56 -07:00
Kelsi
fa1643dc90 fix: WMO readArray integer overflow in bounds check
count * sizeof(T) was computed in uint32_t — a large count value from a
crafted WMO file could wrap to a small number, pass the bounds check,
then attempt a multi-GB allocation causing OOM/crash. Now uses 64-bit
arithmetic with a 64MB sanity cap, matching the M2 loader pattern.
2026-03-29 20:32:47 -07:00
Kelsi
b007a525a6 fix: Lua UnitIsAFK/UnitIsDND/UnitIsGhost/UnitIsPVPFreeForAll read wrong field
All four functions read UNIT_FIELD_FLAGS instead of PLAYER_FLAGS.
- AFK (0x01) hit UNIT_FLAG_SERVER_CONTROLLED — vendors flagged as AFK
- DND (0x02) hit UNIT_FLAG_NON_ATTACKABLE — guards flagged as DND
- Ghost (0x100) hit UNIT_FLAG_IMMUNE_TO_PC — immune NPCs flagged as ghost
- FFA PvP (0x80000) hit UNIT_FLAG_PACIFIED — pacified mobs flagged FFA

All now correctly read PLAYER_FLAGS with the right bit masks (0x01,
0x02, 0x10, 0x80 respectively), matching entity_controller.cpp which
already uses the correct field.
2026-03-29 20:32:39 -07:00
Kelsi
f02be1ffac fix: tolower/toupper UB on signed char at 10 remaining call sites
Final sweep across mpq_manager, application, auth_screen, wmo_renderer,
character_renderer, and terrain_manager. All now use the unsigned char
cast pattern. No remaining bare ::tolower/::toupper or std::tolower(c)
calls on signed char in the codebase.
2026-03-29 20:27:16 -07:00
Kelsi
34e384e1b2 fix: tavern music always played first track — index never incremented
tavernTrackIndex was initialized to 0 but never modified, so the player
always heard TavernAlliance01.mp3. Added post-increment to rotate
through the 3 available tracks on each tavern entry.
2026-03-29 20:27:08 -07:00
Kelsi
a1575ec678 fix: WDT MWMO parser used unbounded strlen on chunk data
std::strlen on raw MWMO chunk data has no upper bound if the chunk
lacks a null terminator (truncated/corrupt WDT file). Replaced with
strnlen bounded by chunkSize, matching the ADT parser fix in d776226f.
2026-03-29 20:26:58 -07:00
Kelsi
7f5cad63cd fix: WMO group debug log throttle was per-process, not per-model
static int logCount/batchLogCount inside the per-group parse loop
accumulated globally, so after the first WMO with many sub-chunks
loaded, no subsequent WMO group would ever log. Changed to function-
local / loop-index-based throttle so each group gets its own window.
2026-03-29 20:14:53 -07:00
Kelsi
fa15a3de1f fix: transport elapsed time lost millisecond precision after ~4.5 hours
elapsedTime_ was float (32-bit, ~7 significant digits). At 16384
seconds the float can only represent integers, so elapsedTime_*1000
jumps in 1-second steps — ships and elevators visibly jerk. Changed to
double (53-bit mantissa) which maintains sub-millisecond precision for
~285 million years. Also changed lastServerUpdate to double to match.
2026-03-29 20:14:45 -07:00
Kelsi
ef25785404 fix: terrain chunk UBO allocation failure crashed GPU via null descriptor
vmaCreateBuffer return value was silently discarded in both loadTerrain
and loadTerrainIncremental. If allocation failed (OOM/fragmentation),
the chunk proceeded with a VK_NULL_HANDLE UBO, causing the GPU to read
from an invalid descriptor on the next draw call. Now checks the return
value and skips the chunk on failure.
2026-03-29 20:14:35 -07:00
Kelsi
c1f6364814 cleanup: remove misleading (void)flags — variable IS used for crit check
The cast falsely suggests flags is unused but it's read on the next
line for isCrit = (flags & 0x02). Also inlines the periodicLog discard.
2026-03-29 20:05:45 -07:00
Kelsi
568a14852d fix: WMO MODS parser raw memcpy without bounds check
The doodad set name read used raw memcpy(20 bytes) bypassing the safe
read<T> template that returns {} on OOB. A truncated WMO file would
read past the vector's storage. Added bounds check before the memcpy.
2026-03-29 20:05:37 -07:00
Kelsi
b5fba65277 fix: BLP loader OOB read on ARGB8888 and signed overflow on dimensions
ARGB8888 decompression read pixelCount*4 bytes from mipData without
checking that mipSize was large enough — a truncated BLP caused heap
OOB reads. Also, 'int pixelCount = width * height' overflowed for
large dimensions (signed int UB). Now validates dimensions <= 4096,
uses uint32_t arithmetic, and checks mipSize >= required for ARGB8888.
2026-03-29 20:05:29 -07:00
Kelsi
59bbeaca62 fix: ::toupper/::tolower UB on signed char at 5 remaining call sites
std::toupper(int) and std::tolower(int) have undefined behavior when
passed a negative value. These sites passed raw signed char without
casting to unsigned char first, unlike the rest of the codebase which
already uses the correct pattern. Affects auth (account names), world
packets, and mount sound path matching.
2026-03-29 19:58:36 -07:00
Kelsi
d776226fd1 fix: ADT parser OOB reads on sub-chunk headers and unterminated strings
1. MCNK sub-chunk bounds checks didn't account for the 8-byte header
   skip, so parseMCVT/parseMCNR could read up to 8 bytes past the
   validated buffer when sub-chunk headers are present (the common case).

2. parseMTEX/parseMMDX/parseMWMO used unbounded strlen on raw chunk
   data. A truncated file without a null terminator would read past the
   chunk boundary. Replaced with strnlen bounded by remaining size.

Also removes dead debug code: empty magic buffer copy, cathedral WMO
search, and Stormwind placement dump (which also had ::toupper UB).
2026-03-29 19:58:28 -07:00
Kelsi
f2237c5531 perf: switch 3 spawn queues from vector to deque
pendingPlayerSpawns_, deferredEquipmentQueue_, and
pendingGameObjectSpawns_ are consumed from the front via erase(begin()),
which is O(n) on vector (shifts all elements). With many spawns queued
(entering a city), this made the processing loop O(n²). deque supports
O(1) front erasure. pendingCreatureSpawns_ already used deque.
2026-03-29 19:51:26 -07:00
Kelsi
3b7ac068d2 perf: hoist key array read out of per-sequence loop in parseAnimTrackVanilla
readArray was called inside the loop on every iteration, re-parsing the
entire flat key array via memcpy. For a model with 200 sequences and
10k keys this produced ~24MB of redundant copying. Now reads once before
the loop (matching how allTimestamps was already handled).
2026-03-29 19:51:17 -07:00
Kelsi
c4d2b1709e fix: SMSG_RANDOM_ROLL parsed fields in wrong order — garbled /roll output
WotLK format is min(4)+max(4)+result(4)+guid(8)=20 bytes. The parser
read guid(8) first (treating min|max as a uint64), then targetGuid(8)
(non-existent field), then the actual values at wrong offsets. Every
/roll message showed garbled numbers and a bogus roller identity.

Also adds a hasRemaining guard for the 64 bytes of damage/armor/resist
fields in the item query parser — previously read past end with silent
zero-fill on truncated packets.
2026-03-29 19:51:07 -07:00
Kelsi
0ee57f4257 fix: FBlock comment said 'CImVector 4 bytes RGBA' but code reads C3Vector
The comment would lead a maintainer to "fix" the working code to read
4-byte RGBA instead of 3-float C3Vector. Updated to match the actual
M2 particle FBlock color format (3 floats, values 0-255, per WoWDev).
2026-03-29 19:43:57 -07:00
Kelsi
d731e0112e fix: std::tolower(char) UB on signed char at 3 call sites
std::tolower(int) has undefined behavior when passed a negative value,
which signed char produces for bytes > 127. The rest of the codebase
correctly casts to unsigned char first; these 3 sites were missed.
2026-03-29 19:43:46 -07:00
Kelsi
27b2322444 fix: chat mention highlight only covered first line of wrapped messages
The golden tint rect was drawn before rendering with a hardcoded single-
line height. Multi-line wrapped messages only had the first line
highlighted. Now drawn after EndGroup() using GetItemRectMin/Max so the
rect covers all wrapped lines.

Also fixes std::tolower(char) UB at two call sites — negative char
values (extended ASCII) are undefined behavior without unsigned cast.
2026-03-29 19:43:38 -07:00
Kelsi
ed63b029cd fix: getRemainingSize() underflowed when readPos exceeded data size
Both operands are size_t (unsigned), so if readPos > data.size() the
subtraction wrapped to ~0 instead of returning 0. This could happen
via setReadPos() which has no bounds check. Downstream hasRemaining()
was already safe but getRemainingSize() callers (e.g. hasFullPackedGuid)
would see billions of bytes available.
2026-03-29 19:36:41 -07:00
Kelsi
9da97e5e88 fix: partial send on non-blocking socket silently dropped data
A single send() that returned fewer bytes than requested was logged but
not retried, leaving the server with a truncated packet. This causes an
irreversible TCP framing desync (next header lands mid-payload) that
manifests as a disconnect under network pressure. Added a retry loop
that handles EWOULDBLOCK with a brief yield.

Also rejects payloads > 64KB instead of silently truncating the 16-bit
CMSG size field, which would have written a wrong header while still
appending all bytes.
2026-03-29 19:36:32 -07:00
Kelsi
e5b4e86600 fix: misleading indentation on BAG_UPDATE/UNIT_INVENTORY_CHANGED emits
The two emit calls were indented 12 spaces (suggesting a nested block)
instead of 8 (matching the enclosing if). Same class of maintenance
trap as the PLAYER_ALIVE/PLAYER_UNGHOST fix in b3abf04d.
2026-03-29 19:31:29 -07:00
Kelsi
061a21da8f fix: guild event string never appended; /leave left stale party state
1. Contradictory condition (!numStrings && numStrings >= 1) was always
   false, so unknown guild event messages never included the server's
   context string. Fixed to just numStrings >= 1.

2. leaveParty() only sent the packet without clearing partyData or
   firing addon events, so /leave left party frames visible until the
   server pushed an update. Now delegates to leaveGroup() which handles
   both the packet and local state cleanup.
2026-03-29 19:31:21 -07:00
Kelsi
3da3638790 cleanup: remove misleading (void)reasonType — variable IS used below
The cast falsely suggests reasonType is unused, but it's read on lines
3699-3702 for AFK/vote-kick differentiation. Same class of issue as
the (void)isPlayerTarget fix in commit 6731e584.
2026-03-29 19:23:05 -07:00
Kelsi
84c0ced228 fix: friend cache inserted empty key; ignore erase before server confirm
handleFriendStatus inserted into friendsCache with an empty playerName
when the name query hadn't resolved yet, creating a phantom "" entry.
Now guards with !playerName.empty().

removeIgnore erased from ignoreCache immediately without waiting for
server confirmation, desyncing the cache if the server rejected. Now
only clears the GUID set and lets the next SMSG_IGNORE_LIST rebuild
the cache, consistent with how removeFriend works.
2026-03-29 19:22:55 -07:00
Kelsi
731d9a88fb fix: SMSG_AUCTION_BIDDER_NOTIFICATION read itemEntry at wrong offset
The handler treated the second uint32 (auctionId) as itemEntry. The
real itemEntry is at byte 24 after auctionHouseId(4)+auctionId(4)+
bidderGuid(8)+bidAmount(4)+outbidAmount(4). Outbid chat messages always
referenced the wrong item.
2026-03-29 19:22:44 -07:00
Kelsi
5b9b8b59ba refactor: extract buildItemDef from 4 copy-pasted blocks in rebuildOnlineInventory
The same 25-line block copying ~20 fields from itemInfoCache_ into
ItemDef was duplicated for equipment, backpack, keyring, and bag slots.
Extracted into buildItemDef() so new fields only need adding once.
Net -100 lines.
2026-03-29 19:16:36 -07:00
Kelsi
e72cb4d380 fix: async creature upload budget blocked cache hits and failures
The per-tick GPU upload budget check ran before consuming async futures,
so after 1 upload ALL remaining ready results were deferred — including
permanent failures and cache hits that need zero GPU work. Moved the
budget gate after failure/cache-hit processing so only actual uploads
count. Re-queues over-budget results as pending spawns for next frame.
2026-03-29 19:16:27 -07:00
Kelsi
05cfcaacf6 fix: clearTarget fired PLAYER_TARGET_CHANGED before zeroing targetGuid
Callbacks and addons querying the current target during this event saw
the old (stale) target instead of null. setTarget correctly updates the
GUID before firing — clearTarget now does the same.
2026-03-29 19:16:18 -07:00
Kelsi
bf63d8e385 fix: static lastSpellCount shared across SpellHandler instances
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
The spellbook tab dirty check used a function-local static, meaning
switching to a character with the same spell count would skip the
rebuild and return the previous character's tabs. Changed to an
instance member so each SpellHandler tracks its own count.
2026-03-29 19:08:58 -07:00
Kelsi
e629898bfb fix: nameplate health bar division by zero when maxHealth is 0
Freshly spawned entities have maxHealth=0 before fields populate.
0/0 produces NaN which propagates through all geometry calculations
for that nameplate frame. Guard with a maxHealth>0 check.
2026-03-29 19:08:51 -07:00
Kelsi
7462fdd41f refactor: extract buildForceAck from 5 duplicated force-ACK blocks
All five force-ACK handlers (speed, root, flag, collision-height,
knockback) repeated the same ~25-line GUID+counter+movementInfo+coord-
conversion+send sequence. Extracted into buildForceAck() which returns
a ready-to-send packet with the movement payload already written.

This also fixes a transport coordinate conversion bug: the collision-
height handler was the only one that omitted the ONTRANSPORT check,
causing position desync when riding boats/zeppelins. buildForceAck
handles transport coords uniformly for all callers.

Net -80 lines.
2026-03-29 19:08:42 -07:00
Kelsi
5fcb30be1a cleanup: remove dead debug loop in buildCreatureDisplayLookups
Loop iterated 20 hair geoset lookups for Human Male but the if-body
was empty — the LOG statement that was presumably there was removed
but the loop skeleton was left behind.
2026-03-29 19:01:41 -07:00
Kelsi
a1252a56c9 fix: forceClearTaxiAndMovementState cleared unrelated death/resurrect state
A function for taxi/movement cleanup was resetting 10 death-related
fields (playerDead_, releasedSpirit_, resurrectPending_, etc.), which
could cancel a pending resurrection or mark a dead player as alive
when called during taxi dismount. Death state is owned by
entity_controller and resurrect packet handlers, not movement cleanup.
2026-03-29 19:01:34 -07:00
Kelsi
2e1f0f15ea fix: auction house refresh failed after browse-all (empty name search)
The auto-refresh after successful bid/buyout was gated on
lastAuctionSearch_.name.length() > 0, so a browse-all search (empty
name) would never refresh. Replaced with a hasAuctionSearch_ flag
that's set on any search regardless of the name filter.
2026-03-29 19:01:06 -07:00
Kelsi
a2340dd702 fix: level-up notification never fired — early return skipped it
The character-list level update loop used 'return' instead of 'break',
exiting the handler lambda before the level-up chat message, sound
effect, callback, and PLAYER_LEVEL_UP event could fire. Since the
player GUID is always in the character list, the notification code
was effectively dead — players never saw "You have reached level N!".
2026-03-29 19:00:54 -07:00
Kelsi
6731e5845a cleanup: remove misleading (void)isPlayerTarget cast
The variable is used earlier in the function for hostile attacker
tracking, so the (void) cast falsely suggests it was unused. Leftover
from a prior refactor.
2026-03-29 18:53:39 -07:00
Kelsi
961af04b36 fix: gossip banker sent CMSG_BANKER_ACTIVATE twice; deduplicate quest icons
Icon==6 and text=="GOSSIP_OPTION_BANKER" both sent BANKER_ACTIVATE
independently. Banking NPCs match both, so the packet was sent twice —
some servers toggle the bank window open then closed. Added sentBanker
guard so only one packet is sent.

Also extracts classifyGossipQuests() from two identical 30-line blocks
in handleGossipMessage and handleQuestgiverQuestList. The icon→status
mapping (5/6/10=completable, 3/4=incomplete, 2/7/8=available) is now
in one place with a why-comment explaining these are protocol-defined.
2026-03-29 18:53:30 -07:00
Kelsi
1a6960e3f9 fix: speed ACK sent before validation caused client/server desync
If the server sent a NaN or out-of-range speed, the client echoed it
back in the ACK (confirming it to the server) but then rejected it
locally. This left the server believing the client accepted the speed
while the client used the old value — a desync only fixable by relog.
Moved validation before the ACK so bad speeds are rejected outright.
2026-03-29 18:53:16 -07:00
Kelsi
3f37ffcea3 refactor: extract SpellHandler::resetAllState from selectCharacter
selectCharacter had 30+ if(spellHandler_) guards reaching into
SpellHandler internals (knownSpells_, spellCooldowns_, playerAuras_,
etc.) to clear per-character state. Consolidated into resetAllState()
so SpellHandler owns its own reset logic and new state fields don't
require editing GameHandler.
2026-03-29 18:46:42 -07:00
Kelsi
fc2c6bab40 fix: strict aliasing violation in handleQueryNextMailTime
reinterpret_cast<float*> on raw packet bytes is undefined behavior per
the C++ strict aliasing rule — compilers can optimize assuming uint8_t
and float never alias. Replaced with packet.readFloat() which uses
memcpy internally. Also switched to hasRemaining() for consistency.
2026-03-29 18:46:34 -07:00
Kelsi
2ae14d5d38 fix: RX silence 15s warning fired ~30 times per window
The 10s silence warning used a one-shot bool guard, but the 15s warning
used a 500ms time window — firing every frame (~30 times at 60fps).
Added rxSilence15sLogged_ guard consistent with the 10s pattern.
2026-03-29 18:46:25 -07:00
Kelsi
3712e6c5c1 fix: operator precedence broke stabled pet parsing — only first pet shown
!packet.hasRemaining(4) + 4 + 4 evaluated as (!hasRemaining(4))+8
due to ! binding tighter than +, making the check always truthy and
breaking out of the loop after the first pet. Hunters with multiple
stabled pets would see only one in the stable master UI.
2026-03-29 18:46:15 -07:00
Kelsi
f681de0a08 refactor: use guidToUnitId() instead of inline 4-way GUID comparison
handleSpellStart and handleSpellGo duplicated the player/target/focus/
pet GUID-to-unitId mapping that already exists in guidToUnitId(). If a
new unit-id category is added (e.g. mouseover), these inline copies
would not pick it up.
2026-03-29 18:39:52 -07:00
Kelsi
6f6571fc7a fix: pet opcodes shared unlearn handler despite incompatible formats
SMSG_PET_GUIDS, SMSG_PET_DISMISS_SOUND, and SMSG_PET_ACTION_SOUND were
registered with the same handler as SMSG_PET_UNLEARN_CONFIRM. Their
different formats (GUID lists, sound IDs with position) were misread as
unlearn cost, potentially triggering a bogus unlearn confirmation dialog.

Also extracts resetWardenState() from 13 lines duplicated verbatim
between connect() and disconnect().
2026-03-29 18:39:38 -07:00
Kelsi
bed859d8db fix: buyback used hardcoded WotLK opcode 0x290 bypassing wireOpcode()
Both buyBackItem() and the retry path in handleBuyFailed constructed
packets with a raw opcode constant instead of using the expansion-aware
BuybackItemPacket::build(). This would silently break if any expansion's
CMSG_BUYBACK_ITEM wire mapping diverges from 0x290.
2026-03-29 18:29:07 -07:00
Kelsi
78e2e4ac4d fix: locomotionFlags missing SWIMMING and DESCENDING
The heartbeat throttle bitmask was missing SWIMMING and DESCENDING,
treating swimming/descending players as stationary and using a slower
heartbeat interval. The identical bitmask in movement_handler.cpp
already included SWIMMING — this inconsistency could cause the server
to miss position updates during swim combat.
2026-03-29 18:28:58 -07:00
Kelsi
4e0e234ae9 fix: MSG_MOVE_START_DESCEND never set DESCENDING flag
Only ASCENDING was cleared — the DESCENDING flag was never toggled,
so outgoing movement packets during flight descent had incorrect flags.
Also clears DESCENDING on start-ascend and stop-ascend for symmetry.

Replaces static heartbeat log counter with member variable (was shared
across instances and not thread-safe) and demotes to LOG_DEBUG.
2026-03-29 18:28:49 -07:00
Kelsi
b0aa4445a0 fix: cast/cooldown/unit-cast timers ticked twice per frame
SpellHandler::updateTimers() (added in 209c2577) already ticks down
castTimeRemaining_, unitCastStates_, and spellCooldowns_. But the
GameHandler::update() loop also ticked them manually — causing casts to
complete at 2x speed and cooldowns to expire twice as fast.

Removed the duplicate tick-downs from update(). The GO interaction
completion check remains (client-timed casts need this fallback).
Also uses resetCastState() instead of manually clearing 4 fields,
adds missing castTimeTotal_ reset, and adds loadSpellNameCache()
to getSpellName/getSpellRank (every other DBC getter had it).
2026-03-29 18:21:03 -07:00
Kelsi
fc2526fc18 fix: env damage alias overwrote handler that preserved damage type
SMSG_ENVIRONMENTALDAMAGELOG (alias) registration at line 173 silently
overwrote the canonical SMSG_ENVIRONMENTAL_DAMAGE_LOG handler at line
108. The alias handler discarded envType (fall/lava/drowning), so the
UI couldn't differentiate environmental damage sources. Removed the
dead alias handler and its method; the canonical inline handler with
envType forwarding is now the sole registration.
2026-03-29 18:20:51 -07:00
Kelsi
0795430390 cleanup: remove dead pos=0 reassignment and demote chat logs to DEBUG
Quest log had a redundant pos=0 right after initialization. Chat handler
logged every incoming/outgoing message at WARNING level, flooding the
log and obscuring genuine warnings.
2026-03-29 18:11:49 -07:00
Kelsi
a30c7f4b1a fix: taxi recovery was dead code — flag cleared before check
taxiRecoverPending_ was unconditionally reset to false in the general
state cleanup, 39 lines before the recovery check that reads it. The
recovery block could never execute. Removed the premature clear so
mid-flight disconnect recovery can actually trigger.
2026-03-29 18:11:37 -07:00
Kelsi
35b952bc6f fix: SMSG_IGNORE_LIST read phantom string field after each GUID
The packet only contains uint8 count + count×uint64 GUIDs, but the
handler called readString() after each GUID. This consumed raw bytes of
subsequent GUIDs as a string, corrupting all entries after the first.
Now stores GUIDs in ignoreListGuids_ and resolves names asynchronously
via SMSG_NAME_QUERY_RESPONSE, matching the friends list pattern.

Also fixes unsafe static_pointer_cast in ready check (no type guard)
and removes redundant packetHasRemaining wrapper (duplicates Packet API).
2026-03-29 18:11:29 -07:00
Kelsi
0e814e9c4a refactor: replace 8 copy-pasted spline speed lambdas with factory
All spline speed opcodes share the same PackedGuid+float format,
differing only in which member receives the value. Replaced 8 identical
lambdas (~55 lines) with a makeSplineSpeedHandler factory that captures
a member pointer, cutting duplication and making it trivial to add new
speed types.
2026-03-29 17:59:51 -07:00
Kelsi
298974ebc2 refactor: extract markPlayerDead to deduplicate death/corpse caching
Both the health==0 and dynFlags UNIT_DYNFLAG_DEAD paths duplicated the
same corpse-position caching and death-state logic with a subtle
asymmetry (only health path called stopAutoAttack). Extracted into
markPlayerDead() so coordinate swapping and state changes happen in one
place. stopAutoAttack remains at the health==0 call site since the
dynFlags path doesn't need it.
2026-03-29 17:59:44 -07:00
Kelsi
dc500fede9 refactor: consolidate buildItemLink into game_utils.hpp
Three identical copies (game_handler.cpp, spell_handler.cpp,
quest_handler.cpp) plus two forward declarations (inventory_handler.cpp,
social_handler.cpp) replaced with a single inline definition in
game_utils.hpp. All affected files already include this header, so
quality color table changes now propagate from one source of truth.
2026-03-29 17:57:05 -07:00
Kelsi
0aff4b155c fix: dismount cleared all indefinite auras instead of just mount aura
The dismount path wiped every aura with maxDurationMs < 0, which
includes racial passives, tracking, and zone buffs — not just the mount
spell. Now only clears the specific mountAuraSpellId_ so the buff bar
stays accurate without waiting for a server aura resync.
2026-03-29 17:56:59 -07:00
Kelsi
8993b8329e fix: isReadableQuestText rejected all non-ASCII UTF-8 text
The range check (c > 0x7E) rejected UTF-8 multi-byte sequences, so quest
titles on localized servers (French, German, Russian, etc.) were treated
as unreadable binary and replaced with 'Quest #ID' placeholders. Now
allows bytes >= 0x80 while still requiring at least one ASCII letter to
distinguish real text from binary garbage.
2026-03-29 17:56:52 -07:00
Kelsi
b3abf04dbb fix: misleading indentation on PLAYER_ALIVE/PLAYER_UNGHOST event emits
The emit calls were indented at a level suggesting they were outside the
if/else blocks, but braces placed them inside. Fixed to match the actual
control flow, preventing a future maintainer from "correcting" the
indentation and accidentally changing the logic.
2026-03-29 17:52:56 -07:00
Kelsi
ec24bcd910 fix: Warrior Charge sent 3x SET_FACING by falling through to generic facing
Charge already computed facing and sent SET_FACING, but then fell through
to both the melee-ability facing block and the generic targeted-spell
facing block — sending up to 3 SET_FACING + 1 HEARTBEAT per cast. Added
facingHandled flag so only one block sends facing, reducing redundant
network traffic that could trigger server-side movement validation.
2026-03-29 17:52:51 -07:00
Kelsi
b9ecc26f50 fix: misplaced brace included book handlers inside LOOT_CLEAR_MONEY loop
The for-loop over {SMSG_LOOT_CLEAR_MONEY} was missing its closing brace,
so SMSG_READ_ITEM_OK and SMSG_READ_ITEM_FAILED registrations were inside
the loop body. Works by accident (single iteration) but fragile and
misleading — future additions to the loop would re-register book handlers.
2026-03-29 17:52:43 -07:00
Kelsi
020e016853 fix: quest reward items stuck as 'Item #ID' due to stale pending queries
Two fixes for item name resolution:

1. Clear entry from pendingItemQueries_ even when response parsing fails.
   Previously a malformed response left the entry stuck in pending forever,
   blocking all retries so the UI permanently showed "Item 12345".

2. Add 5-second periodic cleanup of pendingItemQueries_ so lost/dropped
   responses don't permanently block item info resolution.
2026-03-29 17:44:46 -07:00
Kelsi
51da88b120 fix: SMSG_ITEM_PUSH_RESULT read extra byte causing wrong item count
The handler read an extra uint8 (bag) after bagSlot, shifting all
subsequent fields by 1 byte. This caused count to straddle the count
and countInInventory fields — e.g. count=1 read as 0x03000000 (50M).

Also removes cast bar diagnostic overlay and demotes debug logs.
2026-03-29 17:30:44 -07:00
Kelsi
309fd11a7b fix: cast bar invisible due to stale ImGui saved window position
The cast bar window used ImGuiCond_FirstUseEver for positioning, so
ImGui's .ini state restored a stale off-screen position from a prior
session. Switch to ImGuiCond_Always and add NoSavedSettings flag so
the bar always renders centered near the bottom of the screen.

Also demotes remaining diagnostic logs to LOG_DEBUG.
2026-03-29 17:20:02 -07:00
Kelsi
209c257745 fix: wire SpellHandler::updateTimers and remove stale cast state members
SpellHandler::updateTimers() was never called after PR #23 extraction,
so cast bar timers, spell cooldowns, and unit cast state timers never
ticked. Also removes duplicate cast/queue/spell members left in
GameHandler that shadowed the SpellHandler versions, and fixes
MovementHandler writing to those stale members on world portal.

Demotes SMSG_SPELL_START/CAST_RESULT debug logs to LOG_DEBUG.
2026-03-29 16:49:17 -07:00
Kelsi
d32b35c583 fix: restore Classic aura flag normalization and clean up EntityController
- Restore 0x02→0x80 Classic harmful-to-WotLK debuff bit mapping in
  syncClassicAurasFromFields so downstream checks work across expansions
- Extract handleDisplayIdChange helper to deduplicate identical logic
  in onValuesUpdateUnit and onValuesUpdatePlayer
- Remove unused newItemCreated parameter from handleValuesUpdate
- Fix indentation on PLAYER_DEAD/PLAYER_ALIVE/PLAYER_UNGHOST emit calls
2026-03-29 16:29:56 -07:00
Kelsi Rae Davis
1988b53619
Merge pull request #29 from ldmonster/chore/entity-controller-refactoring
[chore] EntityController refactoring (SOLID decomposition)
2026-03-29 16:25:50 -07:00
Paul
b0a07c2472 refactor(game): apply SOLID phases 2-6 to EntityController
- split applyUpdateObjectBlock into handleCreateObject,
  handleValuesUpdate, handleMovementUpdate
-  extract concern helpers — createEntityFromBlock,
  applyPlayerTransportState, applyUnitFieldsOnCreate/OnUpdate,
  applyPlayerStatFields, dispatchEntitySpawn, trackItemOnCreate,
  updateItemOnValuesUpdate, syncClassicAurasFromFields,
  detectPlayerMountChange, updateNonPlayerTransportAttachment
- UnitFieldIndices, PlayerFieldIndices, UnitFieldUpdateResult
  structs with static resolve() — eliminate repeated fieldIndex() calls
- IObjectTypeHandler strategy interface; concrete handlers
  UnitTypeHandler, PlayerTypeHandler, GameObjectTypeHandler,
  ItemTypeHandler, CorpseTypeHandler registered in typeHandlers_ map;
  handleCreateObject and handleValuesUpdate now dispatch via
  getTypeHandler() — adding a new object type requires zero changes
  to existing handler methods
- PendingEvents member bus; all 27 inline owner_.fireAddonEvent()
  calls in the update path replaced with pendingEvents_.emit(); events
  flushed via flushPendingEvents() at the end of each handler, decoupling
  field-parse logic from the addon callback system

entity_controller.cpp: 1520-line monolith → longest method ~200 lines,
cyclomatic complexity ~180 → ~5; zero duplicated CREATE/VALUES blocks
2026-03-29 14:42:38 +03:00
Paul
f5757aca83 refactor(game): extract EntityController from GameHandler (step 1.3)
Moves entity lifecycle, name/creature/game-object caches, transport GUID
tracking, and the entire update-object pipeline out of GameHandler into a
new EntityController class (friend-class pattern, same as CombatHandler
et al.).

What moved:
- applyUpdateObjectBlock() — 1,520-line core of all entity creation,
  field updates, and movement application
- processOutOfRangeObjects() / finalizeUpdateObjectBatch()
- handleUpdateObject() / handleCompressedUpdateObject() / handleDestroyObject()
- handleNameQueryResponse() / handleCreatureQueryResponse()
- handleGameObjectQueryResponse() / handleGameObjectPageText()
- handlePageTextQueryResponse()
- enqueueUpdateObjectWork() / processPendingUpdateObjectWork()
- playerNameCache, playerClassRaceCache_, pendingNameQueries
- creatureInfoCache, pendingCreatureQueries
- gameObjectInfoCache_, pendingGameObjectQueries_
- transportGuids_, serverUpdatedTransportGuids_
- EntityManager (accessed by other handlers via getEntityManager())

8 opcodes re-registered by EntityController::registerOpcodes():
  SMSG_UPDATE_OBJECT, SMSG_COMPRESSED_UPDATE_OBJECT, SMSG_DESTROY_OBJECT,
  SMSG_NAME_QUERY_RESPONSE, SMSG_CREATURE_QUERY_RESPONSE,
  SMSG_GAMEOBJECT_QUERY_RESPONSE, SMSG_GAMEOBJECT_PAGETEXT,
  SMSG_PAGE_TEXT_QUERY_RESPONSE

Other handler files (combat, movement, social, spell, inventory, quest,
chat) updated to access EntityManager via getEntityManager() and the
name cache via getPlayerNameCache() — no logic changes.

Also included:
- .clang-tidy: add modernize-use-nodiscard,
  modernize-use-designated-initializers; set -std=c++20 in ExtraArgs
- test.sh: prepend clang's own resource include dir before GCC's to
  silence xmmintrin.h / ia32intrin.h conflicts during clang-tidy runs

Line counts:
  entity_controller.hpp  147 lines  (new)
  entity_controller.cpp  2172 lines (new)
  game_handler.cpp       8095 lines (was 10143, −2048)

Build: 0 errors, 0 warnings.
2026-03-29 08:21:27 +03:00
Kelsi
4f2a4e5520 debug: log SMSG_SPELL_START to diagnose missing cast bar
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
2026-03-28 17:00:24 -07:00
Kelsi
71cf3ab737 debug: log CMSG_CAST_SPELL packet size to verify format 2026-03-28 16:56:15 -07:00
Kelsi
d68bb5a831 fix: spell facing used atan2(dy,dx) but canonical convention is atan2(-dy,dx)
The canonical yaw convention (documented in coordinates.hpp) is
atan2(-dy, dx) where X=north, Y=west. North=0, East=+PI/2.

The spell facing code used atan2(dy, dx) (no negation on dy), producing
a yaw ~77° off from the correct server orientation. The server rejected
every cast with "unit not in front" because the sent orientation pointed
in the wrong direction.

Fixed in all 3 locations: charge facing, melee facing, and general
pre-cast facing.
2026-03-28 16:51:23 -07:00
Kelsi
7f3c7379b5 debug: log pre-cast facing orientation details 2026-03-28 16:45:57 -07:00
Kelsi
4ff59c6f76 debug: log castSpell calls and SMSG_CAST_RESULT at WARNING level 2026-03-28 16:41:15 -07:00
Kelsi
1aec1c6cf1 fix: send heartbeat after SET_FACING before cast to ensure server has orientation 2026-03-28 16:27:26 -07:00
Kelsi
9cb6c596d5 fix: face target before casting any targeted spell (not just melee)
Only melee abilities sent MSG_MOVE_SET_FACING before the cast packet.
Ranged spells like Smite used whatever orientation was in movementInfo
from the last movement, causing "target not in front" server rejection.

Now sends a facing update toward the target entity before ANY targeted
spell cast. The server checks a ~180° frontal arc for most spells.
2026-03-28 16:23:27 -07:00
Kelsi
c58537e2b8 fix: load binary DBCs from Data/db/ fallback path
CreatureDisplayInfo.dbc (691KB, 24K+ entries) exists at Data/db/ but
the loader only checked DBFilesClient\ (MPQ manifest) and expansion CSV.
The CSV had only 13248 entries (malformed export), so TBC+ creatures
(Mana Wyrms, Blood Elf area) had no display data and were invisible.

Now checks Data/db/ as a fallback for binary DBCs. This path contains
pre-extracted DBCs shared across expansions. Binary DBCs have complete
record data including proper IDs.
2026-03-28 16:17:59 -07:00
Kelsi
d8c768701d fix: visible item field base 284→283 (confirmed by raw field dump)
RAW FIELDS dump shows item entries at odd indices: 283, 285, 287, 289...
With base=283, stride=2: 17 of 19 slots have valid item IDs (14200,
12020, 14378, etc). Slots 12-13 (trinkets) correctly empty.

With base=284: only 5 entries, and values are enchant IDs (913, 905, 904)
— these are the field AFTER each entry, confirming base was off by 1.
2026-03-28 16:12:31 -07:00
Kelsi
fdca990209 debug: dump raw fields for first 3 players (lowered threshold to size>20) 2026-03-28 16:06:03 -07:00
Kelsi
f74b79f1f8 debug: log outgoing heartbeat coords and chat, fix BG filter for SAY type
Heartbeat: log canonical + wire coords every 30th heartbeat to detect
if we're sending wrong position (causing server to teleport us).

Chat: log outgoing messages at WARNING level to confirm packets are sent.

BG filter: announcer uses SAY (type=0) with color codes, not SYSTEM.
Match "BG Queue Announcer" in message body regardless of chat type.
2026-03-28 16:02:36 -07:00
Kelsi
91c6eef967 fix: suspend gravity for 10s after world entry to prevent WMO fall-through
Stormwind WMO collision takes 25+ seconds to fully load. The warmup
ground check couldn't detect the WMO floor because collision data
wasn't finalized yet. Player spawned and immediately fell through
the unloaded WMO floor into the terrain below (Dun Morogh).

New approach: suspendGravityFor(10s) after world entry. Gravity is
disabled (Z position frozen) until either:
1. A floor is detected by the collision system (gravity resumes instantly)
2. The 10-second timer expires (gravity resumes as fallback)

This handles the case where WMO collision loads during the first few
seconds of gameplay — the player hovers at spawn Z until the floor
appears, then lands normally.

Also fixes faction language for chat (ORCISH for Horde, COMMON for
Alliance) and adds SMSG_MESSAGECHAT diagnostic logging.
2026-03-28 15:50:13 -07:00
Kelsi
b1e2b8866d fix: use faction-correct language for outgoing chat (COMMON vs ORCISH)
Chat was always sent with COMMON (7) language. For Horde players,
AzerothCore rejects COMMON and silently drops the message. Alliance
players nearby also couldn't see Horde messages.

Now detects player race and sends ORCISH (1) for Horde races, COMMON (7)
for Alliance. This matches what the real WoW client sends.
2026-03-28 15:42:01 -07:00
Kelsi
2f96bda6fa fix: far same-map teleport blocked packet handler for 41 seconds
loadOnlineWorldTerrain() was called directly from the worldEntryCallback
inside the packet handler, running the 20s warmup loop synchronously.
This blocked ALL packet processing and froze the game for 20-41 seconds.

Now defers the world reload to pendingWorldEntry_ which is processed on
the next frame, outside the packet handler. Position and camera snap
immediately so the player doesn't drift at the old location.

The /y respawn report was actually a server-initiated teleport (possibly
anti-spam or area trigger) that hit this 41-second blocking path.
2026-03-28 15:38:44 -07:00
Kelsi
9666b871f8 fix: BG announcer filter was suppressing ALL chat messages
The filter matched ALL chat types for patterns like "[H:" + "A:" which
are common in normal messages. Any SAY/WHISPER/GUILD message containing
both substrings was silently dropped. This broke all incoming chat.

Now only filters SYSTEM messages and only matches specific BG announcer
keywords: "Queue status", "BG Queue", "BGAnnouncer".
2026-03-28 15:31:16 -07:00
Kelsi
6edcad421b fix: group invite popup never showing (hasPendingGroupInvite stale getter)
hasPendingGroupInvite() and getPendingInviterName() were inline getters
reading GameHandler's stale copies. SocialHandler owns the canonical
pendingGroupInvite/pendingInviterName state. Players were auto-added to
groups without seeing the accept/decline popup.

Now delegates to socialHandler_.
2026-03-28 15:29:19 -07:00
Kelsi
1af1c66b04 fix: SMSG_TRADE_STATUS_EXTENDED format (whichPlayer is uint32, add missing fields)
WotLK trade packet format was wrong in multiple ways:
- whichPlayer was read as uint8, actually uint32
- Missing tradeId field (we read tradeId as tradeCount)
- Per-slot size was 52 bytes, actually 64 (missing suffixFactor,
  randomPropertyId, lockId = 12 bytes)
- tradeCount is 8 (7 trade + 1 "will not be traded"), not capped at 7

Verified: header(4+4=8) + 8×(1+64=65) + gold(4) = 532 bytes matches
the observed packet size exactly.

Note: Classic trade format differs and will need its own parser.
2026-03-28 15:24:26 -07:00
Kelsi
df9dad952d fix: handle TRADE_STATUS_UNACCEPT (status=8), revert to Open state 2026-03-28 15:21:32 -07:00
Kelsi
ce54b196e7 fix: trade COMPLETE resets state before EXTENDED can populate items/gold
SMSG_TRADE_STATUS(COMPLETE) and SMSG_TRADE_STATUS_EXTENDED arrive in the
same packet batch. COMPLETE was calling resetTradeState() which cleared
all trade slots and gold BEFORE EXTENDED could write the final data.
The trade window showed "7c" (garbage gold) because the gold field read
from the wrong offset (slot size was also wrong: 60→52 bytes).

Now COMPLETE just sets status to None without full reset, preserving
trade state for EXTENDED to populate. The TRADE_CLOSED addon event
still fires correctly.
2026-03-28 15:18:33 -07:00
Kelsi
ed7cbccceb fix: trade slot size check 60→52 bytes, add trade diagnostic logging 2026-03-28 15:14:53 -07:00
Kelsi
615db79819 fix: skip all-zero equipment emit, broaden BG announcer filter
Equipment: the first emitOtherPlayerEquipment call fired before any item
queries returned, sending all-zero displayIds that stripped players naked.
Now skips the callback when resolved=0 (waiting for queries). Equipment
only applies once at least one item resolves, preventing the naked flash.

BG announcer: broadened filter to match ALL chat types (not just SYSTEM),
and added more patterns: "BGAnnouncer", "[H: N, A: N]" with spaces.

Also added diagnostic logging in setOnlinePlayerEquipment to trace
displayId counts reaching the renderer.
2026-03-28 15:09:52 -07:00
Kelsi
12f5aaf286 fix: filter BG queue announcer spam from system chat
ChromieCraft/AzerothCore BG queue announcer module floods chat with
SYSTEM messages like "Queue status for Alterac Valley [H: 12/40, A: 15/40]".
Now filtered by detecting common patterns: "Queue status", "BG Queue",
"Announcer]", and "[H:...A:..." format.

Equipment status: resolved items ARE rendering (head, shoulders, chest,
legs confirmed with displayIds). Remaining unresolved slots (weapons)
are item queries the server hasn't responded to yet — timing issue,
not a client bug. Items trickle in over ~5 seconds as queries return.
2026-03-28 15:01:25 -07:00
Kelsi
11571c582b fix: hearthstone from action bar, far teleport loading screen
Action bar hearthstone: the slot was type SPELL (spell 8690) not ITEM.
castSpell sends CMSG_CAST_SPELL which the server rejects for item-use
spells. Now detects item-use spells via getItemIdForSpell() and routes
through useItemById() instead, sending CMSG_USE_ITEM correctly.

Far same-map teleport: hearthstone on the same continent (e.g., Westfall
→ Stormwind on Azeroth) skipped the loading screen, so the player fell
through unloaded terrain. Now triggers a full world reload with loading
screen for teleports > 500 units, with the warmup ground check ensuring
WMO floors are loaded before spawning.
2026-03-28 14:55:58 -07:00
Kelsi
4e709692f1 fix: filter officer chat for non-officers (server sends to all guild members)
Some private servers (AzerothCore/ChromieCraft) send OFFICER chat type
to all guild members regardless of rank. The real WoW client checks the
GR_RIGHT_OFFCHATLISTEN (0x80) guild rank permission before displaying.

Now checks the player's guild rank rights from the roster data and
suppresses officer chat if the permission bit is not set.
2026-03-28 14:45:51 -07:00
Kelsi
21fb2aa11c fix: backpack window jumps position when selling items (missing ##id in title) 2026-03-28 14:42:21 -07:00
Kelsi
504d112625 fix: gossip/vendor windows not closing when opening mailbox/trainer/taxi
Domain handlers were setting `owner_.gossipWindowOpen = false` directly
on GameHandler's stale member, but isGossipWindowOpen() delegates to
QuestHandler's copy. The gossip window stayed open because the
delegating getter never saw the close.

Fix: use owner_.closeGossip() / owner_.closeVendor() which properly
delegate to QuestHandler/InventoryHandler to close the canonical state.

Affected: InventoryHandler (3 sites: mail, trainer, bank opening),
MovementHandler (1 site: taxi opening), QuestHandler (2 sites: gossip
opening closes vendor).
2026-03-28 14:36:14 -07:00
Kelsi
e5959dceb5 fix: add bare-points spline fallback for flying/falling splines (0x10000) 2026-03-28 12:47:37 -07:00
Kelsi
47bea0d233 fix: use delegating getters for vendor buyback refresh (stale member read) 2026-03-28 12:45:59 -07:00
Kelsi
b81c616785 fix: delegate gossip/quest detail getters to QuestHandler (NPC dialog broken)
4 more stale getters from PR #23 split:
- isGossipWindowOpen() — QuestHandler owns gossipWindowOpen_
- getCurrentGossip() — QuestHandler owns currentGossip_
- isQuestDetailsOpen() — QuestHandler owns questDetailsOpen_
- getQuestDetails() — QuestHandler owns currentQuestDetails_

Also fix GameHandler::update() distance-close checks to use delegating
getters instead of stale member variables for vendor/gossip/taxi/trainer.

Map state (currentMapId_, worldStateZoneId_, exploredZones_) confirmed
NOT stale — domain handlers write via owner_. reference to GameHandler's
members. Those getters are correct as-is.
2026-03-28 12:43:44 -07:00
Kelsi
ee02faa183 fix: delegate all 113 stale GameHandler getters to domain handlers
PR #23 split GameHandler into 8 domain handlers but left 113 inline
getters reading stale duplicate member variables. Every feature that
relied on these getters was silently broken (showing empty/stale data):

InventoryHandler (32): bank, mail, auction house, guild bank, trainer,
  loot rolls, vendor, buyback, item text, master loot candidates
SocialHandler (43): guild roster, battlegrounds, LFG, duels, petitions,
  arena teams, instance lockouts, ready check, who results, played time
SpellHandler (10): talents, craft queue, GCD, pet unlearn, queued spell
QuestHandler (13): quest log, gossip POIs, quest offer/request windows,
  tracked quests, shared quests, NPC quest statuses
MovementHandler (15): all 8 server speeds, taxi state, taxi nodes/data

All converted from inline `{ return member_; }` to out-of-line
delegations: `return handler_ ? handler_->getter() : fallback;`
2026-03-28 12:18:14 -07:00
Kelsi
d6b387ae35 fix: increase tile-count fallback from 10s to 20s to prevent premature spawn 2026-03-28 12:04:54 -07:00
Kelsi
2633a490eb fix: remove reinterpret_cast UB in trade slot delegation
The TradeSlot structs differ between GameHandler (has bag/slot fields)
and InventoryHandler (no bag/slot). The reinterpret_cast was undefined
behavior that corrupted memory, potentially causing the teleport bug.

Now properly copies fields between the two struct layouts.

NOTE: 113 stale getters remain in GameHandler that read duplicate member
variables never updated by domain handlers. These need systematic fixing.
2026-03-28 12:02:08 -07:00
Kelsi
f37994cc1b fix: trade accept dialog not showing (stale state from domain handler split)
GameHandler::hasPendingTradeRequest() and all trade getters were reading
GameHandler's own tradeStatus_/tradeSlots_ which are never written after
the PR #23 split. InventoryHandler owns the canonical trade state.

Delegate all trade getters to InventoryHandler:
- getTradeStatus, hasPendingTradeRequest, isTradeOpen, getTradePeerName
- getMyTradeSlots, getPeerTradeSlots, getMyTradeGold, getPeerTradeGold

Also fix InventoryHandler::isTradeOpen() to include Accepted state.
2026-03-28 11:58:02 -07:00
Kelsi
99ac31987f fix: add missing <algorithm> include for std::clamp (Windows build) 2026-03-28 11:51:34 -07:00
Kelsi
b9ac3de498 tweak: camera defaults stiffness=30, pivot height=1.6 2026-03-28 11:45:21 -07:00
Kelsi
416e091498 feat: add Camera Stiffness and Pivot Height settings for motion comfort
Camera Stiffness (default 20, range 5-100): controls how tightly the
camera follows the player. Higher values = less sway/lag. Users who
experience motion sickness can increase this to reduce floaty camera.

Camera Pivot Height (default 1.8, range 0-3): height of the camera
orbit point above the player's feet. Lower values reduce the
"detached/floating" feel that can cause nausea. Setting to 0 puts the
pivot at foot level (ground-locked camera).

Both settings saved to settings file and applied via sliders in the
Gameplay tab of the Settings window.
2026-03-28 11:39:37 -07:00
Kelsi
5a8ab87a78 fix: warmup checks WMO floor proximity, not just terrain existence
Stormwind players stand on WMO floors ~95m above terrain. The previous
check only tested if terrain existed at the spawn XY (it did — far below).
Now checks WMO floor first, then terrain, requiring the ground to be within
15 units of spawn Z. Falls back to tile count after 10s.

Also adds diagnostic logging for useItemBySlot (hearthstone debug).
2026-03-28 11:34:07 -07:00
Kelsi
8aaa2e7ff3 fix: warmup checks WMO floor + terrain + tile count before spawning
Stormwind players stand on WMO floors, not terrain. The terrain-only
check passed immediately (terrain exists below the city) but the WMO
floor hadn't loaded yet, so the player fell through.

Now checks three ground sources in order:
1. Terrain height at spawn point
2. WMO floor height at spawn point (for cities/buildings)
3. After 8s, accepts if 4+ terrain tiles are loaded (fallback)

Won't exit warmup until at least one ground source returns valid height,
or the 25s hard cap is reached.
2026-03-28 11:23:18 -07:00
Kelsi
7b26938e45 fix: warmup terrain check uses server spawn coords, not character position
The terrain readiness check was using getCharacterPosition() which is
(0,0,0) during warmup — always returned a valid height and exited
immediately, causing the player to spawn before terrain loaded.

Now uses the server-provided spawn coordinates (x,y,z from world entry)
converted to render coords for the terrain query. Also logs when terrain
isn't ready after 5 seconds to show warmup progress.

Player spawn callbacks and equipment re-emit chain confirmed working.
2026-03-28 11:18:36 -07:00
Kelsi
ada95756ce fix: don't exit warmup until terrain under player is loaded
Added terrain readiness check to the warmup exit condition: the loading
screen won't drop until getHeightAt(playerPos) returns a valid height,
ensuring the ground exists under the player's feet before spawning.

Also increased warmup hard cap from 15s to 25s to give terrain more time
to load in cities like Stormwind with dense WMO/M2 assets.

Equipment re-emit chain confirmed working: items resolve 3-4 seconds
after spawn and equipment is re-applied with valid displayIds.
2026-03-28 11:09:36 -07:00
Kelsi
15f6aaadb2 fix: revert stride to 2 (correct for WotLK visible items), add re-emit tracing
Stride 4 was wrong — the raw dump shows entries at 284, 288, 292 which
are slots 0, 2, 4 with stride 2 (slot 1=NECK is zero because necks are
invisible). Stride 2 with base 284 correctly maps 19 equipment slots.

Added WARNING-level log when item query responses trigger equipment
re-emit for other players, to confirm the re-emit chain works.

The falling-through-world issue is likely terrain chunks not loading
fast enough — the terrain streaming stalls are still present.
2026-03-28 11:07:17 -07:00
Kelsi
05ab9922c4 fix: visible item stride 2→4 (confirmed from raw field dump)
RAW FIELDS dump shows equipment entries at indices 284, 288, 292, 296, 300
— stride 4, not 2. Each visible item slot occupies 4 fields (entry +
enchant + 2 padding), not 2 as previously assumed.

Field dump evidence:
  [284]=3817(Reinforced Buckler) [288]=3808(Double Mail Boots)
  [292]=3252 [296]=3823 [300]=3845 [312]=3825 [314]=3827

With stride 2, slots 0-18 read indices 284,286,288,290... which interleaves
entries with enchant/padding values, producing mostly zeros for equipment.
With stride 4, slots correctly map to entry-only fields.
2026-03-28 11:04:29 -07:00
Kelsi
f70beba07c fix: visible item field base 408→286 (computed from INV_SLOT_HEAD=324)
PLAYER_VISIBLE_ITEM_1_ENTRYID = PLAYER_FIELD_INV_SLOT_HEAD(324) - 19*2
= 286. The previous value of 408 landed far past inventory slots in
string/name data, producing garbage entry IDs (ASCII fragments like
"mant", "alk ", "ryan") that the server rejected as invalid items.

Derivation: 19 visible item slots × 2 fields (entry + enchant) = 38
fields immediately before PLAYER_FIELD_INV_SLOT_HEAD at index 324.
2026-03-28 10:58:34 -07:00
Kelsi
37300d65ce fix: remove Classic spline fallback, add no-parabolic WotLK variant
The Classic fallback silently succeeded on WotLK data by false-positive
matching, consuming wrong bytes and producing corrupt entity data that
was silently dropped — resulting in zero other players/NPCs visible.

Now tries 4 WotLK-only variants in order:
1. Full WotLK (durationMod+durationModNext+vertAccel+effectStart+compressed)
2. Full WotLK uncompressed
3. WotLK without parabolic fields (durationMod+durationModNext+points)
4. WotLK without parabolic, compressed

This covers servers that don't unconditionally send vertAccel+effectStart
(the MEMORY.md says AzerothCore does, but other cores may not).
2026-03-28 10:55:46 -07:00
Kelsi
559f100204 fix: restore Classic spline fallback to prevent UPDATE_OBJECT packet loss
The previous fix (b8a9efb7) that returned false on spline failure was too
aggressive — it aborted the ENTIRE UPDATE_OBJECT packet, not just one
block. Since many entity spawns (NPCs, other players) share the same
packet, a single spline parse failure killed ALL entities in the batch.

Restored the Classic-format fallback as a last resort after WotLK format
fails. The key difference from the original bug is that WotLK is now
tried FIRST (with proper position save/restore), and Classic only fires
if WotLK fails. This prevents the false-positive match that originally
caused corruption while still handling edge-case spline formats.
2026-03-28 10:52:26 -07:00
Kelsi
f4a2a631ab fix: visible item field base 284→408 (was reading quest log, not equipment)
PLAYER_VISIBLE_ITEM_1_ENTRYID for WotLK 3.3.5a is at UNIT_END(148) + 260
= field index 408 with stride 2. The previous default of 284 (UNIT_END+136)
was in the quest log field range, causing item IDs like "Lesser Invisibility
Potion" and "Deathstalker Report" to be read as equipment entries.

This was the root cause of other players appearing naked — item queries
returned valid responses but for the WRONG items (quest log entries instead
of equipment), so displayInfoIds were consumable/quest item appearances.

The heuristic auto-detection still overrides for Classic/TBC (different
stride per expansion), so this only affects the WotLK default before
detection runs.

Also filter addon whispers (GearScore GS_*, DBM, oRA, BigWigs, tab-prefixed)
from chat display — these are invisible in the real WoW client.
2026-03-28 10:49:00 -07:00
Kelsi
1bcb05aac4 fix: only show fishing message for player's own bobber, not others'
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
SMSG_GAMEOBJECT_CUSTOM_ANIM with animId=0 on a fishing node (type 17)
was triggering "A fish is on your line!" for ALL fishing bobbers in
range, including other players'. Now checks OBJECT_FIELD_CREATED_BY
(fields 6-7) matches the local player GUID before showing the message.
2026-03-28 10:35:53 -07:00
Kelsi
b8a9efb721 fix: abort movement block on spline parse failure instead of corrupting stream
When both WotLK compressed and uncompressed spline point parsing fail,
the parser was silently continuing with a corrupted read position (16
bytes of WotLK spline header already consumed). This caused the update
mask to read garbage (maskBlockCount=40), corrupting the current entity
AND all remaining blocks in the same UPDATE_OBJECT packet.

Now returns false on spline failure, cleanly aborting the single block
parse and allowing the remaining blocks to be recovered (if the parser
can resync). Also logs the failing GUID and spline flags for debugging.

This fixes:
- Entities spawning with displayId=0/entry=0 (corrupted parse)
- "Unknown update type: 128" errors from reading garbage
- Falling through the ground (terrain entities lost in corrupted batch)
- Phantom "fish on your line" from fishing bobber entity parse failure
2026-03-28 10:31:53 -07:00
Kelsi
ed8ff5c8ac fix: increase packet parse/callback budgets to fix Warden module stall
Warden module download (18756 bytes, 38 chunks of 500 bytes) stalled at
32 chunks because the per-pump packet parse budget was 16 — after two
2ms pump cycles (32 packets), the TCP receive buffer filled and the
server stopped sending. Character list never arrived.

- kDefaultMaxParsedPacketsPerUpdate: 16 → 64
- kDefaultMaxPacketCallbacksPerUpdate: 6 → 48

Also adds WARNING-level diagnostic logs for auth pipeline packets and
Warden module download progress (previously DEBUG-only, invisible in
production logs).
2026-03-28 10:28:20 -07:00
Kelsi Rae Davis
6a46e573bb
Merge pull request #23 from ldmonster/chore/split-game-handler
[chore] GameHandler: extract 8 domain handler classes
2026-03-28 10:10:16 -07:00
Paul
285ebc88dd add linter 2026-03-28 11:45:09 +03:00
Paul
888a78d775 fixin critical bugs, non critical bugs, sendmail implementation 2026-03-28 11:35:10 +03:00
Paul
b2710258dc refactor(game): split GameHandler into domain handlers
Extract domain-specific logic from the monolithic GameHandler into
dedicated handler classes, each owning its own opcode registration,
state, and packet parsing:

- CombatHandler: combat, XP, kill, PvP, loot roll (~26 methods)
- SpellHandler: spells, auras, pet stable, talent (~3+ methods)
- SocialHandler: friends, guild, groups, BG, RAF, PvP AFK (~14+ methods)
- ChatHandler: chat messages, channels, GM tickets, server messages,
               defense/area-trigger messages (~7+ methods)
- InventoryHandler: items, trade, loot, mail, vendor, equipment sets,
                    read item (~3+ methods)
- QuestHandler: gossip, quests, completed quest response (~5+ methods)
- MovementHandler: movement, follow, transport (~2 methods)
- WardenHandler: Warden anti-cheat module

Each handler registers its own dispatch table entries via
registerOpcodes(DispatchTable&), called from
GameHandler::registerOpcodeHandlers(). GameHandler retains core
orchestration: auth/session handshake, update-object parsing,
opcode routing, and cross-handler coordination.

game_handler.cpp reduced from ~10,188 to ~9,432 lines.

Also add a POST_BUILD CMake step to symlink Data/ next to the
executable so expansion profiles and opcode tables are found at
runtime when running from build/bin/.
2026-03-28 09:42:37 +03:00
Kelsi
3762dceaa6 docs: add CONTRIBUTING.md and CHANGELOG.md; optimize chat parser allocation
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
CONTRIBUTING.md: code style, PR process, architecture pointers, packet
handler pattern, key files for new contributors.

CHANGELOG.md: grouped changes since v1.8.1-preview into Performance,
Bug Fixes, Features, Security, and Code Quality sections.

Chat parser: use stack-allocated std::array<char, 256> for typical chat
messages instead of heap-allocated std::string. Only falls back to heap
for messages > 256 bytes. Reduces allocator pressure on high-frequency
chat packet handling.
2026-03-27 18:47:35 -07:00
Kelsi
e2383725f0 security: path traversal rejection, packet length validation; code quality
Security:
- Asset loader rejects paths containing ".." sequences (path traversal)
- Chat message parser validates length against remaining packet bytes
  before resize(), preventing memory exhaustion from malformed packets

Code quality:
- Extract 11 named geoset constants (kGeosetBareForearms, kGeosetWithCape,
  etc.) replacing ~40 magic number sites across 4 code paths
- Add build-debug/ and .claude/ to .gitignore
- Remove .claude/scheduled_tasks.lock from tracking
2026-03-27 18:42:48 -07:00
Kelsi
e61b23626a perf: entity/skill/DBC/warden maps to unordered_map; fix 3x contacts scan
Entity storage: std::map<uint64_t, shared_ptr<Entity>> → unordered_map for
O(1) entity lookups instead of O(log n). No code depends on GUID ordering.

Player skills: std::map<uint32_t, PlayerSkill> → unordered_map.
DBC ID cache: std::map<uint32_t, uint32_t> → unordered_map.
Warden: apiHandlers_ and allocations_ → unordered_map (freeBlocks_ kept
as std::map since its coalescing logic requires ordered iteration).

Contacts: handleFriendStatus() did 3 separate O(n) find_if scans per
packet. Consolidated to single find_if with iterator reuse. O(3n) → O(n).
2026-03-27 18:28:36 -07:00
Kelsi
2af3594ce8 perf: eliminate per-frame heap allocs in M2 renderer; UI polish and report
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
M2 renderer: move 3 per-frame local containers to member variables:
- particleGroups_ (unordered_map): reuse bucket structure across frames
- ribbonDraws_ (vector): reuse draw call buffer
- shadowTexSetCache_ (unordered_map): reuse descriptor cache
Eliminates ~3 heap allocations per frame in particle/ribbon/shadow passes.

UI polish:
- Nameplate hover tooltip showing level, class (players), guild name
- Bag window titles show slot counts: "Backpack (12/16)"

Player report: CMSG_COMPLAIN packet builder and reportPlayer() method.
"Report Player" option in target frame right-click menu for other players.
Server response handler (SMSG_COMPLAIN_RESULT) was already implemented.
2026-03-27 18:21:47 -07:00
Kelsi
dee90d2951 fix: NPC/player attack animation uses weapon-appropriate anim ID
NPC and other-player melee swing callback was hardcoded to animation 16
(unarmed attack). Now tries 17 (1H weapon), 18 (2H weapon) first with
hasAnimation() check, falling back to 16 if neither exists on the model.
2026-03-27 18:14:29 -07:00
Kelsi
dce11a0d3f perf: skip bone animation for LOD3 models, frustum-cull water surfaces
M2 renderer: skip bone matrix computation for instances beyond 150 units
(LOD 3 threshold). These models use minimal static geometry with no visible
skeletal animation. Last-computed bone matrices are retained for GPU upload.
Removes unnecessary float matrix operations for hundreds of distant NPCs
in crowded zones.

Water renderer: add per-surface AABB frustum culling before draw calls.
Computes tight AABB from surface corners and height range, tests against
camera frustum. Skips descriptor binding and vkCmdDrawIndexed for surfaces
outside the view. Handles both ADT and WMO water (rotated step vectors).
2026-03-27 18:11:20 -07:00
Kelsi
cccd52b32f fix: equipment visibility (remove layout verification gate), follow uses run speed
Equipment: removed the visibleItemLayoutVerified_ gate from
updateOtherPlayerVisibleItems(). The default WotLK field layout (base=284,
stride=2) is correct and should be used immediately. The verification
heuristic was silently blocking ALL other-player equipment rendering by
queuing for auto-inspect (which doesn't return items in WotLK anyway).

Follow: auto-follow now uses run speed (autoRunning) instead of walk speed.
Also uses squared distance for the distance checks.

Commands: /quit, /exit aliases for /logout; /difficulty normal/heroic/25/25heroic
sends CMSG_CHANGEPLAYER_DIFFICULTY.
2026-03-27 18:05:42 -07:00
Kelsi
b366773f29 fix: inspect (packed GUID), follow (client-side auto-walk); add loot/raid commands
Inspect: CMSG_INSPECT was writing full uint64 GUID instead of packed GUID.
Server silently rejected the malformed packet. Fixed both InspectPacket and
QueryInspectAchievementsPacket to use writePackedGuid().

Follow: was a no-op (only stored GUID). Added client-side auto-follow system:
camera controller walks toward followed entity, faces target, cancels on
WASD/mouse input, stops within 3 units, cancels at 40+ units distance.

Party commands:
- /lootmethod (ffa/roundrobin/master/group/nbg) sends CMSG_LOOT_METHOD
- /lootthreshold (0-5 or quality name) sets minimum loot quality
- /raidconvert converts party to raid (leader only)

Equipment diagnostic logging still active for debugging naked players.
2026-03-27 17:54:56 -07:00
Kelsi
16fc3ebfdf feat: target frame right-click context menu; add equipment diagnostic logging
Target frame: add Follow, Clear Target, and Set Raid Mark submenu to the
right-click context menu (Inspect, Trade, Duel were already present).

Equipment diagnostics: add LOG_INFO traces to updateOtherPlayerVisibleItems()
and emitOtherPlayerEquipment() to debug why other players appear naked.
Logs the visible item entry IDs received from the server and the resolved
displayIds from itemInfoCache. Check the log for "emitOtherPlayerEquipment"
to see if entries arrive as zeros (server not sending fields) or if
displayIds are zero (item templates not cached yet).
2026-03-27 17:41:37 -07:00
Kelsi
a20f46f0b6 feat: render shoulder armor M2 models on other players and NPCs
Shoulder pieces are M2 model attachments (like helmets), not body geosets.
Load left shoulder at attachment point 5, right shoulder at point 6.
Models resolved from ItemDisplayInfo.dbc LeftModel/RightModel fields,
with race/gender suffix variants tried first. Applied to both online
player and NPC equipment paths.
2026-03-27 17:35:42 -07:00
Kelsi
0396a42beb feat: render equipment on other players (helmets, weapons, belts, wrists)
Other players previously appeared partially naked — only chest, legs, feet,
hands, cape, and tabard rendered. Now renders full equipment:

- Helmet M2 model: loads from ItemDisplayInfo.dbc with race/gender suffix,
  attaches at head bone (point 0/11), hides hair geoset under helm
- Weapons: mainhand (attachment 1) and offhand (attachment 2) M2 models
  loaded from ItemDisplayInfo, with Weapon/Shield path fallback
- Wrist/bracer geoset (group 8): applies when no chest sleeve overrides
- Belt/waist geoset (group 18): reads GeosetGroup1 from ItemDisplayInfo
- Shoulder M2 attachments deferred (separate bone attachment system)

Also applied same wrist/waist geosets to NPC and character preview paths.

Minimap: batch 9 individual vkUpdateDescriptorSets into single call.
2026-03-27 17:30:35 -07:00
Kelsi
50a3eb7f07 fix: mail money uint64, other-player cape textures, zone toast dedup, TCP_NODELAY
Mail: change money/COD fields from uint32 to uint64 in CMSG_SEND_MAIL and
SMSG_MAIL_LIST_RESULT for WotLK 3.3.5a. Classic keeps uint32 on the wire.
Fixes money truncation and packet misalignment causing mail failures.

Other-player capes: add cape texture loading to setOnlinePlayerEquipment().
The cape geoset was enabled but no texture was loaded, leaving capes blank.
Now mirrors the local-player path: looks up ItemDisplayInfo.dbc, finds cape
texture candidates, applies via setGroupTextureOverride/setTextureSlotOverride.

Zone toasts: suppress duplicate zone toast when the zone text overlay is
already showing the same zone name. Fixes double "Entering: Stormwind City".

Network: enable TCP_NODELAY on both auth and world sockets after connect(),
disabling Nagle's algorithm to eliminate up to 200ms buffering delay on
small packets (movement, spell casts, chat).

Rendering: track material and bone descriptor sets in M2 renderer to skip
redundant vkCmdBindDescriptorSets calls between batches sharing same textures.
2026-03-27 17:20:31 -07:00
Kelsi
6b1c728377 perf: eliminate double map lookups, dynamic_cast in render loops, div by 255
- Replace count()+operator[] double lookups with find() or try_emplace()
  in gameObjectInstances_, playerTextureSlotsByModelId_, onlinePlayerAppearance_
- Add Entity::isUnit() helper; replace 5 dynamic_cast<Unit*> in per-frame
  UI rendering (nameplates, combat text, pet frame) with isUnit()+static_cast
- Add constexpr kInv255 reciprocal for per-pixel normal map generation loops
  in character_renderer and wmo_renderer
2026-03-27 17:04:13 -07:00
Kelsi
6f2c8962e5 fix: use expansion context for spline parsing; preload DBC caches at world entry
Spline parsing: remove Classic format fallback from the WotLK parser. The
PacketParsers hierarchy already dispatches to expansion-specific parsers
(Classic/TBC/WotLK/Turtle), so the WotLK parseMovementBlock should only
attempt WotLK spline format. The Classic fallback could false-positive when
durationMod bytes resembled a valid point count, corrupting downstream parsing.

Preload DBC caches: call loadSpellNameCache() and 5 other lazy DBC caches
during handleLoginVerifyWorld() on initial world entry. This moves the ~170ms
Spell.csv load from the first SMSG_SPELL_GO handler to the loading screen,
eliminating the mid-gameplay stall.

WMO portal culling: move per-instance portalVisibleGroups vector and
portalVisibleGroupSet to reusable member variables, eliminating heap
allocations per WMO instance per frame.
2026-03-27 16:58:39 -07:00
Kelsi
a795239e77 fix: spline parse order (WotLK-first) fixes missing NPCs; bound WMO liquid loading
Spline auto-detection: try WotLK format before Classic to prevent false-positive
matches where durationMod float bytes resemble a valid Classic pointCount. This
caused the movement block to consume wrong byte count, corrupting the update mask
read (maskBlockCount=57/129/203 instead of ~5) and silently dropping NPC spawns.

Terrain latency: bound WMO liquid group loading to 4 groups per advanceFinalization
call. Large WMOs (e.g., Stormwind canals with 40+ liquid groups) previously loaded
all groups in one unbounded loop, blowing past the 8ms frame budget and causing
stalls up to 1300ms. Now yields back to processReadyTiles() after 4 groups so the
time budget check can break out.
2026-03-27 16:51:13 -07:00
Kelsi
d26eed1e7c perf: constexpr reciprocals, cache redundant lookups, consolidate texture maps
- Hoist DBC field index lookups before loops in game_handler (7 DBC iteration loops)
- Cache getSkybox()/getPosition() calls instead of redundant per-frame queries
- Merge textureHasAlphaByPtr_ + textureColorKeyBlackByPtr_ into single map
- Add constexpr for DEG_TO_RAD, reciprocal constants, physics delta
- Add reserve() for WMO/M2 collision grid queries and portal BFS
- Frustum plane normalize: inversesqrt instead of length+divide
- M2 particle emission: inversesqrt for direction normalization
- Parse creature display IDs from query response
- UI: show spell names/IDs as fallback instead of "Unknown"
2026-03-27 16:47:30 -07:00
Kelsi
b0466e9029 perf: eliminate ~70 unnecessary sqrt ops per frame, optimize caches and threading
Squared distance optimizations across 30 files:
- Convert glm::length() comparisons to glm::dot() (no sqrt)
- Use glm::inversesqrt() for check-then-normalize patterns (1 rsqrt vs 2 sqrt)
- Defer sqrt to after early-out checks in collision/movement code
- Hottest paths: camera_controller (21), weather particles, WMO collision,
  transport movement, creature interpolation, nameplate culling

Container and algorithm improvements:
- std::map<string> → std::unordered_map for asset/DBC/MPQ/warden caches
- std::mutex → std::shared_mutex for asset_manager and mpq_manager caches
- std::sort → std::partial_sort in lighting_manager (top-2 of N volumes)
- Double-lookup find()+operator[] → insert_or_assign in game_handler
- Add reserve() for per-frame vectors: weather, swim_effects, WMO/M2 collision

Threading and synchronization:
- Replace 1ms busy-wait polling with condition_variable in character_renderer
- Move timestamp capture before mutex in logger
- Use memory_order_acquire/release for normal map completion signaling

API additions:
- DBC getStringView()/getStringViewByOffset() for zero-copy string access
- Parse creature display IDs from SMSG_CREATURE_QUERY_SINGLE_RESPONSE
2026-03-27 16:33:16 -07:00
Kelsi
cf0e2aa240 refactor: deduplicate pomSampleTable in wmo_renderer, last static const array
Move duplicate pomSampleTable (2 copies → 1 constexpr) to file-scope
anonymous namespace. All static const primitive arrays outside src/game/
are now constexpr.
2026-03-27 15:34:48 -07:00
Kelsi
c762688202 refactor: promote static const arrays to constexpr across audio/core/rendering
audio: birdPaths, cricketPaths, races
core/application: componentDirs (4 instances), compDirs
rendering/character_preview: componentDirs
rendering/character_renderer: regionCoords256, regionSizes256
2026-03-27 15:31:21 -07:00
Kelsi
d6769172d1 refactor: remove remaining shadowed arrays in lua_engine, constexpr batch
Remove 4 more local arrays that shadowed the file-scope constexpr
constants added in the previous commit (kLuaClasses×2, kLuaRaces×1,
kCls×1, kQualityHex×1).

Promote 7 remaining static const char* arrays to constexpr
(kFamilies, kItemClasses, kInvTypes, kTypes, kDiff, kIcons, kClassFiles).
2026-03-27 15:27:47 -07:00
Kelsi
ad209b81bd fix: check lua_pcall return in ACTIONBAR_PAGE_CHANGED; deduplicate 17 arrays
Fix unchecked lua_pcall that leaked an error message onto the Lua stack
when an ACTIONBAR_PAGE_CHANGED handler errored.

Move 17 duplicated static arrays to file-scope constexpr constants:
- kLuaClasses (5 copies → 1), kLuaRaces (3 → 1), kLuaPowerNames (2 → 1)
- kQualHexNoAlpha (5 → 1), kQualHexAlpha (2 → 1)
2026-03-27 15:24:19 -07:00
Kelsi
e805eae33c refactor: add [[nodiscard]] to shader/asset load functions, suppress warnings
Add [[nodiscard]] to VkShaderModule::loadFromFile, Shader::loadFromFile/
loadFromSource, AssetManifest::load, DbcLoader::load — all return bool
indicating success/failure that callers should check.

Suppress with (void) at 17 call sites where validity is checked via
isValid() after loading rather than the return value (m2_renderer
recreatePipelines, swim_effects recreatePipelines).
2026-03-27 15:17:19 -07:00
Kelsi
b5b84fbc19 fix: guard texture log dedup sets with mutex for thread safety
loadTexture() is called from terrain worker threads, but the static
unordered_set dedup caches for missing-texture and decode-failure
warnings had no synchronization. Add std::mutex guards around both
log-dedup blocks to prevent data races.
2026-03-27 15:12:36 -07:00
Kelsi
fb3bfe42c9 refactor: add kCastGreen/kQueueGreen constants, remove dead code
Add kCastGreen (interruptible cast bar, 5 uses) and kQueueGreen
(queue status / talent met, 7 uses across game_screen + talent_screen).

Remove commented-out renderQuestMarkers call (replaced by 3D billboards).
2026-03-27 15:01:12 -07:00
Kelsi
53a4377ed7 refactor: extract magic numbers in terrain alpha map and texture compositing
terrain_manager: replace bare 4096/2048/0x80/0x7F with named constants
ALPHA_MAP_SIZE, ALPHA_MAP_PACKED, ALPHA_FILL_FLAG, ALPHA_COUNT_MASK
— documents the WoW alpha map RLE format.

character_renderer: replace bare 256/512 texture sizes with
kBaseTexSize/kUpscaleTexSize for NPC skin upscaling logic.
2026-03-27 14:57:20 -07:00
Kelsi
5b91ef398e fix: return UINT32_MAX from findMemType on failure, add [[nodiscard]]
The findMemType/findMemoryType helper in auth_screen, loading_screen,
and vk_context returned 0 on failure — a valid memory type index.
Changed to return UINT32_MAX and log an error, so vkAllocateMemory
receives an invalid index and fails cleanly rather than silently
using the wrong memory type.

Add [[nodiscard]] to VkBuffer::uploadToGPU/createMapped and
VkContext::initialize/recreateSwapchain so callers that ignore
failure are flagged at compile time. Suppress with (void) cast at
3 call sites where failure is non-actionable (resize best-effort).
2026-03-27 14:53:29 -07:00
Kelsi
7028dd64c1 refactor: promote remaining static const arrays to constexpr across UI
game_screen: fsrScales, fsrScaleFactors, kTotemInfo, kRaidMarks,
kTimerInfo, kNPMarks, kCellMarks, kPartyMarks, kMMMarks, kCatOrder
keybinding_manager: actionMap

All static const arrays in UI files are now constexpr where possible.
2026-03-27 14:47:58 -07:00
Kelsi
d2430faa51 refactor: promote 7 more static const arrays to constexpr
inventory_screen: groups, tiers, leftSlots, rightSlots, weaponSlots
character_create_screen: kAllRaces, kAllClasses
2026-03-27 14:46:31 -07:00
Kelsi
e474dca2be refactor: add 9 button/bar color constants, batch constexpr promotions
New ui_colors.hpp constants: kBtnGreen, kBtnGreenHover, kBtnRed,
kBtnRedHover, kBtnDkGreen/Hover, kBtnDkRed/Hover, kMidHealthYellow
— replacing 21 inline literals across accept/decline button and
health bar patterns.

Deduplicate kMon/kMonths month arrays (2 copies → 1 kMonthAbbrev).

Promote 22 remaining static const char*/int arrays to constexpr
(kQualHex, resLabels, kRepRankNames, kTotemNames, kReactLabels,
kChatHelp, kMacroHelp, kHelpLines, kMarkWords, componentDirs,
keyLabels, kRollLabels, gossipIcons, kMarkNames, kDiffLabels,
kStatLabels, kCatHeaders, kSlotNames, kResolutions, displayToInternal).
2026-03-27 14:44:52 -07:00
Kelsi
4981d162c5 refactor: deduplicate item-set DBC key arrays, widen totem timer buffer
- Move itemKeys/spellKeys/thrKeys to shared kItemSetItemKeys/
  kItemSetSpellKeys/kItemSetThresholdKeys in ui_colors.hpp, removing
  5 identical local definitions across game_screen and inventory_screen
- Widen totem timer snprintf buffer from 8 to 16 bytes (defensive)
- Promote kStatTooltips to constexpr
2026-03-27 14:40:44 -07:00
Kelsi
92d8262f96 refactor: move kClassMasks, kRaceMasks, kSocketTypes to shared ui_colors.hpp
Deduplicate class/race bitmask arrays (3 copies each → 1 shared) and
socket type definitions (3 copies → 1 shared). Eliminates ~80 lines of
repeated struct definitions across game_screen.cpp and inventory_screen.cpp.
2026-03-27 14:35:16 -07:00
Kelsi
cd29c6d50b refactor: deduplicate class name functions in talent_screen and game_screen
Replace local getClassName()/classNameStr() with shared
game::getClassName() from character.hpp, removing 2 duplicate
name-lookup implementations (static arrays + wrapper functions).
2026-03-27 14:30:45 -07:00
Kelsi
f5a3ebc774 refactor: deduplicate arrays in inventory_screen, add kDarkYellow constant
- Move kSocketTypes to file-scope constexpr, removing 2 identical local
  definitions across tooltip render functions
- Move kResistNames to file-scope constexpr, removing 3 identical local
  definitions (Holy..Arcane resistance labels)
- Move kRepRankNames to file-scope constexpr, removing 2 identical local
  definitions (Hated..Exalted reputation rank labels)
- Add kDarkYellow color constant, replacing 3 inline literals
2026-03-27 14:25:54 -07:00
Kelsi
cbb42ac58f fix: guard spline point loop against unsigned underflow when pointCount==1
The uncompressed spline skip loop used `pointCount - 1` in its bound
without guarding pointCount > 1. While pointCount==0 is already handled
by an early return, pointCount==1 would correctly iterate 0 times, but
the explicit guard makes the intent clearer and prevents future issues
if the early return is ever removed.
2026-03-27 14:20:28 -07:00
Kelsi
6783ead4ba fix: guard hexDecode std::stoul; extract duration formatting helpers
- Wrap std::stoul in auth_screen hexDecode() with try-catch to prevent
  crash on malformed saved password hex data
- Add fmtDurationCompact() helper replacing 3 identical duration format
  blocks (hours/minutes/seconds for aura icon overlays)
- Add renderAuraRemaining() helper replacing 5 identical "Remaining: Xm Ys"
  tooltip blocks across player/target/focus/raid aura tooltips
2026-03-27 14:17:28 -07:00
Kelsi
0ae7360255 refactor: deduplicate kRaidMarkNames, promote 4 more arrays to constexpr
- Move kRaidMarkNames to file-scope constexpr, removing 3 duplicate
  local definitions across target/raid/party frame menus
- Promote kReactColors, kEnchantSlotColors, kRollColors from static
  const to static constexpr
2026-03-27 14:13:16 -07:00
Kelsi
f1ecf8be53 refactor: deduplicate kDispelNames, use constexpr arrays, remove std::to_string in IDs
- Move kDispelNames to file-scope constexpr, removing 2 duplicate local
  definitions in raid/party frame rendering
- Promote kTotemColors and kReactDimColors from static const to constexpr
- Replace std::to_string + string concat for ImGui widget IDs with
  snprintf into stack buffers (avoids heap allocations in render loops)
2026-03-27 14:11:05 -07:00
Kelsi
22d0b9cd4c refactor: deduplicate class color functions, add 9 color constants
Move classColor/classColorU32 to shared getClassColor()/getClassColorU32()
in ui_colors.hpp, eliminating duplicate 10-case switch in character_screen
and game_screen.

New ui_colors.hpp constants: kInactiveGray, kVeryLightGray, kSymbolGold,
kLowHealthRed, kDangerRed, kEnergyYellow, kHappinessGreen, kRunicRed,
kSoulShardPurple — replacing 36 inline literals across 4 files.
2026-03-27 14:07:36 -07:00
Kelsi
54006fad83 refactor: add 9 color constants, replace 36 more inline literals
New constants in ui_colors.hpp:
- Power types: kEnergyYellow, kHappinessGreen, kRunicRed, kSoulShardPurple
- UI elements: kInactiveGray, kVeryLightGray, kSymbolGold, kLowHealthRed, kDangerRed

Replacements across game_screen(30), inventory_screen(5), character_screen(1).
2026-03-27 14:05:32 -07:00
Kelsi
762daebc75 refactor: replace 23 more inline color literals across 3 UI files
game_screen: kWhite(3), kSilver(4)
inventory_screen: kWarmGold(8), kFriendlyGreen(2), kSocketGreen(4), kActiveGreen(2)
talent_screen: kHealthGreen(1), kWhite(3), kRed(1)
2026-03-27 14:00:15 -07:00
Kelsi
c38fa6d9ec refactor: replace 31 more inline color literals with named constants in game_screen
Replace inline ImVec4 literals with shared constants from ui_colors.hpp:
kHealthGreen(5), kOrange(5), kWarmGold(5), kFriendlyGreen(3),
kActiveGreen(3), kLightGreen(4), kSocketGreen(2), new constants
kSocketGreen/kActiveGreen/kLightGreen/kHealthGreen/kWarmGold/kOrange/kFriendlyGreen
added to ui_colors.hpp.
2026-03-27 13:57:29 -07:00
Kelsi
e3c999d844 refactor: add 4 color constants, replace 31 more inline literals
Add kDarkRed, kSoftRed, kHostileRed, kMediumGray to ui_colors.hpp and
replace 31 inline ImVec4 literals across game_screen, character_screen,
inventory_screen, and performance_hud. Also replace local color aliases
in performance_hud with shared constants.
2026-03-27 10:20:45 -07:00
Kelsi
dec23423d8 chore: remove duplicate #include directives in camera_controller and auth_screen 2026-03-27 10:20:40 -07:00
Kelsi
ff77febb36 fix: guard std::stoi/stof calls at input boundaries against exceptions
Wrap string-to-number conversions in try-catch where input comes from
external sources (realm address port, last_world.cfg, keybinding config,
ADT tile filenames) to prevent crashes on malformed data.
2026-03-27 10:14:49 -07:00
Kelsi
ee20f823f7 refactor: replace 8 more inline color literals with existing constants
Replace kYellow (5), kRed (2), kGray (1), kLightGray (1) inline ImVec4
literals in realm_screen, spellbook_screen, talent_screen, game_screen,
and inventory_screen.
2026-03-27 10:14:47 -07:00
Kelsi
4090041431 refactor: add 6 color constants, replace 61 inline literals, remove const_cast
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
- Add kBrightGold, kPaleRed, kBrightRed, kLightBlue, kManaBlue, kCyan to ui_colors.hpp
- Replace 61 inline ImVec4 color literals across game_screen, inventory_screen,
  talent_screen, and world_map with named constants
- Remove const_cast in character_renderer render loop by using non-const iteration
2026-03-27 10:08:30 -07:00
Kelsi
be694be558 fix: resolve infinite recursion, operator precedence bugs, and compiler warnings
- isPreWotlk() was calling itself instead of checking expansion (infinite recursion)
- luaReturnNil/Zero/False were calling themselves instead of pushing Lua values
- hasRemaining(N) * M had wrong operator precedence (should be hasRemaining(N * M))
- Misleading indentation in PARTY_LEADER_CHANGED handler (fireAddonEvent always fires)
- Remove unused standalone hasFullPackedGuid() (superseded by Packet method)
- Suppress unused-parameter warnings in fish/cancel-auto-repeat lambdas
- Remove unused settings default variables
2026-03-27 10:08:22 -07:00
Kelsi
33f8a63c99 refactor: replace 11 inline white color literals with colors::kWhite
Some checks failed
Build / Build (arm64) (push) Has been cancelled
Build / Build (x86-64) (push) Has been cancelled
Build / Build (macOS arm64) (push) Has been cancelled
Build / Build (windows-arm64) (push) Has been cancelled
Build / Build (windows-x86-64) (push) Has been cancelled
Security / CodeQL (C/C++) (push) Has been cancelled
Security / Semgrep (push) Has been cancelled
Security / Sanitizer Build (ASan/UBSan) (push) Has been cancelled
Replace ImVec4(1.0f, 1.0f, 1.0f, 1.0f) literals in game_screen (10)
and character_screen (1) with the shared kWhite constant.
2026-03-25 19:37:22 -07:00
Kelsi
eb40478b5e refactor: replace 20 more kTooltipGold inline literals across UI files
Replace remaining ImVec4(1.0f, 0.82f, 0.0f, 1.0f) gold color literals
in game_screen.cpp (19) and talent_screen.cpp (1) with the shared
colors::kTooltipGold constant. Zero inline gold literals remain.
2026-03-25 19:30:23 -07:00
Kelsi
7015e09f90 refactor: add kTooltipGold color constant, replace 14 inline literals
Add colors::kTooltipGold to ui_colors.hpp and replace 14 inline
ImVec4(1.0f, 0.82f, 0.0f, 1.0f) literals in inventory_screen.cpp
for item set names, unique markers, and quest item indicators.
2026-03-25 19:18:54 -07:00
Kelsi
7484ce6c2d refactor: extract getInventorySlotName and renderBindingType into shared UI utils
Add getInventorySlotName() and renderBindingType() to ui_colors.hpp,
replacing 3 copies of the 26-case slot name switch (2 inventory_screen
+ 1 game_screen) and 2 copies of the binding type switch. Removes ~80
lines of duplicate tooltip code.
2026-03-25 19:05:10 -07:00
Kelsi
97b44bf833 refactor: consolidate duplicate enchantment name cache in inventory tooltips
Extract getEnchantmentNames() to share a single SpellItemEnchantment.dbc
cache between both renderItemTooltip overloads, replacing two identical
19-line lazy-load blocks with single-line references.
2026-03-25 18:08:08 -07:00
Kelsi
a491202f93 refactor: convert final 7 getRemainingSize() comparisons to hasRemaining()
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Fix extra-paren variants in world_packets and packet_parsers_tbc.
getRemainingSize() is now exclusively arithmetic across the entire
codebase — all bounds checks use hasRemaining().
2026-03-25 16:32:38 -07:00
Kelsi
d50bca21c4 refactor: migrate remaining getRemainingSize() comparisons to hasRemaining()
Convert 33 remaining getRemainingSize() comparison patterns including
ternary expressions and extra-paren variants. getRemainingSize() is
now only used for arithmetic (byte counting), never for bounds checks.
2026-03-25 16:27:42 -07:00
Kelsi
618b479818 refactor: migrate 521 getRemainingSize() comparisons to hasRemaining()
Replace getRemainingSize()>=N with hasRemaining(N) and
getRemainingSize()<N with !hasRemaining(N) across all 4 packet files.
hasRemaining() is now the canonical bounds-check idiom with 680+ uses.
2026-03-25 16:22:47 -07:00
Kelsi
ca08d4313a refactor: replace 13 remaining getReadPos()+N bounds checks in game_handler
Convert final getReadPos()+N>getSize() patterns to hasRemaining(N),
completing the migration across all 5 packet-handling files.
2026-03-25 16:17:36 -07:00
Kelsi
e9d0a58e0a refactor: replace 47 getReadPos()+N bounds checks in packet parsers
Replace verbose bounds checks with hasRemaining(N) in
packet_parsers_classic (7) and packet_parsers_tbc (40), completing
the migration across all packet-handling files.
2026-03-25 16:12:46 -07:00
Kelsi
2b4d910a4a refactor: replace 79 getReadPos()+N bounds checks with hasRemaining(N)
Replace verbose getReadPos()+N>getSize() patterns in world_packets.cpp
with the existing Packet::hasRemaining(N) method, matching the style
already used in game_handler.cpp.
2026-03-25 16:10:48 -07:00
Kelsi
d086d68a2f refactor: extract Interface settings tab into dedicated method
Extract renderSettingsInterfaceTab() (108 lines) from
renderSettingsWindow(). 6 of 7 tabs now have dedicated methods;
only Video remains inline (shares init state with parent).
2026-03-25 16:07:04 -07:00
Kelsi
d0e2d0423f refactor: extract Gameplay and Controls settings tabs
Extract renderSettingsGameplayTab() (162 lines) and
renderSettingsControlsTab() (96 lines) from renderSettingsWindow().
5 of 7 settings tabs are now in dedicated methods; only Video and
Interface remain inline (they share resolution/display local state).
2026-03-25 15:54:14 -07:00
Kelsi
c7a82923ac refactor: extract 3 settings tabs into dedicated methods
Extract renderSettingsAudioTab() (110 lines), renderSettingsChatTab()
(49 lines), and renderSettingsAboutTab() (48 lines) from the 1013-line
renderSettingsWindow(). Reduces it to ~806 lines.
2026-03-25 15:49:38 -07:00
Kelsi
b1a87114ad refactor: extract updateAutoAttack() from update()
Move 98 lines of auto-attack leash range, melee resync, facing
alignment, and hostile attacker orientation into a dedicated method.
update() is now ~180 lines (74% reduction from original 704).
2026-03-25 15:37:19 -07:00
Kelsi
3215832fed refactor: extract updateTaxiAndMountState() from update()
Move 131 lines of taxi flight detection, mount reconciliation, taxi
activation timeout, and flight recovery into a dedicated method.
update() is now ~277 lines (61% reduction from original 704).
2026-03-25 15:32:51 -07:00
Kelsi
123a19ce1c refactor: extract updateEntityInterpolation() from update()
Move entity movement interpolation loop (distance-culled per-entity
update) into its own method. update() is now ~406 lines (down from
original 704, a 42% reduction across 3 extractions).
2026-03-25 15:27:31 -07:00
Kelsi
6343ceb151 refactor: extract updateTimers() from GameHandler::update()
Move 164 lines of timer/pending-state logic into updateTimers():
auction delay, quest accept timeouts, money delta, GO loot retries,
name query resync, loot money notifications, auto-inspect throttling.
update() is now ~430 lines (down from original 704).
2026-03-25 15:23:31 -07:00
Kelsi
7066062136 refactor: extract updateNetworking() from GameHandler::update()
Move socket update, packet processing, Warden async drain, RX silence
detection, disconnect handling, and Warden gate logging into a separate
updateNetworking() method. Reduces update() from ~704 to ~591 lines.
2026-03-25 15:19:03 -07:00
Kelsi
b2e2ad12c6 refactor: add registerWorldHandler() for state-guarded dispatch entries
Add registerWorldHandler() that wraps handler calls with an IN_WORLD
state check. Replaces 8 state-guarded lambda dispatch entries with
concise one-line registrations.
2026-03-25 15:11:15 -07:00
Kelsi
6694a0aa66 refactor: add registerHandler() to replace 120 lambda dispatch wrappers
Add registerHandler() using member function pointers, replacing 120
single-line lambda dispatch entries of the form
[this](Packet& p) { handleFoo(p); } with concise
registerHandler(Opcode::X, &GameHandler::handleFoo) calls.
2026-03-25 15:08:22 -07:00
Kelsi
d73c84d98d refactor: convert remaining 6 skipAll lambdas to registerSkipHandler
Replace all remaining inline skipAll dispatch lambdas with
registerSkipHandler() calls, including 2 standalone entries and
3 for-loop groups covering ~96 opcodes total.
2026-03-25 14:58:34 -07:00
Kelsi
5fe12f3f62 refactor: deduplicate 4 NPC window distance checks in update()
Replace 4 identical 10-line NPC distance check blocks (vendor, gossip,
taxi, trainer) with a shared lambda, reducing 40 lines to 16.
2026-03-25 14:53:16 -07:00
Kelsi
313a1877d5 refactor: add registerSkipHandler/registerErrorHandler for dispatch table
Add helpers for common dispatch table patterns: registerSkipHandler()
for opcodes that just discard data (14 sites), registerErrorHandler()
for opcodes that show an error message (3 sites). Reduces boilerplate
in registerOpcodeHandlers().
2026-03-25 14:50:18 -07:00
Kelsi
12355316b3 refactor: add Packet::hasData(), replace 52 position checks and 14 more Lua guards
Add Packet::hasData() for 'has remaining data' checks, replacing 52
verbose getReadPos()<getSize() comparisons across 3 files. Also replace
14 more standalone Lua return patterns with luaReturnNil/Zero helpers.
2026-03-25 14:39:01 -07:00
Kelsi
4c26b1a8ae refactor: add Lua return helpers to replace 178 inline guard patterns
Add luaReturnNil/luaReturnZero/luaReturnFalse helpers and replace 178
braced guard returns (109 nil, 31 zero, 38 false) in lua_engine.cpp.
Reduces visual noise in Lua binding functions.
2026-03-25 14:33:57 -07:00
Kelsi
0d9aac2656 refactor: add Packet::skipAll() to replace 186 setReadPos(getSize()) calls
Add skipAll() convenience method and replace 186 instances of the
verbose 'discard remaining packet data' idiom across game_handler
and world_packets.
2026-03-25 14:27:26 -07:00
Kelsi
4309c8c69b refactor: add isPreWotlk() helper to replace 24 compound expansion checks
Extract isPreWotlk() = isClassicLikeExpansion() || isActiveExpansion("tbc")
to replace 24 instances of the repeated compound check across packet
handlers. Clarifies intent: these code paths handle pre-WotLK packet
format differences.
2026-03-25 14:24:03 -07:00
Kelsi
e4194b1fc0 refactor: add isInWorld() and replace 119 inline state+socket checks
Add GameHandler::isInWorld() helper that encapsulates the repeated
'state == IN_WORLD && socket' guard. Replace 99 negative checks and
20 positive checks across game_handler.cpp, plus fix 2 remaining
C-style casts.
2026-03-25 14:21:19 -07:00
Kelsi
56f8f5c592 refactor: extract loadWeaponM2() to deduplicate weapon model loading
Extract shared M2+skin loading logic into Application::loadWeaponM2(),
replacing duplicate 15-line blocks in loadEquippedWeapons() and
tryAttachCreatureVirtualWeapons(). Future weapon loading changes only
need to update one place.
2026-03-25 14:17:19 -07:00
Kelsi
43caf7b5e6 refactor: add Packet::writePackedGuid, remove redundant static methods
Add writePackedGuid() to Packet class for read/write symmetry. Remove
now-redundant UpdateObjectParser::readPackedGuid and
MovementPacket::writePackedGuid static methods. Replace 6 internal
readPackedGuid calls, 9 writePackedGuid calls, and 1 inline 14-line
transport GUID write with Packet method calls.
2026-03-25 14:06:42 -07:00
Kelsi
2c79d82446 refactor: add Packet::readPackedGuid() and replace 121 static method calls
Move packed GUID reading into Packet class alongside readUInt8/readFloat.
Replace 121 UpdateObjectParser::readPackedGuid(packet) calls with
packet.readPackedGuid() across 4 files, reducing coupling between
Packet and UpdateObjectParser.
2026-03-25 13:58:48 -07:00
Kelsi
3f54d8bcb8 refactor: replace 37 reinterpret_cast writeBytes with writeFloat
Replace 37 verbose reinterpret_cast<const uint8_t*> float writes with
the existing Packet::writeFloat() method across world_packets,
packet_parsers_classic, and packet_parsers_tbc.
2026-03-25 13:54:10 -07:00
Kelsi
58839e611e chore: remove 3 unused includes from game_screen.cpp
Remove character_preview.hpp, spawn_presets.hpp, and blp_loader.hpp
which are included but not used in game_screen.cpp.
2026-03-25 13:50:22 -07:00
Kelsi
0f19ed40f8 refactor: convert 15 more renderer+sound patterns to withSoundManager
Replace 15 additional 3-line renderer acquisition + sound manager
null-check blocks with single-line withSoundManager() calls. Total
22 sites now use the helper; 11 remaining have complex multi-line
bodies or non-sound renderer usage.
2026-03-25 13:45:05 -07:00
Kelsi
ea15740e17 refactor: add withSoundManager() template to reduce renderer boilerplate
Add GameHandler::withSoundManager() that encapsulates the repeated
getInstance()->getRenderer()->getSoundManager() null-check chain.
Replace 6 call sites, with helper available for future consolidation
of remaining 25 sites.
2026-03-25 13:35:29 -07:00
Kelsi
a0267e6e95 refactor: consolidate 26 playerNameCache.find() calls to use lookupName()
Replace 26 direct playerNameCache lookups with the existing lookupName()
helper, which also provides entity-name fallback. Eliminates duplicate
cache+entity lookup patterns in chat, social, loot, and combat handlers.
Simplifies getCachedPlayerName() to delegate to lookupName().
2026-03-25 13:29:10 -07:00
Kelsi
f02fa10126 refactor: make DBC name caches mutable to eliminate 13 const_cast hacks
Mark spellNameCache_, titleNameCache_, factionNameCache_, areaNameCache_,
mapNameCache_, lfgDungeonNameCache_ and their loaded flags as mutable.
Update 6 lazy-load methods to const. Removes all 13 const_cast<GameHandler*>
calls, allowing const getters to lazily populate caches without UB.
2026-03-25 13:21:02 -07:00
Kelsi
fe043b5da8 refactor: extract getUnitByGuid() to replace 10 entity lookup + dynamic_cast patterns
Add GameHandler::getUnitByGuid() that combines entityManager.getEntity()
with dynamic_cast<Unit*>. Replaces 10 two-line lookup+cast blocks with
single-line calls.
2026-03-25 13:12:51 -07:00
Kelsi
c8617d20c8 refactor: use getSpellName/getSpellSchoolMask helpers instead of raw cache access
Replace 8 direct spellNameCache_.find() patterns with existing helper
methods: getSpellName() for name lookups, getSpellSchoolMask() for
school mask checks. Eliminates redundant loadSpellNameCache() calls
and 3-line cache lookup boilerplate at each site.
2026-03-25 13:08:10 -07:00
Kelsi
03aa915a05 refactor: move packetHasRemaining into Packet::hasRemaining method
Add Packet::hasRemaining(size_t) and remove free function from
game_handler.cpp. Replaces 8 call sites with method calls.
2026-03-25 13:02:49 -07:00
Kelsi
25d1a7742d refactor: add renderCoinsFromCopper() to eliminate copper decomposition boilerplate
Add renderCoinsFromCopper(uint64_t) overload in ui_colors.hpp that
decomposes copper into gold/silver/copper and renders. Replace 14
manual 3-line decomposition blocks across game_screen and
inventory_screen with single-line calls.
2026-03-25 12:59:31 -07:00
Kelsi
f39271453b refactor: extract applyAudioVolumes() to deduplicate 30-line audio settings block
Extract identical 30-line audio volume application block into
GameScreen::applyAudioVolumes(), replacing two copies (startup init
and settings dialog lambda) with single-line calls.
2026-03-25 12:52:07 -07:00
Kelsi
40dd39feed refactor: move hasFullPackedGuid into Packet class, deduplicate 2 definitions
Add Packet::hasFullPackedGuid() method and remove identical standalone
definitions from game_handler.cpp and packet_parsers_classic.cpp.
Replace 53 free-function calls with method calls.
2026-03-25 12:46:44 -07:00
Kelsi
376d0a0f77 refactor: add Packet::getRemainingSize() to replace 656 arithmetic expressions
Add getRemainingSize() one-liner to Packet class and replace all 656
instances of getSize()-getReadPos() across game_handler, world_packets,
and both packet parser files.
2026-03-25 12:42:56 -07:00
Kelsi
b66033c6d8 fix: toLowerInPlace infinite recursion + remove redundant callback guards
Fix toLowerInPlace() which was accidentally self-recursive (would stack
overflow on any Lua string lowering). Remove 30 redundant
if(addonEventCallback_) wrappers around pure fireAddonEvent blocks.
Extract color constants in performance_hud.cpp (24 inline literals).
2026-03-25 12:37:29 -07:00
Kelsi
b892dca0e5 refactor: replace 60+ inline color literals with shared ui::colors constants
Use kRed, kBrightGreen, kDarkGray, kLightGray from ui_colors.hpp across
8 UI files, eliminating duplicate ImVec4 color definitions throughout
the UI layer.
2026-03-25 12:29:44 -07:00
Kelsi
4d46641ac2 refactor: consolidate UI colors, quality colors, and renderCoinsText
Create shared include/ui/ui_colors.hpp with common ImGui color constants,
item quality color lookup, and renderCoinsText utility. Remove 3 duplicate
renderCoinsText implementations and 3 duplicate quality color switch
blocks across game_screen, inventory_screen, and quest_log_screen.
2026-03-25 12:27:43 -07:00
Kelsi
eea205ffc9 refactor: extract toHexString utility, more color constants, final cast cleanup
Add core::toHexString() utility in logger.hpp to replace 11 duplicate
hex-dump loops across world_packets, world_socket, and game_handler.
Add kColorBrightGreen/kColorDarkGray constants in game_screen.cpp
replacing 26 inline literals. Replace remaining ~37 C-style casts in
16 files. Normalize keybinding_manager.hpp to #pragma once.
2026-03-25 12:12:03 -07:00
Kelsi
ba99d505dd refactor: remaining C-style casts, color constants, and header guard cleanup
Replace ~37 remaining C-style casts with static_cast across 16 files.
Extract named color constants (kColorRed/Green/Yellow/Gray) and dialog
window flags (kDialogFlags) in game_screen.cpp, replacing 72 inline
literals. Normalize keybinding_manager.hpp to #pragma once.
2026-03-25 11:57:22 -07:00
Kelsi
05f2bedf88 refactor: replace C-style casts with static_cast and extract toLowerInPlace
Replace ~300 C-style casts ((int), (float), (uint32_t), etc.) with
static_cast across 15 source files. Extract toLowerInPlace() helper in
lua_engine.cpp to replace 72 identical tolower loop patterns.
2026-03-25 11:40:49 -07:00
Kelsi
d646a0451d refactor: add fireAddonEvent() helper to eliminate 170+ null checks
Add inline fireAddonEvent() that wraps the addonEventCallback_ null
check. Replace ~120 direct addonEventCallback_ calls with fireAddonEvent,
eliminating redundant null checks at each callsite and reducing
boilerplate by ~30 lines.
2026-03-25 11:34:22 -07:00
Kelsi
98b9e502c5 refactor: extract guidToUnitId/getQuestTitle helpers and misc cleanup
- Extract guidToUnitId(), getQuestTitle(), findQuestLogEntry() helpers
  to replace 14 duplicated GUID-to-unitId patterns and 7 quest log
  search patterns in game_handler.cpp
- Remove duplicate #include in renderer.cpp
- Remove commented-out model cleanup code in terrain_manager.cpp
- Replace C-style casts with static_cast in auth and transport code
2026-03-25 11:25:44 -07:00
Kelsi
087e42d7a1 fix: remove 12 duplicate dispatch registrations and fix addonEventCallback null-check bugs
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Remove duplicate opcode registrations introduced during the switch-to-dispatch-table
refactor (PR #22), keeping the better-commented second copies. Fix 4 instances where
addonEventCallback_("UNIT_QUEST_LOG_CHANGED") was either called unconditionally
(missing braces) or had incorrect indentation inside braces.
2026-03-24 23:33:00 -07:00
Kelsi Rae Davis
3ca8f20585
Merge pull request #22 from ldmonster/chore/split-mega-switch-to-map
[chore] refactor(game): replace 3,300-line switch with dispatch table in GameHandler
2026-03-24 23:12:49 -07:00
Paul
fa2e8ad0fe Merge commit '6bfa3dc402' into chore/split-mega-switch-to-map 2026-03-25 07:27:03 +03:00
Paul
15f12d86b3 split mega switch 2026-03-25 07:26:38 +03:00
Kelsi
6bfa3dc402 fix: suppress spell sounds and melee swing for crafting/profession spells
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Crafting spells (bandages, smelting, etc.) were playing magic precast/
cast-complete audio and triggering melee weapon swing animations because
they have physical school mask (1). Re-add isProfessionSpell check to
skip spell sounds and melee animation for tradeskill spells. The
character still plays the generic cast animation via spellCastAnimCallback.
2026-03-24 14:33:22 -07:00
Kelsi
432da20b3e feat: enable crafting sounds and add Create All button
Remove the isProfessionSpell sound suppression so crafting spells play
precast and cast-complete audio like combat spells. Crafting was
previously silent by design but users expect audio feedback.

Add "Create All" button to the tradeskill UI that queues 999 crafts.
The server automatically stops the queue when materials run out
(SPELL_FAILED_REAGENTS cancels the craft queue). This matches the
real WoW client's behavior for batch crafting.
2026-03-24 14:22:28 -07:00
Kelsi
1dd3823013 perf: use second GPU queue for parallel texture/buffer uploads
Request 2 queues from the graphics family when available (NVIDIA
exposes 16, AMD 2+). Upload batches now submit to queue[1] while
rendering uses queue[0], enabling parallel GPU transfers without
queue-family ownership transfer barriers (same family).

Falls back to single-queue path on GPUs with only 1 queue in the
graphics family. Transfer command pool is separate to avoid contention.
2026-03-24 14:09:16 -07:00
Kelsi
ed0cb0ad25 perf: time-budget tile finalization to prevent 1+ second main-loop stalls
processReadyTiles was calling advanceFinalization with a step limit of 1
but a single step (texture upload or M2 model load) could take 1060ms.
Replace the step counter with an 8ms wall-clock time budget (16ms during
taxi) so finalization yields to the render loop before causing a visible
stall. Heavy tiles spread across multiple frames instead of blocking.
2026-03-24 13:56:20 -07:00
Kelsi
05e85d9fa7 fix: correct melee swing sound paths to match WoW MPQ layout
The melee swing clips used non-existent paths (SwordSwing, MeleeSwing)
instead of the actual WoW 3.3.5a weapon swing files: WeaponSwings/
mWooshMedium and mWooshLarge for hit swings, MissSwings/MissWhoosh
for misses. Fixes "No melee swing SFX found in assets" warning.
2026-03-24 13:46:01 -07:00
Kelsi
7a5d80e801 fix: flush GPU before first render frame after world load
Add vkDeviceWaitIdle after world loading completes to ensure all async
texture uploads and resource creation are fully flushed before the
first render frame. Mitigates intermittent NVIDIA driver crashes at
vkCmdBeginRenderPass during initial world entry.
2026-03-24 13:34:52 -07:00
Kelsi
891b9e5822 fix: show friendly map names on loading screen (Outland not Expansion01)
Add mapDisplayName() with friendly names for continents: "Eastern
Kingdoms", "Kalimdor", "Outland", "Northrend". The loading screen
previously showed WDT directory names like "Expansion01" when
Map.dbc's localized name field was empty or matched the internal name.
2026-03-24 13:20:06 -07:00
Kelsi
9a6a430768 fix: track render pass subpass mode to prevent ImGui secondary violation
When parallel recording is active, the scene pass uses
VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS. Post-processing paths
(FSR/FXAA) end the scene pass and begin a new INLINE render pass for
the swapchain output. ImGui rendering must use the correct mode —
secondary buffers for SECONDARY passes, direct calls for INLINE.

Previously the check used a static condition based on enabled features
(!fsr && !fsr2 && !fxaa && parallel), which could mismatch if a
feature was enabled but initialization failed. Replace with
endFrameInlineMode_ flag that tracks the actual current render pass
mode at runtime, eliminating the validation error
VUID-vkCmdDrawIndexed-commandBuffer-recording that caused intermittent
NVIDIA driver crashes.
2026-03-24 13:05:27 -07:00
Kelsi
a152023e5e fix: add VkSampler cache to prevent sampler exhaustion crash
Validation layers revealed 9965 VkSamplers allocated against a device
limit of 4000 — every VkTexture created its own sampler even when
configurations were identical. This exhausted NVIDIA's sampler pool
and caused intermittent SIGSEGV in vkCmdBeginRenderPass.

Add a thread-safe sampler cache in VkContext that deduplicates samplers
by FNV-1a hash of all 14 VkSamplerCreateInfo fields. All texture,
render target, renderer, water, and loading screen sampler creation
now goes through getOrCreateSampler(). Textures set ownsSampler_=false
so shared samplers aren't double-freed.

Also auto-disable anisotropy in the cache when the physical device
doesn't support the samplerAnisotropy feature, fixing the validation
error VUID-VkSamplerCreateInfo-anisotropyEnable-01070.
2026-03-24 11:44:54 -07:00
Kelsi
1556559211 fix: skip VkPipelineCache on NVIDIA to prevent driver crash
VkPipelineCache causes vkCmdBeginRenderPass to SIGSEGV inside
libnvidia-glcore.so on NVIDIA 590.x drivers. Skip pipeline cache
creation on NVIDIA GPUs — NVIDIA drivers already provide built-in
shader disk caching, so the Vulkan-level cache is redundant.
Pipeline cache still works on AMD and other vendors.
2026-03-24 10:30:25 -07:00
Kelsi Rae Davis
0a32c0fa27
Merge pull request #21 from ldmonster/chore/add-classification-to-render
refactor(rendering): extract M2 classification into pure functions
2026-03-24 10:18:24 -07:00
Kelsi
d44411c304 fix: convert PLAY_OBJECT_SOUND positions to render coords for 3D audio
Entity positions are in canonical WoW coords (X=north, Y=west) but the
audio listener uses render coords (X=west, Y=north) from the camera.
Without conversion, distance attenuation was computed on swapped axes,
making NPC ambient sounds (peasant voices, etc.) play at wrong volumes
regardless of actual distance.
2026-03-24 10:17:47 -07:00
Kelsi
c09a443b18 cleanup: remove temporary PLAY_SOUND diagnostic logging 2026-03-24 10:13:31 -07:00
Kelsi
4fcb92dfdc fix: skip FSR3 frame gen on non-AMD GPUs to prevent NVIDIA driver crash
The AMD FidelityFX FSR3 runtime corrupts Vulkan driver state when
context creation fails on NVIDIA GPUs, causing vkCmdBeginRenderPass
to SIGSEGV inside libnvidia-glcore. Gate FSR3 frame gen initialization
behind isAmdGpu() check — FSR2 upscaling still works on all GPUs.
2026-03-24 10:11:21 -07:00
Kelsi
ceb8006c3d fix: prevent hang on FSR3 upscale context creation failure
When ffxCreateContext for the upscaler fails (e.g. on NVIDIA with the
AMD FidelityFX runtime), the shutdown() path called dlclose() on the
runtime library which could hang — the library's global destructors may
block waiting for GPU operations that never completed.

Skip dlclose() on context creation failure: just clean up function
pointers and mark as failed. The library stays loaded (harmless) and
the game continues with FSR2 fallback instead of hanging.
2026-03-24 10:06:57 -07:00
Kelsi
d2a396df11 feat: log GPU vendor/name at init, add PLAY_SOUND diagnostics
Log GPU name and vendor ID during VkContext initialization for easier
debugging of GPU-specific issues (FSR3, driver compat, etc.). Add
isAmdGpu()/isNvidiaGpu() accessors.

Temporarily log SMSG_PLAY_SOUND and SMSG_PLAY_OBJECT_SOUND at WARN
level (sound ID, name, file path) to diagnose unidentified ambient
NPC sounds reported by the user.
2026-03-24 09:56:54 -07:00
Paul
cbfe7d5f44 refactor(rendering): extract M2 classification into pure functions 2026-03-24 19:55:24 +03:00
Kelsi
c8c01f8ac0 perf: add Vulkan pipeline cache persistence for faster startup
Create a VkPipelineCache at device init, loaded from disk if available.
All 65 pipeline creation calls across 19 renderer files now use the
shared cache. On shutdown, the cache is serialized to disk so subsequent
launches skip redundant shader compilation.

Cache path: ~/.local/share/wowee/pipeline_cache.bin (Linux),
~/Library/Caches/wowee/ (macOS), %APPDATA%\wowee\ (Windows).
Stale/corrupt caches are handled gracefully (fallback to empty cache).
2026-03-24 09:47:03 -07:00
Kelsi
c18720f0f0 feat: server-synced bag sort, fix world map continent bounds, update docs
Inventory sort: clicking "Sort Bags" now generates CMSG_SWAP_ITEM packets
to move items server-side (one swap per frame to avoid race conditions).
Client-side sort runs immediately for visual preview; server swaps follow.
New Inventory::computeSortSwaps() computes minimal swap sequence using
selection-sort permutation on quality→itemId→stackCount comparator.

World map: fix continent bounds derivation that used intersection (max/min)
instead of union (min/max) of child zone bounds, causing continent views
to display zoomed-in/clipped.

Update README.md and docs/status.md with current features, release info,
and known gaps (v1.8.2-preview, 664 opcode handlers, NPC voices, bag
independence, CharSections auto-detect, quest GO server limitation).
2026-03-24 09:24:09 -07:00
Kelsi
62e99da1c2 fix: remove forced backpack-open from toggleBag for full bag independence
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
2026-03-24 08:38:06 -07:00
Kelsi
9ab70c7b1f cleanup: remove unused spline diagnostic variables 2026-03-24 08:29:43 -07:00
Kelsi
d083ac11fa fix: suppress false-positive maskBlockCount warnings for VALUES updates
VALUES update blocks don't carry an objectType field (it defaults to 0),
so the sanity check incorrectly used the non-PLAYER threshold (10) for
player character updates that legitimately need 42-46 mask blocks. Allow
up to 55 blocks for VALUES updates (could be any entity type including
PLAYER). Only enforce strict limits on CREATE_OBJECT blocks where the
objectType is known.
2026-03-24 08:23:14 -07:00
Kelsi Davis
2e136e9fdc fix: enable Vulkan portability drivers on macOS for MoltenVK compatibility
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Homebrew's vulkan-loader hides portability ICDs (like MoltenVK) from
pre-instance extension enumeration by default, causing SDL2 to fail
with "doesn't implement VK_KHR_surface". Set VK_LOADER_ENABLE_PORTABILITY_DRIVERS
before loading the Vulkan library so the loader includes MoltenVK and
its surface extensions.
2026-03-23 19:16:12 -07:00
Kelsi
5e8d4e76c8 fix: allow closing any bag independently and reset off-screen positions
Remove the forced backpack-open constraint that prevented closing the
backpack while other bags were open. Each bag window is now independently
closable regardless of which others are open.

Add off-screen position reset to individual bag windows (renderBagWindow)
so bags saved at positions outside the current resolution snap back to
their default stack position.
2026-03-23 18:16:23 -07:00
Kelsi
b10c8b7aea fix: send GAMEOBJ_USE+LOOT together for chests, reset off-screen bag pos
Chest-type GOs now send CMSG_GAMEOBJ_USE immediately followed by
CMSG_LOOT in the same frame. The USE handler opens the chest, then the
LOOT handler reads the contents — both processed sequentially by the
server. Previously only CMSG_LOOT was sent (no USE), which failed on
AzerothCore because the chest wasn't activated first.

Reset the Bags window position to bottom-right if the saved position
is outside the current screen resolution (e.g. after a resolution
change or moving between monitors).
2026-03-23 18:10:16 -07:00
Kelsi
8a617e842b fix: direct CMSG_LOOT for chest GOs and increase M2 descriptor pools
Chest-type game objects (quest pickups, treasure chests) now send
CMSG_LOOT directly with the GO GUID instead of CMSG_GAMEOBJ_USE +
delayed CMSG_LOOT. The server's loot handler activates the GO and
sends SMSG_LOOT_RESPONSE in one step. The old approach failed because
CMSG_GAMEOBJ_USE opened+despawned the GO before CMSG_LOOT arrived.

Double M2 bone and material descriptor pool sizes (8192 → 16384) to
handle the increased NPC count from the spline parsing fix — patrolling
NPCs that were previously invisible now spawn correctly, exhausting
the old pool limits.
2026-03-23 17:41:42 -07:00
Kelsi
98cc282e7e fix: stop sending CMSG_LOOT after CMSG_GAMEOBJ_USE (releases server loot)
AzerothCore handles loot automatically in the CMSG_GAMEOBJ_USE handler
(calls SendLoot internally). Sending a redundant CMSG_LOOT 200ms later
triggers DoLootRelease() on the server, which closes the loot the server
just opened — before SMSG_LOOT_RESPONSE ever reaches the client. This
broke quest GO interactions (Bundle of Wood, etc.) because the loot
window never appeared and quest items were never granted.

Also remove temporary diagnostic logging from GO interaction path.
2026-03-23 17:23:49 -07:00
Kelsi
a3934807af fix: restore WMO wall collision threshold to cos(50°) ≈ 0.65
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
The wall/floor classification threshold was lowered from 0.65 to 0.35
in a prior optimization commit, causing surfaces at 35-65° from
horizontal (steep walls, angled building geometry) to be classified as
floors and skipped during wall collision. This allowed the player to
clip through angled WMO walls.

Restore the threshold to 0.65 (cos 50°) in both the collision grid
builder and the runtime checkWallCollision skip, matching the
MAX_WALK_SLOPE limit used for slope-slide physics.
2026-03-23 16:43:15 -07:00
Kelsi
2c3bd06898 fix: read unconditional parabolic fields in WotLK spline parsing
AzerothCore/ChromieCraft always writes verticalAcceleration(float) +
effectStartTime(uint32) after durationMod in the spline movement block,
regardless of whether the PARABOLIC spline flag (0x800) is set. The
parser only read these 8 bytes when PARABOLIC was flagged, causing it
to read the wrong offset as pointCount (0 instead of e.g. 11). This
made every patrolling NPC fail to parse — invisible with no displayId.

Also fix splineStart calculation (was off by 4 bytes) and remove
temporary diagnostic logging.
2026-03-23 16:32:59 -07:00
Kelsi
1a3146395a fix: validate splineMode in Classic spline parse to prevent desync
When a WotLK NPC has durationMod=0.0, the Classic-first spline parser
reads it as pointCount=0 and "succeeds", then consumes garbage bytes as
splineMode and endPoint. This desynchronizes the read position for all
subsequent update blocks in the packet, causing cascading failures
(truncated update mask, unknown update type) that leave NPCs without
displayIds — making them invisible.

Fix: after reading splineMode, reject the Classic parse if splineMode > 3
(valid values are 0-3) and fall through to the WotLK format parser.
2026-03-23 11:09:15 -07:00
Kelsi
503f9ed650 fix: auto-detect CharSections.dbc layout and add Blood Elf/Draenei NPC voices
CharSections.dbc has different field layouts between stock WotLK (textures
at field 4-6) and Classic/TBC/Turtle/HD-textured WotLK (VariationIndex at
field 4). Add detectCharSectionsFields() that probes field-4 values at
runtime to determine the correct layout, so both stock and modded clients
work without JSON changes.

Also add BLOODELF_MALE/FEMALE and DRAENEI_MALE/FEMALE voice types to the
NPC voice system — previously all Blood Elf and Draenei NPCs fell through
to GENERIC (random dwarf/gnome/night elf/orc mix).
2026-03-23 11:00:49 -07:00
Kelsi
d873f27070 feat: add GetNetStats (latency) and AcceptBattlefieldPort (BG queue)
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
GetNetStats() returns bandwidthIn, bandwidthOut, latencyHome,
latencyWorld — with real latency from getLatencyMs(). Used by
latency display addons and the default UI's network indicator.

AcceptBattlefieldPort(index, accept) accepts or declines a
battleground queue invitation. Backed by existing acceptBattlefield
and declineBattlefield methods.
2026-03-23 04:17:25 -07:00
Kelsi
a53342e23f feat: add taxi/flight path API (NumTaxiNodes, TaxiNodeName, TakeTaxiNode)
NumTaxiNodes() returns the count of taxi nodes available at the
current flight master. TaxiNodeName(index) returns the node name.
TaxiNodeGetType(index) returns whether the node is known/reachable.
TakeTaxiNode(index) activates the flight to the selected node.

Uses existing taxiNodes_ data and activateTaxi() method.
Enables flight path addons and taxi map overlay addons.
2026-03-23 04:07:34 -07:00
Kelsi
285c4caf24 feat: add quest interaction (accept, decline, complete, abandon, rewards)
AcceptQuest() / DeclineQuest() respond to quest offer dialogs.
CompleteQuest() sends quest completion to server.
AbandonQuest(questId) abandons a quest from the quest log.
GetNumQuestRewards() / GetNumQuestChoices() return reward counts
for the selected quest log entry.

Backed by existing GameHandler methods. Enables quest helper addons
to accept/decline/complete quests programmatically.
2026-03-23 03:57:53 -07:00
Kelsi
d9c12c733d feat: add gossip/NPC dialog API for quest and vendor addons
GetNumGossipOptions() returns option count for current NPC dialog.
GetGossipOptions() returns pairs of (text, type) for each option
where type is "gossip", "vendor", "taxi", "trainer", etc.
SelectGossipOption(index) selects a dialog option.
GetNumGossipAvailableQuests() / GetNumGossipActiveQuests() return
quest counts in the gossip dialog.
CloseGossip() closes the NPC dialog.

Uses existing GossipMessageData from SMSG_GOSSIP_MESSAGE handler.
Enables gossip addons and quest helper dialog interaction.
2026-03-23 03:53:54 -07:00
Kelsi
93dabe83e4 feat: add connection, equipment, focus, and realm queries
IsConnectedToServer() checks if connected to the game server.
UnequipItemSlot(slot) moves an equipped item to the backpack.
HasFocus() checks if the player has a focus target set.
GetRealmName() / GetNormalizedRealmName() return realm name.

All backed by existing GameHandler methods.
2026-03-23 03:42:26 -07:00
Kelsi
c874ffc6b6 feat: add player commands (helm/cloak toggle, PvP, minimap ping, /played)
ShowHelm() / ShowCloak() toggle helm/cloak visibility.
TogglePVP() toggles PvP flag.
Minimap_Ping(x, y) sends a minimap ping to the group.
RequestTimePlayed() requests /played data from server.

All backed by existing GameHandler methods.
2026-03-23 03:37:18 -07:00
Kelsi
9a47def27c feat: add chat channel management (Join, Leave, GetChannelName)
JoinChannelByName(name, password) joins a chat channel.
LeaveChannelByName(name) leaves a chat channel.
GetChannelName(index) returns channel info (name, header, collapsed,
channelNumber, count, active, category) — 7-field signature.

Backed by existing joinChannel/leaveChannel/getChannelByIndex methods.
Enables chat channel management addons and channel autojoining.
2026-03-23 03:33:09 -07:00
Kelsi
2b582f8a20 feat: add Logout, CancelLogout, RandomRoll, FollowUnit
Logout() sends logout request to server.
CancelLogout() cancels a pending logout.
RandomRoll(min, max) sends /roll (defaults 1-100).
FollowUnit() is a stub (requires movement system).

Backed by existing requestLogout, cancelLogout, randomRoll methods.
2026-03-23 03:27:45 -07:00
Kelsi
6c873622dc feat: add party management (InviteUnit, UninviteUnit, LeaveParty)
InviteUnit(name) invites a player to the group.
UninviteUnit(name) removes a player from the group.
LeaveParty() leaves the current party/raid.

Backed by existing inviteToGroup, uninvitePlayer, leaveGroup methods.
2026-03-23 03:22:30 -07:00
Kelsi
7927d98e79 feat: add guild management (invite, kick, promote, demote, leave, notes)
GuildInvite(name) invites a player to the guild.
GuildUninvite(name) kicks a member (uses kickGuildMember).
GuildPromote(name) / GuildDemote(name) change rank.
GuildLeave() leaves the guild.
GuildSetPublicNote(name, note) sets a member's public note.

All backed by existing GameHandler methods that send the appropriate
guild management CMSG packets.
2026-03-23 03:18:03 -07:00
Kelsi
2f68282afc feat: add DoEmote for /dance /wave /bow and 30+ emote commands
DoEmote(token) maps emote token strings to TextEmote DBC IDs and
sends them via sendTextEmote. Supports 30+ common emotes: WAVE,
BOW, DANCE, CHEER, CHICKEN, CRY, EAT, FLEX, KISS, LAUGH, POINT,
ROAR, RUDE, SALUTE, SHY, SILLY, SIT, SLEEP, SPIT, THANK, CLAP,
KNEEL, LAY, NO, YES, BEG, ANGRY, FAREWELL, HELLO, WELCOME, etc.

Targets the current target if one exists.
2026-03-23 03:12:30 -07:00
Kelsi
a503d09d9b feat: add friend/ignore management (AddFriend, RemoveFriend, AddIgnore, DelIgnore)
AddFriend(name, note) and RemoveFriend(name) manage the friends list.
AddIgnore(name) and DelIgnore(name) manage the ignore list.
ShowFriends() is a stub (friends panel is ImGui-rendered).

All backed by existing GameHandler methods that send the appropriate
CMSG_ADD_FRIEND, CMSG_DEL_FRIEND, CMSG_ADD_IGNORE, CMSG_DEL_IGNORE
packets to the server.
2026-03-23 03:07:24 -07:00
Kelsi
75db30c91e feat: add Who system API for player search addons
GetNumWhoResults() returns result count and total online players.
GetWhoInfo(index) returns name, guild, level, race, class, zone,
classFileName — the standard 7-field /who result signature.

SendWho(query) sends a /who search to the server.
SetWhoToUI() is a stub for addon compatibility.

Uses existing whoResults_ from SMSG_WHO handler and queryWho().
Enables /who replacement addons and social panel search.
2026-03-23 03:03:01 -07:00
Kelsi
da5b464cf6 feat: add IsPlayerSpell, IsCurrentSpell, and spell state queries
IsPlayerSpell(spellId) checks if the spell is in the player's known
spells set. Used by action bar addons to distinguish permanent spells
from temporary proc/buff-granted abilities.

IsCurrentSpell(spellId) checks if the spell is currently being cast.
IsSpellOverlayed() and IsAutoRepeatSpell() are stubs for addon compat.
2026-03-23 02:53:34 -07:00
Kelsi
9cd2cfa46e feat: add title API (GetCurrentTitle, GetTitleName, SetCurrentTitle)
GetCurrentTitle() returns the player's chosen title bit index.
GetTitleName(bit) returns the formatted title string from
CharTitles.dbc (e.g., "Commander %s", "%s the Explorer").
SetCurrentTitle() is a stub for title switching.

Used by title display addons and the character panel title selector.
2026-03-23 02:47:30 -07:00
Kelsi
0dc3e52d32 feat: add inspect and clear stubs for inspection addons
GetInspectSpecialization() returns the inspected player's active
talent group from the cached InspectResult data.

NotifyInspect() and ClearInspectPlayer() are stubs — inspection is
auto-triggered by the C++ side when targeting players. These prevent
nil errors in inspection addons that call them.
2026-03-23 02:38:18 -07:00
Kelsi
4f28187661 feat: add honor/arena currency, played time, and bind location
GetHonorCurrency() returns honor points from update fields.
GetArenaCurrency() returns arena points.
GetTimePlayed() returns total time played and level time played
in seconds (populated from SMSG_PLAYED_TIME).
GetBindLocation() returns the hearthstone bind zone name.

Used by currency displays, /played addons, and hearthstone tooltip.
2026-03-23 02:33:32 -07:00
Kelsi
a20984ada2 feat: add instance lockout API for raid reset tracking
GetNumSavedInstances() returns count of saved instance lockouts.
GetSavedInstanceInfo(index) returns 9-field WoW signature: name,
mapId, resetTimeRemaining, difficulty, locked, extended,
instanceIDMostSig, isRaid, maxPlayers.

Uses existing instanceLockouts_ from SMSG_RAID_INSTANCE_INFO.
Enables SavedInstances and lockout tracking addons to display
which raids/dungeons the player is locked to and when they reset.
2026-03-23 02:28:38 -07:00
Kelsi
2e9dd01d12 feat: add battleground scoreboard API for PvP addons
GetNumBattlefieldScores() returns player count in the BG scoreboard.
GetBattlefieldScore(index) returns 12-field WoW API signature: name,
killingBlows, honorableKills, deaths, honorGained, faction, rank,
race, class, classToken, damageDone, healingDone.

GetBattlefieldWinner() returns winning faction (0=Horde, 1=Alliance)
or nil if BG is still in progress.

RequestBattlefieldScoreData() sends MSG_PVP_LOG_DATA to refresh the
scoreboard from the server.

Uses existing BgScoreboardData from MSG_PVP_LOG_DATA handler.
Enables BG scoreboard addons and PvP tracking.
2026-03-23 02:17:16 -07:00
Kelsi
47e317debf feat: add UnitIsPVP, UnitIsPVPFreeForAll, and GetBattlefieldStatus
UnitIsPVP(unit) checks UNIT_FLAG_PVP (0x1000) on the unit's flags
field. Used by unit frame addons to show PvP status indicators.

UnitIsPVPFreeForAll(unit) checks for FFA PvP flag.

GetBattlefieldStatus() returns stub ("none") for addons that check
BG queue state on login. Full BG scoreboard data exists in
GameHandler but is rendered via ImGui.
2026-03-23 01:42:57 -07:00
Kelsi
d0743c5fee feat: show Unique-Equipped on items with that flag
Items with the Unique-Equipped flag (itemFlags & 0x1000000) now
display "Unique-Equipped" in the tooltip header. This is distinct
from "Unique" (maxCount=1) — Unique-Equipped means you can carry
multiple but only equip one (e.g., trinkets, rings with the flag).
2026-03-23 01:32:37 -07:00
Kelsi
757fc857cd feat: show 'This Item Begins a Quest' on quest-starting item tooltips
Items with a startQuestId now display "This Item Begins a Quest" in
gold text at the bottom of the tooltip, matching WoW's behavior.
Helps players identify quest-starting drops in their inventory.

Passes startsQuest flag through _GetItemTooltipData from the
startQuestId field in ItemQueryResponseData.
2026-03-23 01:28:28 -07:00
Kelsi
b8c33c7d9b feat: resolve spell \$o1 periodic totals from base points × ticks
Spell descriptions now substitute \$o1/\$o2/\$o3 with the total
periodic damage/healing: base_per_tick × (duration / 3sec).

Example: SW:Pain with base=4 (5 per tick), duration=18sec (6 ticks):
  Before: "Causes X Shadow damage over 18 sec"
  After:  "Causes 30 Shadow damage over 18 sec"

Combined with \$s1 (per-tick/instant) and \$d (duration), the three
most common spell template variables are now fully resolved. This
covers the vast majority of spell tooltips.
2026-03-23 01:02:31 -07:00
Kelsi
11ecc475c8 feat: resolve spell \$d duration to real seconds from SpellDuration.dbc
Spell descriptions now substitute \$d with actual duration values:
  Before: "X damage over X sec"
  After:  "30 damage over 18 sec"

Implementation:
- DurationIndex field (40) added to all expansion Spell.dbc layouts
- SpellDuration.dbc loaded during cache build: maps index → base ms
- cleanSpellDescription substitutes \$d with resolved seconds/minutes
- getSpellDuration() accessor on GameHandler

Combined with \$s1/\$s2/\$s3 from the previous commit, most common
spell description templates are now fully resolved with real values.
2026-03-23 01:00:18 -07:00
Kelsi
a5aa1faf7a feat: resolve spell \$s1/\$s2/\$s3 to real DBC damage/heal values
Spell descriptions now substitute \$s1/\$s2/\$s3 template variables
with actual effect base points from Spell.dbc (field 80/81/82).
For example: "causes \$s1 Fire Damage" → "causes 562 Fire Damage".

Implementation:
- Added EffectBasePoints0/1/2 to all 4 expansion DBC layouts
- SpellNameEntry now stores effectBasePoints[3]
- loadSpellNameCache reads base points during DBC iteration
- cleanSpellDescription substitutes \$s1→abs(base)+1 when available
- getSpellEffectBasePoints() accessor on GameHandler

Values are DBC base points (before spell power scaling). Still uses
"X" placeholder for unresolved variables (\$d, \$o1, etc.).
2026-03-23 00:51:19 -07:00
Kelsi
f9464dbacd feat: add CalendarGetDate and calendar stubs
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
CalendarGetDate() returns real weekday, month, day, year from the
system clock. Used by calendar addons and date-aware UI elements.

CalendarGetNumPendingInvites() and CalendarGetNumDayEvents() return 0
as stubs — prevents nil errors in addons that check calendar state.
2026-03-23 00:33:09 -07:00
Kelsi
df610ff472 feat: add GetDifficultyInfo for instance difficulty display
GetDifficultyInfo(id) returns name, groupType, isHeroic, maxPlayers
for WotLK instance difficulties:
  0: "5 Player" (party, normal, 5)
  1: "5 Player (Heroic)" (party, heroic, 5)
  2: "10 Player" (raid, normal, 10)
  3: "25 Player" (raid, normal, 25)
  4/5: 10/25 Heroic raids

Used by boss mod addons (DBM, BigWigs) and instance info displays
to show the current dungeon difficulty.
2026-03-23 00:27:34 -07:00
Kelsi
d1d3645d2b feat: add WEATHER_CHANGED event and GetWeatherInfo query
Fire WEATHER_CHANGED(weatherType, intensity) when the server sends
SMSG_WEATHER with a new weather state. Enables weather-aware addons
to react to rain/snow/storm transitions.

GetWeatherInfo() returns current weatherType (0=clear, 1=rain, 2=snow,
3=storm) and intensity (0.0-1.0). Weather data is already tracked by
game_handler and used by the renderer for particle effects and fog.
2026-03-23 00:23:22 -07:00
Kelsi
2947e31375 feat: add GuildRoster request and SortGuildRoster stub
GuildRoster() triggers CMSG_GUILD_ROSTER to request updated guild
member data from the server. Called by guild roster addons and the
social panel to refresh the member list.

SortGuildRoster() is a no-op (sorting is handled client-side by
the ImGui guild roster display).
2026-03-22 23:42:44 -07:00
Kelsi
79bc3a7fb6 feat: add BuyMerchantItem and SellContainerItem for vendor interaction
BuyMerchantItem(index, count) purchases an item from the current
vendor by merchant slot index. Resolves itemId and slot from the
vendor's ListInventoryData.

SellContainerItem(bag, slot) sells an item from the player's
inventory to the vendor. Supports backpack (bag=0) and bags 1-4.

Enables auto-sell addons (Scrap, AutoVendor) and vendor UI addons
to buy/sell items programmatically.
2026-03-22 23:37:29 -07:00
Kelsi
0a2667aa05 feat: add RepairAllItems for vendor auto-repair addons
RepairAllItems(useGuildBank) sends CMSG_REPAIR_ITEM to repair all
equipped items at the current vendor. Checks CanMerchantRepair before
sending. Optional useGuildBank flag for guild bank repairs.

One of the most commonly needed addon functions — enables auto-repair
addons to fix all gear in a single call when visiting a repair vendor.
2026-03-22 23:32:20 -07:00
Kelsi
397185d33c feat: add trade API (AcceptTrade, CancelTrade, InitiateTrade)
AcceptTrade() locks in the trade offer via CMSG_ACCEPT_TRADE.
CancelTrade() cancels an open trade via CMSG_CANCEL_TRADE.
InitiateTrade(unit) starts a trade with a target player.

Uses existing GameHandler trade functions and TradeStatus tracking.
Enables trade addons and macro-based trade acceptance.
2026-03-22 23:28:25 -07:00
Kelsi
adc1b40290 feat: add GetAuctionItemLink for AH item link generation — commit #100
Quality-colored item links for auction house items, enabling AH addons
to display clickable item links in their UI and chat output.

This is the 100th commit of this session, bringing the total to
408 API functions across all WoW gameplay systems.
2026-03-22 23:22:08 -07:00
Kelsi
fa25d8b6b9 feat: add auction house API for Auctioneer and AH addons
GetNumAuctionItems(listType) returns item count and total for
browse/owner/bidder lists. GetAuctionItemInfo(type, index) returns
the full 17-field WoW API signature: name, texture, count, quality,
canUse, level, minBid, minIncrement, buyoutPrice, bidAmount,
highBidder, owner, saleStatus, itemId.

GetAuctionItemTimeLeft(type, index) returns time category 1-4
(short/medium/long/very long).

Uses existing auctionBrowseResults_, auctionOwnerResults_, and
auctionBidderResults_ from SMSG_AUCTION_LIST_RESULT. Enables
Auctioneer, Auctionator, and AH scanning addons.
2026-03-22 23:14:07 -07:00
Kelsi
3f324ddf3e feat: add mail inbox API for postal and mail addons
GetInboxNumItems() returns count of mail messages.
GetInboxHeaderInfo(index) returns the full 13-field WoW API signature:
packageIcon, stationeryIcon, sender, subject, money, COD, daysLeft,
hasItem, wasRead, wasReturned, textCreated, canReply, isGM.

GetInboxText(index) returns the mail body text.
HasNewMail() checks for unread mail (minimap icon indicator).

Uses existing mailInbox_ populated from SMSG_MAIL_LIST_RESULT.
Enables postal addons (Postal, MailOpener) to read inbox data.
2026-03-22 22:57:45 -07:00
Kelsi
97ec915e48 feat: add glyph socket API for WotLK talent customization — 400 APIs
GetNumGlyphSockets() returns 6 (WotLK glyph slot count).
GetGlyphSocketInfo(index, talentGroup) returns enabled, glyphType
(1=major, 2=minor), glyphSpellID, and icon for each socket.

Uses existing learnedGlyphs_ array populated from SMSG_TALENTS_INFO.
Enables talent/glyph inspection addons.

This commit brings the total API count to exactly 400 functions.
2026-03-22 22:48:30 -07:00
Kelsi
c25151eff1 feat: add achievement API (GetAchievementInfo, GetNumCompleted)
GetNumCompletedAchievements() returns count of earned achievements.
GetAchievementInfo(id) returns the full 12-field WoW API signature:
id, name, points, completed, month, day, year, description, flags,
icon, rewardText, isGuildAchievement.

Uses existing earnedAchievements_ set, achievement name/description/
points caches from Achievement.dbc, and completion date tracking
from SMSG_ALL_ACHIEVEMENT_DATA / SMSG_ACHIEVEMENT_EARNED.

Enables achievement tracking addons (Overachiever, etc.) to query
and display achievement progress.
2026-03-22 22:43:10 -07:00
Kelsi
ee6551b286 feat: add CastPetAction, TogglePetAutocast, PetDismiss, IsPetAttackActive
Complete the pet action bar interaction:

- CastPetAction(index) — cast the pet spell at the given bar slot
  by sending the packed action via sendPetAction
- TogglePetAutocast(index) — toggle autocast for the pet spell
  at the given slot via togglePetSpellAutocast
- PetDismiss() — send dismiss pet command
- IsPetAttackActive() — whether pet is currently in attack mode

Together with the previous pet bar functions (HasPetUI, GetPetActionInfo,
PetAttack, PetFollow, PetWait, PetPassiveMode, PetDefensiveMode), this
completes the pet action bar system for hunters/warlocks/DKs.
2026-03-22 22:37:24 -07:00
Kelsi
3f3ed22f78 feat: add pet action bar API for hunter/warlock pet control
Implement pet action bar functions using existing pet data:

- HasPetUI() — whether player has an active pet
- GetPetActionInfo(index) — name, icon, isActive, autoCastEnabled
  for each of the 10 pet action bar slots
- GetPetActionCooldown(index) — cooldown state stub
- PetAttack() — send attack command to current target
- PetFollow() — send follow command
- PetWait() — send stay command
- PetPassiveMode() — set passive react mode
- PetDefensiveMode() — set defensive react mode

All backed by existing SMSG_PET_SPELLS data (petActionSlots_,
petCommand_, petReact_, petAutocastSpells_) and sendPetAction().
2026-03-22 22:33:18 -07:00
Kelsi
81bd0791aa feat: add GetActionBarPage and ChangeActionBarPage for bar switching
GetActionBarPage() returns the current action bar page (1-6).
ChangeActionBarPage(page) switches pages and fires ACTIONBAR_PAGE_CHANGED
via the Lua frame event system. Used by action bar addons and the
default UI's page arrows / shift+number keybinds.

Action bar page state tracked in Lua global __WoweeActionBarPage.
2026-03-22 22:24:34 -07:00
Kelsi
3a4d2e30bc feat: add CastShapeshiftForm and CancelShapeshiftForm
CastShapeshiftForm(index) casts the spell for the given form slot:
- Warrior: Battle Stance(2457), Defensive(71), Berserker(2458)
- Druid: Bear(5487), Travel(783), Cat(768), Flight(40120),
  Moonkin(24858), Tree(33891)
- Death Knight: Blood(48266), Frost(48263), Unholy(48265)
- Rogue: Stealth(1784)

This makes stance bar buttons functional — clicking a form button
actually casts the corresponding spell to switch forms.

CancelShapeshiftForm stub for cancelling current form.
2026-03-22 22:17:39 -07:00
Kelsi
9986de0529 feat: add GetShapeshiftFormInfo for stance/form bar display
GetShapeshiftFormInfo(index) returns icon, name, isActive, isCastable
for each shapeshift form slot. Provides complete form tables for:

- Warrior: Battle Stance, Defensive Stance, Berserker Stance
- Druid: Bear, Travel, Cat, Swift Flight, Moonkin, Tree of Life
- Death Knight: Blood/Frost/Unholy Presence
- Rogue: Stealth

isActive is true when the form matches the current shapeshiftFormId_.
GetShapeshiftFormCooldown stub returns no cooldown.

Together with GetShapeshiftForm and GetNumShapeshiftForms from the
previous commit, this completes the stance bar API that addons use
to render and interact with form/stance buttons.
2026-03-22 22:14:24 -07:00
Kelsi
587c0ef60d feat: track shapeshift form and fire UPDATE_SHAPESHIFT_FORM events
Add UNIT_FIELD_BYTES_1 to all expansion update field tables (Classic=133,
TBC/WotLK=137). Byte 3 of this field contains the shapeshift form ID
(Bear=1, Cat=3, Travel=4, Moonkin=31, Tree=36, Battle Stance=17, etc.).

Track form changes in the VALUES update handler and fire
UPDATE_SHAPESHIFT_FORM + UPDATE_SHAPESHIFT_FORMS events when the
form changes. This enables stance bar addons and druid form tracking.

New Lua functions:
- GetShapeshiftForm() — returns current form ID (0 = no form)
- GetNumShapeshiftForms() — returns form count by class (Warrior=3,
  Druid=6, DK=3, Rogue=1, Priest=1, Paladin=3)
2026-03-22 22:12:17 -07:00
Kelsi
b9a1b0244b feat: add GetEnchantInfo for enchantment name resolution
GetEnchantInfo(enchantId) looks up the enchantment name from
SpellItemEnchantment.dbc (field 14). Returns the display name
like "Crusader", "+22 Intellect", or "Mongoose" for a given
enchant ID.

Used by equipment comparison addons and tooltip addons to display
enchantment names on equipped gear. The enchant ID comes from the
item's ITEM_FIELD_ENCHANTMENT update field.

Also adds getEnchantName() to GameHandler for C++ access.
2026-03-22 21:53:58 -07:00
Kelsi
922d6bc8f6 feat: clean spell description template variables for readable tooltips
Spell descriptions from DBC contain raw template variables like
\$s1, \$d, \$o1 that refer to effect values resolved at runtime.
Without DBC effect data loaded, these showed as literal "\$s1" in
tooltips, making descriptions hard to read.

Now strips template variables and replaces with readable placeholders:
- \$s1/\$s2/\$s3 → "X" (effect base points)
- \$d → "X sec" (duration)
- \$o1 → "X" (periodic total)
- \$a1 → "X" (radius)
- \$\$ → "$" (literal dollar sign)
- \${...} blocks → stripped

Result: "Hurls a fiery ball that causes X Fire Damage" instead of
"Hurls a fiery ball that causes \$s1 Fire Damage". Not as informative
as real values, but significantly more readable.
2026-03-22 21:32:31 -07:00
Kelsi
42f2873c0d feat: add Mixin, CreateFromMixins, and MergeTable utilities
Implement the WoW Mixin pattern used by modern addons:
- Mixin(obj, ...) — copies fields from mixin tables into obj
- CreateFromMixins(...) — creates a new table from mixin templates
- CreateAndInitFromMixin(mixin, ...) — creates and calls Init()
- MergeTable(dest, src) — shallow-merge src into dest

These enable OOP-style addon architecture used by LibSharedMedia,
WeakAuras, and many Ace3-based addons for class/object creation.
2026-03-22 21:23:00 -07:00
Kelsi
7b88b0c6ec feat: add strgfind and tostringall WoW Lua utilities
strgfind = string.gmatch alias (deprecated WoW function used by
older addons that haven't migrated to string.gmatch).

tostringall(...) converts all arguments to strings and returns
them. Used by chat formatting and debug addons that need to safely
stringify mixed-type argument lists.
2026-03-22 21:17:59 -07:00
Kelsi
f4d78e5820 feat: add SpellStopCasting, name aliases, and targeting stubs
SpellStopCasting() cancels the current cast via cancelCast(). Used by
macro addons and cast-cancel logic (e.g., /stopcasting macro command).

UnitFullName/GetUnitName aliases for UnitName — some addons use these
variant names.

SpellIsTargeting() returns false (no AoE targeting reticle in this
client). SpellStopTargeting() is a no-op stub. Both prevent errors
in addons that check targeting state.
2026-03-22 21:08:18 -07:00
Kelsi
e2fec0933e feat: add GetClassColor and QuestDifficultyColors for UI coloring
GetClassColor(className) returns r, g, b, colorString from the
RAID_CLASS_COLORS table. Used by unit frame addons, chat addons,
and party/raid frames to color player names by class.

QuestDifficultyColors table provides standard quest difficulty
color mappings (impossible=red, verydifficult=orange, difficult=yellow,
standard=green, trivial=gray, header=gold). Used by quest log and
quest tracker addons for level-appropriate coloring.
2026-03-22 21:05:33 -07:00
Kelsi
02456ec7c6 feat: add GetMaxPlayerLevel and GetAccountExpansionLevel
GetMaxPlayerLevel() returns the level cap for the active expansion:
60 (Classic/Turtle), 70 (TBC), 80 (WotLK). Used by XP bar addons
and leveling trackers.

GetAccountExpansionLevel() returns the expansion tier: 1 (Classic),
2 (TBC), 3 (WotLK). Used by addons that adapt features based on
which expansion is active.

Both read from the ExpansionRegistry's active profile at runtime.
2026-03-22 21:01:56 -07:00
Kelsi
bafe036e79 feat: fire CURRENT_SPELL_CAST_CHANGED when player begins casting
CURRENT_SPELL_CAST_CHANGED fires when the player starts a new cast
via handleSpellStart. Some addons register for this as a catch-all
signal that the current spell state changed, complementing the more
specific UNIT_SPELLCAST_START/STOP/FAILED events.
2026-03-22 20:49:25 -07:00
Kelsi
abe5cc73df feat: fire PLAYER_COMBO_POINTS and LOOT_READY events
PLAYER_COMBO_POINTS now fires from the existing SMSG_UPDATE_COMBO_POINTS
handler — the handler already updated comboPoints_ but never notified
Lua addons. Rogue/druid combo point displays and DPS rotation addons
register for this event.

LOOT_READY fires alongside LOOT_OPENED when a loot window opens. Some
addons register for this WoW 5.x+ event name instead of LOOT_OPENED.
2026-03-22 20:46:53 -07:00
Kelsi
3b4909a140 fix: populate item subclass names for TBC expansion
The TBC item query parser left subclassName empty, so TBC items showed
no weapon/armor type in tooltips or the character sheet (e.g., "Sword",
"Plate", "Shield" were all blank). The Classic and WotLK parsers
correctly map subClass IDs to names.

Fix: call getItemSubclassName() in the TBC parser, same as WotLK.
Expose getItemSubclassName() in the header (was static, now shared
across parser files).
2026-03-22 20:30:08 -07:00
Kelsi
7967878cd9 feat: show Unique and Heroic tags on item tooltips
Items with maxCount=1 now show "Unique" in white text below the name.
Items with the Heroic flag (0x8) show "Heroic" in green text. Both
display before the bind type line, matching WoW's tooltip order.

Heroic items (from heroic dungeon/raid drops) are visually
distinguished from their normal-mode counterparts. Unique items
(trinkets, quest items, etc.) show the carry limit clearly.
2026-03-22 20:25:41 -07:00
Kelsi
1b075e17f1 feat: show item spell effects in tooltips (Use/Equip/Chance on Hit)
Item tooltips now display spell effects in green text:
- "Use: Restores 2200 health over 30 sec" (trigger 0)
- "Equip: Increases attack power by 120" (trigger 1)
- "Chance on hit: Strikes the enemy for 95 Nature damage" (trigger 2)

Passes up to 5 item spell entries through _GetItemTooltipData with
spellId, trigger type, spell name, and spell description from DBC.
The tooltip builder maps trigger IDs to "Use: ", "Equip: ", or
"Chance on hit: " prefixes.

This completes the item tooltip with all major WoW tooltip sections:
quality name, bind type, equip slot/type, armor, damage/DPS/speed,
primary stats, combat ratings, resistances, spell effects, gem sockets,
required level, flavor text, and sell price.
2026-03-22 20:17:50 -07:00
Kelsi
216c83d445 feat: add spell descriptions to tooltips via GetSpellDescription
Spell tooltips now show the spell description text (e.g., "Hurls a
fiery ball that causes 565 to 655 Fire Damage") in gold/yellow text
between the cast info and cooldown display.

New GetSpellDescription(spellId) C function exposes the description
field from SpellNameEntry (loaded from Spell.dbc via the spell name
cache). Descriptions contain the raw DBC text which may include
template variables ($s1, $d, etc.) — these show as-is until template
substitution is implemented.
2026-03-22 20:03:18 -07:00
Kelsi
572b3ce7ca feat: show gem sockets and item set ID in item tooltips
Add gem socket display to item tooltips — shows [Meta Socket],
[Red Socket], [Yellow Socket], [Blue Socket], or [Prismatic Socket]
based on socketColor mask from ItemQueryResponseData.

Also pass itemSetId through _GetItemTooltipData for addons that
track set bonuses.
2026-03-22 19:59:52 -07:00
Kelsi
a70f42d4f6 feat: add UnitRage, UnitEnergy, UnitFocus, UnitRunicPower aliases
Register power-type-specific aliases (UnitRage, UnitEnergy, UnitFocus,
UnitRunicPower) that map to the existing lua_UnitPower function. Some
Classic/TBC addons call these directly instead of the generic UnitPower.
All return the unit's current power value regardless of type — the
underlying function reads from the entity's power field.
2026-03-22 19:37:58 -07:00
Kelsi
2f4065cea0 feat: wire PlaySound to real audio engine for addon sound feedback
Replace PlaySound no-op stub with a real implementation that maps
WoW sound IDs and names to the UiSoundManager methods:

By ID: 856/1115→button click, 840→quest activate, 841→quest complete,
       862→bag open, 863→bag close, 888→level up
By name: IGMAINMENUOPTION→click, IGQUESTLISTOPEN→quest activate,
         IGQUESTLISTCOMPLETE→quest complete, IGBACKPACKOPEN/CLOSE→bags,
         LEVELUPSOUND→level up, TALENTSCREEN→character sheet

This gives addons audio feedback when they call PlaySound() — button
clicks, quest sounds, and other UI sounds now actually play instead
of being silently swallowed.
2026-03-22 19:35:14 -07:00
Kelsi
aa164478e1 feat: fire DISPLAY_SIZE_CHANGED and UNIT_QUEST_LOG_CHANGED events
DISPLAY_SIZE_CHANGED fires when the window is resized via
SDL_WINDOWEVENT_RESIZED, allowing UI addons to adapt their layout
to the new screen dimensions (5 FrameXML registrations).

UNIT_QUEST_LOG_CHANGED("player") fires alongside QUEST_LOG_UPDATE
at all 6 quest log modification points, for addons that register
for this variant instead (4 FrameXML registrations).
2026-03-22 19:29:06 -07:00
Kelsi
2365091266 fix: tighten addon message detection to avoid suppressing regular chat
The tab-based addon message detection was too aggressive — any chat
message containing a tab character was treated as an addon message
and silently dropped from regular chat display. This could suppress
legitimate player messages containing tabs (from copy-paste).

Now only matches as addon message when:
- Chat type is PARTY/RAID/GUILD/WHISPER/etc. (not SAY/YELL/EMOTE)
- Prefix before tab is <=16 chars (WoW addon prefix limit)
- Prefix contains no spaces (addon prefixes are identifiers)

This prevents false positives while still correctly detecting addon
messages formatted as "DBM4\ttimer:start:10".
2026-03-22 19:17:24 -07:00
Kelsi
40907757b0 feat: fire UNIT_QUEST_LOG_CHANGED alongside QUEST_LOG_UPDATE
UNIT_QUEST_LOG_CHANGED("player") now fires at all 6 locations where
QUEST_LOG_UPDATE fires — quest accept, complete, objective update,
abandon, and server-driven quest log changes. Some addons register
for this event instead of QUEST_LOG_UPDATE (4 registrations in
FrameXML). Both events are semantically equivalent for the player.
2026-03-22 19:12:29 -07:00
Kelsi
96c5f27160 feat: fire CHAT_MSG_ADDON for inter-addon communication messages
Detect addon messages in the SMSG_MESSAGECHAT handler by looking for
the 'prefix\ttext' format (tab delimiter). When detected, fire
CHAT_MSG_ADDON with args (prefix, message, channel, sender) instead
of the regular CHAT_MSG_* event, and suppress the raw message from
appearing in chat.

This enables inter-addon communication used by:
- Boss mods (DBM, BigWigs) for timer/alert synchronization
- Raid tools (oRA3) for ready checks and cooldown tracking
- Group coordination addons for pull countdowns and assignments

Works with the existing SendAddonMessage/RegisterAddonMessagePrefix
functions that format outgoing messages as 'prefix\ttext'.
2026-03-22 19:08:51 -07:00
Kelsi
491dd2b673 feat: fire SPELL_UPDATE_USABLE alongside ACTIONBAR_UPDATE_USABLE
Some addons register for SPELL_UPDATE_USABLE instead of
ACTIONBAR_UPDATE_USABLE to detect when spell usability changes
due to power fluctuations. Fire both events together when the
player's mana/rage/energy changes.
2026-03-22 19:00:34 -07:00
Kelsi
661fba12c0 feat: fire ACTIONBAR_UPDATE_USABLE on player power changes
When the player's mana/rage/energy changes, action bar addons need
ACTIONBAR_UPDATE_USABLE to update button dimming (grey out abilities
the player can't afford). Now fires from both the SMSG_POWER_UPDATE
handler and the SMSG_UPDATE_OBJECT VALUES power field change path.

Without this event, action bar buttons showed as usable even when the
player ran out of mana — the usability state only refreshed on spell
cast attempts, not on power changes.
2026-03-22 18:53:11 -07:00
Kelsi
8fd1dfb4f1 feat: add UnitArmor and UnitResistance for character sheet addons
UnitArmor(unit) returns base, effective, armor, posBuff, negBuff
matching WoW's 5-return signature. Uses server-authoritative armor
from UNIT_FIELD_RESISTANCES[0].

UnitResistance(unit, school) returns base, effective, posBuff, negBuff
for physical (school 0 = armor) and magical resistances (1-6:
Holy/Fire/Nature/Frost/Shadow/Arcane).

Needed by character sheet addons (PaperDollFrame, DejaCharacterStats)
to display armor and resistance values.
2026-03-22 18:44:43 -07:00
Kelsi
f951dbb95d feat: add merchant/vendor API for auto-sell and vendor addons
Implement core vendor query functions from ListInventoryData:

- GetMerchantNumItems() — count of items for sale
- GetMerchantItemInfo(index) — name, texture, price, stackCount,
  numAvailable, isUsable for each vendor item
- GetMerchantItemLink(index) — quality-colored item link
- CanMerchantRepair() — whether vendor offers repair service

Enables auto-sell addons (AutoVendor, Scrap) to read vendor inventory
and check repair capability. Data sourced from SMSG_LIST_INVENTORY
via currentVendorItems + itemInfoCache for names/icons.
2026-03-22 18:39:27 -07:00
Kelsi
81180086e3 feat: fire UNIT_DISPLAYPOWER when unit power type changes
When a unit's power type changes (e.g., druid shifting from mana to
rage in bear form, or warrior switching stances), fire UNIT_DISPLAYPOWER
so unit frame addons can switch the power bar display (mana blue bar →
rage red bar). Detected via UNIT_FIELD_BYTES_0 byte 3 changes in the
VALUES update path.
2026-03-22 18:33:56 -07:00
Kelsi
92a1e9b0c3 feat: add RAID_ROSTER_UPDATE and UNIT_LEVEL events
RAID_ROSTER_UPDATE now fires alongside GROUP_ROSTER_UPDATE when the
group type is raid, matching the event that raid frame addons register
for (6 registrations in FrameXML). Fires from group list updates and
group uninvite handlers.

UNIT_LEVEL fires when any tracked unit (player, target, focus, pet)
changes level via VALUES update fields. Used by unit frame addons to
update level display (5 registrations in FrameXML).
2026-03-22 18:30:07 -07:00
Kelsi
e46919cc2c fix: use rich tooltip display for SetAction items and SetHyperlink
SetAction's item branch and SetHyperlink's item/spell branches
showed only the item name, ignoring the full tooltip system we built.

SetAction item path now uses _WoweePopulateItemTooltip (shows armor,
stats, damage, bind type, sell price etc.).

SetHyperlink item path now uses _WoweePopulateItemTooltip; spell
path now uses SetSpellByID (shows cost, range, cast time, cooldown).

This means shift-clicking an item link in chat, hovering an item on
the action bar, or viewing any hyperlink tooltip now shows the full
stat breakdown instead of just the name.
2026-03-22 18:22:56 -07:00
Kelsi
8d4478b87c feat: enhance spell tooltips with cost, range, cast time, and cooldown
SetSpellByID now shows comprehensive spell information:
- Mana/Rage/Energy/Runic Power cost
- Range in yards (or omitted for self-cast)
- Cast time ("1.5 sec cast" or "Instant")
- Active cooldown remaining in red

Uses existing GetSpellInfo (castTime, range from DBC), GetSpellPowerCost
(mana cost from DBC), and GetSpellCooldown (remaining CD) to populate
the tooltip with real spell data.
2026-03-22 18:19:51 -07:00
Kelsi
22f8b721c7 feat: show sell price on item tooltips in gold/silver/copper format
Item tooltips now display the vendor sell price at the bottom, formatted
as "Sell Price: 12g 50s 30c". Uses the vendorPrice field from GetItemInfo
(field 11, sourced from SMSG_ITEM_QUERY_SINGLE_RESPONSE sellPrice).

Helps players quickly assess item value when looting or sorting bags.
2026-03-22 18:17:21 -07:00
Kelsi
5678de562f feat: add combat ratings, resistances to item tooltip display
Extend item tooltips with secondary stats and resistances:

- Extra stats from ItemQueryResponseData.extraStats: Hit Rating,
  Crit Rating, Haste Rating, Resilience, Attack Power, Spell Power,
  Defense Rating, Dodge/Parry/Block Rating, Expertise, Armor Pen,
  Mana/Health per 5 sec, Spell Penetration — all in green text
- Elemental resistances: Fire/Nature/Frost/Shadow/Arcane Resistance

Also passes extraStats as an array of {type, value} pairs and
resistance fields through _GetItemTooltipData for Lua consumption.

Stat type IDs follow the WoW ItemMod enum (3=Agi, 7=Sta, 31=Hit,
32=Crit, 36=Haste, 45=SpellPower, etc.).
2026-03-22 18:13:23 -07:00
Kelsi
0e78427767 feat: add full item stat display to tooltips (armor, damage, stats, bind)
Enhance _WoweePopulateItemTooltip to show complete item information:
- Bind type (Binds when picked up / equipped / used)
- Armor value for armor items
- Weapon damage range, speed, and DPS for weapons
- Primary stats (+Stamina, +Strength, +Agility, +Intellect, +Spirit)
  in green text
- Required level
- Flavor/lore description text in gold

Backed by new _GetItemTooltipData(itemId) C function that returns a
Lua table with armor, bindType, damageMin/Max, speed, primary stats,
requiredLevel, and description from ItemQueryResponseData.
2026-03-22 18:07:58 -07:00
Kelsi
e72d6ad852 feat: enhance item tooltips with item level, equip slot, and subclass
Replace minimal name-only item tooltips with proper WoW-style display:
- Quality-colored item name header
- Item level line for equipment (gold text)
- Equip slot and weapon/armor type on a double line
  (e.g., "Head" / "Plate" or "One-Hand" / "Sword")
- Item class for non-equipment items

Shared _WoweePopulateItemTooltip() helper used by both
SetInventoryItem and SetBagItem for consistent tooltip formatting.
Maps INVTYPE_* strings to display names (Head, Chest, Two-Hand, etc.).
2026-03-22 18:02:46 -07:00
Kelsi
101ea9fd17 fix: populate item class, subclass, and equip slot in GetItemInfo
GetItemInfo returned empty strings for item class (field 6), subclass
(field 7), and equip slot (field 9). Now returns:

- Class: mapped from itemClass enum (Consumable, Weapon, Armor, etc.)
- Subclass: from parsed subclassName (Sword, Mace, Shield, etc.)
- EquipSlot: mapped from inventoryType to INVTYPE_ strings
  (INVTYPE_HEAD, INVTYPE_CHEST, INVTYPE_WEAPON, etc.)

These fields are used by equipment comparison addons, character sheet
displays, and bag sorting addons to categorize and filter items.
2026-03-22 17:58:39 -07:00
Kelsi
a7e8a6eb83 fix: unify time epoch across GetTime, cooldowns, auras, and cast bars
Four independent static local steady_clock start times were used as
time origins in GetTime(), GetSpellCooldown(), UnitBuff expiration,
and UnitCastingInfo — each initializing on first call at slightly
different times. This created systematic timestamp mismatches.

When addons compute (start + duration - GetTime()), the start value
from GetSpellCooldown and the GetTime() return used different epochs,
causing cooldown sweeps and buff timers to appear offset.

Replace all four independent statics with a single file-scope
kLuaTimeEpoch constant and luaGetTimeNow() helper, ensuring all
time-returning Lua functions share exactly the same origin.
2026-03-22 17:48:37 -07:00
Kelsi
c3fd6d2f85 feat: add keybinding query API for action bar tooltips and binding UI
Implement GetBindingKey(command) and GetBindingAction(key) with
default action button mappings (ACTIONBUTTON1-12 → "1"-"9","0","-","=").
Action bar addons display bound keys on button tooltips via
GetBindingKey("ACTIONBUTTON"..slot).

Also add stubs for GetNumBindings, GetBinding, SetBinding, SaveBindings,
SetOverrideBindingClick, and ClearOverrideBindings to prevent nil-call
errors in FrameXML keybinding UI code (37 call sites).
2026-03-22 17:43:54 -07:00
Kelsi
b25dba8069 fix: fire ACTIONBAR_SLOT_CHANGED when assigning spells to action bar
setActionBarSlot (called from PickupAction/PlaceAction drag-drop and
from server-driven action button updates) updated the slot data and
notified the server, but never fired the Lua addon event. Action bar
addons (Bartender4, Dominos) register for ACTIONBAR_SLOT_CHANGED to
refresh button textures, tooltips, and cooldown state when slots change.

Also fires ACTIONBAR_UPDATE_STATE for general action bar refresh.
2026-03-22 17:37:33 -07:00
Kelsi
d00ebd00a0 fix: fire PLAYER_DEAD, PLAYER_ALIVE, and PLAYER_UNGHOST death events
PLAYER_DEAD only fired from SMSG_FORCED_DEATH_UPDATE (GM kill) — the
normal death path (health dropping to 0 via VALUES update) never fired
it. Death-related addons and the default release spirit dialog depend
on this event.

Also add PLAYER_ALIVE (fires when resurrected without having been a
ghost) and PLAYER_UNGHOST (fires when player rezzes from ghost form)
at the health-restored-from-zero VALUES path. These events control
the transition from ghost form back to alive, letting addons restore
normal UI state after death.
2026-03-22 17:33:22 -07:00
Kelsi
2a2db5cfb5 fix: fire CHAT_MSG_TEXT_EMOTE for incoming text emotes
handleTextEmote pushed emote messages directly to chatHistory
instead of using addLocalChatMessage, so Lua chat addons never
received CHAT_MSG_TEXT_EMOTE events for /wave, /dance, /bow, etc.
from other players. Use addLocalChatMessage which fires the event
and also notifies the C++ display callback.
2026-03-22 17:28:33 -07:00
Kelsi
25b35d5224 fix: include GCD in GetSpellCooldown and GetActionCooldown returns
GetSpellCooldown only returned per-spell cooldowns from the
spellCooldowns map, ignoring the Global Cooldown. Addons like OmniCC
and action bar addons rely on GetSpellCooldown returning GCD timing
when no individual spell cooldown is active — this is what drives the
cooldown sweep animation on action bar buttons after casting.

Now falls back to GCD timing (from getGCDRemaining/getGCDTotal) when
the spell has no individual cooldown but the GCD is active. Returns
proper (start, duration) values so addons can compute elapsed/remaining.

Same fix applied to GetActionCooldown for spell-type action bar slots.
2026-03-22 17:23:52 -07:00
Kelsi
015574f0bd feat: add modifier key queries and resting/exhaustion state events
Implement keyboard modifier queries using ImGui IO:
- IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
- IsModifiedClick(action) — CHATLINK=Shift, DRESSUP=Ctrl, SELFCAST=Alt
- GetModifiedClick/SetModifiedClick for keybind configuration

Fire UPDATE_EXHAUSTION and PLAYER_UPDATE_RESTING events when rest state
changes (entering/leaving inns and cities) and when rested XP updates.
XP bar addons use UPDATE_EXHAUSTION to show the rested bonus indicator.
2026-03-22 17:19:57 -07:00
Kelsi
bf8c0aaf1a feat: add modifier key queries and IsModifiedClick for input handling
Implement keyboard modifier state queries using ImGui IO state:
- IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown — direct key queries
- IsModifiedClick(action) — checks if the modifier matching a named
  action is held (CHATLINK/SPLITSTACK=Shift, DRESSUP=Ctrl, SELFCAST=Alt)
- GetModifiedClick(action) — returns the assigned key name for an action
- SetModifiedClick — no-op stub for compatibility

These are fundamental input functions used by virtually all interactive
addons: shift-click to link items in chat, ctrl-click for dressup,
alt-click for self-cast, shift-click to split stacks, etc.
2026-03-22 17:12:57 -07:00
Kelsi
ebe52d3eba fix: color item links by quality in GetItemInfo and GameTooltip:GetItem
GetItemInfo returned item links with hardcoded white color (|cFFFFFFFF)
regardless of quality. Now uses quality-appropriate colors: gray for
Poor, white for Common, green for Uncommon, blue for Rare, purple for
Epic, orange for Legendary, gold for Artifact, cyan for Heirloom.

Also fix GameTooltip:GetItem() to use the quality-colored link from
GetItemInfo instead of hardcoded white.
2026-03-22 17:08:31 -07:00
Kelsi
74ef454538 feat: add raid roster info, threat colors, and unit watch for raid frames
GetRaidRosterInfo(index) returns name, rank, subgroup, level, class,
fileName, zone, online, isDead, role, isML — the core function raid
frame addons (Grid, Healbot, VuhDo) use to populate unit frame data.
Resolves class from UNIT_FIELD_BYTES_0 when entity is available.

GetThreatStatusColor(status) returns RGB for threat indicator coloring
(gray/yellow/orange/red). Used by unit frames and threat meters.

GetReadyCheckStatus(unit) stub returns nil (no check in progress).
RegisterUnitWatch/UnregisterUnitWatch stubs for secure frame compat.
2026-03-22 17:04:56 -07:00
Kelsi
4e04050f91 feat: add GetItemQualityColor, GetItemCount, and UseContainerItem
GetItemQualityColor(quality) returns r, g, b, hexString for item
quality coloring (Poor=gray through Heirloom=cyan). Used by bag
addons, tooltips, and item frames to color item names/borders.

GetItemCount(itemId) counts total stacks across backpack + bags.
Used by addons to check material availability, quest item counts,
and consumable tracking.

UseContainerItem(bag, slot) uses/equips an item from a container
slot, delegating to useItemById for the actual equip/use action.
2026-03-22 17:01:16 -07:00
Kelsi
e4da47b0d7 feat: add UI_ERROR_MESSAGE events and quest removal notifications
Fire UI_ERROR_MESSAGE from addUIError() so Lua addons can react to
error messages like "Not enough mana" or "Target is too far away".
Previously only the C++ overlay callback was notified. Also add
addUIInfoMessage() helper for informational system messages.

Fire QUEST_REMOVED and QUEST_LOG_UPDATE when quests are removed from
the quest log — both via server-driven removal (SMSG_QUEST_UPDATE_FAILED
etc.) and player-initiated abandon (CMSG_QUESTLOG_REMOVE_QUEST). Quest
tracking addons like Questie register for these events to update their
map markers and objective displays.
2026-03-22 16:53:35 -07:00
Kelsi
8fd735f4a3 fix: fire UNIT_AURA event for Classic/Turtle field-based aura updates
Classic and Turtle WoW don't use SMSG_AURA_UPDATE packets — they
pack aura data into UNIT_FIELD_AURAS update fields. The code correctly
rebuilds playerAuras from these fields in both CREATE_OBJECT and VALUES
update paths, but never fired the UNIT_AURA("player") addon event.

Buff frame addons (Buffalo, ElkBuffBars, etc.) register for UNIT_AURA
to refresh their display. Without this event, buff frames on Classic
and Turtle never update when buffs are gained or lost.
2026-03-22 16:47:49 -07:00
Kelsi
a8c241f6bd fix: fire CHAT_MSG_* events for player's own messages and system text
addLocalChatMessage only pushed to chatHistory and called the C++
display callback — it never fired Lua addon events. This meant the
player's own sent messages (local echoes from sendChatMessage) and
system messages (loot, XP gains, errors) were invisible to Lua chat
frame addons.

Now fires CHAT_MSG_{type} with the full 12-arg WoW signature from
addLocalChatMessage, matching the incoming message path. Uses the
active character name as sender for player-originated messages.
2026-03-22 16:43:13 -07:00
Kelsi
f37a83fc52 feat: fire CHAT_MSG_* events for all incoming chat messages
The SMSG_MESSAGECHAT handler stored messages in chatHistory and
triggered chat bubbles, but never fired Lua addon events. Chat frame
addons (Prat, Chatter, WIM) and the default ChatFrame all register for
CHAT_MSG_SAY, CHAT_MSG_WHISPER, CHAT_MSG_PARTY, CHAT_MSG_GUILD, etc.
to display incoming messages.

Now fires CHAT_MSG_{type} for every incoming message with the full WoW
event signature: message, senderName, language, channelName, displayName,
specialFlags, zoneChannelID, channelIndex, channelBaseName, unused,
lineID, and senderGUID. Covers all chat types: SAY, YELL, WHISPER,
PARTY, RAID, GUILD, OFFICER, CHANNEL, EMOTE, SYSTEM, MONSTER_SAY, etc.
2026-03-22 16:38:34 -07:00
Kelsi
7425881e98 feat: add UI panel management, scroll frames, and macro parsing stubs
Implement high-frequency FrameXML infrastructure functions:

- ShowUIPanel/HideUIPanel/ToggleFrame — UI panel show/hide (240+ calls
  in FrameXML). ShowUIPanel delegates to frame:Show(), HideUIPanel to
  frame:Hide().
- TEXT(str) — localization identity function (549 calls)
- FauxScrollFrame_GetOffset/Update/SetOffset/OnVerticalScroll — scroll
  list helpers used by quest log, guild roster, friends list, etc.
- SecureCmdOptionParse — basic macro conditional parser, returns
  unconditional fallback text
- ChatFrame_AddMessageGroup/RemoveMessageGroup/AddChannel/RemoveChannel
  — chat frame configuration stubs
- UIPanelWindows table, GetUIPanel, CloseWindows stubs
2026-03-22 16:33:57 -07:00
Kelsi
9a570b49db feat: implement cursor/drag-drop system for action bar and inventory
Add the complete cursor state machine needed for drag-and-drop:
- PickupAction(slot) — pick up or swap action bar slots
- PlaceAction(slot) — place cursor content into action bar
- PickupSpell / PickupSpellBookItem — drag spells from spellbook
- PickupContainerItem(bag, slot) — drag items from bags
- PickupInventoryItem(slot) — drag equipped items
- ClearCursor / DeleteCursorItem — clear cursor state
- GetCursorInfo — returns cursor content type/id
- CursorHasItem / CursorHasSpell — query cursor state
- AutoEquipCursorItem — equip item from cursor

Cursor state tracks type (SPELL/ITEM/ACTION), id, and source slot.
PickupAction on empty slots with a spell cursor auto-assigns spells
to the action bar. Enables spellbook-to-action-bar drag-drop and
inventory management through the WoW UI.
2026-03-22 16:30:31 -07:00
Kelsi
be4cbad0b0 fix: unify lava UV scroll timer across render passes to prevent flicker
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Lava M2 models used independent static-local start times in pass 1
and pass 2 for UV scroll animation. Since static locals initialize
on first call, the two timers started at slightly different times
(microseconds to frames apart), causing a permanent UV offset mismatch
between passes — visible as texture flicker/jumping on lava surfaces.

Replace both function-scoped statics with a single file-scoped
kLavaAnimStart constant, ensuring both passes compute identical UV
offsets from the same epoch.
2026-03-22 16:25:32 -07:00
Kelsi
b6047cdce8 feat: add world map navigation API for WorldMapFrame compatibility
Implement the core map functions needed by WorldMapFrame.lua:
- SetMapToCurrentZone — sets map view from player's current mapId/zone
- GetCurrentMapContinent — returns continent (1=Kalimdor, 2=EK, etc.)
- GetCurrentMapZone — returns current zone ID
- SetMapZoom(continent, zone) — navigate map view
- GetMapContinents — returns continent name list
- GetMapZones(continent) — returns zone names per continent
- GetNumMapLandmarks — stub (returns 0)

Maps game mapId (0=EK, 1=Kalimdor, 530=Outland, 571=Northrend) to
WoW's continent numbering. Internal state tracks which continent/zone
the map UI is currently viewing.
2026-03-22 16:18:52 -07:00
Kelsi
f9856c1046 feat: implement GameTooltip methods with real item/spell/aura data
Replace empty stub GameTooltip methods with working implementations:

- SetInventoryItem(unit, slot): populates tooltip with equipped item
  name and quality-colored text via GetInventoryItemLink + GetItemInfo
- SetBagItem(bag, slot): populates from GetContainerItemInfo + GetItemInfo
- SetSpellByID(spellId): populates with spell name/rank from GetSpellInfo
- SetAction(slot): delegates to SetSpellByID or item lookup via GetActionInfo
- SetUnitBuff/SetUnitDebuff: populates from UnitBuff/UnitDebuff data
- SetHyperlink: parses item: and spell: links to populate name
- GetItem/GetSpell: now return real item/spell data when tooltip is populated

Also fix GetCVar/SetCVar conflict — remove Lua-side overrides that
were shadowing the C-side implementations (which return real screen
dimensions and sensible defaults for common CVars).
2026-03-22 16:13:39 -07:00
Kelsi
31ab76427f fix: remove dead duplicate ufNpcFlags check and add missing UNIT_MODEL_CHANGED events
In the CREATE update block, the ufNpcFlags check at the end of the
else-if chain was unreachable dead code — it was already handled
earlier in the same chain. Remove the duplicate.

In the VALUES update block, mount display changes via field updates
fired mountCallback_ but not the UNIT_MODEL_CHANGED addon event,
unlike the CREATE path which fired both. Add the missing event so
Lua addons are notified when the player mounts/dismounts via VALUES
updates (the common case for aura-based mounting).

Also fire UNIT_MODEL_CHANGED for target/focus/pet display ID changes
in the VALUES displayIdChanged path, matching the CREATE path behavior.
2026-03-22 16:09:57 -07:00
Kelsi
cbdf03c07e feat: add quest objective leaderboard API for WatchFrame quest tracking
Implement GetNumQuestLeaderBoards and GetQuestLogLeaderBoard — the core
functions WatchFrame.lua and QuestLogFrame.lua use to display objective
progress like "Kobold Vermin slain: 3/8" or "Linen Cloth: 2/6".

GetNumQuestLeaderBoards counts kill + item objectives from the parsed
SMSG_QUEST_QUERY_RESPONSE data. GetQuestLogLeaderBoard returns the
formatted progress text, type ("monster"/"item"/"object"), and
completion status for each objective.

Also adds ExpandQuestHeader/CollapseQuestHeader (no-ops for flat quest
list) and GetQuestLogSpecialItemInfo stub.
2026-03-22 16:04:33 -07:00
Kelsi
296121f5e7 feat: add GetPlayerFacing, GetCVar/SetCVar for minimap and addon settings
GetPlayerFacing() returns player orientation in radians, needed by
minimap addons for arrow rotation and facing-dependent mechanics.

GetCVar(name) returns sensible defaults for commonly queried CVars
(uiScale, screen dimensions, nameplate visibility, sound toggles,
autoLoot). SetCVar is a no-op stub for addon compatibility.
2026-03-22 15:58:45 -07:00
Kelsi
73ce601bb5 feat: fire PLAYER_ENTERING_WORLD and critical login events for addons
PLAYER_ENTERING_WORLD is the single most important WoW addon event —
virtually every addon registers for it to initialize UI, state, and
data structures. It was never fired, causing widespread addon init
failures on login and after teleports.

Now fired from:
- handleLoginVerifyWorld (initial login + same-map teleports)
- handleNewWorld (cross-map teleports, instance transitions)

Also fires:
- PLAYER_LOGIN on initial world entry only
- ZONE_CHANGED_NEW_AREA on all world entries
- UPDATE_WORLD_STATES on initial entry
- SPELLS_CHANGED + LEARNED_SPELL_IN_TAB after SMSG_INITIAL_SPELLS
  (so spell book addons can initialize on login)
2026-03-22 15:50:05 -07:00
Kelsi
5086520354 feat: add spell book tab API for SpellBookFrame addon compatibility
Implement GetNumSpellTabs, GetSpellTabInfo, GetSpellBookItemInfo, and
GetSpellBookItemName — the core functions SpellBookFrame.lua needs to
organize known spells into class skill line tabs.

Tabs are built lazily from knownSpells grouped by SkillLineAbility.dbc
mappings (category 7 = class). A "General" tab collects spells not in
any class skill line. Tabs auto-rebuild when the spell count changes.

Also adds SpellBookTab struct and getSpellBookTabs() to GameHandler.
2026-03-22 15:40:40 -07:00
Kelsi
f29ebbdd71 feat: add quest watch/tracking and selection Lua API for WatchFrame
Implement the quest tracking functions needed by WatchFrame.lua:
- SelectQuestLogEntry/GetQuestLogSelection — quest log selection state
- GetNumQuestWatches — count of tracked quests
- GetQuestIndexForWatch(watchIdx) — map Nth watched quest to log index
- AddQuestWatch/RemoveQuestWatch — toggle quest tracking by log index
- IsQuestWatched — check if a quest log entry is tracked
- GetQuestLink — generate colored quest link string

Backed by existing trackedQuestIds_ set and questLog_ vector.
Adds selectedQuestLogIndex_ state to GameHandler for quest selection.
2026-03-22 15:36:25 -07:00
Kelsi
6d72228f66 feat: add GetInventorySlotInfo for PaperDollFrame and BankFrame
Maps WoW equipment slot names (e.g. "HeadSlot", "MainHandSlot") to
inventory slot IDs, empty-slot textures, and relic check flags.
Supports case-insensitive matching with optional "Slot" suffix stripping.

Unblocks PaperDollFrame.lua and BankFrame.lua which call this function
to resolve slot button IDs during UI initialization.
2026-03-22 15:30:53 -07:00
Kelsi
ab8ff6b7e5 feat: add UnitStat and combat chance Lua API for character sheet addons
Expose server-authoritative player stats to Lua addons:

- UnitStat(unit, statIndex) — returns STR/AGI/STA/INT/SPI (base,
  effective, posBuff, negBuff) matching the WoW API 4-return signature
- GetDodgeChance, GetParryChance, GetBlockChance — defensive stats
- GetCritChance, GetRangedCritChance — physical crit percentages
- GetSpellCritChance(school) — per-school spell crit
- GetCombatRating(index) — WotLK combat rating system
- GetSpellBonusDamage, GetSpellBonusHealing — caster stat display
- GetAttackPowerForStat, GetRangedAttackPower — melee/ranged AP

All data is already tracked from SMSG_UPDATE_OBJECT field updates;
these functions simply expose existing GameHandler getters to Lua.
Enables PaperDollFrame, DejaCharacterStats, and similar addons.
2026-03-22 15:25:20 -07:00
Kelsi
e9ce062112 fix: restore correct CharSections.dbc field indices for character textures
PR #19 (572bb4ef) swapped CharSections.dbc field indices, placing
Texture1-3 at fields 4-6 and VariationIndex/ColorIndex at 8-9. Binary
analysis of the actual DBC files (Classic, TBC, Turtle — all identical
layout, no WotLK-specific override) confirms the correct order is:

  Field 4 = VariationIndex
  Field 5 = ColorIndex
  Field 6 = Texture1 (string)
  Field 7 = Texture2 (string)
  Field 8 = Texture3 (string)
  Field 9 = Flags

With the wrong indices, VariationIndex/ColorIndex reads returned string
offsets (garbage values that never matched), so all CharSections lookups
failed silently — producing white untextured character models at the
login screen and in-world.

Fixes all 4 expansion JSON layouts, hardcoded fallbacks in
character_preview.cpp, application.cpp, and character_create_screen.cpp.
Also handles the single-layer edge case (body skin only, no face/underwear)
by loading the texture directly instead of skipping compositing.
2026-03-22 15:22:25 -07:00
Kelsi
329a1f4b12 feat: add IsActionInRange, GetActionInfo, and GetActionCount Lua API
IsActionInRange(slot) checks if the spell on an action bar slot is within
range of the current target, using DBC spell range data and entity positions.
Returns 1/0/nil matching the WoW API contract.

GetActionInfo(slot) returns action type ("spell"/"item"/"macro"), id, and
subType for action bar interrogation by bar addons.

GetActionCount(slot) returns item stack count across backpack and bags for
consumable tracking on action bars.
2026-03-22 15:11:29 -07:00
Kelsi
ce4f93dfcb feat: add UnitCastingInfo/UnitChannelInfo Lua API and fix SMSG_CAST_FAILED events
Expose cast/channel state to Lua addons via UnitCastingInfo(unit) and
UnitChannelInfo(unit), matching the WoW API signature (name, text, texture,
startTime, endTime, isTradeSkill, castID, notInterruptible). Works for
player, target, focus, and pet units using existing UnitCastState tracking.

Also fix handleCastFailed (SMSG_CAST_FAILED, Classic/TBC path) to fire
UNIT_SPELLCAST_FAILED and UNIT_SPELLCAST_STOP events — previously only
the WotLK SMSG_CAST_RESULT path fired these, leaving Classic/TBC addons
unaware of cast failures.

Adds isChannel field to UnitCastState and getCastTimeTotal() accessor.
2026-03-22 15:05:29 -07:00
Kelsi Rae Davis
1482694495
Merge pull request #19 from ldmonster/fix/wotlk-render
fix/wotlk-render: WotLK rendering stability, Intel GPU compatibility & terrain OOM fixes
2026-03-22 13:40:10 -07:00
Paul
027640189a make start on ubuntu intel video cards 2026-03-22 21:47:12 +03:00
Paul
7565019dc9 log falling 2026-03-22 21:40:16 +03:00
Paul
bd725f0bbe build fix 2026-03-22 21:39:40 +03:00
Paul
572bb4ef36 fix preview white textutes 2026-03-22 21:38:56 +03:00
Kelsi
3103662528 fix: query corpse position on ghost login for accurate minimap marker
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
When logging in while already dead (reconnect/crash recovery), send
MSG_CORPSE_QUERY to get the server-authoritative corpse location.
Without this, the minimap corpse marker would be missing or point to
the wrong position after reconnecting as a ghost.
2026-03-21 14:13:03 -07:00
Kelsi
42222e4095 feat: handle MSG_CORPSE_QUERY for server-authoritative corpse position
Parse MSG_CORPSE_QUERY server response to get the exact corpse location
and map ID. Also send the query after releasing spirit so the minimap
corpse marker points to the correct position even when the player died
in an instance and releases to an outdoor graveyard.

Previously the corpse position was only set from the entity death
location, which could be wrong for cross-map ghost runs.
2026-03-21 14:08:47 -07:00
Kelsi
a4c8fd621d fix: use geoset 503 for bare shins to reduce knee width discontinuity
Change the bare shin (no boots) default from geoset 502 to 503 across
all four code paths (character creation, character preview, equipment
update, NPC rendering).

Geoset 503 has Y width ~0.44 which better matches the thigh mesh
width (~0.42) than 502's width (~0.39), reducing the visible gap at
the knee joint where lower and upper leg meshes meet.
2026-03-21 13:53:02 -07:00
Kelsi
afc5266acf feat: add UnitDistanceSquared for proximity and range check addons
Returns squared distance between the player and a unit, plus a boolean
indicating whether the calculation was possible. Squared distance
avoids sqrt for efficient range comparisons.

Used by DBM, BigWigs, and proximity warning addons for raid encounter
range checks (e.g., "spread 10 yards" mechanics).
2026-03-21 12:52:56 -07:00
Kelsi
c836b421fc feat: add CheckInteractDistance for proximity-based addon checks
Returns true if the player is within interaction distance of a unit:
- Index 1: Inspect range (28 yards)
- Index 2: Trade range (11 yards)
- Index 3: Duel range (10 yards)
- Index 4: Follow range (28 yards)

Used by trade addons, inspect addons, and proximity detection addons.
2026-03-21 12:33:39 -07:00
Kelsi
42b776dbf8 feat: add IsSpellInRange for healing and range-check addons
Returns 1 if the spell can reach the target, 0 if out of range, nil
if range can't be determined. Compares player-to-target distance against
the spell's maxRange from Spell.dbc via SpellDataResolver.

Used by healing addons (Healbot, VuhDo, Clique) to check if heals can
reach party members, and by action bar addons for range coloring.
2026-03-21 12:23:08 -07:00
Kelsi
d575c06bc1 feat: add UnitIsVisible for entity visibility checks
Returns true when the unit's entity exists in the entity manager
(within UPDATE_OBJECT range). Unlike UnitExists which falls back to
party member data, UnitIsVisible only returns true for entities that
can actually be rendered on screen.

Used by nameplate addons and proximity addons to check if a unit is
within visual range.

Session 14 commit #100: 95 new API functions, 113 new events.
2026-03-21 11:49:23 -07:00
Kelsi
be841fb3e1 feat: fire AUTOFOLLOW_BEGIN and AUTOFOLLOW_END events
Fire AUTOFOLLOW_BEGIN when the player starts following another unit
via /follow. Fire AUTOFOLLOW_END when following is cancelled. Used by
movement addons and AFK detection addons.
2026-03-21 11:45:52 -07:00
Kelsi
1f6865afce feat: fire PLAYER_LOGOUT event when logout begins
Fire PLAYER_LOGOUT from SMSG_LOGOUT_RESPONSE when the server confirms
logout. Addons use this to save state and perform cleanup before the
player leaves the world.
2026-03-21 11:22:57 -07:00
Kelsi
1fd220de29 feat: fire QUEST_TURNED_IN event when quest rewards are received
Fire QUEST_TURNED_IN with questId from SMSG_QUESTGIVER_QUEST_COMPLETE
when a quest is successfully completed and removed from the quest log.
Used by quest tracking addons (Questie, QuestHelper) and achievement
tracking addons.
2026-03-21 11:13:36 -07:00
Kelsi
1988e778c7 feat: fire CHAT_MSG_COMBAT_XP_GAIN on area exploration XP
Fire CHAT_MSG_COMBAT_XP_GAIN from SMSG_EXPLORATION_EXPERIENCE when the
player discovers a new area and gains exploration XP. Used by XP
tracking addons to count all XP sources including discovery.
2026-03-21 11:02:46 -07:00
Kelsi
24e2069225 feat: add UnitGroupRolesAssigned for LFG role display in raid frames
Returns "TANK", "HEALER", "DAMAGER", or "NONE" based on the WotLK LFG
roles bitmask from SMSG_GROUP_LIST. Used by raid frame addons (Grid,
VuhDo, Healbot) to display role icons next to player names.
2026-03-21 10:47:47 -07:00
Kelsi
d8c0820c76 feat: fire CHAT_MSG_COMBAT_FACTION_CHANGE on reputation changes
Fire CHAT_MSG_COMBAT_FACTION_CHANGE with the reputation change message
alongside UPDATE_FACTION when faction standings change. Used by
reputation tracking addons (FactionFriend, RepHelper) that parse
reputation gain messages.
2026-03-21 10:33:21 -07:00
Kelsi
964437cdf4 feat: fire TRAINER_UPDATE and SPELLS_CHANGED after trainer purchase
Fire TRAINER_UPDATE from SMSG_TRAINER_BUY_SUCCEEDED so trainer UI
addons refresh the spell list (marking learned spells as unavailable).
Also fire SPELLS_CHANGED so spellbook and action bar addons detect
the newly learned spell.
2026-03-21 10:27:43 -07:00
Kelsi
5d6376f3f1 feat: add UnitCanAttack and UnitCanCooperate for targeting addons
UnitCanAttack(unit, otherUnit): returns true if otherUnit is hostile
(attackable). UnitCanCooperate(unit, otherUnit): returns true if
otherUnit is friendly (can receive beneficial spells).

Used by nameplate addons for coloring and by targeting addons for
filtering hostile/friendly units.
2026-03-21 10:19:29 -07:00
Kelsi
a4ff315c81 feat: add UnitCreatureFamily for hunter pet and beast lore addons
Returns the creature family name (Wolf, Cat, Bear, etc.) for NPC units.
Data from CreatureInfo cache (creature_template family field). Used by
hunter pet management addons and tooltips that show pet family info.
2026-03-21 10:13:04 -07:00
Kelsi
3ad917bd95 feat: add colorStr and GenerateHexColor methods to RAID_CLASS_COLORS
Enhance RAID_CLASS_COLORS entries with colorStr hex string field and
GenerateHexColor()/GenerateHexColorMarkup() methods. Many addons
(Prat, Details, oUF) use colorStr to build colored chat text and
GenerateHexColor for inline color markup.
2026-03-21 10:02:34 -07:00
Kelsi
9b2f100387 feat: fire UNIT_MODEL_CHANGED on mount display changes
Fire UNIT_MODEL_CHANGED for the player when mount display ID changes
(mounting or dismounting). Mount addons and portrait addons now get
notified when the player's visual model switches between ground and
mounted form.
2026-03-21 09:53:32 -07:00
Kelsi
c97898712b feat: add GetSpellPowerCost for spell cost display addons
Returns a table of power cost entries: {{ type=powerType, cost=amount,
name=powerName }}. Data from SpellDataResolver (Spell.dbc ManaCost and
PowerType fields). Used by spell tooltip addons and action bar addons
that display mana/rage/energy costs.
2026-03-21 09:38:41 -07:00
Kelsi
8dca33e5cc feat: add UnitOnTaxi function for flight path detection
Returns true when the player is on a taxi/flight path. Used by action
bar addons to disable abilities during flight and by map addons to
track taxi state.
2026-03-21 09:32:40 -07:00
Kelsi
b1171327cb fix: UnitIsDead falls back to party member stats for out-of-range units
Previously UnitIsDead returned false for out-of-range party members
(entity not in entity manager). Now checks curHealth==0 from
SMSG_PARTY_MEMBER_STATS data, so raid frame addons correctly show
dead members in other zones as dead.
2026-03-21 09:23:20 -07:00
Kelsi
4364fa7bbe fix: UnitPowerType falls back to party member stats for out-of-range units
Previously UnitPowerType returned 0 (MANA) for party members who are
out of entity range. Now falls back to SMSG_PARTY_MEMBER_STATS power
type data, so raid frame addons correctly color rage/energy/runic
power bars for distant party members.
2026-03-21 09:18:25 -07:00
Kelsi
9267aec0b0 feat: fire UPDATE_WORLD_STATES event on world state changes
Fire UPDATE_WORLD_STATES from SMSG_UPDATE_WORLD_STATE when BG scores,
zone capture progress, or other world state variables change. Used by
BG score addons and world PvP objective tracking addons.
2026-03-21 09:12:59 -07:00
Kelsi
ac9214c03f feat: fire UNIT_THREAT_LIST_UPDATE event on threat changes
Fire UNIT_THREAT_LIST_UPDATE from SMSG_THREAT_UPDATE,
SMSG_HIGHEST_THREAT_UPDATE, and SMSG_THREAT_CLEAR. Threat data is
already parsed and stored in threatLists_ — this event notifies
addon systems when the data changes.

Used by Omen, ThreatPlates, and other threat meter addons to refresh
their displays when threat values update.
2026-03-21 09:08:02 -07:00
Kelsi
f580fd7e6b feat: add UnitDetailedThreatSituation for detailed threat queries
Implement UnitDetailedThreatSituation(unit, mobUnit) returning:
- isTanking (boolean)
- status (0-3, same as UnitThreatSituation)
- threatPct (100 if tanking, 0 otherwise)
- rawThreatPct (same)
- threatValue (0 — no server threat data available)

Used by Omen and other threat meter addons that query detailed threat
info per mob-target pair.
2026-03-21 09:02:47 -07:00
Kelsi
dcd78f4f28 feat: add UnitThreatSituation for threat meter and tank addons
Implement UnitThreatSituation(unit, mobUnit) returning 0-3 threat level:
- 0: not on threat table
- 1: in combat but not tanking (mob targeting someone else)
- 3: securely tanking (mob is targeting this unit)

Approximated from mob's UNIT_FIELD_TARGET to determine who the mob is
attacking. Used by threat meter addons (Omen, ThreatPlates) and tank
UI addons to display threat state.
2026-03-21 08:57:38 -07:00
Kelsi
4af9838ab4 feat: add UnitIsTapped, UnitIsTappedByPlayer, UnitIsTappedByAllThreatList
Add three tapped-state query functions for addons:
- UnitIsTapped(unit): true if any player has tagged the mob
- UnitIsTappedByPlayer(unit): true if local player can loot (tapped+lootable)
- UnitIsTappedByAllThreatList(unit): true if shared-tag mob

Used by nameplate addons (Plater, TidyPlates) and unit frame addons
to determine and display tap ownership state.
2026-03-21 08:48:58 -07:00
Kelsi
aebc905261 feat: show grey focus frame name for tapped mobs
Extend tapped-by-other detection to the focus frame, matching the
target frame and nameplate treatment. All three UI elements (nameplate,
target frame, focus frame) now consistently show grey for tapped mobs.
2026-03-21 08:42:56 -07:00
Kelsi
57ccee2c28 feat: show grey target frame name for tapped mobs
Extend the tapped-by-other-player check to the target frame. Mobs
tagged by another player now show a grey name color on the target
frame, matching the grey nameplate treatment and WoW's behavior.

Players can now see at a glance on both nameplates AND target frame
whether a mob is tagged.
2026-03-21 08:37:39 -07:00
Kelsi
586e9e74ff feat: show grey nameplates for mobs tapped by other players
Check UNIT_DYNFLAG_TAPPED_BY_PLAYER (0x0004) on hostile NPC nameplates.
Mobs tagged by another player now show grey health bars instead of red,
matching WoW's visual indication that the mob won't yield loot/XP.

Mobs with TAPPED_BY_ALL_THREAT_LIST (0x0008) still show red since
those are shared-tag mobs that give loot to everyone.
2026-03-21 08:33:54 -07:00
Kelsi
82990f5891 feat: fire UNIT_FLAGS event when unit flags change
Fire UNIT_FLAGS for player/target/focus when UNIT_FIELD_FLAGS updates.
Covers PvP flag, combat state, silenced, disarmed, and other flag
changes. Used by nameplate addons for PvP indicators and by unit frame
addons tracking CC/silence state.
2026-03-21 08:22:52 -07:00
Kelsi
e7be60c624 feat: fire UNIT_FACTION event when unit faction template changes
Fire UNIT_FACTION for player/target/focus when UNIT_FIELD_FACTIONTEMPLATE
updates. Covers PvP flag toggling, mind control faction swaps, and any
server-side faction changes. Used by nameplate addons to update hostility
coloring and by PvP addons tracking faction state.
2026-03-21 08:17:38 -07:00
Kelsi
2c6a345e32 feat: fire UNIT_MODEL_CHANGED event when unit display model changes
Fire UNIT_MODEL_CHANGED for player/target/focus/pet when their
UNIT_FIELD_DISPLAYID update field changes. This covers polymorph,
mount display changes, shapeshifting, and model swaps.

Used by unit frame addons that display 3D portraits and by nameplate
addons that track model state changes.
2026-03-21 08:13:47 -07:00
Kelsi
a4d54e83bc feat: fire MIRROR_TIMER_PAUSE event when breath/fatigue timer pauses
Fire MIRROR_TIMER_PAUSE from SMSG_PAUSE_MIRROR_TIMER with paused state
(1=paused, 0=resumed). Completes the mirror timer event trio alongside
MIRROR_TIMER_START and MIRROR_TIMER_STOP.
2026-03-21 08:07:39 -07:00
Kelsi
a73c680190 feat: add common WoW global constants for addon compatibility
Add frequently referenced WoW global constants that many addons check:
- MAX_TALENT_TABS, MAX_NUM_TALENTS
- BOOKTYPE_SPELL, BOOKTYPE_PET
- MAX_PARTY_MEMBERS, MAX_RAID_MEMBERS, MAX_ARENA_TEAMS
- INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED
- NUM_BAG_SLOTS, NUM_BANKBAGSLOTS, CONTAINER_BAG_OFFSET
- MAX_SKILLLINE_TABS, TRADE_ENCHANT_SLOT

Prevents nil-reference errors when addons use these standard constants.
2026-03-21 07:58:38 -07:00
Kelsi
2da0883544 feat: fire BARBER_SHOP_OPEN and BARBER_SHOP_CLOSE events
Fire BARBER_SHOP_OPEN when the barber shop UI is enabled
(SMSG_ENABLE_BARBER_SHOP). Fire BARBER_SHOP_CLOSE when the barber
shop completes or is dismissed. Used by UI customization addons.
2026-03-21 07:54:30 -07:00
Kelsi
5ee2b55f4b feat: fire MIRROR_TIMER_START and MIRROR_TIMER_STOP events
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Fire MIRROR_TIMER_START with type, value, maxValue, scale, and paused
args when breath/fatigue/fire timers begin. Fire MIRROR_TIMER_STOP with
type when they end. Timer types: 0=fatigue, 1=breath, 2=fire.

Used by timer bar addons to display breath/fatigue countdown overlays.
2026-03-21 07:48:06 -07:00
Kelsi
774f9bf214 feat: fire BAG_UPDATE and UNIT_INVENTORY_CHANGED on item received
Fire BAG_UPDATE and UNIT_INVENTORY_CHANGED from SMSG_ITEM_PUSH_RESULT
when any item is received (loot, quest reward, trade, mail). Bag addons
(Bagnon, AdiBags) immediately show new items, and equipment tracking
addons detect inventory changes.
2026-03-21 07:33:22 -07:00
Kelsi
c6a6849c86 feat: fire PET_BAR_UPDATE event when pet action bar changes
Fire PET_BAR_UPDATE when:
- Pet is summoned (SMSG_PET_SPELLS with new spell list)
- Pet learns a new spell (SMSG_PET_LEARNED_SPELL)

Used by pet action bar addons to refresh their display when the pet's
available abilities change.
2026-03-21 07:30:01 -07:00
Kelsi
6ab1a189c7 feat: fire GUILD_INVITE_REQUEST event with inviter and guild names
Fire GUILD_INVITE_REQUEST when another player invites the local player
to a guild. Includes inviterName and guildName as arguments. Used by
auto-accept guild addons and invitation notification addons.
2026-03-21 07:23:15 -07:00
Kelsi
d24d12fb8f feat: fire PARTY_INVITE_REQUEST event with inviter name
Fire PARTY_INVITE_REQUEST when another player invites the local player
to a group. Used by auto-accept group addons and invite notification
addons. Includes the inviter's name as the first argument.
2026-03-21 07:17:20 -07:00
Kelsi
70a50e45f5 feat: fire CONFIRM_TALENT_WIPE event with respec cost
Fire CONFIRM_TALENT_WIPE with the gold cost when the trainer offers
to reset talents (MSG_TALENT_WIPE_CONFIRM). Used by talent management
addons to show the respec cost dialog.
2026-03-21 07:12:38 -07:00
Kelsi
df79e08788 fix: fire GROUP_ROSTER_UPDATE when group is destroyed
SMSG_GROUP_DESTROYED clears all party state but wasn't firing addon
events. Raid frame addons (Grid, VuhDo, Healbot) now properly hide
when the group disbands. Also fires PARTY_MEMBERS_CHANGED for compat.
2026-03-21 07:07:32 -07:00
Kelsi
12fb8f73f7 feat: fire BAG_UPDATE and PLAYER_MONEY events after selling items
SMSG_SELL_ITEM success now fires BAG_UPDATE so bag addons refresh
their display, and PLAYER_MONEY so gold tracking addons see the
sell price income immediately.
2026-03-21 06:52:41 -07:00
Kelsi
b407d5d632 feat: fire RESURRECT_REQUEST event when another player offers resurrection
Fire RESURRECT_REQUEST with the caster's name from SMSG_RESURRECT_REQUEST
when a player/NPC offers to resurrect the dead player. Used by auto-accept
resurrection addons and death tracking addons.
2026-03-21 06:47:32 -07:00
Kelsi
5d93108a88 feat: fire CONFIRM_SUMMON event on warlock/meeting stone summons
Fire CONFIRM_SUMMON from SMSG_SUMMON_REQUEST when another player
summons via warlock portal or meeting stone. Used by auto-accept
summon addons and summon notification addons.
2026-03-21 06:42:59 -07:00
Kelsi
de903e363c feat: fire PLAYER_STARTED_MOVING and PLAYER_STOPPED_MOVING events
Track horizontal movement flag transitions (forward/backward/strafe)
and fire events when the player starts or stops moving. Used by
Healbot, cast-while-moving addons, and nameplate addons that track
player movement state for positioning optimization.
2026-03-21 06:38:48 -07:00
Kelsi
d36172fc90 fix: fire PLAYER_MONEY event from SMSG_LOOT_MONEY_NOTIFY
The loot money handler directly updates playerMoneyCopper_ but wasn't
firing PLAYER_MONEY. The update object path fires it when the coinage
field changes, but there can be a delay. Now gold-tracking addons
(Accountant, GoldTracker) immediately see looted money.
2026-03-21 06:32:41 -07:00
Kelsi
b3ad64099b feat: fire UNIT_PET event when pet is summoned, dismissed, or dies
Fire UNIT_PET with "player" as arg from SMSG_PET_SPELLS when:
- Pet is cleared (dismissed/dies) — both size-based and guid=0 paths
- Pet is summoned (new pet GUID received with spell list)

Used by pet frame addons and unit frame addons to show/hide pet
frames and update pet action bars when pet state changes.
2026-03-21 06:27:55 -07:00
Kelsi
5ab6286f7e fix: include pet unit ID in UNIT_HEALTH/POWER events from dedicated packets
SMSG_HEALTH_UPDATE and SMSG_POWER_UPDATE were not checking for the pet
GUID when dispatching addon events. Pet health/power bar addons now
properly receive UNIT_HEALTH and UNIT_POWER with unitId="pet".

The UPDATE_OBJECT and UNIT_AURA paths already had the pet check.
2026-03-21 06:23:03 -07:00
Kelsi
b04e36aaa4 fix: include pet unit ID in all spellcast addon events
Add pet GUID check to all spellcast event dispatchers:
- UNIT_SPELLCAST_START
- UNIT_SPELLCAST_SUCCEEDED
- UNIT_SPELLCAST_CHANNEL_START
- UNIT_SPELLCAST_CHANNEL_STOP
- UNIT_SPELLCAST_INTERRUPTED + STOP

Previously these events only fired for player/target/focus, meaning
pet cast bars and pet spell tracking addons wouldn't work. Now pet
spellcasts properly fire with unitId="pet".
2026-03-21 06:19:14 -07:00
Kelsi
6687c617d9 fix: display Lua errors from OnUpdate, executeFile, executeString as UI errors
Extend the Lua error UI display to cover all error paths:
- OnUpdate frame callbacks (previously only logged)
- executeFile loading errors (now also shown as UI error)
- executeString /run errors (now also shown as UI error)

This ensures addon developers see ALL Lua errors in-game, not just
event handler errors from the previous commit.
2026-03-21 06:08:17 -07:00
Kelsi
900626f5fe feat: fire UPDATE_BATTLEFIELD_STATUS event on BG queue/join/leave
Fire UPDATE_BATTLEFIELD_STATUS with the status code when battlefield
status changes (queued, ready to join, in progress, waiting to leave).
Used by BG queue addons and PvP addons to track battleground state.
2026-03-21 06:02:28 -07:00
Kelsi
19b8d31da2 feat: display Lua addon errors as in-game UI errors
Previously Lua addon errors only logged to the log file. Now they
display as red UI error text to the player (same as spell errors and
game warnings), helping addon developers debug issues in real-time.

Add LuaErrorCallback to LuaEngine, fire it from event handler and
frame OnEvent pcall error paths. Wire the callback to GameHandler's
addUIError in application.cpp.
2026-03-21 06:00:06 -07:00
Kelsi
64c0c75bbf feat: fire CHAT_MSG_COMBAT_HONOR_GAIN event on PvP honor kills
Fire CHAT_MSG_COMBAT_HONOR_GAIN from SMSG_PVP_CREDIT with the honor
message text. Used by PvP addons (HonorSpy, HonorTracker) to track
honor gains and kill counts.
2026-03-21 05:47:22 -07:00
Kelsi
d20357415b feat: fire PLAYER_CONTROL_LOST/GAINED on movement control changes
Fire PLAYER_CONTROL_LOST when SMSG_CLIENT_CONTROL_UPDATE revokes player
movement (stun, fear, mind control, etc.) and PLAYER_CONTROL_GAINED when
movement is restored.

Used by loss-of-control addons and action bar addons to show stun/CC
indicators and disable ability buttons during crowd control.
2026-03-21 05:42:57 -07:00
Kelsi
2e6400f22e feat: fire MAIL_INBOX_UPDATE and UPDATE_PENDING_MAIL events
Fire MAIL_INBOX_UPDATE when the mail list is received/refreshed
(SMSG_MAIL_LIST_RESULT), so mail addons can update their display.

Fire UPDATE_PENDING_MAIL when new mail arrives (SMSG_RECEIVED_MAIL),
enabling minimap mail icon addons and notification addons to react.
2026-03-21 05:38:35 -07:00
Kelsi
2560bd1307 feat: fire QUEST_WATCH_UPDATE on kill and item objective progress
Fire QUEST_WATCH_UPDATE (with quest ID for kills) and QUEST_LOG_UPDATE
when quest objectives progress:
- Kill objectives: when SMSG_QUESTUPDATE_ADD_KILL updates a kill count
- Item objectives: when SMSG_QUESTUPDATE_ADD_ITEM updates an item count

Used by quest tracker addons (Questie, QuestHelper) and the built-in
quest tracker to refresh objective display when progress changes.
2026-03-21 05:33:29 -07:00
Kelsi
b5f7659db5 feat: fire MERCHANT_UPDATE and BAG_UPDATE events after purchase
Fire MERCHANT_UPDATE after a successful SMSG_BUY_ITEM so vendor addons
refresh their stock display. Also fire BAG_UPDATE so bag addons show
the newly purchased item immediately.
2026-03-21 05:27:34 -07:00
Kelsi
a02e021730 fix: fire UNIT_SPELLCAST_FAILED/STOP for other units on SPELL_FAILED_OTHER
SMSG_SPELL_FAILED_OTHER was clearing the unit cast state but not firing
addon events. Cast bar addons (Quartz, ClassicCastbars) showing target/
focus cast bars need UNIT_SPELLCAST_FAILED and UNIT_SPELLCAST_STOP to
clear the bar when another unit's cast fails.

Now fires both events for target and focus units, matching the behavior
already implemented for the player's own cast failures.
2026-03-21 05:22:17 -07:00
Kelsi
7f0d9fe432 feat: fire PLAYER_GUILD_UPDATE event on guild join/disband
Fire PLAYER_GUILD_UPDATE when the player's guild membership changes:
- When guild name is first resolved (player joins guild/logs in)
- When guild is disbanded

Used by guild frame addons and guild info display to update when
guild status changes.
2026-03-21 05:17:40 -07:00
Kelsi
82d3abe5da feat: add GetAddOnMetadata for reading TOC directives from Lua
Implement GetAddOnMetadata(addonNameOrIndex, key) which reads arbitrary
TOC file directives. All directives are now stored in the addon info
registry table under a "metadata" sub-table.

This enables addons to read their own version, author, X-* custom
fields, and other TOC metadata at runtime. Used by addon managers,
version checkers, and self-updating addons.
2026-03-21 05:13:28 -07:00
Kelsi
d4c1eda22b feat: fire PARTY_LEADER_CHANGED event on leader changes
Fire PARTY_LEADER_CHANGED (with GROUP_ROSTER_UPDATE) from both:
- SMSG_GROUP_SET_LEADER: when a new leader is named by string
- SMSG_REAL_GROUP_UPDATE: when leader GUID changes via group update

Used by raid frame addons to update leader crown icons and by
group management addons to track leadership changes.
2026-03-21 05:03:03 -07:00
Kelsi
494175e2a7 feat: add remaining CHAT_MSG_* event mappings
Map 5 previously unmapped chat types to addon events:
- CHAT_MSG_MONSTER_PARTY (NPC party chat in dungeons/scripted events)
- CHAT_MSG_AFK (player AFK auto-reply messages)
- CHAT_MSG_DND (player DND auto-reply messages)
- CHAT_MSG_LOOT (loot roll/distribution messages)
- CHAT_MSG_SKILL (skill-up messages)

All WoW chat types in the ChatType enum are now mapped to addon events.
2026-03-21 04:57:19 -07:00
Kelsi
f99f4a732a feat: fire INSPECT_READY event from both WotLK and Classic inspect paths
Fire INSPECT_READY with the inspected player's GUID when inspection
results are received. Fires from both:
- WotLK SMSG_TALENTS_INFO type=1 (talent + gear inspect)
- Classic SMSG_INSPECT (gear-only inspect)

Used by GearScore, TacoTip, and other inspection addons that need
to know when inspect data is available for a specific player.
2026-03-21 04:53:08 -07:00
Kelsi
74d7e969ab feat: add action bar constants and functions for Bartender/Dominos compat
Add essential WoW action bar globals and functions that action bar
addons (Bartender4, Dominos, CT_BarMod) require on initialization:

Constants: NUM_ACTIONBAR_BUTTONS, NUM_ACTIONBAR_PAGES, NUM_PET_ACTION_SLOTS
Functions: GetActionBarPage, ChangeActionBarPage, GetBonusBarOffset,
  GetActionText, GetActionCount
Binding: GetBindingKey, GetBindingAction, SetBinding, SaveBindings
Macro: GetNumMacros, GetMacroInfo, GetMacroBody, GetMacroIndexByName
Stance: GetNumShapeshiftForms, GetShapeshiftFormInfo
Pet: GetPetActionInfo, GetPetActionsUsable

These prevent nil-reference errors during addon initialization and
enable basic action bar addon functionality.
2026-03-21 04:48:06 -07:00
Kelsi
1f3e362512 feat: add RAID_TARGET_UPDATE event and GetRaidTargetIndex/SetRaidTarget
Fire RAID_TARGET_UPDATE event when raid markers (skull, cross, etc.)
are set or cleared on targets. Add two Lua API functions:
- GetRaidTargetIndex(unit) returns marker index 1-8 (or nil)
- SetRaidTarget(unit, index) sets marker 1-8 (or 0 to clear)

Enables raid marking addons and nameplate addons that display raid
icons to react to marker changes in real-time.
2026-03-21 04:43:42 -07:00
Kelsi
8e51754615 feat: fire READY_CHECK, READY_CHECK_CONFIRM, READY_CHECK_FINISHED events
Fire addon events for the raid ready check system:
- READY_CHECK fires when a ready check is initiated, with initiator name
- READY_CHECK_CONFIRM fires for each player's response, with GUID and
  ready state (1=ready, 0=not ready)
- READY_CHECK_FINISHED fires when the ready check period ends

These events are used by raid frame addons (Grid, VuhDo, Healbot) to
show ready check status on unit frames, and by raid management addons
to track responsiveness.
2026-03-21 04:38:35 -07:00
Kelsi
70a5d3240c feat: add ACHIEVEMENT_EARNED event and 15 missing CHAT_MSG_* events
Fire ACHIEVEMENT_EARNED event when a player earns an achievement,
enabling achievement tracking addons.

Add 15 previously unmapped chat type → addon event mappings:
- CHAT_MSG_ACHIEVEMENT, CHAT_MSG_GUILD_ACHIEVEMENT
- CHAT_MSG_WHISPER_INFORM (echo of sent whispers)
- CHAT_MSG_RAID_LEADER, CHAT_MSG_BATTLEGROUND_LEADER
- CHAT_MSG_MONSTER_SAY/YELL/EMOTE/WHISPER
- CHAT_MSG_RAID_BOSS_EMOTE/WHISPER
- CHAT_MSG_BG_SYSTEM_NEUTRAL/ALLIANCE/HORDE

These events are needed by boss mod addons (DBM, BigWigs) to detect
boss emotes, by achievement trackers, and by chat filter addons that
process all message types.
2026-03-21 04:28:15 -07:00
Kelsi
6a0e86efe8 fix: IsUsableAction now checks spell power cost from DBC
IsUsableAction previously always returned notEnoughMana=false. Now it
checks the spell's mana cost from SpellDataResolver against the player's
current power, matching the same fix applied to IsUsableSpell.

This fixes action bar addons (Bartender, Dominos) incorrectly showing
abilities as usable when the player lacks mana/rage/energy.
2026-03-21 04:23:07 -07:00
Kelsi
91794f421e feat: add spell power cost to SpellDataResolver; fix IsUsableSpell mana check
Extend SpellDataInfo with manaCost and powerType fields, extracted from
Spell.dbc ManaCost and PowerType columns. This enables IsUsableSpell()
to properly check if the player has enough mana/rage/energy to cast.

Previously IsUsableSpell always returned notEnoughMana=false since cost
data wasn't available. Now it compares the spell's DBC mana cost against
the player's current power, returning accurate usability and mana state.

This fixes action bar addons showing abilities as usable when the player
lacks sufficient power, and enables OmniCC-style cooldown text to
properly dim insufficient-power abilities.
2026-03-21 04:20:58 -07:00
Kelsi
c7e16646fc feat: resolve spell cast time and range from DBC for GetSpellInfo
Add SpellDataResolver that lazily loads Spell.dbc, SpellCastTimes.dbc,
and SpellRange.dbc to provide cast time and range data. GetSpellInfo()
now returns real castTime (ms), minRange, and maxRange instead of
hardcoded 0 values.

This enables spell tooltip addons, cast bar addons (Quartz), and range
check addons to display accurate spell information. The DBC chain is:
  Spell.dbc[CastingTimeIndex] → SpellCastTimes.dbc[Base ms]
  Spell.dbc[RangeIndex] → SpellRange.dbc[MinRange, MaxRange]

Follows the same lazy-loading pattern as SpellIconPathResolver and
ItemIconPathResolver.
2026-03-21 04:16:12 -07:00
Kelsi
cfb9e09e1d feat: cache player class/race from name queries for UnitClass/UnitRace
Add playerClassRaceCache_ that stores classId and raceId from
SMSG_NAME_QUERY_RESPONSE. This enables UnitClass and UnitRace to return
correct data for players who were previously seen but are now out of
UPDATE_OBJECT range.

Fallback chain for UnitClass/UnitRace is now:
1. Entity update fields (UNIT_FIELD_BYTES_0) — for nearby entities
2. Name query cache — for previously queried players
3. getPlayerClass/Race() — for the local player

This improves class-colored names in chat, unit frames, and nameplates
for players who move out of view range.
2026-03-21 04:11:48 -07:00
Kelsi
d6a25ca8f2 fix: unit API functions return data for out-of-range party members
Previously UnitHealth, UnitHealthMax, UnitPower, UnitPowerMax, UnitLevel,
UnitName, and UnitExists returned 0/"Unknown"/false for party members in
other zones because the entity doesn't exist in the entity manager.

Now these functions fall back to SMSG_PARTY_MEMBER_STATS data stored in
GroupMember structs, which provides health, power, level, and name for
all party members regardless of distance. UnitName also falls back to
the player name cache.

This fixes raid frame addons (Grid, Healbot, VuhDo) showing blank/zero
data for party members who are out of UPDATE_OBJECT range.
2026-03-21 04:04:39 -07:00
Kelsi
61b54cfa74 feat: add unit state query functions and fix UnitAffectingCombat
Add 6 commonly needed unit state functions:
- UnitIsGhost(unit) checks ghost flag from UNIT_FIELD_FLAGS
- UnitIsDeadOrGhost(unit) combines dead + ghost checks
- UnitIsAFK(unit) / UnitIsDND(unit) check player flags
- UnitPlayerControlled(unit) true for players and player pets
- UnitSex(unit) reads gender from UNIT_FIELD_BYTES_0 byte 2

Fix UnitAffectingCombat to check UNIT_FLAG_IN_COMBAT (0x00080000)
from entity update fields for any unit, not just "player". Previously
returned false for all non-player units.

These functions are needed by unit frame addons (SUF, Pitbull, oUF)
to properly display ghost state, AFK/DND status, and combat state.
2026-03-21 03:59:04 -07:00
Kelsi
ec082e029c fix: UnitClass and UnitRace now work for target, focus, party, and all units
Previously UnitClass() only returned the correct class for "player" and
returned "Unknown" for all other units (target, focus, party1-4, etc.).
UnitRace() had the same bug.

Now both functions read UNIT_FIELD_BYTES_0 from the entity's update
fields to resolve class (byte 1) and race (byte 0) for any unit. This
fixes unit frame addons, class-colored names, and race-based logic for
all unit IDs.

Also fix UnitRace to return 3 values (localized, English, raceId) to
match WoW's API signature — previously it only returned 1.
2026-03-21 03:55:23 -07:00
Kelsi
8229a963d1 feat: add player name tab-completion in chat input
When typing commands like /w, /whisper, /invite, /trade, /duel, /follow,
/inspect, etc., pressing Tab now cycles through matching player names.

Name sources (in priority order):
1. Last whisper sender (most likely target for /r follow-ups)
2. Party/raid members
3. Friends list
4. Nearby visible players

Tab cycles through all matches; single match auto-appends a space.
Complements the existing slash-command tab-completion.
2026-03-21 03:49:02 -07:00
Kelsi
0d49cc8b94 fix: handle NPC facing-only rotation in SMSG_MONSTER_MOVE
Fix bug where NPCs receiving moveType=4 (FacingAngle) or moveType=3
(FacingTarget) monster move packets with zero waypoints would not
rotate in place. The handler only processed orientation when hasDest
was true, but facing-only updates have no destination waypoints.

Now NPCs properly rotate when:
- moveType=4: server specifies an exact facing angle (e.g., NPC turns
  to face the player during dialogue or scripted events)
- moveType=3: NPC should face a specific target entity

This fixes NPCs appearing frozen/unresponsive during scripted events,
quest interactions, and patrol waypoint facing changes.
2026-03-21 03:38:17 -07:00
Kelsi
a63f980e02 feat: add guild roster Lua API for guild management addons
Implement 5 guild-related WoW Lua API functions:
- IsInGuild() returns whether the player is in a guild
- GetGuildInfo("player") returns guildName, rankName, rankIndex
- GetNumGuildMembers() returns totalMembers, onlineMembers
- GetGuildRosterInfo(index) returns full 11-value tuple: name, rank,
  rankIndex, level, class, zone, note, officerNote, online, status, classId
- GetGuildRosterMOTD() returns the guild message of the day

Data sourced from SMSG_GUILD_ROSTER and SMSG_GUILD_QUERY_RESPONSE.
Enables guild management addons (GreenWall, officer tools, roster UIs).
2026-03-21 03:34:31 -07:00
Kelsi
7807058f9c feat: add SendAddonMessage and RegisterAddonMessagePrefix for addon comms
Implement the addon messaging API used by virtually every multiplayer
addon (DBM, BigWigs, EPGP, RC Loot Council, WeakAuras, etc.):

- SendAddonMessage(prefix, text, chatType, target) sends an addon
  message encoded as "prefix\ttext" via the appropriate chat channel
- RegisterAddonMessagePrefix(prefix) registers a prefix for filtering
  incoming addon messages
- IsAddonMessagePrefixRegistered(prefix) checks registration status
- C_ChatInfo table with aliases for the above functions (newer API compat)

Without these functions, all inter-addon communication between players
fails, breaking boss mods, loot distribution, and group coordination.
2026-03-21 03:31:54 -07:00
Kelsi
b2826ce589 feat: fire PLAYER_UPDATE_RESTING event on rest state changes
Fire PLAYER_UPDATE_RESTING when the player enters or leaves a resting
area (inn/capital city). Fires from both the SET_REST_START packet and
the QUEST_FORCE_REMOVE rest-state update path. Used by XP bar addons
and rest state indicator addons.
2026-03-21 03:27:09 -07:00
Kelsi
e64f9f4585 fix: add mail, auction, quest, and trade windows to Escape key chain
The Escape key now properly closes these windows before showing the
escape menu:
- Mail window (closeMailbox)
- Auction house (closeAuctionHouse)
- Quest details dialog (declineQuest)
- Quest offer reward dialog (closeQuestOfferReward)
- Quest request items dialog (closeQuestRequestItems)
- Trade window (cancelTrade)

Previously these windows required clicking their close button since
Escape would skip directly to the escape menu.
2026-03-21 03:24:23 -07:00
Kelsi
a39acd71ba feat: apply M2 color alpha and transparency tracks to batch opacity
Apply at-rest values from M2 color alpha and transparency animation
tracks to batch rendering opacity. This fixes models that should render
as semi-transparent (ghosts, ethereal effects, fading doodads) but were
previously rendering at full opacity.

The fix multiplies colorAlphas[batch.colorIndex] and
textureWeights[batch.transparencyIndex] into batchOpacity during model
setup. Zero values are skipped to avoid the edge case where animated
tracks start at 0 (invisible) and animate up — baking that first
keyframe would make the entire batch permanently invisible.
2026-03-21 03:14:57 -07:00
Kelsi
4f4c169825 feat: add GetNumFriends/GetFriendInfo/GetNumIgnores/GetIgnoreName API
Implement friend and ignore list query functions for social addons:
- GetNumFriends() returns friend count from contacts list
- GetFriendInfo(index) returns 7-value tuple: name, level, class, area,
  connected, status (AFK/DND), note
- GetNumIgnores() returns ignore count
- GetIgnoreName(index) returns ignored player's name

Data sourced from the contacts list populated by SMSG_FRIEND_LIST and
SMSG_CONTACT_LIST. Area names resolved from AreaTable.dbc.
2026-03-21 03:08:37 -07:00
Kelsi
b7e5034f27 feat: fire GUILD_ROSTER_UPDATE and GUILD_MOTD events for guild addons
Fire GUILD_ROSTER_UPDATE from SMSG_GUILD_ROSTER and from guild events
(member join/leave/kick, promotions, leader changes, online/offline,
disbanded). Fire GUILD_MOTD with the MOTD text when received.

These events are needed by guild management addons (GuildGreet,
GuildRoster replacements, officer tools) to refresh their UI.
2026-03-21 03:04:59 -07:00
Kelsi
b8d92b5ff2 feat: fire FRIENDLIST_UPDATE and IGNORELIST_UPDATE events
Fire FRIENDLIST_UPDATE from all three friend list packet handlers:
- SMSG_FRIEND_LIST (Classic format)
- SMSG_CONTACT_LIST (WotLK format)
- SMSG_FRIEND_STATUS (add/remove/online/offline updates)

Fire IGNORELIST_UPDATE when SMSG_CONTACT_LIST includes ignore entries.

These events are used by social addons to refresh their UI when the
friend/ignore list changes.
2026-03-21 03:01:55 -07:00
Kelsi
8f2a2dfbb4 feat: fire UNIT_NAME_UPDATE event when player names are resolved
Fire UNIT_NAME_UPDATE for target/focus/player when SMSG_NAME_QUERY_RESPONSE
resolves a player's name. Nameplate and unit frame addons use this event
to update displayed names when they become available asynchronously.
2026-03-21 02:58:55 -07:00
Kelsi
3b8165cbef feat: fire events for loot rolls, trade windows, and duels
Add missing addon events for three gameplay systems:

Loot rolls:
- START_LOOT_ROLL fires on SMSG_LOOT_START_ROLL with slot and countdown
- LOOT_SLOT_CLEARED fires when a loot item is removed (SMSG_LOOT_REMOVED)

Trade:
- TRADE_REQUEST when another player initiates a trade
- TRADE_SHOW when the trade window opens
- TRADE_CLOSED when trade is cancelled, declined, or completed
- TRADE_ACCEPT_UPDATE when the trade partner accepts

Duels:
- DUEL_REQUESTED with challenger name on incoming duel challenge
- DUEL_FINISHED when a duel completes or is cancelled
2026-03-21 02:57:00 -07:00
Kelsi
7105672f06 feat: resolve item icon paths from ItemDisplayInfo.dbc for Lua API
Add ItemIconPathResolver that lazily loads ItemDisplayInfo.dbc to map
displayInfoId → icon texture path. This fixes three Lua API functions
that previously returned nil for item icons:

- GetItemInfo() field 10 (texture) now returns the icon path
- GetActionTexture() for item-type action bar slots now returns icons
- GetLootSlotInfo() field 1 (texture) now returns proper item icons
  instead of incorrectly using the spell icon resolver

Follows the same lazy-loading pattern as SpellIconPathResolver. The DBC
is loaded once on first query and cached for all subsequent lookups.
2026-03-21 02:53:07 -07:00
Kelsi
e21f808714 feat: support SavedVariablesPerCharacter for per-character addon data
Implement the SavedVariablesPerCharacter TOC directive that many addons
use to store different settings per character (Bartender, Dominos,
MoveAnything, WeakAuras, etc.). Without this, all characters share the
same addon data file.

Per-character files are stored as <AddonName>.<CharacterName>.lua.saved
alongside the existing account-wide <AddonName>.lua.saved files. The
character name is resolved from the player GUID at world entry time.

Changes:
- TocFile::getSavedVariablesPerCharacter() parses the TOC directive
- AddonManager loads/saves per-character vars alongside account-wide vars
- Character name set from game handler before addon loading
2026-03-21 02:46:21 -07:00
Kelsi
0d2fd02dca feat: add 40+ frame metatable methods to prevent addon nil-reference errors
Add commonly called frame methods as no-ops or with basic state tracking
on the frame metatable, so any CreateFrame result supports them:

Layout: SetFrameLevel/Get, SetFrameStrata/Get, SetScale/Get/GetEffective,
  ClearAllPoints, SetID/GetID, GetLeft/Right/Top/Bottom, GetNumPoints,
  GetPoint, SetHitRectInsets
Behavior: EnableMouse, EnableMouseWheel, SetMovable, SetResizable,
  RegisterForDrag, SetClampedToScreen, SetToplevel, Raise, Lower,
  StartMoving, StopMovingOrSizing, RegisterForClicks, IsMouseOver
Visual: SetBackdrop, SetBackdropColor, SetBackdropBorderColor
Scripting: HookScript (chains with existing SetScript handlers),
  SetAttribute/GetAttribute, GetObjectType
Sizing: SetMinResize, SetMaxResize

These prevent the most common addon errors when addons call standard
WoW frame methods on CreateFrame results.
2026-03-21 02:39:44 -07:00
Kelsi
b99bf7021b feat: add WoW table/string/math/bit utility functions for addon compat
Add commonly used WoW global utility functions that many addons depend on:

Table: tContains, tInvert, CopyTable, tDeleteItem
String: strupper, strlower, strfind, strsub, strlen, strrep, strbyte,
  strchar, strrev, gsub, gmatch, strjoin
Math: Clamp, Round
Bit ops: bit.band, bit.bor, bit.bxor, bit.bnot, bit.lshift, bit.rshift
  (pure Lua implementation for Lua 5.1 which lacks native bit ops)

These prevent nil-reference errors and missing-function crashes in
addons that use standard WoW utility globals.
2026-03-21 02:37:56 -07:00
Kelsi
154140f185 feat: add UIDropDownMenu framework, font objects, and UI global stubs
Add the UIDropDownMenu compatibility framework used by virtually every
addon with settings or selection menus: UIDropDownMenu_Initialize,
CreateInfo, AddButton, SetWidth, SetText, GetText, SetSelectedID, etc.

Add global font object stubs (GameFontNormal, GameFontHighlight, etc.)
referenced by CreateFontString template arguments.

Add UISpecialFrames table, InterfaceOptionsFrame for addon panels,
InterfaceOptions_AddCategory, and common font color constants
(GRAY_FONT_COLOR, NORMAL_FONT_COLOR, etc.).

These globals prevent nil-reference errors in most popular addons.
2026-03-21 02:36:06 -07:00
Kelsi
760c6a2790 feat: fire PLAYER_ENTER_COMBAT and PLAYER_LEAVE_COMBAT events
Fire PLAYER_ENTER_COMBAT when the player's auto-attack starts
(SMSG_ATTACKSTART) and PLAYER_LEAVE_COMBAT when auto-attack stops.
These events are distinct from PLAYER_REGEN_DISABLED/ENABLED — they
specifically track physical melee combat state and are used by
combat-aware addons for weapon swing timers and attack state tracking.
2026-03-21 02:31:59 -07:00
Kelsi
60904e2e15 fix: fire talent/spell events correctly when learning talents
Fix bug where learning a talent caused an early return before firing
LEARNED_SPELL_IN_TAB and SPELLS_CHANGED events, leaving talent addons
unaware of changes. Now talent learning fires CHARACTER_POINTS_CHANGED,
PLAYER_TALENT_UPDATE, LEARNED_SPELL_IN_TAB, and SPELLS_CHANGED.

Also fire CHARACTER_POINTS_CHANGED, ACTIVE_TALENT_GROUP_CHANGED, and
PLAYER_TALENT_UPDATE from handleTalentsInfo (SMSG_TALENTS_INFO), so
talent addons update when the full talent state is received from the
server (login, spec switch, respec).

Also fire UNIT_HEALTH/UNIT_POWER events from SMSG_HEALTH_UPDATE and
SMSG_POWER_UPDATE packets for real-time unit frame updates.
2026-03-21 02:29:48 -07:00
Kelsi
d75f2c62e5 feat: fire UNIT_HEALTH/UNIT_POWER events from dedicated update packets
SMSG_HEALTH_UPDATE and SMSG_POWER_UPDATE are high-frequency WotLK
packets that update entity health/power values but weren't firing
addon events. Unit frame addons (Pitbull, oUF, SUF) depend on these
events to update health/mana bars in real-time.

Now fire UNIT_HEALTH for player/target/focus on SMSG_HEALTH_UPDATE
and UNIT_POWER on SMSG_POWER_UPDATE, matching the events already
fired from the UPDATE_OBJECT path.
2026-03-21 02:26:44 -07:00
Kelsi
55ef607093 feat: add talent tree Lua API for talent inspection addons
Implement 5 talent-related WoW Lua API functions:
- GetNumTalentTabs() returns class-specific talent tree count (usually 3)
- GetTalentTabInfo(tab) returns name, icon, pointsSpent, background
- GetNumTalents(tab) returns talent count in a specific tree
- GetTalentInfo(tab, index) returns full 8-value tuple with name, tier,
  column, current rank, max rank, and availability
- GetActiveTalentGroup() returns active spec (1 or 2)

Data sourced from Talent.dbc, TalentTab.dbc, and the server-sent talent
info packet. Enables talent addons and spec display addons.
2026-03-21 02:22:35 -07:00
Kelsi
0a6fdfb8b1 feat: add GetNumSkillLines and GetSkillLineInfo for profession addons
Implement skill line API functions that profession and tradeskill addons
need to display player skills:
- GetNumSkillLines() returns count of player skills
- GetSkillLineInfo(index) returns full 12-value tuple: name, isHeader,
  isExpanded, rank, tempPoints, modifier, maxRank, isAbandonable, etc.

Data comes from SMSG_SKILLS_INFO update fields and SkillLine.dbc names.
2026-03-21 02:18:25 -07:00
Kelsi
855f00c5b5 feat: add LibStub and CallbackHandler-1.0 for Ace3 addon compatibility
Implement LibStub — the universal library version management system that
virtually every WoW addon framework depends on (Ace3, LibDataBroker,
LibSharedMedia, etc.). Without LibStub, most popular addons fail to load.

Also implement CallbackHandler-1.0 — the standard event callback library
used by Ace3-based addons for inter-module communication. Supports
RegisterCallback, UnregisterCallback, UnregisterAllCallbacks, and Fire.

These two libraries unlock the entire Ace3 addon ecosystem.
2026-03-21 02:15:50 -07:00
Kelsi
c20db42479 feat: fire UNIT_SPELLCAST_SENT and UNIT_SPELLCAST_STOP events
Fire UNIT_SPELLCAST_SENT when the player initiates a spell cast (before
server confirms), enabling cast bar addons like Quartz to show latency.
Includes target name and spell ID as arguments.

Fire UNIT_SPELLCAST_STOP whenever a cast bar should disappear:
- On successful cast completion (SMSG_SPELL_GO)
- On cast failure (SMSG_CAST_RESULT with error)
- On spell interrupt (SMSG_SPELL_FAILURE/SMSG_SPELL_FAILED_OTHER)
- On manual cast cancel

These events are essential for cast bar replacement addons to properly
track when casts begin and end.
2026-03-21 02:10:09 -07:00
Kelsi
6e863a323a feat: add UseAction, CancelUnitBuff, and CastSpellByID Lua functions
Implement 3 critical gameplay Lua API functions:
- UseAction(slot) activates an action bar slot (spell/item), enabling
  action bar addons like Bartender/Dominos to fire abilities
- CancelUnitBuff("player", index) cancels a buff by index, enabling
  auto-cancel and buff management addons
- CastSpellByID(id) casts a spell by numeric ID, enabling macro addons
  and spell queuing systems
2026-03-21 02:03:51 -07:00
Kelsi
45850c5aa9 feat: add targeting Lua API functions for addon and macro support
Implement 8 targeting functions commonly used by unit frame addons,
targeting macros, and click-casting addons:
- TargetUnit(unitId) / ClearTarget()
- FocusUnit(unitId) / ClearFocus()
- AssistUnit(unitId) — target the given unit's target
- TargetLastTarget() — return to previous target
- TargetNearestEnemy() / TargetNearestFriend() — tab-targeting
2026-03-21 01:58:03 -07:00
Kelsi
3ae18f03a1 feat: fire UNIT_HEALTH/POWER/AURA events for party members; fix closeLoot event
Fire UNIT_HEALTH, UNIT_POWER, and UNIT_AURA events from
SMSG_PARTY_MEMBER_STATS with proper unit IDs (party1..4, raid1..40).
Previously, health/power changes for party members via the stats packet
were silent — raid frame addons never got notified.

Also fix closeLoot() not firing LOOT_CLOSED event when the loot window
is closed by the player (only handleLootReleaseResponse fired it).
2026-03-21 01:55:30 -07:00
Kelsi
00a97aae3f fix: remove Lua stubs overriding C implementations; add GameTooltip and frame factories
Fix GetScreenWidth/GetScreenHeight/GetNumLootItems/GetFramerate being
overridden by hardcoded Lua stubs that ran after the C functions were
registered. Now the real C implementations correctly take effect.

Add GameTooltip global frame with 20+ methods (SetOwner, ClearLines,
AddLine, AddDoubleLine, SetText, NumLines, GetText, SetHyperlink, etc.)
and ShoppingTooltip1/2 — critical for virtually all WoW addons.

Add frame:CreateTexture() and frame:CreateFontString() methods returning
stub objects with common API methods, enabling UI creation addons.

Add real GetFramerate() returning actual FPS from ImGui.
2026-03-21 01:52:59 -07:00
Kelsi
ce26284b90 feat: add GetCursorPosition, screen size queries, and frame positioning methods
Add global Lua API functions:
- GetCursorPosition() returns mouse x,y screen coordinates
- GetScreenWidth()/GetScreenHeight() return window dimensions

Add frame methods for UI layout:
- SetPoint, SetSize, SetWidth, SetHeight, GetWidth, GetHeight, GetCenter
- SetAlpha, GetAlpha, SetParent, GetParent

These enable UI customization addons to query cursor position, screen
dimensions, and manage frame layout — fundamental for unit frames,
action bars, and tooltip addons.
2026-03-21 01:44:59 -07:00
Kelsi
8555c80aa2 feat: add loot window Lua API for addon compatibility
Implement 6 loot-related WoW Lua API functions:
- GetNumLootItems() returns count of items in loot window
- GetLootSlotInfo(slot) returns texture, name, quantity, quality, locked
- GetLootSlotLink(slot) returns item link string
- LootSlot(slot) takes an item from loot
- CloseLoot() closes the loot window
- GetLootMethod() returns current group loot method

These pair with the LOOT_OPENED/LOOT_CLOSED events to enable loot
addons (AutoLoot, loot filters, master loot helpers).
2026-03-21 01:42:03 -07:00
Kelsi
7459f27771 feat: add targettarget, focustarget, pettarget, mouseovertarget unit IDs
Support compound unit IDs that resolve an entity's current target via
UNIT_FIELD_TARGET_LO/HI update fields. This enables addons to query
target-of-target info (e.g., UnitName("targettarget"), UnitHealth("focustarget"))
which is essential for threat meters and unit frame addons.
2026-03-21 01:37:44 -07:00
Kelsi
74125b7340 feat: fire LOOT/GOSSIP/QUEST/TRAINER addon events on window open/close
Fire the following events for addon compatibility:
- LOOT_OPENED, LOOT_CLOSED on loot window open/close
- GOSSIP_SHOW, GOSSIP_CLOSED on gossip/quest-list window open/close
- QUEST_DETAIL when quest details are shown to the player
- QUEST_COMPLETE when quest offer reward dialog opens
- TRAINER_SHOW, TRAINER_CLOSED on trainer window open/close
2026-03-21 01:35:18 -07:00
Kelsi
fe8950bd4b feat: add action bar, combo points, reaction, and connection Lua API functions
Implement 10 new WoW Lua API functions for addon compatibility:
- GetComboPoints, UnitReaction, UnitIsConnected for unit frames/raid addons
- HasAction, GetActionTexture, IsCurrentAction, IsUsableAction, GetActionCooldown
  for action bar addons (Bartender, Dominos, etc.)
- UnitMana/UnitManaMax as Classic-era aliases for UnitPower/UnitPowerMax
2026-03-21 01:31:34 -07:00
Kelsi
32a51aa93d feat: add mouseover unit ID support and fire UPDATE_MOUSEOVER_UNIT/PLAYER_FOCUS_CHANGED events
Add "mouseover" as a valid unit ID in resolveUnitGuid so Lua API functions
like UnitName("mouseover"), UnitHealth("mouseover") etc. work for addons.
Fire UPDATE_MOUSEOVER_UNIT event when the mouseover target changes, and
PLAYER_FOCUS_CHANGED event when focus is set or cleared.
2026-03-21 01:26:37 -07:00
Kelsi
22798d1c76 feat: fire MAIL_SHOW/CLOSED and AUCTION_HOUSE_SHOW/CLOSED events
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Fire MAIL_SHOW when mailbox opens (SMSG_SHOW_MAILBOX) and MAIL_CLOSED
when it closes. Fire AUCTION_HOUSE_SHOW when AH opens and AUCTION_HOUSE_CLOSED
when it closes. Used by mail addons (Postal) and AH addons (Auctionator).
2026-03-20 22:43:29 -07:00
Kelsi
395d6cdcba feat: fire BANKFRAME_OPENED and BANKFRAME_CLOSED events for bank addons
Fire BANKFRAME_OPENED when bank window opens and BANKFRAME_CLOSED when
it closes. Used by bank management addons (Bagnon, BankItems) to detect
when the player is interacting with their bank.
2026-03-20 22:32:21 -07:00
Kelsi
8cc90a69e8 feat: fire MERCHANT_SHOW and MERCHANT_CLOSED events for vendor addons
Fire MERCHANT_SHOW when vendor window opens (SMSG_LIST_INVENTORY) and
MERCHANT_CLOSED when vendor is closed. Used by vendor price addons and
auto-sell addons that need to detect vendor interaction state.
2026-03-20 22:22:36 -07:00
Kelsi
37a5b4c9d9 feat: fire ACTIONBAR_SLOT_CHANGED event on action bar updates
Fire when SMSG_ACTION_BUTTONS populates the action bar on login and when
SMSG_SUPERCEDED_SPELL upgrades spell ranks on the bar. Used by action bar
addons (Bartender, Dominos) to refresh their displays.
2026-03-20 22:13:57 -07:00
Kelsi
fc182f8653 feat: fire SKILL_LINES_CHANGED event when player skills update
Detect changes in player skill values after extractSkillFields() and fire
SKILL_LINES_CHANGED when any skill value changes. Used by profession
tracking addons and skill bar displays.
2026-03-20 21:57:27 -07:00
Kelsi
d68ef2ceb6 feat: fire CHAT_MSG_MONEY and CHAT_MSG_COMBAT_XP_GAIN events
Fire CHAT_MSG_MONEY when gold is looted (used by gold tracking addons
like MoneyFu, Titan Panel). Fire CHAT_MSG_COMBAT_XP_GAIN when XP is
earned (used by XP tracking addons and leveling speed calculators).
2026-03-20 21:47:39 -07:00
Kelsi
44d2b80998 feat: fire CHAT_MSG_LOOT event when items are looted
Fire CHAT_MSG_LOOT addon event from SMSG_ITEM_PUSH_RESULT with the loot
message text, item ID, and count. Used by loot tracking addons (AutoLootPlus,
Loot Appraiser) and damage meters that track loot distribution.
2026-03-20 21:27:04 -07:00
Kelsi
0885f885e8 feat: fire PLAYER_FLAGS_CHANGED event when player flags update
Fires when AFK/DND status, PvP flag, ghost state, or other player flags
change via PLAYER_FLAGS update field. Enables addons that track player
status changes (FlagRSP, TRP3, etc.).
2026-03-20 21:18:25 -07:00
Kelsi
3dcd489e81 feat: show random suffix names in auction owner sold/expired notifications
Parse randomPropertyId from SMSG_AUCTION_OWNER_NOTIFICATION to display
full item names in sold/bid/expired messages like "Your auction of
Gloves of the Monkey has sold!" Completes suffix resolution across
all 9 item display contexts.
2026-03-20 21:02:12 -07:00
Kelsi
9f49f543f6 feat: show random suffix names in auction outbid and expired notifications
Apply getRandomPropertyName() to SMSG_AUCTION_BIDDER_NOTIFICATION and
SMSG_AUCTION_REMOVED_NOTIFICATION so outbid/expired messages show full
item names like "You have been outbid on Leggings of the Eagle" instead
of just "Leggings". Completes suffix name resolution across all AH contexts.
2026-03-20 20:57:23 -07:00
Kelsi
df55242c50 feat: add GetCoinTextureString/GetCoinText Lua money formatting utility
Formats copper amounts into "Xg Ys Zc" strings for addon display.
GetCoinText is aliased to GetCoinTextureString. Used by money display
addons (Titan Panel, MoneyFu) and auction/vendor price formatting.
2026-03-20 20:44:59 -07:00
Kelsi
b659ab9caf feat: add GetPlayerInfoByGUID Lua API for damage meter player identification
Returns (class, englishClass, race, englishRace, sex, name, realm) for a
GUID string. Resolves player name from entity cache. Returns class/race
info for the local player. Used by Details!, Recount, and Skada to
identify players in COMBAT_LOG_EVENT_UNFILTERED data.
2026-03-20 20:22:15 -07:00
Kelsi
8be8d31b85 feat: add GetItemLink Lua API for clickable item links from item IDs
Returns WoW-format quality-colored item link for any item ID from the
item info cache. Used by loot addons, tooltip addons, and chat formatting
to create clickable item references.
2026-03-20 20:07:45 -07:00
Kelsi
6d2a94a844 feat: add GetSpellLink Lua API for clickable spell links in chat
Returns WoW-format spell link string "|cff71d5ff|Hspell:ID|h[Name]|h|r"
for a spell ID or name. Used by damage meters, chat addons, and WeakAuras
to create clickable spell references in chat messages.
2026-03-20 19:57:13 -07:00
Kelsi
bc4ff501e2 feat: show random suffix names in AH bids and seller auction tabs
Extend random property name resolution to the Bids tab and Your Auctions
(seller) tab. All three auction house tabs now display items with their
full suffix names (e.g., "Gloves of the Monkey" instead of "Gloves").
2026-03-20 19:37:17 -07:00
Kelsi
a13dfff9a1 feat: show random suffix names in auction house item listings
Append suffix name from getRandomPropertyName() to auction browse results
so items display as "Leggings of the Eagle" instead of just "Leggings"
in the auction house search table. Uses the randomPropertyId field from
the SMSG_AUCTION_LIST_RESULT packet data.
2026-03-20 19:33:01 -07:00
Kelsi
99f4ded3b5 feat: show random suffix names in loot roll popup and roll-won messages
Apply getRandomPropertyName() to SMSG_LOOT_START_ROLL and SMSG_LOOT_ROLL_WON
handlers so items with random suffixes display correctly in group loot
contexts (e.g., "Leggings of the Eagle" in the Need/Greed popup and
"Player wins Leggings of the Eagle (Need 85)" in chat).
2026-03-20 19:22:59 -07:00
Kelsi
4b3e377add feat: resolve random property/suffix names for item display
Load ItemRandomProperties.dbc and ItemRandomSuffix.dbc lazily to resolve
suffix names like "of the Eagle", "of the Monkey" etc. Add
getRandomPropertyName(id) callback on GameHandler wired through Application.
Append suffix to item names in SMSG_ITEM_PUSH_RESULT loot notifications
so items display as "Leggings of the Eagle" instead of just "Leggings".
2026-03-20 19:18:30 -07:00
Kelsi
23a7d3718c fix: return WoW-standard (start, duration, enabled) from GetSpellCooldown
Previously returned (0, remaining) which broke addons computing remaining
time as start + duration - GetTime(). Now returns (GetTime(), remaining, 1)
when on cooldown and (0, 0, 1) when off cooldown, plus the third 'enabled'
value that WoW always returns. Fixes cooldown display in OmniCC and similar.
2026-03-20 19:03:34 -07:00
Kelsi
3a4d59d584 feat: add GetXPExhaustion and GetRestState Lua APIs for rested XP tracking
GetXPExhaustion() returns rested XP pool remaining (nil if none).
GetRestState() returns 1 (normal) or 2 (rested) based on inn/city state.
Used by XP bar addons like Titan Panel and XP tracking WeakAuras.
2026-03-20 18:53:56 -07:00
Kelsi
2b99011cd8 fix: cap gossipPois_ vector growth and add soft frame rate limiter
Cap gossipPois_ at 200 entries (both gossip POI and quest POI paths) to
prevent unbounded memory growth from rapid gossip/quest queries. Add soft
240 FPS frame rate limiter when vsync is off to prevent 100% CPU usage —
sleeps for remaining frame budget when frame completes in under 4ms.
2026-03-20 18:51:05 -07:00
Kelsi
4bd237b654 feat: add IsUsableSpell Lua API for spell usability checks
Returns (usable, noMana) tuple. Checks if the spell is known and not on
cooldown. Accepts spell ID or name. Used by action bar addons and
WeakAuras for conditional spell display (greyed out when unusable).
2026-03-20 18:42:33 -07:00
Kelsi
ce128990d2 feat: add IsInInstance, GetInstanceInfo, and GetInstanceDifficulty Lua APIs
IsInInstance() returns whether player is in an instance and the type.
GetInstanceInfo() returns map name, instance type, difficulty index/name,
and max players. GetInstanceDifficulty() returns 1-based difficulty index.
Critical for raid/dungeon addons like DBM for instance detection.
2026-03-20 18:33:44 -07:00
Kelsi
2a9a7fe04e feat: add UnitClassification Lua API for nameplate and boss mod addons
Returns WoW-standard classification strings: "normal", "elite", "rareelite",
"worldboss", or "rare" based on creature rank from CreatureCache. Used by
nameplate addons (Plater, TidyPlates) and boss mods (DBM) to detect elite/
boss/rare mobs for special handling.
2026-03-20 18:25:39 -07:00
Kelsi
180990b9f1 feat: play minimap ping sound when party members ping the map
Add playMinimapPing() to UiSoundManager with MapPing.wav (falls back to
target select sound). Play the ping sound in MSG_MINIMAP_PING handler
when the sender is not the local player. Provides audio feedback for
party member map pings, matching WoW behavior.
2026-03-20 18:21:34 -07:00
Kelsi
f03ed8551b feat: add GetGameTime, GetServerTime, UnitXP, and UnitXPMax Lua APIs
GetGameTime() returns server game hours and minutes from the day/night
cycle. GetServerTime() returns Unix timestamp. UnitXP("player") and
UnitXPMax("player") return current and next-level XP values. Used by
XP tracking addons and time-based conditionals.
2026-03-20 18:16:12 -07:00
Kelsi
71837ade19 feat: show zone name on loading screen during world transitions
Add setZoneName() to LoadingScreen and display the map name from Map.dbc
as large gold text with drop shadow above the progress bar. Shown in both
render() and renderOverlay() paths. Zone name is resolved from gameHandler's
getMapName(mapId) during world load. Improves feedback during zone transitions.
2026-03-20 18:12:23 -07:00
Kelsi
ff1840415e fix: invoke despawn callbacks on disconnect to prevent renderer leaks
Mirror the zone-transition cleanup in disconnect(): fire despawn callbacks
for all entities before clearing the entity manager. Prevents M2 instances
and character models from leaking when the player disconnects and reconnects
quickly (e.g., server kick, network recovery).
2026-03-20 18:07:00 -07:00
Kelsi
922177abe0 fix: invoke despawn callbacks during zone transitions to release renderer resources
handleNewWorld() previously called entityManager.clear() directly without
notifying the renderer, leaving stale M2 instances and character models
allocated. Now iterates all entities and fires creatureDespawnCallback,
playerDespawnCallback, and gameObjectDespawnCallback before clearing.
Also clears player caches (visible items, cast states, aura cache,
combat text) to prevent state leaking between zones.
2026-03-20 18:05:09 -07:00
Kelsi
1d7eaaf2a0 fix: compute aura expirationTime for addon countdown timers
The expirationTime field (7th return value of UnitBuff/UnitDebuff/UnitAura)
was hardcoded to 0. Now returns GetTime() + remaining seconds, matching
WoW's convention where addons compute remaining = expirationTime - GetTime().
Enables buff/debuff timer addons like OmniCC and WeakAuras.
2026-03-20 18:00:57 -07:00
Kelsi
5adb9370d2 fix: return caster unit ID from UnitBuff/UnitDebuff/UnitAura
The caster field (8th return value) was always nil. Now returns the
caster's unit ID ("player", "target", "focus", "pet") or hex GUID
string for other units. Enables addons to identify who applied a
buff/debuff for filtering and tracking purposes.
2026-03-20 17:58:53 -07:00
Kelsi
ffe16f5cf2 feat: add equipment slot Lua API for gear inspection addons
Add GetInventoryItemLink(unit, slotId), GetInventoryItemID(unit, slotId),
and GetInventoryItemTexture(unit, slotId) for WoW inventory slots 1-19
(Head through Tabard). Returns quality-colored item links with WoW format.
Enables gear inspection and item level calculation addons.
2026-03-20 17:56:20 -07:00
Kelsi
3f0b152fe9 fix: return debuff type string from UnitBuff/UnitDebuff/UnitAura
The debuffType field (5th return value) was always nil. Now resolves
dispel type from Spell.dbc via getSpellDispelType(): returns "Magic",
"Curse", "Disease", or "Poison" for debuffs. Enables dispel-focused
addons like Decursive and Grid to detect debuff categories.
2026-03-20 17:53:01 -07:00
Kelsi
7c5bec50ef fix: increase world packet size limit from 16KB to 32KB
The 0x4000 (16384) limit was too conservative and could disconnect the
client when the server sends large packets such as SMSG_GUILD_ROSTER
with 500+ members (~30KB) or SMSG_AUCTION_LIST with many results.
Increase to 0x8000 (32768) which covers all normal gameplay while still
protecting against framing desync from encryption errors.
2026-03-20 17:49:49 -07:00
Kelsi
f712d3de94 feat: add quest log Lua API for quest tracking addons
Add GetNumQuestLogEntries(), GetQuestLogTitle(index), GetQuestLogQuestText(index),
and IsQuestComplete(questID). GetQuestLogTitle returns WoW-compatible 8 values
including title, isComplete flag, and questID. Enables quest tracking addons
like Questie and QuestHelper to access the player's quest log.
2026-03-20 17:37:35 -07:00
Kelsi
ee59c37b83 feat: add loot method change notifications and CRITERIA_UPDATE event
Show "Loot method changed to Master Looter/Round Robin/etc." in chat when
group loot method changes via SMSG_GROUP_LIST. Fire CRITERIA_UPDATE addon
event with criteria ID and progress when achievement criteria progress
changes, enabling achievement tracking addons.
2026-03-20 17:33:34 -07:00
Kelsi
c44e1bde0a feat: fire UPDATE_FACTION, QUEST_ACCEPTED, and QUEST_LOG_UPDATE events
Fire UPDATE_FACTION when reputation standings change (SMSG_SET_FACTION_STANDING).
Fire QUEST_ACCEPTED with quest ID when a new quest is added to the log.
Fire QUEST_LOG_UPDATE on both quest acceptance and quest completion.
Enables reputation tracking and quest log addons.
2026-03-20 17:28:28 -07:00
Kelsi
14007c81df feat: add /cancelqueuedspell command to clear spell queue
Add cancelQueuedSpell() method that clears queuedSpellId_ and
queuedSpellTarget_. Wire /cancelqueuedspell and /stopspellqueue
slash commands. Useful for combat macros that need to prevent
queued spells from firing after a current cast.
2026-03-20 17:24:16 -07:00
Kelsi
8761ad9301 fix: clean up combat text, cast bars, and aura cache on entity destroy
When SMSG_DESTROY_OBJECT removes an entity, now also purge combat text
entries targeting that GUID (prevents floating damage numbers on despawned
mobs), erase unit cast state (prevents stale cast bars), and clear cached
auras (prevents stale buff/debuff data for destroyed units).
2026-03-20 17:19:18 -07:00
Kelsi
0f480f5ada feat: add container/bag Lua API for bag addon support
Add GetContainerNumSlots(bag), GetContainerItemInfo(bag, slot),
GetContainerItemLink(bag, slot), and GetContainerNumFreeSlots(bag).
Container 0 = backpack (16 slots), containers 1-4 = equipped bags.
Returns item count, quality, and WoW-format item links with quality
colors. Enables bag management addons (Bagnon, OneBag, AdiBags).
2026-03-20 17:14:07 -07:00
Kelsi
e6fbdfcc02 feat: add /dump command for Lua expression evaluation and debugging
/dump <expression> evaluates a Lua expression and prints the result to
chat. For tables, iterates key-value pairs and displays them. Aliases:
/print. Useful for addon development and debugging game state queries
like "/dump GetSpellInfo(133)" or "/dump UnitHealth('player')".
2026-03-20 17:05:48 -07:00
Kelsi
b3f406c6d3 fix: sync cloud density with weather intensity and DBC cloud coverage
Cloud renderer's density was hardcoded at 0.35 and never updated from the
DBC-driven cloudDensity parameter. Now setDensity() is called each frame
with the lighting manager's cloud coverage value. Active weather (rain/
snow/storm) additionally boosts cloud density by up to 0.4 so clouds
visibly thicken during storms.
2026-03-20 16:50:32 -07:00
Kelsi
d7d6819855 feat: add generic UnitAura(unit, index, filter) Lua API function
Add UnitAura() that accepts WoW-compatible filter strings: "HELPFUL" for
buffs, "HARMFUL" for debuffs. Delegates to existing UnitBuff/UnitDebuff
logic. Many addons (WeakAuras, Grid, etc.) use UnitAura with filter
strings rather than separate UnitBuff/UnitDebuff calls.
2026-03-20 16:42:06 -07:00
Kelsi
4cdccb7430 feat: fire BAG_UPDATE and PLAYER_EQUIPMENT_CHANGED events for addons
Fire BAG_UPDATE and UNIT_INVENTORY_CHANGED when item stack/durability
fields change in UPDATE_OBJECT VALUES path. Fire PLAYER_EQUIPMENT_CHANGED
when equipment slot fields change. Enables bag addons (Bagnon, OneBag) and
gear tracking addons to react to inventory changes.
2026-03-20 16:38:57 -07:00
Kelsi
ae18d25996 feat: add sun height attenuation and warm sunset tint to lens flare
Reduce flare intensity when sun is near the horizon via smoothstep on
sunDir.z (0→0.25 range). Apply amber/orange color shift to flare elements
at sunrise/sunset for a warm golden glow. Prevents overly bright flares
at low sun angles while enhancing atmospheric mood.
2026-03-20 16:34:11 -07:00
Kelsi
bf62061a31 feat: expand slash command autocomplete with 30+ missing commands
Add /reload, /reloadui, /rl, /ready, /notready, /readycheck, /cancellogout,
/clearmainassist, /clearmaintank, /mainassist, /maintank, /cloak, /gdemote,
/gkick, /gleader, /gmotd, /gpromote, /gquit, /groster, /leaveparty,
/removefriend, /score, /script, /targetenemy, /targetfriend, /targetlast,
/ticket, and more to the tab-completion list. Alphabetically sorted.
2026-03-20 16:29:32 -07:00
Kelsi
00201c1232 feat: show enchant name and XP source creature in chat messages
SMSG_ENCHANTMENTLOG now resolves spell name and shows "You enchant with
[name]" or "[Caster] enchants your item with [name]" instead of silent
debug log. SMSG_LOG_XPGAIN now shows creature name: "Wolf dies, you gain
45 experience" instead of generic "You gain 45 experience" for kill XP.
2026-03-20 16:21:52 -07:00
Kelsi
21ead2aa4b feat: add /reload command to re-initialize addon system
Add AddonManager::reload() which saves all SavedVariables, shuts down the
Lua VM, re-initializes it, rescans .toc files, and reloads all addons.
Wire /reload, /reloadui, /rl slash commands that call reload() and fire
VARIABLES_LOADED + PLAYER_LOGIN + PLAYER_ENTERING_WORLD lifecycle events.
Essential for addon development and troubleshooting.
2026-03-20 16:17:04 -07:00
Kelsi
23ebfc7e85 feat: add LFG role check confirmation popup with CMSG_LFG_SET_ROLES
When the dungeon finder initiates a role check (SMSG_LFG_ROLE_CHECK_UPDATE
state=2), show a centered popup with Tank/Healer/DPS checkboxes and
Accept/Leave Queue buttons. Accept sends CMSG_LFG_SET_ROLES with the
selected role mask. Previously only showed passive "Role check in progress"
text with no way to respond.
2026-03-20 16:10:29 -07:00
Kelsi
df7feed648 feat: add distinct STORM weather type with wind-driven particles
Add Weather::Type::STORM enum value and wire it from SMSG_WEATHER type 3.
Storm particles are faster (70 units/s vs rain's 50), wind-angled at 15+
units lateral velocity with gusty turbulence, darker blue-grey tint, and
shorter lifetime. Previously storms rendered identically to rain.
2026-03-20 15:56:58 -07:00
Kelsi
d1bcd2f844 fix: resolve compiler warnings in lua_engine and game_screen
Remove unused getPlayerUnit() helper in lua_engine.cpp (-Wunused-function).
Increase countStr buffer from 8 to 16 bytes in action bar item count
display to eliminate -Wformat-truncation warning for %d with int32_t.
Build is now warning-free.
2026-03-20 15:53:43 -07:00
Kelsi
4b6ed04926 feat: add GetZoneText, GetSubZoneText, and GetMinimapZoneText Lua APIs
Add zone name query functions using worldStateZoneId + getAreaName lookup.
GetRealZoneText is aliased to GetZoneText. These are heavily used by boss
mod addons (DBM) for zone detection and by quest tracking addons.
2026-03-20 15:44:25 -07:00
Kelsi
0dd1b08504 feat: fire spellcast channel and interrupt events for Lua addons
Add UNIT_SPELLCAST_CHANNEL_START (MSG_CHANNEL_START), UNIT_SPELLCAST_CHANNEL_STOP
(MSG_CHANNEL_UPDATE with 0ms remaining), UNIT_SPELLCAST_FAILED (SMSG_CAST_RESULT
with error), and UNIT_SPELLCAST_INTERRUPTED (SMSG_SPELL_FAILURE) events. These
enable addons to track channeled spells and cast interruptions for all units.
2026-03-20 15:37:33 -07:00
Kelsi
e033efc998 feat: add bid status indicators to auction house UI
Show [Winning] (green) or [Outbid] (red) labels on the Bids tab based on
bidderGuid vs player GUID comparison. Show [Bid] (gold) indicator on the
seller's Auctions tab when someone has placed a bid on their listing.
Improves auction house usability by making bid status visible at a glance.
2026-03-20 15:31:41 -07:00
Kelsi
fb7b2b5390 feat: add 9 more WoW Lua API functions for group and unit queries
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Add UnitAffectingCombat, GetNumRaidMembers, GetNumPartyMembers, UnitInParty,
UnitInRaid, UnitIsUnit, UnitIsFriend, UnitIsEnemy, and UnitCreatureType.
These are commonly used by raid/group addons for party composition checks,
combat state queries, and mob type identification. Total API count now 55.
2026-03-20 15:21:38 -07:00
Kelsi
50ca4f71f9 fix: correct NPC equipment geoset group assignments for gloves and boots
NPC character models used wrong geoset groups: gloves were group 3 (300s)
instead of group 4 (400s), boots were group 4 (400s) instead of group 5
(500s), matching the character preview code. Also remove spurious "torso"
geoset from group 5 (conflicted with boots) — chest armor controls only
group 8 (sleeves), not a separate torso visibility group. Fixes NPC
equipment rendering with incorrect body part meshes.
2026-03-20 15:15:15 -07:00
Kelsi
66f779c186 feat: add zone change and login sequence events for Lua addons
Fire ZONE_CHANGED_NEW_AREA and ZONE_CHANGED when worldStateZoneId changes
in SMSG_INIT_WORLD_STATES. Add VARIABLES_LOADED and PLAYER_LOGIN events in
the addon loading sequence (before PLAYER_ENTERING_WORLD), and fire
PLAYER_ENTERING_WORLD on subsequent world entries (teleport, instance).
Enables zone-aware addons like DBM and quest trackers.
2026-03-20 15:05:29 -07:00
Kelsi
5eaf738b66 feat: show quest POI markers on the world map overlay
Add QuestPoi struct and setQuestPois() to WorldMap, render quest objective
markers as cyan circles with golden outlines and quest title labels. Wire
gossipPois_ (from SMSG_QUEST_POI_QUERY_RESPONSE) through GameScreen to the
world map so quest objectives are visible alongside party dots and taxi nodes.
2026-03-20 15:00:29 -07:00
Kelsi
3790adfa06 feat: replace hardcoded state stubs with real game state in Lua API
IsMounted, IsFlying, IsSwimming, IsResting, IsFalling, and IsStealthed
now query actual GameHandler state (mount display ID, movement flags,
resting flag, aura list) instead of returning false. Add GetUnitSpeed
for player run speed. Fixes addon conditionals that depend on player
movement/mount/combat state.
2026-03-20 14:57:13 -07:00
Kelsi
90ccfbfc4e fix: fire GROUP_ROSTER_UPDATE on group uninvite and leave
handleGroupUninvite and leaveGroup cleared partyData but did not fire
GROUP_ROSTER_UPDATE/PARTY_MEMBERS_CHANGED events, so addon group tracking
would not update when kicked or leaving. Now both paths fire both events.
2026-03-20 14:44:48 -07:00
Kelsi
dbac4eb4f0 feat: add WoW compatibility stubs for broader addon support
Add error handling (geterrorhandler, seterrorhandler, debugstack, securecall,
issecurevariable), CVar system (GetCVar, GetCVarBool, SetCVar), screen/state
queries (GetScreenWidth/Height, GetFramerate, GetNetStats, IsLoggedIn,
IsMounted, IsFlying, etc.), UI stubs (StaticPopup_Show/Hide, StopSound),
and RAID_CLASS_COLORS table. Prevents common addon load errors.
2026-03-20 14:38:50 -07:00
Kelsi
ae30137705 feat: add COMBAT_LOG_EVENT_UNFILTERED and cooldown start events
Fire COMBAT_LOG_EVENT_UNFILTERED from addCombatText with WoW-compatible
subevent names (SWING_DAMAGE, SPELL_DAMAGE, SPELL_HEAL, etc.), source/dest
GUIDs, names, spell info, and amount. Also fire SPELL_UPDATE_COOLDOWN and
ACTIONBAR_UPDATE_COOLDOWN when cooldowns start (handleSpellCooldown), not
just when they end. Enables damage meter and boss mod addons.
2026-03-20 14:35:00 -07:00
Kelsi
ae627193f8 feat: fire combat, spell, and cooldown events for Lua addon system
Add PLAYER_REGEN_DISABLED/ENABLED (combat enter/leave) via per-frame
edge detection, LEARNED_SPELL_IN_TAB/SPELLS_CHANGED on spell learn/remove,
SPELL_UPDATE_COOLDOWN/ACTIONBAR_UPDATE_COOLDOWN on cooldown finish, and
PLAYER_XP_UPDATE on XP field changes. Total addon events now at 34.
2026-03-20 14:27:46 -07:00
Kelsi
4c10974553 feat: add party/raid unit IDs and game events for Lua addon system
Extend resolveUnit() to support party1-4, raid1-40, and use resolveUnitGuid
for UnitGUID/UnitIsPlayer/UnitBuff/UnitDebuff (including unitAurasCache for
party member auras). Fire UNIT_HEALTH, UNIT_POWER, UNIT_AURA, UNIT_SPELLCAST_START,
UNIT_SPELLCAST_SUCCEEDED, GROUP_ROSTER_UPDATE, and PARTY_MEMBERS_CHANGED events
to Lua addons from the corresponding packet handlers.
2026-03-20 14:15:00 -07:00
Kelsi
22b0cc8a3c feat: add GetSpellInfo, GetSpellTexture, GetItemInfo and more Lua API functions
Add spell icon path resolution via SpellIcon.dbc + Spell.dbc lazy loading,
wired through GameHandler callback. Fix UnitBuff/UnitDebuff to return icon
texture paths instead of nil. Add GetLocale, GetBuildInfo, GetCurrentMapAreaID.
2026-03-20 13:58:54 -07:00
Kelsi
3ff43a530f feat: add hooksecurefunc, UIParent, and noop stubs for addon compat
- hooksecurefunc(tblOrName, name, hook) — hook any function to run
  additional code after it executes without replacing the original.
  Supports both global and table method forms.

- UIParent, WorldFrame — standard parent frames that many addons
  reference as parents for their own frames.

- Noop stubs: SetDesaturation, SetPortraitTexture, PlaySound,
  PlaySoundFile — prevent errors from addons that call these
  visual/audio functions which don't have implementations yet.
2026-03-20 13:27:27 -07:00
Kelsi
0a62529b55 feat: add DEFAULT_CHAT_FRAME with AddMessage for addon output
Many WoW addons use DEFAULT_CHAT_FRAME:AddMessage(text, r, g, b) to
output colored text to chat. Implemented as a Lua table with AddMessage
that converts RGB floats to WoW color codes and calls print().
Also aliased as ChatFrame1 for compatibility.

Example: DEFAULT_CHAT_FRAME:AddMessage("Hello!", 1, 0.5, 0)
2026-03-20 13:18:16 -07:00
Kelsi
ee3f60a1bb feat: add GetNumAddOns and GetAddOnInfo for addon introspection
- GetNumAddOns() — returns count of loaded addons
- GetAddOnInfo(indexOrName) — returns name, title, notes, loadable

Addon info is stored in the Lua registry from the .toc directives
and populated before addon files execute. Useful for addon managers
and compatibility checks between addons.

Total WoW API: 33 functions.
2026-03-20 13:07:45 -07:00
Kelsi
66431ab762 feat: fire ADDON_LOADED event after each addon finishes loading
Fire ADDON_LOADED(addonName) after all of an addon's files have been
executed. This is the standard WoW pattern for addon initialization —
addons register for this event to set up defaults after SavedVariables
are loaded:

  local f = CreateFrame("Frame")
  f:RegisterEvent("ADDON_LOADED")
  f:SetScript("OnEvent", function(self, event, name)
      if name == "MyAddon" then
          MyAddonDB = MyAddonDB or {defaults}
      end
  end)

Total addon events: 20.
2026-03-20 12:52:25 -07:00
Kelsi
05a37036c7 feat: add UnitBuff and UnitDebuff API for Lua addons
Implement the most commonly used buff/debuff query functions:

- UnitBuff(unitId, index) — query the Nth buff on a unit
- UnitDebuff(unitId, index) — query the Nth debuff on a unit

Returns WoW-compatible 11-value tuple: name, rank, icon, count,
debuffType, duration, expirationTime, caster, isStealable,
shouldConsolidate, spellId.

Supports "player" and "target" unit IDs. Essential for buff tracking
addons (WeakAuras-style), healer addons, and combat analysis tools.

Total WoW API: 31 functions.
2026-03-20 12:45:43 -07:00
Kelsi
7d178d00fa fix: exclude vendored Lua 5.1.5 from Semgrep security scan
The Semgrep security scan was failing because vendored Lua 5.1.5 source
uses strcpy/strncpy which are flagged as insecure C functions. These are
false positives in frozen third-party code that we don't modify.

Added .semgrepignore to exclude all vendored extern/ directories
(lua-5.1.5, imgui, stb, vk-bootstrap, FidelityFX SDKs).
2026-03-20 12:27:59 -07:00
Kelsi
062cfd1e4a feat: add SavedVariables persistence for Lua addons
Addons can now persist data across sessions using the standard WoW
SavedVariables pattern:

1. Declare in .toc: ## SavedVariables: MyAddonDB
2. Use the global in Lua: MyAddonDB = MyAddonDB or {default = true}
3. Data is automatically saved on logout and restored on next login

Implementation:
- TocFile::getSavedVariables() parses comma-separated variable names
- LuaEngine::loadSavedVariables() executes saved .lua file to restore globals
- LuaEngine::saveSavedVariables() serializes Lua tables/values to valid Lua
- Serializer handles tables (nested), strings, numbers, booleans, nil
- Save triggered on PLAYER_LEAVING_WORLD and AddonManager::shutdown()
- Files stored as <AddonDir>/<AddonName>.lua.saved

Updated HelloWorld addon to track login count across sessions.
2026-03-20 12:22:50 -07:00
Kelsi
5ea5588c14 feat: add 6 more WoW API functions for Lua addons
- UnitRace(unitId) — returns race name ("Human", "Orc", etc.)
- UnitPowerType(unitId) — returns power type ID and name ("MANA", "RAGE", etc.)
- GetNumGroupMembers() — party/raid member count
- UnitGUID(unitId) — returns hex GUID string (0x format)
- UnitIsPlayer(unitId) — true if target is a player (not NPC)
- InCombatLockdown() — true if player is in combat

Total WoW API surface: 29 functions.
2026-03-20 12:15:36 -07:00
Kelsi
b235345b2c feat: add C_Timer.After and C_Timer.NewTicker for Lua addons
Implement WoW's C_Timer API used by most modern addons:

- C_Timer.After(seconds, callback) — fire callback after delay
- C_Timer.NewTicker(seconds, callback, iterations) — repeating timer
  with optional iteration limit and :Cancel() method

Implemented in pure Lua using a hidden OnUpdate frame that
auto-hides when no timers are pending (zero overhead when idle).

Example:
  C_Timer.After(3, function() print("3 sec later!") end)
  local ticker = C_Timer.NewTicker(1, function() print("tick") end, 5)
2026-03-20 12:11:24 -07:00
Kelsi
1f8660f329 feat: add OnUpdate frame script for per-frame addon callbacks
Frames can now set an OnUpdate script that fires every frame with
the elapsed time as an argument. This enables addon timers, polling,
and animations.

  local f = CreateFrame("Frame")
  f:SetScript("OnUpdate", function(self, elapsed)
      -- called every frame with deltaTime
  end)

OnUpdate only fires for visible frames (frame:Hide() pauses it).
Tracked in __WoweeOnUpdateFrames table, dispatched via
LuaEngine::dispatchOnUpdate() called from the Application main loop.
2026-03-20 12:07:22 -07:00
Kelsi
c7e25beaf1 feat: fire PLAYER_MONEY, PLAYER_DEAD, PLAYER_ALIVE addon events
Fire more gameplay events to Lua addons:
- PLAYER_MONEY — when gold/silver/copper changes (both CREATE and VALUES paths)
- PLAYER_DEAD — on forced death (SMSG_FORCED_DEATH_UPDATE)
- PLAYER_ALIVE — when ghost flag clears (player resurrected)

Total addon events: 19 (2 world + 12 chat + 5 gameplay).
2026-03-20 11:56:59 -07:00
Kelsi
269d9e2d40 feat: fire PLAYER_TARGET_CHANGED and PLAYER_LEVEL_UP addon events
Add a generic AddonEventCallback to GameHandler for firing named events
with string arguments directly from game logic. Wire it to the addon
system in Application.

New events fired:
- PLAYER_TARGET_CHANGED — when target is set or cleared
- PLAYER_LEVEL_UP(newLevel) — on level up

The generic callback pattern makes it easy to add more events from
game_handler.cpp without touching Application/AddonManager code.
Total addon events: 16 (2 world + 12 chat + 2 gameplay).
2026-03-20 11:51:46 -07:00
Kelsi
c284a971c2 feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:

- CreateFrame(type, name, parent, template) — creates a frame table
  with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name

Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.

Updated HelloWorld to use standard WoW addon pattern:
  local f = CreateFrame("Frame", "MyFrame")
  f:RegisterEvent("PLAYER_ENTERING_WORLD")
  f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
Kelsi
c1820fd07d feat: add WoW utility functions and SlashCmdList for addon slash commands
Utility functions:
- strsplit(delim, str), strtrim(str), wipe(table)
- date(format), time() — safe replacements for removed os.date/os.time
- format (alias for string.format), tinsert/tremove (table aliases)

SlashCmdList system:
- Addons can register custom slash commands via the standard WoW pattern:
  SLASH_MYADDON1 = "/myaddon"
  SlashCmdList["MYADDON"] = function(args) ... end
- Chat input checks SlashCmdList before built-in commands
- dispatchSlashCommand() iterates SLASH_<NAME>1..9 globals to match

Total WoW API surface: 23 functions + SlashCmdList + 14 events.
2026-03-20 11:40:58 -07:00
Kelsi
52a97e7730 feat: add action WoW API functions for Lua addons
Add 5 more essential WoW API functions for addon development:

- SendChatMessage(msg, type, lang, target) — send chat messages
  (SAY, YELL, WHISPER, PARTY, GUILD, OFFICER, RAID, BG)
- CastSpellByName(name) — cast highest rank of named spell
- IsSpellKnown(spellId) — check if player knows a spell
- GetSpellCooldown(nameOrId) — get remaining cooldown
- HasTarget() — check if player has a target

Total WoW API surface: 18 functions across Unit, Game, and Action
categories. Addons can now query state, react to events, send
messages, and cast spells.
2026-03-20 11:34:04 -07:00
Kelsi
0a0ddbfd9f feat: fire CHAT_MSG_* events to Lua addons for all chat types
Wire chat messages to the addon event system via AddonChatCallback.
Every chat message now fires the corresponding WoW event:

- CHAT_MSG_SAY, CHAT_MSG_YELL, CHAT_MSG_WHISPER
- CHAT_MSG_PARTY, CHAT_MSG_GUILD, CHAT_MSG_OFFICER
- CHAT_MSG_RAID, CHAT_MSG_RAID_WARNING, CHAT_MSG_BATTLEGROUND
- CHAT_MSG_SYSTEM, CHAT_MSG_CHANNEL, CHAT_MSG_EMOTE

Event handlers receive (eventName, message, senderName) arguments.
Addons can now filter, react to, or log chat messages in real-time.
2026-03-20 11:29:53 -07:00
Kelsi
510f03fa32 feat: add WoW event system for Lua addons
Implement the WoW-compatible event system that lets addons react to
gameplay events in real-time:

- RegisterEvent(eventName, handler) — register a Lua function for an event
- UnregisterEvent(eventName, handler) — remove a handler
- fireEvent() dispatches events to all registered handlers with args

Currently fired events:
- PLAYER_ENTERING_WORLD — after addons load and world entry completes
- PLAYER_LEAVING_WORLD — before logout/disconnect

Events are stored in a __WoweeEvents Lua table, dispatched via
LuaEngine::fireEvent() which is called from AddonManager::fireEvent().
Error handling logs Lua errors without crashing.

Updated HelloWorld addon to use RegisterEvent for world entry/exit.
2026-03-20 11:23:38 -07:00
Kelsi
7da1f6f5ca feat: add core WoW Lua API functions for addon development
Add 13 WoW-compatible Lua API functions that addons can call:

Unit API: UnitName, UnitHealth, UnitHealthMax, UnitPower, UnitPowerMax,
UnitLevel, UnitExists, UnitIsDead, UnitClass (supports "player",
"target", "focus", "pet" unit IDs)

Game API: GetMoney, IsInGroup, IsInRaid, GetPlayerMapPosition

Updated HelloWorld addon to demonstrate querying player state.
2026-03-20 11:17:15 -07:00
Kelsi
290e9bfbd8 feat: add Lua 5.1 addon system with .toc loader and /run command
Foundation for WoW-compatible addon support:

- Vendor Lua 5.1.5 source as a static library (extern/lua-5.1.5)
- TocParser: parses .toc files (## directives + file lists)
- LuaEngine: Lua 5.1 VM with sandboxed stdlib (no io/os/debug),
  WoW-compatible print() that outputs to chat, GetTime() stub
- AddonManager: scans Data/interface/AddOns/ for .toc files,
  loads .lua files on world entry, skips LoadOnDemand addons
- /run <code> slash command for inline Lua execution
- HelloWorld test addon that prints to chat on load

Integration: AddonManager initialized after asset manager, addons
loaded once on first world entry, reset on logout. XML frame
parsing is deferred to a future step.
2026-03-20 11:12:07 -07:00
Kelsi
52064eb438 feat: show item tooltip for /use macros when spell tooltip unavailable
When hovering a /use macro whose item's on-use spell isn't in the DBC
(no rich spell tooltip available), the tooltip fell back to showing raw
macro text. Now searches the item info cache and shows the full item
tooltip (stats, quality, binding, description) as a more useful
fallback for /use macros.
2026-03-20 10:12:42 -07:00
Kelsi
71a3abe5d7 feat: show item icon for /use macros on action bar
Macros with /use ItemName tried to find the item as a spell name for
icon resolution, which fails for items without a matching spell (e.g.
engineering trinkets, quest items). Now falls back to searching the
item info cache by name and showing the item's display icon when no
spell name matches.
2026-03-20 10:06:14 -07:00
Kelsi
503115292b fix: save character config when quest tracking changes
setQuestTracked() modified trackedQuestIds_ but didn't call
saveCharacterConfig(), so tracked quests were only persisted if
another action (like editing a macro or rearranging the action bar)
happened to trigger a save before logout. Now saves immediately
when quests are tracked or untracked.
2026-03-20 09:48:27 -07:00
Kelsi
d9ab1c8297 feat: persist tracked quest IDs across sessions
Quest tracking choices (right-click → Track on the quest objective
tracker) were lost on logout because trackedQuestIds_ was not saved
in the character config. Now saves tracked quest IDs as a comma-
separated list and restores them on login, so the quest tracker
shows the same quests the player chose to track in their previous
session.
2026-03-20 09:44:41 -07:00
Kelsi
6b61d24438 feat: document mouseover and @ target syntax in /macrohelp
Add [target=mouseover] and the @ shorthand syntax (@focus, @pet,
@mouseover, @player, @target) to the /macrohelp output. These are
commonly used for mouseover healing macros and were already supported
but not documented in the in-game help.
2026-03-20 09:32:14 -07:00
Kelsi
52d8da0ef0 feat: update /help output with missing commands
The /help text was missing several commonly-used commands: /castsequence,
/use, /threat, /combatlog, /mark, /raidinfo, /assist, /inspect,
/chathelp. Reorganized categories for clarity and added all missing
entries to match the expanded auto-complete list.
2026-03-20 09:27:22 -07:00
Kelsi
0e14174764 feat: expand chat auto-complete with 30+ missing slash commands
Many working slash commands were missing from the chat auto-complete
suggestions: /equipset, /focus, /clearfocus, /cleartarget, /inspect,
/played, /screenshot, /pvp, /duel, /threat, /unstuck, /logout, /loc,
/friend, /ignore, /unignore, /ginvite, /mark, /raidinfo, /helm,
/forfeit, /kneel, /assist, /castsequence, /stopmacro, /help, and more.
Reorganized alphabetically for maintainability.
2026-03-20 09:23:21 -07:00
Kelsi
b89aa36483 fix: clear spell visual negative cache on world entry
The spell visual failed-model cache was never cleared across world
changes, so models that failed to load during initial asset loading
(before MPQ/CASC data was fully indexed) would never retry. Now clears
spellVisualFailedModels_ in resetCombatVisualState() alongside the
active spell visual cleanup, giving failed models a fresh attempt on
each world entry.
2026-03-20 09:14:53 -07:00
Kelsi
6bd950e817 feat: support /use macros for action bar icon and indicators
Macros with /use ItemName (e.g. /use Healthstone, /use Engineering
trinket) had no icon, cooldown, or tooltip on the action bar because
only /cast and /castsequence were recognized. Now the spell resolution
also handles /use by looking up the item name in the item info cache
and finding its on-use spell ID. Added getItemInfoCache() accessor.
2026-03-20 09:08:49 -07:00
Kelsi
b960a1cdd5 fix: invalidate macro spell cache when spells are learned/removed
The macro primary spell cache stored 0 (no spell found) when a macro
referenced a spell the player hadn't learned yet. After learning the
spell from a trainer or leveling up, the cache was never refreshed,
so the macro button stayed broken. Now tracks the known spell count
and clears the cache when it changes, ensuring newly learned spells
are resolved on the next frame.
2026-03-20 08:52:57 -07:00
Kelsi
87e1ac7cdd feat: support /castsequence macros for action bar icon and indicators
Macros with /castsequence were treated as having no primary spell, so
they showed no icon, cooldown, range, power, or tooltip on the action
bar. Now both resolveMacroPrimarySpellId() and the icon derivation
code recognize /castsequence commands, strip the reset= spec, and
use comma-separation to find the first spell in the sequence. This
gives /castsequence macros the same visual indicators as /cast macros.
2026-03-20 08:43:19 -07:00
Kelsi
a5609659c7 feat: show cast-failed red flash on macro action bar buttons
The error-flash overlay (red fade on spell cast failure) only applied to
SPELL-type slots. Macro buttons never flashed red when their primary
spell failed to cast. Now resolves the macro's primary spell and checks
the actionFlashEndTimes_ map for a matching flash, completing macro
action bar parity with spell buttons across all 6 visual indicators.
2026-03-20 08:38:24 -07:00
Kelsi
a2df2ff596 feat: show insufficient-power tint on macro action bar buttons
The insufficient-power indicator only applied to SPELL-type slots.
Macro buttons like /cast Fireball never showed the power tint when the
player was out of mana. Now resolves the macro's primary spell and
checks its power cost against the player's current power, giving the
same visual feedback as regular spell buttons.
2026-03-20 08:32:07 -07:00
Kelsi
1d53c35ed7 feat: show out-of-range red tint on macro action bar buttons
The out-of-range indicator (red tint) only applied to SPELL-type action
bar slots. Macro buttons like /cast Frostbolt never turned red even when
the target was out of range. Now resolves the macro's primary spell via
the cached lookup and checks its max range against the target distance,
giving the same visual feedback as regular spell buttons.
2026-03-20 08:27:10 -07:00
Kelsi
3b20485c79 feat: show spell tooltip on macro action bar hover
Hovering a macro button on the action bar previously showed "Macro #N"
with raw macro text. Now resolves the macro's primary spell via the
cached lookup and shows its full rich tooltip (name, school, cost, cast
time, range, description) — same as hovering a regular spell button.
Falls back to the raw text display if no primary spell is found.
Also shows the cooldown remaining in red when the spell is on cooldown.
2026-03-20 08:18:28 -07:00
Kelsi
a103fb5168 fix: key macro cooldown cache by macro ID instead of slot index
The macro primary spell cache was keyed by action bar slot index, so
switching characters or rearranging macros could return stale spell IDs
from the previous character's macro in that slot. Now keyed by macro ID,
which is stable per-macro regardless of which slot it occupies.
2026-03-20 08:14:08 -07:00
Kelsi
bfbf590ee2 refactor: cache macro primary spell ID to avoid per-frame name search
The macro cooldown display from the previous commit iterated all known
spells (400+) every frame for each macro on the action bar, doing
lowercase string comparisons. Moved the spell name resolution into a
cached lookup (macroPrimarySpellCache_) that only runs once per macro
and is invalidated when macro text is edited. The per-frame path now
just does a single hash map lookup + spellCooldowns check.
2026-03-20 08:11:13 -07:00
Kelsi
670055b873 feat: show spell cooldown on macro action bar buttons
Macro buttons on the action bar never showed cooldowns — a /cast
Fireball macro would display no cooldown sweep or timer even when
Fireball was on cooldown. Now resolves the macro's primary spell (from
the first /cast command, stripping conditionals and alternatives) and
checks its cooldown via spellCooldowns. The cooldown sweep overlay and
countdown text display using the resolved spell's remaining time.
2026-03-20 08:07:20 -07:00
Kelsi
2e879fe354 fix: sync item cooldowns to action bar slots on login
The cooldown sync after SMSG_ACTION_BUTTONS and SMSG_INITIAL_SPELLS
only handled SPELL-type action bar slots. ITEM-type slots (potions,
trinkets, engineering items) were skipped, so items on the action bar
showed no cooldown overlay after login even if their on-use spell was
on cooldown. Now looks up each item's on-use spell IDs from the item
info cache and syncs any matching spellCooldowns entries.
2026-03-20 08:01:54 -07:00
Kelsi
625754f0f7 fix: let FSR3 settings persist across restarts without env var
FSR2/FSR3 upscaling mode was forcibly reverted to FSR1 on every startup
unless the WOWEE_ALLOW_STARTUP_FSR2 environment variable was set. This
meant users had to re-select FSR 3.x and re-enable frame generation on
every launch. Removed the env var requirement since the deferred
activation (wait until IN_WORLD state) already provides sufficient
startup safety by preventing FSR init during login/character screens.
2026-03-20 07:53:07 -07:00
Kelsi
1ed6380152 fix: raise initial cooldown count cap from 256 to 1024
Some server implementations include cooldown entries for all spells
(even with zero remaining time) to communicate category cooldown data.
The previous 256 cap could truncate these entries, causing missing
cooldown tracking for spells near the end of the list. Raised to match
the spell count cap for consistency.
2026-03-20 07:32:15 -07:00
Kelsi
eeb116ff7e fix: raise initial spell count cap from 256 to 1024
WotLK characters with all ability ranks, mounts, companion pets,
professions, and racial skills can know 400-600 spells. The previous
256 cap truncated the spell list, causing missing spells in the
spellbook, broken /cast commands for truncated spells, and missing
cooldown tracking for spells beyond the cap.
2026-03-20 07:28:24 -07:00
Kelsi
f101ed7c83 fix: clear spell visual instances on map change/world entry
Active spell visual M2 instances were never cleaned up when the player
teleported to a different map or re-entered the world. Orphaned effects
could linger visually from the previous combat session. Now properly
removes all active spell visual instances in resetCombatVisualState(),
which is called on every world entry.
2026-03-20 07:23:38 -07:00
Kelsi
e24c39f4be fix: add UNIT_FIELD_AURAFLAGS to update field name table
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
UNIT_FIELD_AURAFLAGS was defined in the UF enum and used in Classic and
Turtle JSON files (index 98) but missing from the kUFNames lookup table.
The JSON loader silently skipped it, so Classic/Turtle aura flag data
from UPDATE_OBJECT was never mapped. This could cause aura display
issues on Classic 1.12 and Turtle WoW servers.
2026-03-20 07:16:34 -07:00
Kelsi
ebc7d66dfe fix: add honor/arena currency to update field name table
PLAYER_FIELD_HONOR_CURRENCY and PLAYER_FIELD_ARENA_CURRENCY were added
to the UF enum and JSON files in cycle 1, but the kUFNames lookup table
in update_field_table.cpp was not updated. This meant the JSON loader
could not map these field names to their enum values, so honor and
arena point values from UPDATE_OBJECT were silently ignored.
2026-03-20 07:12:40 -07:00
Kelsi
5172c07e15 fix: include category cooldowns in initial spell cooldown tracking
SMSG_INITIAL_SPELLS cooldown entries have both cooldownMs (individual)
and categoryCooldownMs (shared, e.g. potions). The handler only checked
cooldownMs, so spells with category-only cooldowns (cooldownMs=0,
categoryCooldownMs=120000) were not tracked. Now uses the maximum of
both values, ensuring potion and similar shared cooldowns show on the
action bar after login.
2026-03-20 07:02:57 -07:00
Kelsi
533831e18d fix: sync pending spell cooldowns to action bar after login
SMSG_SPELL_COOLDOWN arrives before SMSG_ACTION_BUTTONS during login,
so cooldown times were stored in spellCooldowns but never applied to
the newly populated action bar slots. Players would see all abilities
as ready immediately after login even if spells were on cooldown.
Now applies pending cooldowns from the spellCooldowns map to each
matching slot when the action bar is first populated.
2026-03-20 06:59:23 -07:00
Kelsi
72993121ab feat: add pulsing yellow flash to chat tabs with unread messages
Chat tabs with unread messages now pulse yellow to attract attention.
The existing unread count "(N)" suffix was text-only and easy to miss,
especially for whisper and guild tabs. The pulsing color clears when
the tab is clicked, matching standard WoW chat tab behavior.
2026-03-20 06:47:39 -07:00
Kelsi
22742fedb8 feat: add [raid], [noraid], and [spec:N] macro conditionals
Add commonly-used WoW macro conditionals:
- [raid]/[noraid] — checks if the player is in a raid group (groupType
  == 1) vs a regular party. Used for conditional healing/targeting in
  raid content.
- [spec:1]/[spec:2] — checks the active talent spec (1-based index).
  Used for dual-spec macros that swap gear sets or use different
  rotations per spec.

Updated /macrohelp to list the new conditionals.
2026-03-20 06:42:43 -07:00
Kelsi
a6fe5662c8 fix: implement [target=pet] and [@pet] macro target specifiers
The /macrohelp listed [target=pet] as supported but the conditional
evaluator didn't handle the "pet" specifier for target= or @ syntax.
Now resolves to the player's active pet GUID (or skips the alternative
if no pet is active). Essential for hunter/warlock macros like:
  /cast [target=pet] Mend Pet
  /cast [@pet,dead] Revive Pet
2026-03-20 06:38:13 -07:00
Kelsi
fa82d32a9f feat: add [indoors]/[outdoors] macro conditionals via WMO detection
Add indoor/outdoor state macro conditionals using the renderer's WMO
interior detection. Essential for mount macros that need to select
ground mounts indoors vs flying mounts outdoors. The Renderer now
caches the insideWmo state in playerIndoors_ and exposes it via
isPlayerIndoors(). Updated /macrohelp to list the new conditionals.
2026-03-20 06:29:33 -07:00
Kelsi
114478271e feat: add [pet], [nopet], [group], [nogroup] macro conditionals
Add frequently-used macro conditionals for pet and group state:
- [pet]/[nopet] — checks if the player has an active pet (hunters,
  warlocks, DKs). Essential for pet management macros.
- [group]/[nogroup]/[party] — checks if the player is in a party or
  raid. Used for conditional targeting and ability usage.

Updated /macrohelp output to list the new conditionals.
2026-03-20 06:25:02 -07:00
Kelsi
a9e0a99f2b feat: add /macrohelp command to list available macro conditionals
Players can now type /macrohelp to see all supported macro conditionals
grouped by category (state, target, form, keys, aura). Also added to
the /help output and chat auto-complete list. This helps users discover
the macro system without external documentation.
2026-03-20 06:17:23 -07:00
Kelsi
d7059c66dc feat: add mounted/swimming/flying/stealthed/channeling macro conditionals
Add commonly-used WoW macro conditionals that were missing:
- [mounted]/[nomounted] — checks isMounted() state
- [swimming]/[noswimming] — checks SWIMMING movement flag
- [flying]/[noflying] — checks CAN_FLY + FLYING movement flags
- [stealthed]/[nostealthed] — checks UNIT_FLAG_SNEAKING (0x02000000)
- [channeling]/[nochanneling] — checks if currently channeling a spell

These are essential for common macros like mount/dismount toggles,
rogue opener macros, and conditional cast sequences.
2026-03-20 06:13:27 -07:00
Kelsi
6b7975107e fix: add proficiency warning to vendor/loot item tooltips
The proficiency check added in the previous commit only applied to the
ItemDef tooltip variant (inventory items). Vendor, loot, and AH
tooltips use the ItemQueryResponseData variant which was missing the
check. Now both tooltip paths show "You can't use this type of item."
in red when the player lacks weapon or armor proficiency.
2026-03-20 06:07:38 -07:00
Kelsi
120c2967eb feat: show proficiency warning in item tooltips
Item tooltips now display a red "You can't use this type of item."
warning when the player lacks proficiency for the weapon or armor
subclass (e.g. a mage hovering over a plate item or a two-handed
sword). Uses the existing canUseWeaponSubclass/canUseArmorSubclass
checks against SMSG_SET_PROFICIENCY bitmasks.
2026-03-20 06:04:29 -07:00
Kelsi
bc2085b0fc fix: increase compressed UPDATE_OBJECT decompressed size limit to 5MB
Capital cities and large raids can produce UPDATE_OBJECT packets that
decompress to more than 1MB. The real WoW client handles up to ~10MB.
Bump the limit from 1MB to 5MB to avoid silently dropping entity
updates in densely populated areas like Dalaran or 40-man raids.
2026-03-20 05:59:11 -07:00
Kelsi
bda5bb0a2b fix: add negative cache for failed spell visual model loads
Spell visual M2 models that fail to load (missing file, empty model,
or GPU upload failure) were re-attempted on every subsequent spell cast,
causing repeated file I/O during combat. Now caches failed model IDs in
spellVisualFailedModels_ so they are skipped on subsequent attempts.
2026-03-20 05:56:33 -07:00
Kelsi
90edb3bc07 feat: use M2 animation duration for spell visual lifetime
Spell visual effects previously used a fixed 3.5s duration for all
effects, causing some to linger too long and overlap during combat.
Now queries the M2 model's default animation duration via the new
getInstanceAnimDuration() method and clamps it to 0.5-5s. Effects
without animations fall back to a 2s default. This makes spell impacts
feel more responsive and reduces visual clutter.
2026-03-20 05:52:47 -07:00
Kelsi
29c938dec2 feat: add Isle of Conquest to battleground score frame
Add IoC (map 628) to the BG score display with Alliance/Horde
reinforcement counters (world state keys 4221/4222, max 300).
2026-03-20 05:40:53 -07:00
Kelsi
9d1fb39363 feat: add "Usable" filter to auction house and query token item names
Add a "Usable" checkbox to the AH search UI that filters results to
items the player can actually equip/use (server-side filtering via the
usableOnly parameter in CMSG_AUCTION_LIST_ITEMS). Also ensure token
item names for extended costs are queried from the server via
ensureItemInfo() so they display properly instead of "Item#12345".
2026-03-20 05:34:17 -07:00
Kelsi
5230815353 feat: display detailed honor/arena/token costs for vendor items
Load ItemExtendedCost.dbc and show specific costs (e.g. "2000 Honor",
"200 Arena", "30x Badge of Justice") instead of generic "[Tokens]" for
vendor items with extended costs. Items with both gold and token costs
now show both. Token item names are resolved from item info cache.
2026-03-20 05:28:45 -07:00
Kelsi
595ea466c2 fix: update local equipment set GUID on save confirmation and auto-request played time on login
SMSG_EQUIPMENT_SET_SAVED now updates the local set's GUID from the
server response, preventing duplicate set creation when clicking
"Update" on a newly-saved set. New sets are also added to the local
list immediately so the UI reflects them without a relog.

Additionally, CMSG_PLAYED_TIME is now auto-sent on initial world entry
(with sendToChat=false) so the character Stats tab shows total and
level time immediately without requiring /played.
2026-03-20 05:17:27 -07:00
Kelsi
e68a1fa2ec fix: guard equipment set packets against unsupported expansions
Classic and TBC lack equipment set opcodes, so sending save/use/delete
packets would transmit wire opcode 0xFFFF and potentially disconnect the
client. Now all three methods check wireOpcode != 0xFFFF before sending,
and the Outfits tab is only shown when the expansion supports equipment
sets (via supportsEquipmentSets() check).
2026-03-20 05:12:24 -07:00
Kelsi
9600dd40e3 fix: correct CMSG_EQUIPMENT_SET_USE packet format
The packet previously sent only a uint32 setId, which does not match
the WotLK protocol. AzerothCore/TrinityCore expect 19 iterations of
(PackedGuid itemGuid + uint8 srcBag + uint8 srcSlot). Now looks up the
equipment set's target item GUIDs and searches equipment, backpack, and
extra bags to provide correct source locations for each item.
2026-03-20 05:01:21 -07:00
Kelsi
1ae4cfaf3f fix: auto-acknowledge cinematic and movie triggers to prevent server hangs
Send CMSG_NEXT_CINEMATIC_CAMERA in response to SMSG_TRIGGER_CINEMATIC
and CMSG_COMPLETE_MOVIE in response to SMSG_TRIGGER_MOVIE. Some WotLK
servers block further packets or disconnect clients that don't respond
to these triggers, especially during the intro cinematic on first login.
2026-03-20 04:53:54 -07:00
Kelsi
f4d705738b fix: send CMSG_SET_WATCHED_FACTION when tracking a reputation
setWatchedFactionId() previously only stored the faction locally.
Now it also sends CMSG_SET_WATCHED_FACTION with the correct repListId
to the server, so the tracked faction persists across sessions.
2026-03-20 04:50:49 -07:00
Kelsi
ae56f2eb80 feat: implement equipment set save, update, and delete
Add saveEquipmentSet() and deleteEquipmentSet() methods that send
CMSG_EQUIPMENT_SET_SAVE and CMSG_DELETEEQUIPMENT_SET packets. The save
packet captures all 19 equipment slot GUIDs via packed GUID encoding.
The Outfits tab now always shows (not just when sets exist), with an
input field to create new sets and Update/Delete buttons per set.
2026-03-20 04:43:46 -07:00
Kelsi
f88d90ee88 feat: track and display honor/arena points from update fields
Add PLAYER_FIELD_HONOR_CURRENCY and PLAYER_FIELD_ARENA_CURRENCY to the
update field system for WotLK (indices 1422/1423) and TBC (1505/1506).
Parse values from both CREATE_OBJECT and VALUES update paths, and show
them in the character Stats tab under a PvP Currency section.
2026-03-20 04:36:30 -07:00
Kelsi
0830215b31 fix: force Node.js 24 for GitHub Actions to resolve CI failure
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
2026-03-19 20:08:14 -07:00
Kelsi
0b8e1834f6 feat: group dungeon finder list by expansion with separator headers
Some checks failed
Build / Build (arm64) (push) Has been cancelled
Build / Build (x86-64) (push) Has been cancelled
Build / Build (macOS arm64) (push) Has been cancelled
Build / Build (windows-arm64) (push) Has been cancelled
Build / Build (windows-x86-64) (push) Has been cancelled
Security / CodeQL (C/C++) (push) Has been cancelled
Security / Semgrep (push) Has been cancelled
Security / Sanitizer Build (ASan/UBSan) (push) Has been cancelled
Categorize dungeons into Random/Classic/TBC/WotLK sections with visual
separators in the dropdown for easier navigation.
2026-03-18 12:43:04 -07:00
Kelsi
86cc6e16a4 fix: correct PET_CAST_FAILED expansion format and parse LFG role choices
SMSG_PET_CAST_FAILED: Classic/TBC omit the castCount byte (matching
SMSG_CAST_FAILED pattern). Without this fix, TBC parsing reads garbage.
SMSG_LFG_ROLE_CHOSEN: surface role selection messages in chat during
dungeon finder role checks.
2026-03-18 12:40:20 -07:00
Kelsi
d149255c58 feat: implement petition signing flow for guild charter creation
Parse SMSG_PETITION_QUERY_RESPONSE, SMSG_PETITION_SHOW_SIGNATURES,
and SMSG_PETITION_SIGN_RESULTS. Add UI to view signatures, sign
petitions, and turn in completed charters. Send CMSG_PETITION_SIGN
and CMSG_TURN_IN_PETITION packets.
2026-03-18 12:31:48 -07:00
Kelsi
41e15349c5 feat: improve arena team UI with names, types, and roster requests
Store team name and type (2v2/3v3/5v5) from SMSG_ARENA_TEAM_QUERY_RESPONSE.
Display proper team labels instead of raw IDs. Add Load/Refresh roster
buttons and CMSG_ARENA_TEAM_ROSTER request support.
2026-03-18 12:26:23 -07:00
Kelsi
aed8c94544 feat: add instance difficulty indicator on minimap
Show Normal/Heroic/25-Man difficulty badge below zone name when inside
a dungeon or raid instance. Orange-highlighted for heroic modes.
2026-03-18 12:21:41 -07:00
Kelsi
801f29f043 fix: sync player appearance after barber shop or polymorph
PLAYER_BYTES and PLAYER_BYTES_2 changes in SMSG_UPDATE_OBJECT now
update the Character struct's appearanceBytes and facialFeatures,
and fire an appearance-changed callback that resets the inventory
screen preview so it reloads with the new hair/face values.
2026-03-18 12:17:00 -07:00
Kelsi
2e134b686d fix: correct BattlemasterList.dbc IDs for arenas and Isle of Conquest
Arena and BG type IDs now match actual 3.3.5a BattlemasterList.dbc:
Nagrand Arena=4, Blade's Edge=5, Ruins of Lordaeron=8, Dalaran
Sewers=10, Ring of Valor=11, Isle of Conquest=30, Random BG=32.
2026-03-18 12:04:38 -07:00
Kelsi
5d5083683f fix: correct Eye of the Storm bgTypeId and simplify BG invite popup
Eye of the Storm uses bgTypeId 7 (from BattlemasterList.dbc), not 6.
BG invite popup now uses the stored bgName from the queue slot instead
of re-deriving the name with a duplicate switch statement.
2026-03-18 12:03:36 -07:00
Kelsi
64fd7eddf8 feat: implement barber shop UI with hair/facial customization
Adds a functional barber shop window triggered by SMSG_ENABLE_BARBER_SHOP.
Players can adjust hair style, hair color, and facial features using
sliders bounded by race/gender max values. Sends CMSG_ALTER_APPEARANCE
on confirm; server result closes the window on success. Escape key
also closes the barber shop.
2026-03-18 11:58:01 -07:00
Kelsi
8dfd916fe4 feat: add right-click context menu to target and focus frames
Right-clicking the target or focus frame name now opens a context
menu with Set Focus/Target, Clear Focus, Whisper, Invite, Trade,
Duel, Inspect, Add Friend, and Ignore options (player-specific
options only shown for player targets).
2026-03-18 11:48:22 -07:00
Kelsi
bf8710d6a4 feat: add Shift+V toggle for friendly player nameplates
V key now toggles enemy/NPC nameplates, while Shift+V independently
toggles friendly player nameplates. Setting is persisted to config.
2026-03-18 11:43:39 -07:00
Kelsi
d6c752fba5 feat: Escape key closes topmost open window before showing menu
Escape now closes UI windows in priority order (vendor, bank, trainer,
who, combat log, social, talents, spellbook, quest log, character,
inventory, world map) before falling through to the escape menu, matching
standard WoW behavior.
2026-03-18 11:35:05 -07:00
Kelsi
f283f9eb86 fix: show equipment durability summary in repair button tooltip
The Repair All button tooltip now shows how many items are damaged or
broken instead of a generic message, helping players gauge repair need.
2026-03-18 11:30:34 -07:00
Kelsi
4a30fdf9f6 feat: add spell icon to nameplate cast bars
Nameplate cast bars now display the spell icon to the left of the bar,
matching the visual treatment of target frame and party cast bars.
2026-03-18 11:29:08 -07:00
Kelsi
0caf945a44 feat: add NumLock auto-run toggle and HUD indicator
NumLock now toggles auto-run alongside the existing tilde key. A cyan
[Auto-Run] indicator appears in the player info area when active.
2026-03-18 11:25:35 -07:00
Kelsi
9368c8a715 feat: add confirmation dialog before spending talent points
Clicking a learnable talent now opens a modal confirmation popup
showing the spell name and rank, preventing accidental talent spending.
2026-03-18 11:23:35 -07:00
Kelsi
ef4cf461a5 feat: add duration countdown and stack count to nameplate debuff dots
Nameplate debuff indicators now show: clock-sweep overlay for elapsed
duration, countdown text below each dot (color-coded red < 5s, yellow
< 15s), stack count badge, and duration in hover tooltip.
2026-03-18 11:21:14 -07:00
Kelsi
d4c7157208 feat: add vendor purchase confirmation for expensive items
Shows a confirmation dialog before buying items costing 1 gold or more,
preventing accidental purchases. Displays item name, quantity, and
total cost in gold/silver/copper.
2026-03-18 11:16:43 -07:00
Kelsi
9b32a328c3 feat: add item stack splitting via Shift+right-click
Implements CMSG_SPLIT_ITEM (0x10E) with a slider popup for choosing
split count. Auto-finds empty destination slot across backpack and bags.
Shift+right-click on stackable items (count > 1) opens split dialog;
non-stackable items still get the destroy confirmation.
2026-03-18 11:07:27 -07:00
Kelsi
17d652947c feat: extend cursor hover to NPCs and players
Hand cursor now shows when hovering over any interactive entity in the
3D world (NPCs, players, game objects), not just game objects. Helps
identify clickable targets at a glance.
2026-03-18 10:56:44 -07:00
Kelsi
1cff1a03a5 feat: add clock display on minimap
Show local time (12-hour AM/PM) at the bottom-right corner of the
minimap with a semi-transparent background.
2026-03-18 10:54:03 -07:00
Kelsi
7f2ee8aa7e fix: add error sound on cast failure and AFK/DND whisper auto-reply
Play UI error sound on SMSG_CAST_FAILED for consistent audio feedback,
matching other error handlers (vendor, inventory, trainer).
Auto-reply to incoming whispers with AFK/DND message when player has
set /afk or /dnd status.
2026-03-18 10:50:42 -07:00
Kelsi
2dc5b21341 feat: add screenshot capture (PrintScreen key and /screenshot command)
Captures the Vulkan swapchain image to PNG via stb_image_write.
Screenshots saved to ~/.wowee/screenshots/ with timestamped filenames.
Cross-platform: BGRA→RGBA swizzle, localtime_r/localtime_s.
2026-03-18 10:47:34 -07:00
Kelsi
a417a00d3a feat: add FPS counter to latency meter
Display color-coded FPS alongside latency at top of screen.
Green >=60, yellow >=30, red <30. Shows FPS even without latency data.
2026-03-18 10:27:25 -07:00
Kelsi
6a0b0a99d1 fix: add /loc to /help command listing 2026-03-18 10:23:42 -07:00
Kelsi
09860e5fc6 feat: add /loc command to show player coordinates
Type /loc, /coords, or /whereami in chat to display current position
(X, Y, Z) and zone name as a system message. Useful for sharing
locations or debugging position issues.
2026-03-18 10:22:39 -07:00
Kelsi
dfddc71ebb docs: update status with nameplate and combat text features 2026-03-18 10:19:25 -07:00
Kelsi
355b75c3c7 feat: add creature type and guild name to focus frame
Show creature type (Beast, Humanoid, etc.) on the focus frame next to
the rank badge, matching the target frame. Also display player guild
names on focus frame for player targets.
2026-03-18 10:14:09 -07:00
Kelsi
c8f80339f1 feat: display creature type on target frame
Show creature classification (Beast, Humanoid, Demon, etc.) next to the
level on the target frame. Useful for knowing which CC abilities apply
(Polymorph → Humanoid/Beast, Banish → Demon/Elemental, etc.).
2026-03-18 10:12:03 -07:00
Kelsi
1ea9334eca feat: enable login screen background music
Re-enable the login screen music system that was previously disabled.
Randomly selects from available tracks in assets/Original Music/ and
plays them at 80% volume during authentication.
2026-03-18 10:08:44 -07:00
Kelsi
402bbc2f14 feat: elite/boss/rare border decorations on nameplates
Add rank-specific outer borders on NPC nameplates: gold for Elite and
Rare Elite, red for Boss, silver for Rare. Provides immediate visual
identification of dangerous mobs without needing to target them.
2026-03-18 10:07:40 -07:00
Kelsi
fd7886f4ce feat: show NPC subtitle on nameplates
Display creature subtitles (e.g. <Reagent Vendor>, <Innkeeper>) below
NPC names on nameplates, mirroring the guild tag display for players.
The subtitle is fetched from the creature info cache populated by
SMSG_CREATURE_QUERY_RESPONSE.
2026-03-18 10:05:49 -07:00
Kelsi
209f60031e feat: respect loot roll voteMask for button visibility
Store the voteMask from SMSG_LOOT_START_ROLL and use it to conditionally
show Need/Greed/Disenchant/Pass buttons. Previously all four buttons were
always shown regardless of the server's allowed roll types.
2026-03-18 10:01:53 -07:00
Kelsi
02a1b5cbf3 fix: show reflected spell name in combat text
SMSG_SPELL_MISS_LOG REFLECT entries include a reflectSpellId field that
was parsed but discarded. Now store it in SpellMissLogEntry and pass it
to addCombatText, so floating combat text shows the actual reflected
spell name instead of the original cast spell.
2026-03-18 09:59:54 -07:00
Kelsi
63b4394e3e feat: world-space floating combat text above entities
Combat text (damage, heals, misses, crits, etc.) now floats above the
target entity in 3D space instead of appearing at fixed screen positions.
Text rises upward from the entity's head, with random horizontal stagger
to prevent stacking. HUD-only types (XP, Honor, Procs) and entries
without a valid entity anchor fall back to the original screen overlay.
2026-03-18 09:54:52 -07:00
Kelsi
6aea48aea9 feat: show guild name on target frame for players
Display <GuildName> below the player name in the target frame,
using the same guild name cache as nameplates.
2026-03-18 09:48:03 -07:00
Kelsi
e572cdfb4a feat: show guild names on player nameplates
Read PLAYER_GUILDID from entity update fields (UNIT_END + 3) and query
guild names via CMSG_GUILD_QUERY. Cache results in guildNameCache_ so
each guild ID is queried only once. Display <Guild Name> in grey below
the player name on nameplates. Fix handleGuildQueryResponse to not
overwrite the local player's guild data when querying other guilds.
2026-03-18 09:44:43 -07:00
Kelsi
003ad8b20c fix: read WotLK periodic damage isCrit byte in SMSG_PERIODICAURALOG
The WotLK periodic damage format includes an isCrit byte after resisted
(21 bytes total, not 20). Missing this byte caused parse misalignment
for multi-effect periodicauralog packets. Also use the already-read
isCrit on periodic heals to display critical HoT ticks distinctly.
2026-03-18 09:17:00 -07:00
Kelsi
8b7786f2b3 feat: display combo points on target frame
Add 5-dot combo point indicator between target power bar and cast bar.
Lit dots are yellow (1-4 CP) or red (5 CP) with glow effect; unlit
dots show as dark outlines. Only visible when the player's combo target
matches the current target.
2026-03-18 09:08:46 -07:00
Kelsi
6d9adc547a fix: extend world-load animation callbacks to handle online players
loadOnlineWorldTerrain re-registers the death/respawn/swing callbacks,
overriding the ones from setupUICallbacks. The world-load versions only
checked creatureInstances_, so the player lookup fix from the previous
commit was silently reverted whenever the world loaded. Now both
registration sites check playerInstances_ as a fallback.
2026-03-18 08:52:00 -07:00
Kelsi
1af5acba3f fix: show real player names on nameplates instead of "Player"
Player class declared its own 'name' member and getName()/setName()
that shadowed the inherited Unit::name. Since getName() is non-virtual,
code using Unit* pointers (nameplates, target frame, entity list) read
Unit::name (always empty) while Player::setName() wrote to the shadowed
Player::name. Removed the redundant declaration so Player inherits
name storage from Unit.
2026-03-18 08:49:16 -07:00
Kelsi
100d66d18b fix: play death/attack animations for online players, not just NPCs
Death, respawn, and melee swing callbacks only checked
creatureInstances_, so online players never played death animation when
killed, never returned to idle on resurrect, and never showed attack
swings. Extended all three callbacks to also check playerInstances_.

Also extended the game_handler death/respawn callback triggers to fire
for PLAYER entities (not just UNIT), and added spawn-time death
detection for players that are already dead when first seen.
2026-03-18 08:43:19 -07:00
Kelsi
e54ed1d46f fix: pass correct offset to setPlayerOnTransport on transport boarding
Both CREATE_OBJECT and MOVEMENT update paths called
setPlayerOnTransport(guid, vec3(0)) then immediately overwrote
playerTransportOffset_ on the next line. This left a one-frame window
where the composed world position used (0,0,0) as the local offset,
causing the player to visually snap to the transport origin. Compute the
canonical offset first and pass it directly.
2026-03-18 08:39:35 -07:00
Kelsi
a619f44dfb fix: add per-frame animation sync for online players
Online players had no animation state machine — once Run started from a
movement packet, it never transitioned back to Stand/Idle. This mirrors
the creature sync loop: position, orientation, and locomotion animation
(Run/Walk/Swim/Fly ↔ Stand/SwimIdle/FlyIdle) are now driven per-frame
based on Entity::isActivelyMoving() state transitions.

Also cleans up creatureRenderPosCache_ on player despawn.
2026-03-18 08:33:45 -07:00
Kelsi
18c06d98ac fix: stop creature run animation when movement interpolation completes
Creatures were stuck in Run/Walk animation during the dead-reckoning
overrun window (up to 2x movement duration). The animation check used
isEntityMoving() which stays true through dead reckoning, causing
creatures to "run in place" after reaching their destination.

Add isActivelyMoving() which is true only during the active
interpolation phase (moveElapsed < moveDuration), and use it for
animation state transitions. Dead reckoning still works for position
extrapolation — only the animation now correctly stops at arrival.
2026-03-18 08:22:50 -07:00
Kelsi
0b33bcbe53 fix: reject oversized MonsterMove spline and fix loot format comment
Change WotLK MonsterMove pointCount > 1000 from cap-to-1000 to return
false. Capping caused the parser to read only 1000 of N points, leaving
the remaining point data unread and misaligning subsequent reads.

Also correct misleading loot response comment: Classic/TBC DO include
randomSuffix and randomPropertyId (22 bytes/item, same as WotLK). The
only WotLK difference is the quest item list appended after regular
items.
2026-03-18 08:18:21 -07:00
Kelsi
64b03ffdf5 fix: add bounds checks to update block and field parsers
Check remaining packet data before reading update type, GUIDs, object
type, and block count in parseUpdateBlock and parseUpdateFields. Prevents
silent garbage reads when the parser reaches the end of a truncated or
misaligned packet.
2026-03-18 08:08:08 -07:00
Kelsi
d1c99b1c0e fix: add bounds checks to WotLK movement block parser
Complete the parser hardening across all expansions. Check remaining
bytes before every conditional read in the WotLK base
UpdateObjectParser::parseMovementBlock: LIVING entry (66-byte minimum),
transport, pitch, fall time, jumping, spline elevation, speeds,
POSITION, STATIONARY, and all tail flags (HAS_TARGET, TRANSPORT,
VEHICLE, ROTATION, LOWGUID, HIGHGUID). Prevents silent garbage reads
when Packet::readUInt8/readFloat return 0 past EOF.
2026-03-18 08:04:00 -07:00
Kelsi
e802decc84 fix: add bounds checks to TBC movement block parser
Same hardening as the Classic and Turtle parsers: check remaining bytes
before every conditional read in TbcPacketParsers::parseMovementBlock.
Change spline pointCount > 256 to return false instead of capping to
zero (which silently consumed wrong bytes for the endPoint).
2026-03-18 08:01:39 -07:00
Kelsi
eca570140a fix: eliminate 8-second teleport freeze on same-map teleport
Replace processAllReadyTiles() with bounded processReadyTiles() in the
same-map teleport and reconnect paths. processAllReadyTiles finalizes
every pending tile synchronously with a GPU sync wait, which caused
8+ second main-thread stalls when many tiles were queued. The bounded
version processes 1-4 tiles per call with async GPU upload — remaining
tiles finalize incrementally over subsequent frames.
2026-03-18 07:54:05 -07:00
Kelsi
14cd6c82b2 fix: add bounds checks to Classic movement block parser
Mirror the Turtle parser hardening: check remaining bytes before every
conditional read in ClassicPacketParsers::parseMovementBlock. Prevents
silent garbage reads (readUInt8 returns 0 past EOF) that corrupt
subsequent update fields and lose NPC data in multi-block packets.
2026-03-18 07:47:46 -07:00
Kelsi
0a04a00234 fix: harden Turtle movement block parser with bounds checks
The Turtle parseMovementBlock had no bounds checking on any reads.
Since Packet::readUInt8() returns 0 past the end without failing, the
parser could "succeed" with all-zero garbage data, then subsequent
parseUpdateFields would read from wrong positions, producing
"truncated field value" and "truncated update mask" errors.

Added bounds checks before every conditional read section (transport,
swimming pitch, fall time, jumping, spline elevation, speeds, spline
data, tail flags). Also removed the WotLK movement block fallback from
the Turtle parser chain — WotLK format is fundamentally incompatible
(uint16 flags, 9 speeds) and false-positive parses corrupt NPC data.
Also changed spline pointCount > 256 from cap-to-zero to return false
so the parser correctly fails instead of silently dropping waypoints.
2026-03-18 07:39:40 -07:00
Kelsi
ce3caf0438 fix: auto-detect Classic vs WotLK spline format in UPDATE_OBJECT
The spline parser assumed WotLK format (durationMod, durationModNext,
conditional PARABOLIC fields) for all expansions. Classic/Turtle has a
simpler layout: timePassed+duration+splineId+pointCount directly.
Reading WotLK-specific fields from Classic data consumed wrong bytes,
causing pointCount to read garbage and the entire update block to fail
— losing dozens of NPC spawns in multi-block packets.

Now tries Classic format first (pointCount at offset 12), then WotLK
(offset 20+), then compact fallback. Also fixes WotLK SMSG_SPELL_GO
hit/miss targets to use full uint64 GUIDs instead of PackedGuid, which
was the root cause of garbage missCount values (46, 64, 241).
2026-03-18 07:23:51 -07:00
Kelsi
6484dfc32d fix: gate spline verticalAccel/effectStartTime on PARABOLIC flag
The legacy UPDATE_OBJECT spline path was reading verticalAccel (float)
and effectStartTime (uint32) unconditionally, but these 8 bytes are
only present when SPLINEFLAG_PARABOLIC (0x00000800) is set. Without
the flag, the extra reads shifted the stream by 8 bytes, causing
pointCount to read garbage (e.g. 3323328650) and failing the entire
update block parse.
2026-03-18 07:05:17 -07:00
Kelsi
f78d885e13 fix: add 60-second grace period to M2 model cleanup
Models that lose all instances are no longer immediately evicted from
GPU memory. Instead they get a 60-second grace period, preventing the
thrash cycle where GO models (barrels, chests, herbs) were evicted
every 5 seconds and re-loaded when the same object type respawned.
2026-03-18 07:00:50 -07:00
Kelsi
3c60ef8464 fix: add hex dump diagnostics to spell-go missCount parsing
When SMSG_SPELL_GO reads a suspiciously high missCount (>20), log
the surrounding packet bytes, castFlags, and position for debugging
the persistent offset error causing garbage miss counts (46, 48, 241).
2026-03-18 06:57:15 -07:00
Kelsi
c8922e4826 fix: stop player movement before game object interaction
Servers may reject CMSG_GAMEOBJ_USE or cancel the resulting pickup
spell cast if movement flags are still active. Now sends MSG_MOVE_STOP
to clear directional movement before the interaction packet. Also adds
diagnostic logging for GO interactions to help trace collection issues.
2026-03-18 06:49:43 -07:00
Kelsi
f8f514d28c fix: add $C (class) and $R (race) quest text placeholders
Quest dialogs were showing literal "$C" instead of the player's class
name. Added support for $c/$C (class) and $r/$R (race) placeholders
in both game_screen and quest_log_screen substitution functions.
2026-03-18 06:49:37 -07:00
Kelsi
e0346c85df fix: salvage spell-go hit data when miss targets are truncated
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
SMSG_SPELL_GO packets with unreasonably high miss counts (48, 118, 241)
were causing the entire packet to be discarded, losing all combat hit
data. Now salvage the successfully-parsed hit targets (needed for combat
text, health bars, animations) instead of discarding everything. Also
add spellId/hitCount to truncation warnings for easier diagnosis.
2026-03-18 06:23:03 -07:00
Kelsi
379ca116d1 fix: eliminate full spatial index rebuild on M2 instance removal
M2Renderer::removeInstance() was calling rebuildSpatialIndex() for every
single removal, causing 25-90ms frame hitches during entity despawns.
Now uses O(1) lookup via instanceIndexById, incremental spatial grid
cell removal, and swap-remove from the instance vector. The auxiliary
index vectors are rebuilt cheaply since they're small.
2026-03-18 06:20:24 -07:00
Kelsi
702155ff4f fix: correct SMSG_SPELL_GO REFLECT miss payload size (WotLK/TBC)
WotLK and TBC parsers were reading uint32+uint8 (5 bytes) for
SPELL_MISS_REFLECT entries, but the server only sends uint8
reflectResult (1 byte). This caused a 4-byte misalignment after every
reflected spell, corrupting subsequent miss entries and SpellCastTargets
parsing. Classic parser was already correct.
2026-03-18 06:20:18 -07:00
Kelsi
25138b5648 fix: use CMSG_OPEN_ITEM for locked containers (lockboxes)
Right-clicking a locked container (e.g. Dead-Tooth's Strong Box) was
sending CMSG_USE_ITEM with spellId=0, which the server rejects. Locked
containers (itemClass==1, inventoryType==0) now send CMSG_OPEN_ITEM
instead, letting the server auto-check the keyring for the required key.
2026-03-18 06:06:29 -07:00
Kelsi
2fb7901cca feat: enable water refraction by default
The VK_ERROR_DEVICE_LOST crash on AMD/Mali GPUs (barrier srcAccessMask)
was fixed in 2026-03-18. Enable refraction for new sessions so players
get the improved water visuals without needing to touch Settings.
Existing saved configs that explicitly disabled it are preserved.
2026-03-18 05:44:59 -07:00
Kelsi
fabcde42a5 fix: clarify death dialog — auto-release label and resurrection hint
'Release in X:XX' implied a client-enforced forced release; renamed to
'Auto-release in X:XX' (server-driven) and added 'Or wait for a player
to resurrect you.' hint so players know they can stay dead without
clicking Release Spirit.
2026-03-18 05:39:42 -07:00
Kelsi
90843ea989 fix: don't set releasedSpirit_ optimistically in releaseSpirit()
Setting releasedSpirit_=true immediately on CMSG_REPOP_REQUEST raced
with PLAYER_FLAGS field updates that arrive from the server before it
processes the repop: the PLAYER_FLAGS handler saw wasGhost=true /
nowGhost=false and fired the 'ghost cleared' path, wiping corpseMapId_
and corpseGuid_ — so the minimap skull marker and the Resurrect from
Corpse dialog never appeared.

Ghost state is now driven entirely by the server-confirmed PLAYER_FLAGS
GHOST bit (and the login-as-ghost path), eliminating the race.
2026-03-18 05:35:23 -07:00
Kelsi
d0f544395e feat: add mounted/group/channeling/casting/vehicle macro conditionals
Extends evaluateMacroConditionals() with [mounted], [nomounted],
[group], [nogroup], [raid], [channeling], [nochanneling],
[channeling:SpellName], [casting], [nocasting], [vehicle], [novehicle].
2026-03-18 05:23:32 -07:00
Kelsi
4e13a344e8 feat: add buff:/nobuff:/debuff:/nodebuff: macro conditionals
Macro conditions now support checking aura presence:
  [buff:Power Word: Fortitude]  — player has the named buff
  [nobuff:Frost Armor]          — player does NOT have the named buff
  [debuff:Faerie Fire]          — target has the named debuff
  [nodebuff:Hunter's Mark]      — target does NOT have the named debuff

Name matching is case-insensitive. When a target override (@target etc.)
is active the check uses that unit's aura list instead of the player's.
2026-03-18 05:20:15 -07:00
Kelsi
a802e05091 feat: add /mark slash command for setting raid target icons
Adds /mark [icon], /marktarget, and /raidtarget slash commands that
set a raid mark on the current target. Accepts icon names (star,
circle, diamond, triangle, moon, square, cross, skull), numbers 1-8,
or "clear"/"none" to remove the mark. Defaults to skull when no
argument is given.
2026-03-18 05:16:14 -07:00
Kelsi
e7fe35c1f9 feat: add right-click pet spell autocast toggle via CMSG_PET_SPELL_AUTOCAST
Right-clicking a castable pet ability (actionId > 6) in the pet action
bar now sends CMSG_PET_SPELL_AUTOCAST to toggle the spell's autocast
state. The local petAutocastSpells_ set is updated optimistically and
the tooltip shows the current state with a right-click hint.
2026-03-18 05:08:10 -07:00
Kelsi
586408516b fix: correct character geoset group ranges for other-player equipment rendering
setOnlinePlayerEquipment used wrong geoset ID ranges for boots (402+ instead
of 501+), gloves (301+ instead of 401+), and chest/sleeves (501+ instead of
801+), and was missing bare-shin (502), bare-wrist (801), and bare-leg (1301)
defaults. This caused other players to render with missing shin/wrist geometry
and wrong geosets when wearing equipment (the "shin mesh" gap in status.md).

Now mirrors the CharacterPreview::applyEquipment logic exactly:
- Group 4 (4xx) forearms/gloves: default 401, equipment 401+gg
- Group 5 (5xx) shins/boots:    default 502, equipment 501+gg
- Group 8 (8xx) wrists/sleeves: default 801, equipment 801+gg
- Group 13 (13xx) legs/pants:   default 1301, equipment 1301+gg
2026-03-18 04:42:21 -07:00
Kelsi
5f3bc79653 feat: show queued spell icon in cast bar and expose getQueuedSpellId()
When a spell is queued in the 400ms window before the current cast ends,
render its icon dimmed (0.8 alpha) to the right of the cast bar progress,
with a "Queued: <name>" tooltip. The progress bar shrinks to accommodate
the icon when one is present.

Also exposes getQueuedSpellId() as a public const accessor on GameHandler
so the UI can observe the spell queue state without friend access.
2026-03-18 04:34:36 -07:00
Kelsi
277a26b351 feat: flash action bar button red when spell cast fails
Add SpellCastFailedCallback to GameHandler, fired from SMSG_CAST_RESULT
when result != 0. GameScreen registers the callback and records each failed
spellId in actionFlashEndTimes_ (keyed by spell ID, value = expiry time).

During action bar rendering, if a slot's spell has an active flash entry,
an AddRectFilled overlay is drawn over the button with alpha proportional
to remaining time (1.0→0.0 over 0.5 s), giving the same error-red flash
visual feedback as the original WoW client.
2026-03-18 04:30:33 -07:00
Kelsi
c1765b6b39 fix: defer loot item notification until item name is known from server query
When SMSG_ITEM_PUSH_RESULT arrives for an item not yet in the cache, store
a PendingItemPushNotif and fire the 'Received: [item]' chat message only
after SMSG_ITEM_QUERY_SINGLE_RESPONSE resolves the name and quality, so the
notification always shows a proper item link instead of 'item #12345'.

Notifications that are already cached emit immediately as before; multiple
pending notifs for the same item are all flushed on the single response.
2026-03-18 04:25:37 -07:00
Kelsi
09b0bea981 feat: add /stopmacro support and low durability warning for equipped items
- /stopmacro [conditions] halts remaining macro commands; supports all existing
  macro conditionals ([combat], [nocombat], [mod:shift], etc.) via the sentinel
  action trick on evaluateMacroConditionals
- macroStopped_ flag in GameScreen; executeMacroText resets and checks it after
  each command so /stopmacro mid-macro skips all subsequent lines
- Emit a "X is about to break!" UI error + system chat when an equipped item's
  durability drops below 20% via SMSG_UPDATE_OBJECT field delta; warning fires
  once per threshold crossing (prevDur >= maxDur/5, newDur < maxDur/5)
2026-03-18 04:14:44 -07:00
Kelsi
d7c377292e feat: show socket gems and consolidate enchant name DBC cache in item tooltips
Extends OnlineItemInfo to track gem enchant IDs (socket slots 2-4) from item
update fields; socket display now shows inserted gem name inline (e.g.
"Red Socket: Bold Scarlet Ruby"). Consolidates redundant SpellItemEnchantment
DBC loads into one shared static per tooltip variant.
2026-03-18 04:04:23 -07:00
Kelsi
167e710f92 feat: add /equipset macro command for saved equipment set switching
/equipset <name> equips a saved set by case-insensitive prefix match;
/equipset with no argument lists available sets in chat.
2026-03-18 03:53:59 -07:00
Kelsi
1fd3d5fdc8 feat: display permanent and temporary enchants in item tooltips for equipped items
Tracks ITEM_ENCHANTMENT_SLOT 0 (permanent) and 1 (temporary) from item update
fields in OnlineItemInfo, then looks up names from SpellItemEnchantment.dbc and
renders them in both ItemDef and ItemQueryResponseData tooltip variants.
2026-03-18 03:50:24 -07:00
Kelsi
4025e6576c feat: implement /castsequence macro command
Supports: /castsequence [conds] [reset=N/target/combat] Spell1, Spell2, ...
Cycles through the spell list on successive button presses. State is keyed
by spell list so the same sequence shared across macros stays in sync.
2026-03-18 03:36:05 -07:00
Kelsi
df7150503b feat: /assist now accepts name and macro conditional arguments
/assist TankName targets whoever TankName is targeting; /assist [target=focus]
assists your focus target. Mirrors /target and /focus conditional support.
2026-03-18 03:31:40 -07:00
Kelsi
5d4b0b0f04 feat: show target-of-focus with health bar in focus frame
Healers and tanks can now see who their focus target is targeting,
with a compact percentage health bar — mirrors the ToT in the target frame.
2026-03-18 03:29:48 -07:00
Kelsi
a151531a2a feat: show health bar on target-of-target in target frame
The ToT health bar gives healers immediate % health readout of whoever
the target is attacking, without needing to click-through to that unit.
2026-03-18 03:28:06 -07:00
Kelsi
11c07f19cb feat: add macro conditional support to /cleartarget and /startattack
/cleartarget [dead] now clears target only when it meets conditions;
/startattack [harm,nodead] respects conditionals including target=mouseover.
2026-03-18 03:25:34 -07:00
Kelsi
6cd3c613ef feat: add macro conditional support to /target and /focus commands
/target [target=mouseover], /target [mod:shift] BossName; DefaultMob,
/focus [target=mouseover], and /focus PlayerName all now evaluate WoW
macro conditionals and resolve named/mouseover targets correctly.
2026-03-18 03:21:27 -07:00
Kelsi
e2a484256c feat: show spell icon on macro buttons via #showtooltip directive
- getMacroShowtooltipArg() parses the #showtooltip [SpellName] directive
- Action bar macro buttons now display the named spell's icon when
  #showtooltip SpellName is present at the top of the macro body
- For bare #showtooltip (no argument), derives the icon from the first
  /cast line in the macro (stripping conditionals and rank suffixes)
- Falls back to "Macro" text label only when no spell can be resolved
2026-03-18 03:16:05 -07:00
Kelsi
28d7d3ec00 feat: track mouseover on party frames; fix /cast !spell; update macro editor hint 2026-03-18 03:11:34 -07:00
Kelsi
7967bfdcb1 feat: implement [target=mouseover] macro conditional via nameplate/raid hover
- Adds mouseoverGuid_ to GameHandler (set/cleared each frame by UI)
- renderNameplates() sets mouseoverGuid when the cursor is inside a
  nameplate's hit region; resets to 0 at frame start
- Raid frame cells set mouseoverGuid while hovered (IsItemHovered)
- evaluateMacroConditionals() resolves @mouseover / target=mouseover to
  the hover GUID; returns false (skip alternative) when no unit is hovered

This enables common healer macros like:
  /cast [target=mouseover,help,nodead] Renew; Renew
2026-03-18 03:09:43 -07:00
Kelsi
d2b2a25393 feat: extend macro conditionals to /use command 2026-03-18 03:06:23 -07:00
Kelsi
30513d0f06 feat: implement WoW macro conditional evaluator for /cast
Adds evaluateMacroConditionals() which parses the [cond1,cond2] Spell;
[cond3] Spell2; Default syntax and returns the first matching
alternative. Supported conditions:

- mod:shift/ctrl/alt, nomod  — keyboard modifier state
- target=player/focus/target, @player/@focus/@target — target override
- help / harm (noharm / nohelp)  — target faction check
- dead / nodead                  — target health check
- exists / noexists              — target presence check
- combat / nocombat              — player combat state
- noform / nostance / form:0     — shapeshift/stance state
- Unknown conditions are permissive (true) to avoid false negatives.

/cast now resolves conditionals before spell lookup and routes
castSpell() to the [target=X] override GUID when specified.
isHostileFaction() exposed as isHostileFactionPublic() for UI use.
2026-03-18 03:04:45 -07:00
Kelsi
ed3bca3d17 fix: escape newlines in macro cfg persistence; execute all macro lines
- Macro text is now escaped (\\n, \\\\) on save and unescaped on load,
  fixing multiline macros silently truncating after the first line in
  the character config file.
- executeMacroText() runs every non-comment line of a macro body in
  sequence (WoW behaviour), replacing the firstMacroCommand() approach
  that only fired the first actionable line. The server still enforces
  one spell-cast per click; non-cast commands (target, equip, pet, etc.)
  now all execute correctly in the same macro activation.
2026-03-18 02:44:28 -07:00
Kelsi
c676d99fc2 feat: add /petattack, /petfollow, /petstay, /petpassive, /petaggressive macro commands
Adds the standard WoW pet control slash commands used in macros:
- /petattack     — attack current target
- /petfollow     — follow player
- /petstay / /pethalt — stop and hold position
- /petpassive    — set passive react mode
- /petdefensive  — set defensive react mode
- /petaggressive — set aggressive react mode
- /petdismiss    — dismiss the pet

All commands also appear in Tab-autocomplete.
2026-03-18 02:32:49 -07:00
Kelsi
ae3e57ac3b feat: add /cancelform, /cancelshapeshift, /cancelaura slash commands
These are standard WoW macro commands:

- /cancelform / /cancelshapeshift: exits current shapeshift form by
  cancelling the first permanent aura (flag 0x20) on the player
- /cancelaura <name|#id>: cancels a specific player buff by spell name
  or numeric ID (e.g. /cancelaura Stealth, /cancelaura #1784)

Also expand the Tab-autocomplete command list to include /cancelaura,
/cancelform, /cancelshapeshift, /dismount, /sit, /stand, /startattack,
/stopcasting, /target, and other commands that were previously missing.
2026-03-18 02:30:35 -07:00
Kelsi
c3be43de58 fix: skip #showtooltip and other # directives when executing macros
Macros often start with a #showtooltip or #show directive line; these
should not be executed as chat commands.  The firstMacroCommand() helper
now scans forward through the macro text, skipping blank lines and any
line starting with '#', and executes the first actual command line.

Applies to all three execution paths: left-click, keyboard shortcut,
and right-click Execute menu item.
2026-03-18 02:27:34 -07:00
Kelsi
db0f868549 feat: extend /use command to support bag/slot notation and equip slot numbers
Adds WoW macro-standard /use argument forms alongside the existing
item-name search:

- /use 0 <slot>   — backpack slot N (1-based, bag 0)
- /use 1-4 <slot> — equipped bag slot N (1-based bag index)
- /use <N>        — equip slot N (1-based, e.g. /use 16 = main hand)

These are the standard forms used in macros like:
  #showtooltip
  /use 13          (trinket 1)
  /cast Arcane Blast
2026-03-18 02:23:47 -07:00
Kelsi
b236a85454 docs: update status.md — water refraction fix, date 2026-03-18 2026-03-18 02:20:59 -07:00
Kelsi
fa3a5ec67e fix: correct water refraction barrier srcAccessMask to prevent VK_ERROR_DEVICE_LOST
The captureSceneHistory barrier was using srcAccessMask=0 with
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT when transitioning the swapchain
image from PRESENT_SRC_KHR to TRANSFER_SRC_OPTIMAL.  This does not
flush the GPU's color attachment write caches, causing VK_ERROR_DEVICE_LOST
on strict drivers (AMD, Mali) that require explicit cache invalidation
before transfer reads.

Fix: use VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT + COLOR_ATTACHMENT_OUTPUT
as the source mask so color writes are properly made visible to the
transfer unit before the image copy begins.

Also remove the now-unnecessary "requires FSR" restriction in the
settings UI — water refraction can be enabled independently of FSR.
2026-03-18 02:20:35 -07:00
Kelsi
8abb65a813 feat: execute macros via keyboard shortcuts; support numeric /cast spell IDs
Two companion improvements for the macro system:

- Keyboard shortcut handler now executes MACRO slots (1-0 keys) by running
  the first line of their text as a command, same as left-click
- /cast now accepts a numeric spell ID or #ID prefix (e.g. /cast 133,
  /cast #133) in addition to spell names — enables standard WoW macro
  syntax and direct spell ID testing
2026-03-18 02:14:10 -07:00
Kelsi
2c86fb4fa6 feat: implement client-side macro text storage and execution
Macros in WoW are client-side — the server sends only a macro index via
SMSG_ACTION_BUTTONS, never the text. This commit adds local storage and
a UI so macro slots are actually usable.

- GameHandler: getMacroText/setMacroText accessors backed by macros_ map;
  text is persisted to the character .cfg file as macro_N_text= entries
- Action bar left-click: MACRO slot executes first line of macro text as
  a chat/slash command (same path as /cast, /use, etc.)
- Context menu: "Execute" and "Edit" items for MACRO slots; "Edit" opens
  a multiline modal editor (320×80 px, up to 255 chars) with Save/Cancel
- Tooltip: shows macro text body below the index; hints "right-click to
  Edit" when no text is set yet
2026-03-18 02:07:59 -07:00
Kelsi
1588c1029a fix: add user feedback for ATTACKSWING_NOTSTANDING and CANT_ATTACK
Both handlers silently cleared state with no visible message, leaving the
player unsure why their attack failed.  Split the shared case block:

- NOTSTANDING: show "You need to stand up to fight." (rate-limited to 1.25s
  via the existing autoAttackRangeWarnCooldown_ guard), keep auto-attack
  active so it fires once the player stands.

- CANT_ATTACK: call stopAutoAttack() to end the attack loop (target is a
  critter, civilian, or already dead — no point retrying), then show "You
  can't attack that." with the same rate limiter.
2026-03-18 01:46:19 -07:00
Kelsi
36158ae3e3 fix: show macro ID in action bar tooltip and context menu header
Macro slots stored from SMSG_ACTION_BUTTONS had no tooltip and no context
menu header — hovering or right-clicking gave a blank result.  Add an
"else if MACRO" branch to both the tooltip and the popup-context-item so
that "Macro #N" is displayed in both places.  Clearing via right-click
still works via the existing "Clear Slot" item which was already outside
the type branches.
2026-03-18 01:42:07 -07:00
Kelsi
7a0c7241ba fix: parse macro action bar slots from SMSG_ACTION_BUTTONS
Macro slots (type 0x40 / 64) were silently dropped by the default branch
of the SMSG_ACTION_BUTTONS type switch, leaving the bar empty for any slot
a player had set to a macro.  ActionBarSlot::MACRO already existed and the
UI already rendered it; only the parser was missing the case.  Add
case 0x40 to map to ActionBarSlot::MACRO for Classic (type=64), TBC, and
WotLK formats, which all share the same 0x40 encoding for macros.
2026-03-18 01:35:39 -07:00
Kelsi
5801af41bc fix: correct Turtle WoW SMSG_INIT_WORLD_STATES format and remove dead minRepeatMs branch
Turtle WoW is Classic 1.12-based and uses the Classic packet format for
SMSG_INIT_WORLD_STATES (no areaId uint32 field before count), not WotLK
format.  Including it in the WotLK branch caused the parser to consume 4
bytes of the count+first-key as a phantom areaId, misaligning all world
state key/value pairs (BG scores, zone events, flag states).

Also remove the dead `turtleMode ? 150 : 150` branch in
performGameObjectInteractionNow — both arms were identical so the ternary
had no effect; replace with a constexpr constant.
2026-03-18 01:30:20 -07:00
Kelsi
57b44d2347 fix: clear craft queue on spell failure and all cast reset paths
craftQueueSpellId_ and craftQueueRemaining_ were already cleared in
cancelCast(), stopCasting(), and SMSG_CAST_RESULT failure, but were
missing from five other cast-abort paths:

- SMSG_SPELL_FAILURE (mid-cast interrupt): queue persisted after
  combat interruption, risking a ghost re-cast on the next SMSG_SPELL_GO
- handleCastFailed() (SMSG_CAST_FAILED): queue persisted if the server
  rejected a craft before it started
- Player login state reset: leftover queue from prior session survived
  into the new world session
- Same-map resurrection (SMSG_NEW_WORLD): queue persisted through
  spirit-healer resurrection teleport
- Regular world transfer (SMSG_NEW_WORLD): queue persisted across zone
  changes and dungeon portals
2026-03-18 01:15:04 -07:00
Kelsi
6be695078b fix: clear spell queue in stopCasting; fix SMSG_SPELL_DELAYED castTimeTotal; clear cast on same-map res
- stopCasting() (invoked by /stopcasting) now clears queuedSpellId_/
  queuedSpellTarget_ and craftQueueSpellId_/craftQueueRemaining_ so a
  queued spell cannot fire silently after the player explicitly cancels.
- SMSG_SPELL_DELAYED now extends castTimeTotal alongside castTimeRemaining
  for the local player, matching the existing other-unit handling and
  keeping the cast bar progress percentage accurate after server-imposed
  cast delays.
- Same-map resurrection path (SMSG_NEW_WORLD same-map) now resets casting,
  castIsChannel, currentCastSpellId, castTimeRemaining, and the spell queue
  as a defensive measure (player is dead and cannot be casting, but this
  ensures state is clean on respawn).
2026-03-18 00:59:15 -07:00
Kelsi
76ba428b87 fix: /target command selects nearest matching entity
Previously used arbitrary map-iteration order (last match), meaning
'/target Kobold' might target a far-away enemy instead of the closest.

Now computes squared distance for every prefix-matching entity and
keeps the nearest one, matching WoW's own /target behaviour.
2026-03-18 00:39:32 -07:00
Kelsi
60d5edf97f fix: cancel timed cast immediately on movement start
When the player starts moving (forward/backward/strafe/jump) while a
timed non-channeled cast is in progress, call cancelCast() before
sending the movement packet.  Previously the cast bar kept counting
down until the server sent SMSG_SPELL_FAILED, causing a visible lag.

Channeled spells are excluded (server ends those via MSG_CHANNEL_UPDATE).
Turning opcodes are excluded (turning while casting is allowed in WoW).
2026-03-18 00:25:04 -07:00
Kelsi
4907f4124b feat: implement spell queue window (400ms pre-cast)
When castSpell() is called while a timed cast is in progress and
castTimeRemaining <= 0.4s, store the spell in queuedSpellId_ instead
of silently dropping it.  handleSpellGo() fires the queued spell
immediately after clearing the cast state, matching the ~400ms spell
queue window in Blizzlike WoW clients.

Queue is cleared on all cancel/interrupt paths: cancelCast(),
handleCastFailed(), SMSG_CAST_RESULT failure, SMSG_SPELL_FAILED,
world-teardown, and worldport ACK.  Channeled casts never queue
(cancelling a channel should remain explicit).
2026-03-18 00:21:46 -07:00
Kelsi
0f8852d290 fix: clear selfResAvailable_ when player releases spirit 2026-03-18 00:09:22 -07:00
Kelsi
5a5c2dcda3 feat: implement self-resurrection (Reincarnation/Twisting Nether)
SMSG_PRE_RESURRECT was silently discarded; Shamans with Reincarnation
and Warlocks with Twisting Nether could never see or use the self-res
ability. Now:

- SMSG_PRE_RESURRECT sets selfResAvailable_ flag when addressed to the
  local player
- Death dialog gains a "Use Self-Resurrection" button (blue, shown above
  Release Spirit) when the flag is set
- Clicking it sends CMSG_SELF_RES (empty body) and clears the flag
- selfResAvailable_ is cleared on all resurrection and session-reset
  paths so it never bleeds across deaths or logins
2026-03-18 00:06:39 -07:00
Kelsi
395a8f77c4 fix: clear corpse reclaim delay on world reset and resurrection
Reset corpseReclaimAvailableMs_ to 0 in both world-teardown/re-login
and ghost-flag-cleared paths so the PvP delay countdown never bleeds
into subsequent deaths or sessions.
2026-03-17 23:57:47 -07:00
Kelsi
b0046fa777 feat: track PvP corpse-reclaim delay and show countdown in UI
SMSG_CORPSE_RECLAIM_DELAY is now stored as an absolute expiry timestamp
(steady_clock ms) instead of being discarded after a chat message.

GameHandler::getCorpseReclaimDelaySec() returns remaining seconds (0 when
reclaim is available). The "Resurrect from Corpse" button now:
- Disables and shows the remaining seconds when a PvP delay is active
- Shows the usual "Corpse: N yards" helper text when available
Also resets corpseReclaimAvailableMs_ on world/session teardown.
2026-03-17 23:52:45 -07:00
Kelsi
2acab47eee fix: correct corpse reclaim — SMSG_DEATH_RELEASE_LOC is graveyard, not corpse
Two bugs prevented "Resurrect from Corpse" from working:

1. SMSG_DEATH_RELEASE_LOC was overwriting corpseX_/Y_/Z_/MapId_ with the
   graveyard spawn point (where the ghost appears after releasing spirit),
   not the actual corpse location.  canReclaimCorpse() was therefore comparing
   the ghost's distance to the graveyard instead of the real corpse, so the
   button never appeared when the ghost returned to the death position.
   Fix: read and log the packet but leave corpseX_/Y_/Z_ untouched.

2. reclaimCorpse() fell back to playerGuid when corpseGuid_ == 0.
   CMSG_RECLAIM_CORPSE requires the corpse object's own GUID; the server
   looks it up by GUID and silently rejects an unknown one.
   Fix: gate reclaimCorpse() on corpseGuid_ being known (set when the
   corpse object arrives in SMSG_UPDATE_OBJECT), and add canReclaimCorpse()
   guard for the same.

Corpse position is now sourced only from:
  - Health-drop detection (primary, fires immediately on death)
  - SMSG_UPDATE_OBJECT CORPSE type (updates when object enters view range)
2026-03-17 23:44:55 -07:00
Kelsi
d99fe8de0f feat: add Sort Bags button to backpack window
Adds Inventory::sortBags() which collects all items from the backpack
and equip bags, sorts them client-side by quality descending → item ID
ascending → stack count descending, then writes them back. A "Sort Bags"
SmallButton is rendered in the backpack footer with a tooltip explaining
the sort order.

The sort is purely local (no server packets) since the WoW protocol has
no sort-bags opcode; it provides an instant, session-persistent visual
reorder.
2026-03-17 23:29:50 -07:00
Kelsi
3e3bbf915e fix: parse SMSG_TRADE_STATUS_EXTENDED correctly for Classic/TBC
WotLK inserts a uint32 tradeId between isSelf and slotCount, and
appends uint32 createPlayedTime at the end of each slot (52-byte
trail vs 48 for Classic/TBC). Without the expansion check, Classic
and TBC parsers consumed tradeId as part of slotCount, resulting in
a bogus slot count and corrupted trade window item display.

Now gates the tradeId read and adjusts SLOT_TRAIL size based on
isActiveExpansion("wotlk").
2026-03-17 22:42:20 -07:00
Kelsi
87cb293297 fix: consume SpellCastTargets bytes after miss list in Classic/TBC SpellGo
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Added skipClassicSpellCastTargets() and skipTbcSpellCastTargets() calls
in parseSpellGo() for both expansions, matching the same fix applied to
WotLK SpellGoParser and both SpellStartParsers. Prevents packet stream
misalignment for ground-targeted and AoE spells (Blizzard, Rain of
Fire, Flamestrike, etc.) where the server appends DEST_LOCATION or
other target fields after the hit/miss lists.
2026-03-17 22:29:02 -07:00
Kelsi
6f936f258f fix: consume all SpellCastTargets bytes in WotLK SpellGoParser
Applied the same SpellCastTargets fix from SpellStartParser (dd64724)
to SpellGoParser: after parsing hit/miss target lists, now reads the
full target section (UNIT/UNIT_MINIPET/CORPSE/GAMEOBJECT packed GUID,
ITEM/TRADE_ITEM packed GUID, SOURCE/DEST PackedGuid+3floats, null-
terminated STRING). Also adds targetGuid field to SpellGoData so
callers can read the primary target. Prevents stream misalignment on
ground-targeted AoE spells (e.g. Blizzard, Rain of Fire).
2026-03-17 22:26:05 -07:00
Kelsi
dd64724dbb fix: consume all SpellCastTargets bytes in WotLK SpellStartParser
Replaced partial UNIT/OBJECT-only flag handling with full WotLK
SpellCastTargets layout: UNIT/UNIT_MINIPET/CORPSE/GAMEOBJECT share
one PackedGuid, ITEM/TRADE_ITEM share one PackedGuid, SOURCE_LOCATION
and DEST_LOCATION are each PackedGuid+3floats (transport-relative),
STRING is null-terminated. Prevents byte-stream corruption on
ground-targeted AoE and similar multi-field target packets.
2026-03-17 22:20:03 -07:00
Kelsi
a4415eb207 fix: clamp pointCount in handleMonsterMoveTransport to prevent DoS
handleMonsterMoveTransport() read a server-supplied pointCount without
any bounds check before iterating. A malformed packet with
pointCount=0xFFFFFFFF would loop billions of times. All other parsers
(MonsterMoveParser::parse, TBC parseMonsterMove) cap at 1000 or 16384.

Added kMaxTransportSplinePoints=1000 cap with a LOG_WARNING, matching
the limit used by MonsterMoveParser::parse() in world_packets.cpp.
2026-03-17 22:08:25 -07:00
Kelsi
b00025918c feat: draw player facing arrow at minimap center
The minimap had a comment "skip self (already drawn as arrow)" but no
code that actually drew the arrow. Players had no visual indication of
which direction they were facing on the minimap.

Draws a chevron-shaped white/gold arrow at the minimap center:
- On fixed-north minimap: arrow rotates to match camera compass bearing
  (computed from camera forward vector: atan2(-fwd.x, fwd.y))
- On rotating minimap: arrow points straight up because the minimap
  already rotates to put camera-forward at the top
- Style: two filled triangles (tip+left half, tip+right half) with dark
  outline for readability against all map backgrounds
- Rendered last so it sits on top of all other minimap markers
2026-03-17 22:05:24 -07:00
Kelsi
c870460dea fix: wire Warden module tick, generateRC4Keys, and unload callbacks
The funcList_ dispatchers were populated by initializeModule() but the
public tick(), generateRC4Keys(), and unload() methods had their actual
call sites commented out as TODOs.

- tick(): now calls funcList_.tick(deltaMs) so the emulated module can
  run its internal periodic scheduler.
- generateRC4Keys(): now calls funcList_.generateRC4Keys(packet) so
  the Warden crypto stream is re-keyed as the module expects.
- unload(): now calls funcList_.unload(nullptr) before freeing module
  memory, allowing the module to clean up its own state.

All three paths already guard on !loaded_ || !funcList_.<fn> so they
are no-ops when the module is not loaded or Unicorn is unavailable.
2026-03-17 22:00:06 -07:00
Kelsi
32497552d1 fix: R key resets camera angles only; consume all SpellCastTargets bytes
- CameraController::resetAngles(): new method that only resets yaw/pitch
  without teleporting the player. R key now calls resetAngles() instead
  of reset() so pressing R no longer moves the character to spawn.
  The full reset() (position + angles) is still used on world-entry and
  respawn via application.cpp.

- packet_parsers_classic: parseSpellStart now calls
  skipClassicSpellCastTargets() to consume all target payload bytes
  (UNIT, ITEM, SOURCE_LOCATION, DEST_LOCATION, etc.) instead of only
  handling UNIT/OBJECT. Prevents packet-read corruption for ground-
  targeted AoE spells.

- packet_parsers_tbc: added skipTbcSpellCastTargets() static helper
  (uint32 targetFlags, full payload coverage including TRADE_ITEM and
  STRING targets). parseSpellStart now uses it.
2026-03-17 21:52:45 -07:00
Kelsi
a731223e47 fix: right-clicking a quest-starting item now opens the quest offer dialog
Items with startQuestId != 0 were calling useItemBySlot()/useItemInBag()
which sends CMSG_USE_ITEM — but quest-starting items have no on-use spell,
so the server silently ignored the packet and no quest dialog appeared.

Fix:
- offerQuestFromItem(itemGuid, questId): sends CMSG_QUESTGIVER_QUERY_QUEST
  with the item's own GUID as the questgiver GUID. The server responds with
  SMSG_QUESTGIVER_QUEST_DETAILS which handleQuestDetails() already picks up
  and opens the Accept/Decline dialog with full rewards/description.
- getBagItemGuid(bagIndex, slotIndex): resolves the per-slot item GUID from
  the bag's containerContents_ map (mirrors the logic inside useItemInBag).
- inventory_screen.cpp right-click handler: checks item.startQuestId != 0
  before the equip/use branch; if set, resolves item GUID and calls
  offerQuestFromItem. Works for both backpack slots and bag slots.
2026-03-17 21:38:08 -07:00
Kelsi
c70740fcdf feat: wire Warden funcList_ dispatchers and implement PacketHandler call
Previously initializeModule() read the 4 WardenFuncList function addresses
from emulated memory, logged them, then discarded them — funcList_ was never
populated, so tick(), generateRC4Keys(), and processCheckRequest() were
permanently no-ops even when the Unicorn emulator successfully ran the module.

Changes:
- initializeModule() now wraps each non-null emulated function address in a
  std::function lambda that marshals args to/from emulated memory via
  emulator_->writeData/callFunction/freeMemory
- generateRC4Keys: copies 4-byte seed to emulated space, calls function
- unload: calls function with NULL (module saves own RC4 state)
- tick: direct uint32_t(deltaMs) dispatch, returns emulated EAX
- packetHandler: 2-arg variant for generic callers
- Stores emulatedPacketHandlerAddr_ for full 4-arg call in processCheckRequest
- processCheckRequest() now calls the emulated PacketHandler with the proper
  4-argument stdcall convention: (data, size, responseOut, responseSizeOut),
  reads back the response size and bytes, returns them in responseOut
- unload() resets emulatedPacketHandlerAddr_ to 0 for clean re-initialization
- Remove dead no-op renderObjectiveTracker() (no call sites, superseded)
2026-03-17 21:29:09 -07:00
Kelsi
005b1fcb54 feat: implement Warden API stub dispatch via Unicorn UC_HOOK_CODE
Previously hookAPI() allocated a stub address and registered a C++ handler
but never stored the handler or wrote any executable code to the stub
region, meaning any Warden module call to a Windows API would execute zeros
and crash or silently return garbage.

Changes:
- Store ApiHookEntry {argCount, handler} per stub address in apiHandlers_
- Write RET (0xC3) to stub memory as a safe fallback
- Register UC_HOOK_CODE over the API stub address range during initialize()
- hookCode() now detects stub addresses, reads args from the emulated stack,
  dispatches to the C++ handler, then simulates stdcall epilogue by setting
  EAX/ESP/EIP so Unicorn returns cleanly to the caller
- Convert static-local nextStubAddr to instance member nextApiStubAddr_
  so re-initialization resets the allocator correctly
- Known arg counts for all 7 registered Windows APIs (VirtualAlloc,
  VirtualFree, GetTickCount, Sleep, GetCurrentThreadId,
  GetCurrentProcessId, ReadProcessMemory)
2026-03-17 21:22:41 -07:00
Kelsi
b29d76bbc8 feat: highlight quest-starting items in loot window with gold indicator
Items with startQuestId != 0 now show:
- Gold outer glow border (2px) around the item icon
- Gold "!" badge in the top-right corner of the icon
- "Begins a Quest" label in gold on the second text line

Matches WoW's visual convention for quest-pickup items in loot rolls.
2026-03-17 21:17:22 -07:00
Kelsi
49ba89dfc3 feat: handle SMSG_PET_UNLEARN_CONFIRM with pet talent respec dialog
Parses the pet talent wipe confirm packet (petGuid + cost), shows a
confirmation dialog matching the player talent reset UX, and sends
CMSG_PET_UNLEARN_TALENTS on confirmation. Completes the pet talent
respec flow for Hunters/Warlocks on WotLK servers.
2026-03-17 21:13:27 -07:00
Kelsi
67c8101f67 fix: add missing TOGGLE_SKILLS to keybinding_manager (fixes CI build failure) 2026-03-17 21:08:02 -07:00
Kelsi
5df5f4d423 feat: handle SMSG_PET_RENAMEABLE to auto-open pet rename dialog on first tame
When the server sends SMSG_PET_RENAMEABLE (after taming a pet for the first
time), the pet rename modal now automatically opens so the player can name
their new pet without needing to right-click the pet frame.
2026-03-17 20:59:29 -07:00
Kelsi
113be66314 feat: parse MSG_BATTLEGROUND_PLAYER_POSITIONS and show flag carriers on minimap
Replaces the silent consume with full packet parsing: reads two lists of
(guid, x, y) positions (typically ally and horde flag carriers) and stores
them in bgPlayerPositions_. Renders each as a colored diamond on the minimap
(blue=group0, red=group1) with a "Flag carrier" tooltip showing the player's
name when available.
2026-03-17 20:54:59 -07:00
Kelsi
48cb7df4b4 feat: add Skills/Professions window (K key) with per-category progress bars
Implements renderSkillsWindow() showing all player skills grouped by
DBC category (Professions, Secondary Skills, Class Skills, Weapon Skills,
Armor, Languages) with value/max progress bars and a bonus breakdown tooltip.
Hooked up to the TOGGLE_SKILLS keybinding (K by default).
2026-03-17 20:46:41 -07:00
Kelsi
d44d462686 feat: add auto-repair at vendor open
When 'Auto Repair' is enabled in Settings > Gameplay, all damaged
equipment is automatically repaired when opening any armorer vendor
(canRepair=true). The repair is skipped when no items are actually
damaged to avoid a pointless server round-trip. A system chat message
confirms the repair. Setting persists to ~/.wowee/settings.cfg as
auto_repair.
2026-03-17 20:27:45 -07:00
Kelsi
072f256af6 feat: add auto-sell grey items on vendor open
When 'Auto Sell Greys' is enabled in Settings > Gameplay, all grey
(ItemQuality::POOR) items in the backpack and extra bags are sold
automatically when opening a vendor window. Items with no sell price
are skipped. A system chat message reports the number of items sold
and total gold received. The setting persists to ~/.wowee/settings.cfg
under the key auto_sell_grey.
2026-03-17 20:21:06 -07:00
Kelsi
e62ae8b03e feat: add local time clock display below minimap coordinates
Shows current local time in HH:MM format in a small dimmed label just
below the coordinate display near the minimap. Uses localtime_r (POSIX)
with a _WIN32 fallback. The clock complements the existing coordinate
and zone name overlays, matching the WoW default UI minimap area.
2026-03-17 20:06:05 -07:00
Kelsi
63f4d10ab1 fix: apply interruptibility coloring to target-of-target cast bar
The ToT (target-of-target) cast bar was still using a fixed orange-yellow
color regardless of spell interruptibility. Now uses the same green/red
scheme as the target frame and nameplate cast bars: green = interruptible
(can Kick/Counterspell), red = not interruptible, both pulse at >80%.
2026-03-17 20:02:02 -07:00
Kelsi
4ce6fdb5f3 feat: color player cast bar by spell school from Spell.dbc
The player's own cast bar now uses spell-school-based colors for quick
identification: Fire=orange-red, Frost=icy blue, Shadow=purple,
Arcane=violet, Nature=green, Holy=golden, Physical=gold. Channels
remain blue regardless of school. Adds getSpellSchoolMask() using the
already-loaded Spell.dbc cache (schoolMask field, covering all
expansions including Classic SchoolEnum→bitmask conversion).
2026-03-17 19:56:52 -07:00
Kelsi
d0df6eed2c feat: show corpse skull marker on world map when player is a ghost
When the player dies and releases spirit, the world map now renders a
bone-white X cross at the corpse's location (matching the existing
minimap skull marker). The marker appears only when the player is a
ghost with an unclaimed corpse on the same map, and shows a "Your
corpse" tooltip on hover. Implemented via setCorpsePos() on WorldMap,
called from renderWorldMap() using getCorpseCanonicalPos().
2026-03-17 19:52:17 -07:00
Kelsi
614fcf6b98 feat: show orange nameplate border when hostile NPC is targeting player
When a hostile unit has UNIT_FIELD_TARGET pointing to the local player,
highlight its nameplate with an orange border so players can immediately
see which enemies are attacking them vs. attacking group members.

Priority: gold=selected, orange=targeting you, dark=default.
2026-03-17 19:47:45 -07:00
Kelsi
1f20f55c62 fix: set interruptible flag on channel start for non-player casters
MSG_CHANNEL_START for NPCs/bosses was leaving UnitCastState::interruptible
at its default (true) instead of checking Spell.dbc AttributesEx.
2026-03-17 19:45:45 -07:00
Kelsi
7c932559e0 fix: apply interruptibility coloring to boss frame cast bars
Boss encounter frames were still using the old fixed orange/red cast bar
color. Update them to match the target frame: green = interruptible,
red = SPELL_ATTR_EX_NOT_INTERRUPTIBLE, both pulse at >80% completion.
2026-03-17 19:44:48 -07:00
Kelsi
279b4de09a feat: color cast bars green/red by spell interruptibility from Spell.dbc
Load AttributesEx from Spell.dbc for all expansions (Classic/TBC/WotLK/
Turtle). Check SPELL_ATTR_EX_NOT_INTERRUPTIBLE (bit 4 = 0x10) to classify
each cast as interruptible or not when SMSG_SPELL_START arrives.

Target frame and nameplate cast bars now use:
- Green: spell can be interrupted by Kick/Counterspell/Pummel etc.
- Red: spell is immune to interrupt (boss abilities, instant-cast effects)
Both colors pulse faster at >80% completion to signal the closing window.

Adds GameHandler::isSpellInterruptible() and UnitCastState::interruptible.
2026-03-17 19:43:19 -07:00
Kelsi
b8712f380d fix: show sub-zone name in minimap label using server-reported zone ID
The zone label above the minimap now preferentially uses the zone/area
name from getWorldStateZoneId() (populated via SMSG_INIT_WORLD_STATES)
rather than the renderer's map-level zone name. This means the label
correctly shows "Ironforge", "Wailing Caverns", etc. instead of always
showing the parent continent zone name.
2026-03-17 19:16:02 -07:00
Kelsi
f9947300da feat: show zone entry text on every zone crossing via SMSG_INIT_WORLD_STATES
Previously the "Entering: [Zone]" overlay only triggered when the terrain
renderer loaded a new map. Now it also fires whenever worldStateZoneId_
changes (sent by the server via SMSG_INIT_WORLD_STATES on each zone
crossing), giving correct "Entering: Ironforge", "Entering: Wailing
Caverns" etc. display for sub-zones and dungeon entries without requiring
a full map reload.

- Added lastKnownWorldStateZoneId_ to track server-reported zone changes
- renderZoneText() now takes GameHandler& to access getWorldStateZoneId()
  and getWhoAreaName() for name lookup via WorldMapArea.dbc cache
- Renderer zone name still checked as a fallback for map-level transitions
- Both sources de-duplicate to avoid triggering the same text twice
2026-03-17 19:14:17 -07:00
Kelsi
4a439fb0d1 feat: add clock-sweep arc to buff bar and target aura icons
Aura icons on the player buff bar and the target frame now display a
WoW-style dark fan overlay that sweeps clockwise as the buff/debuff
elapses, providing instant visual feedback on remaining duration.
The sweep uses AuraSlot::maxDurationMs / getRemainingMs() — the same
data that already drives the numeric countdown — so no new state is
required. Only temporary auras (maxDurationMs > 0) show a sweep;
permanent buffs remain unaffected.
2026-03-17 19:04:40 -07:00
Kelsi
d60d296b77 feat: show discovered taxi nodes as markers on the world map
Add gold diamond markers for every flight master the player has already
discovered (knownTaxiMask_), read from TaxiNodes.dbc and filtered to the
current continent/map being displayed:
- WorldMapTaxiNode struct carries canonical WoW coords + known flag
- WorldMap::setTaxiNodes() accepts the per-frame list from game_screen
- renderImGuiOverlay() projects each known node to UV, draws a gold
  diamond (AddQuadFilled) with a dark outline, and shows the node name
  as a tooltip on hover
- GameHandler::isKnownTaxiNode(id) checks knownTaxiMask_[] efficiently
- Markers update live — newly discovered nodes appear without reopening
  the map
2026-03-17 19:01:03 -07:00
Kelsi
488ec945b6 feat: display glancing and crushing blows in combat text and log
Add GLANCING (hitInfo 0x800) and CRUSHING (hitInfo 0x1000) as distinct
combat text types so players see mechanics feedback they expect from
Classic/TBC content:
- Glancing: shown as "~{amount}" in muted yellow/red; "glances for N" in
  the combat log
- Crushing: shown as "{amount}!" in bright orange/red; "crushes for N!"
  in the combat log
Both types are counted toward DPS meter accumulation. AttackerStateUpdateData
gains isGlancing()/isCrushing() helpers alongside the existing isCrit()/isMiss().
2026-03-17 18:51:48 -07:00
Kelsi
36fed15d43 feat: separate cast/impact kit paths in spell visual DBC lookup
loadSpellVisualDbc() now builds two distinct maps:
  spellVisualCastPath_  — visualId → M2 via SpellVisual.CastKit chain
  spellVisualImpactPath_ — visualId → M2 via SpellVisual.ImpactKit chain

playSpellVisual() accepts useImpactKit=false (default, cast) / true (impact).
SMSG_PLAY_SPELL_IMPACT passes useImpactKit=true so impact effects (explosions,
debuff indicators) use the ImpactKit model instead of the CastKit model.
Added ImpactKit field to all four dbc_layouts.json files.
2026-03-17 18:30:11 -07:00
Kelsi
d558e3a927 fix: separate SMSG_PLAY_SPELL_IMPACT from SMSG_PLAY_OBJECT_SOUND and spawn impact visual
SMSG_PLAY_SPELL_IMPACT has a different wire format from SMSG_PLAY_OBJECT_SOUND:
it carries uint64 targetGuid + uint32 visualId (same as SMSG_PLAY_SPELL_VISUAL),
not uint32 soundId + uint64 sourceGuid.

Previously both were handled together, causing the target GUID low-bytes to be
misread as a sound ID and the visualId to be missed entirely.

Now each handler parses its own format correctly.  SMSG_PLAY_SPELL_IMPACT resolves
the target entity position and calls playSpellVisual() to spawn the M2 impact effect
at that location.
2026-03-17 18:26:55 -07:00
Kelsi
315adfbe93 feat: implement SMSG_PLAY_SPELL_VISUAL with SpellVisual DBC chain lookup
Parse SMSG_PLAY_SPELL_VISUAL (casterGuid + visualId) and spawn a
transient M2 spell effect at the caster's world position.

DBC chain: SpellVisual.dbc → SpellVisualKit.dbc → SpellVisualEffectName.dbc
Lookup priority: CastKit.SpecialEffect0, fallback to MissileModel.
Models are lazy-loaded and cached by path; instances auto-expire after 3.5s.
DBC layouts added to all four expansion layout files (Classic/TBC/WotLK/Turtle).
2026-03-17 18:23:05 -07:00
Kelsi
06ad676be1 fix: surface barber shop, NPC, and LFG autojoin errors in UIError overlay
Add addUIError() for remaining error-only chat-message cases:
- SMSG_BARBER_SHOP_RESULT non-zero result (not enough money, wrong
  location, must stand up)
- SMSG_NPC_WONT_TALK ("That creature can't talk to you right now")
- SMSG_LFG_AUTOJOIN_FAILED and SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER

Completes the UIError improvement pass: all server-reported failure
events now surface as the red on-screen overlay, not chat-only.
2026-03-17 18:08:27 -07:00
Kelsi
2d00f00261 fix: surface LFG/auction/chat/pet errors in UIError overlay
Add addUIError() alongside addSystemChatMessage() for:
- SMSG_CHAT_WRONG_FACTION / SMSG_CHAT_NOT_IN_PARTY / SMSG_CHAT_RESTRICTED
- SMSG_LFG_JOIN_RESULT failure, LFG proposal failure (state=0), LFG
  role check missing-role failure
- SMSG_AUCTION_COMMAND_RESULT error cases (bid/post/cancel/buyout)
- SMSG_PLAYERBINDERROR (hearthstone not bound / bind failed)
- SMSG_READ_ITEM_FAILED
- SMSG_PET_NAME_INVALID

Consistent with the rest of the error-overlay pass: players now see
these failures as the red on-screen overlay text, not just in chat.
2026-03-17 17:56:53 -07:00
Kelsi
cd39cd821f fix: show zone transfer failures and rename errors in UIError overlay
- SMSG_TRANSFER_ABORTED: all zone/instance portal rejection reasons shown as UIError
  (expansion required, instance full, too many instances, zone in combat, etc.)
2026-03-17 17:49:06 -07:00
Kelsi
8411c39eaf fix: surface rename/stable/durability loss errors in UIError overlay
- SMSG_CHAR_RENAME error: "Rename failed: [reason]" shown as UIError
- SMSG_STABLE_RESULT failure (0x09): stable error shown as UIError
- SMSG_DURABILITY_DAMAGE_DEATH: durability loss % shown as UIError overlay
2026-03-17 17:48:04 -07:00
Kelsi
5ad849666d fix: surface pet/raid/talent/instakill errors in UIError overlay
- SMSG_PET_TAME_FAILURE: "Failed to tame: [reason]" shown as UIError
- SMSG_RAID_GROUP_ONLY: "Must be in raid group" shown as UIError
- SMSG_RAID_READY_CHECK_ERROR: all ready check failures shown as UIError
- SMSG_RESET_FAILED_NOTIFY: instance reset failure shown as UIError
- SMSG_TALENTS_INVOLUNTARILY_RESET: talents reset notification shown as UIError
- SMSG_EQUIPMENT_SET_USE_RESULT failure: shown as UIError
- SMSG_SPELLINSTAKILLLOG (player victim): instakill notification shown as UIError
2026-03-17 17:45:45 -07:00
Kelsi
0f2f9ff78d fix: show group kick/party command failures in UIError overlay
- handleGroupUninvite: "You have been removed from the group." now shown as UIError
- handlePartyCommandResult: all party errors (group full, not leader, wrong faction,
  ignoring you, etc.) now also shown as UIError overlay
2026-03-17 17:43:10 -07:00
Kelsi
b22183b000 fix: surface fishing/BG/party/instance/zone notifications in UIError overlay
- Fishing bobber splash: "A fish is on your line!" shown as UIError (time-critical)
- SMSG_BATTLEFIELD_PORT_DENIED: shown as UIError
- SMSG_INSTANCE_RESET_FAILED: failure reason shown as UIError
- SMSG_GROUP_DESTROYED: "Party disbanded" shown as UIError
- SMSG_CORPSE_NOT_IN_INSTANCE: shown as UIError
- SMSG_ZONE_UNDER_ATTACK: "[Zone] is under attack!" shown as UIError
- SMSG_AREA_TRIGGER_MESSAGE: zone/area entry messages shown as UIError
2026-03-17 17:39:02 -07:00
Kelsi
220f1b177c fix: surface trainer/resurrect/innkeeper/difficulty errors in UIError overlay
- SMSG_TRAINER_BUY_FAILED: "Cannot learn [spell]" now appears as red overlay
- SMSG_RESURRECT_FAILED: all resurrection failure reasons shown as UIError
- SMSG_BINDZONEREPLY error: "Too far from innkeeper" shown as UIError
- SMSG_CHANGEPLAYER_DIFFICULTY_RESULT error: reason shown as UIError
- SMSG_INVENTORY_CHANGE_FAILURE case 1: level-gated equip error now calls
  addUIError before the early break, matching all other inventory error paths
2026-03-17 17:36:25 -07:00
Kelsi
495dfb7aae fix: show buy/sell vendor failures in UIError overlay
SMSG_BUY_FAILED ("Not enough money", "Sold out", etc.) and
SMSG_SELL_ITEM non-zero results now call addUIError() so the error
appears on screen alongside the chat message.
2026-03-17 17:25:27 -07:00
Kelsi
fba6aba80d fix: show inventory, mount, and socket errors in UIError overlay
Several server-reported action failures were posting to chat only
without firing the red on-screen UIError overlay:
- SMSG_INVENTORY_CHANGE_FAILURE: bag full, wrong slot, can't equip, etc.
- SMSG_MOUNTRESULT / SMSG_DISMOUNTRESULT: mount denied errors
- SMSG_QUESTLOG_FULL: quest log at capacity
- SMSG_SOCKET_GEMS_RESULT: gem socketing failure

All now call addUIError() in addition to addSystemChatMessage() so
players see the error immediately on screen without looking at chat.
2026-03-17 17:24:23 -07:00
Kelsi
dcf9aeed92 fix: show SMSG_CAST_FAILED reason in UIError overlay
handleCastFailed was only posting to chat; now also calls addUIError
so mid-cast server rejections (e.g. "Interrupted") show the same red
on-screen overlay as SMSG_CAST_RESULT failures already did.
2026-03-17 17:20:24 -07:00
Kelsi
caad20285b feat: add hover tooltips to character sheet stats panel
Hovering over Armor, primary stats (Strength/Agility/Stamina/
Intellect/Spirit), and secondary rating stats now shows a brief
description of the stat's in-game effect — matching WoW's native
character screen behavior.

Uses ImGui::BeginGroup/EndGroup to make multi-widget rows (stat +
green bonus) respond to a single IsItemHovered check.
2026-03-17 17:16:56 -07:00
Kelsi
d1a392cd0e feat: add colors for SKILL, LOOT, BG system, and monster chat types
Added distinct colors for chat types that previously fell through to
the gray default: SKILL (cyan), LOOT (light purple), GUILD_ACHIEVEMENT
(gold), MONSTER_WHISPER/RAID_BOSS_WHISPER (pink), RAID_BOSS_EMOTE
(orange), MONSTER_PARTY (blue), BG_SYSTEM_NEUTRAL/ALLIANCE/HORDE
(gold/blue/red), and AFK/DND (light gray).
2026-03-17 17:00:46 -07:00
Kelsi
1e80e294f0 feat: add Heroic and Unique-Equipped indicators to chat link tooltips
Chat item link tooltips now show "Heroic" (green) for items with
ITEM_FLAG_HEROIC_TOOLTIP (0x8) and "Unique-Equipped" for items with
ITEM_FLAG_UNIQUE_EQUIPPABLE (0x1000000), matching InventoryScreen.
"Unique" text is now gold-colored to match as well.
2026-03-17 16:56:37 -07:00
Kelsi
cb99dbaea4 feat: add elemental resistances and full spell descriptions to chat link tooltips
Chat item link tooltips now show per-school elemental resistances
(Holy/Fire/Nature/Frost/Shadow/Arcane) when non-zero, matching the
inventory tooltip. Spell effect text (Use/Equip/Chance on Hit) now
shows the full spell description instead of just the spell name,
consistent with InventoryScreen::renderItemTooltip.
2026-03-17 16:54:40 -07:00
Kelsi
7e6de75e8a feat: show skill, reputation, class and race requirements in chat link tooltips
Chat item link tooltips now match InventoryScreen for required-skill
(SkillLine.dbc), required-reputation (Faction.dbc), class restriction,
and race restriction. Red text when the player does not meet the
requirement, grey otherwise.
2026-03-17 16:47:33 -07:00
Kelsi
dab03f2729 feat: show item set name and bonuses in chat item link tooltips
Chat link tooltips (hover over item links in chat) were missing item set
information already shown in the inventory tooltip.  Now shows:
- Set name with equipped/total piece count (e.g. "Tier 9 (2/5)")
- Each set bonus with its piece-threshold, colored green when active
  and grey when inactive
- Falls back to "Set (id N)" when ItemSet.dbc is unavailable

Lazy-loads ItemSet.dbc on first hover; consistent with
InventoryScreen::renderItemTooltip formatting.
2026-03-17 16:43:57 -07:00
Kelsi
dee33db0aa feat: show gem socket slots and socket bonus in chat item link tooltips
Item tooltips shown when hovering chat links already displayed all stats,
spells, and flavor text, but gem sockets were missing.  Add the same
socket rendering used in the inventory tooltip:

- Iterate socketColor[0..2]; for each non-zero slot show a colored label
  (Meta / Red / Yellow / Blue Socket) in the socket's faction color
- Lazy-load SpellItemEnchantment.dbc to resolve the socketBonus enchant
  name; fall back to "(id N)" when the record is not found
- Consistent with InventoryScreen::renderItemTooltip formatting
2026-03-17 16:42:19 -07:00
Kelsi
973db16658 feat: add screen-space weather particle overlay (rain/snow/storm)
Weather type and intensity are already tracked from SMSG_WEATHER, but
only an icon was shown next to the zone name.  This adds a fullscreen
ImDrawList overlay that renders:
- Rain (type 1): diagonal rain streaks proportional to intensity
- Snow (type 2): gently swaying snowflakes with two-tone highlight
- Storm (type 3): heavy rain + dark fog-vignette on screen edges

Particles wrap at screen boundaries and are re-seeded on type or
resolution change.  Delta time is capped at 50 ms to prevent teleporting
after focus loss.  No heap allocations at runtime (static local arrays).
2026-03-17 16:34:39 -07:00
Kelsi
1f1925797f feat: show cooldown overlay on pet action bar spell buttons
Pet spell buttons now dim and display remaining cooldown time when a
spell is on cooldown, matching the feedback available on the player
action bar. Clicking a pet spell while it is on cooldown is also
suppressed to prevent spam-sending CMSG_PET_ACTION to the server.
Cooldown time appears as a text overlay (seconds or "Nm" for minutes)
and is also shown in the hover tooltip.
2026-03-17 15:59:27 -07:00
Kelsi
98dc2a0dc7 feat: show Max Level bar at max level instead of hiding XP bar
When nextLevelXp==0 and playerLevel>0, render a gold fully-filled bar
with centered "Max Level" text instead of hiding the XP bar entirely.
Fixes missing closing brace that caused all subsequent methods to fail
compilation.
2026-03-17 15:28:33 -07:00
Kelsi
c15ef915bf feat: add Ctrl+1..3 keyboard shortcuts for stance/form/presence switching
Ctrl+1, Ctrl+2, Ctrl+3 (up to Ctrl+8 for Druids with many forms) now
cast the Nth available stance spell for classes that use a stance bar.
Ordering matches the stance bar UI so visual and keyboard positions align.
Normal action bar keys 1–= are skipped when Ctrl is held to prevent
accidental spell casts instead of stance switches.
2026-03-17 15:18:04 -07:00
Kelsi
6d83027226 feat: add stance/form/presence bar for Warriors, Druids, Death Knights, Rogues, Priests
Renders a stance bar to the left of the main action bar showing the
player's known stance spells filtered to only those they have learned:
- Warrior: Battle Stance, Defensive Stance, Berserker Stance
- Death Knight: Blood Presence, Frost Presence, Unholy Presence
- Druid: Bear/Dire Bear, Cat, Travel, Aquatic, Moonkin, Tree, Flight forms
- Rogue: Stealth
- Priest: Shadowform

Active form detected from permanent player auras (maxDurationMs == -1).
Clicking an inactive stance casts the corresponding spell. Active stance
shown with green border/tint; inactive stances are slightly dimmed.
Spell name tooltips shown on hover using existing SpellbookScreen lookup.
2026-03-17 15:12:58 -07:00
Kelsi
4edc4017ed feat: show extra stats in equipped item comparison panel (shift-hover)
When shift-hovering an item link in chat to compare with equipped gear,
also display extra stats (hit/crit/haste/AP/SP/expertise) for the
currently-equipped item, matching what is shown for the hovered item.
2026-03-17 14:50:28 -07:00
Kelsi
3b79f44b54 feat: show item flavor/lore text in item tooltip
Display item description (flavor text) from SMSG_ITEM_QUERY_SINGLE_RESPONSE
at the bottom of item tooltips in gold color, matching WoW's standard
tooltip layout where lore text appears below stats and effects.
2026-03-17 14:44:15 -07:00
Kelsi
020ba134cd feat: show item spell effects (Use/Equip/Teaches) in item tooltip
Display Use, Equip, Chance on Hit, and Teaches spell effects from
SMSG_ITEM_QUERY_SINGLE_RESPONSE in item tooltips. Looks up spell
name from Spell.dbc via SpellbookScreen for readable descriptions.
2026-03-17 14:43:22 -07:00
Kelsi
03397ec23c feat: show extra item stats in tooltip (hit/crit/haste/sp/ap/expertise)
Display all ExtraStat entries from SMSG_ITEM_QUERY_SINGLE_RESPONSE in
the item tooltip (hit rating, crit rating, haste, spell power, attack
power, expertise, resilience, etc.). These were previously silently
discarded, making WotLK/TBC gear tooltips incomplete.
2026-03-17 14:42:00 -07:00
Kelsi
f04875514e feat: improve item tooltip with bind type, item level, weapon damage range, and required level
Add standard WoW tooltip fields that were previously missing:
- Bind type (Binds when picked up/equipped/used, Quest Item)
- Unique indicator
- Item Level XX
- Weapon damage range (e.g. '22 - 41 Damage  Speed 2.20') replacing bare DPS
- Damage per second sub-line in dimmed text
- Requires Level XX
2026-03-17 14:41:00 -07:00
Kelsi
8b57e6fa45 feat: add HONOR_GAIN floating combat text for PvP honor gains
Show '+X Honor' floating text in gold when SMSG_PVP_CREDIT is received,
matching WoW's native behavior. Also add HONOR_GAIN to the combat log
panel for a complete record. Previously only a chat message was added.
2026-03-17 14:38:57 -07:00
Kelsi
b6ea78dfab fix: show spell name in REFLECT floating combat text
REFLECT entries already stored the reflected spell ID but the floating
text display showed only "Reflected"/"You Reflect" without the name.
Now shows "Reflected: Fireball" or "Reflect: Frost Nova", matching the
pattern already used by INTERRUPT, DISPEL, and STEAL entries.
2026-03-17 14:26:10 -07:00
Kelsi
5513c4aad5 fix: apply skull-red color and "Lv ??" to level-0 mobs in focus frame
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Consistent with the target frame fix: focus targets with level 0
(unknown/?? mobs) now show skull-red instead of grey, and display
"Lv ??" instead of "Lv 0".
2026-03-17 14:18:49 -07:00
Kelsi
39f4162ec1 fix: show skull-red color and "Lv ??" for unknown-level mobs in target frame
Level 0 in the update fields means the server hasn't sent or
the mob is undetectable (e.g. high-level raid bosses). Previously
these were colored grey (no-XP path) and displayed "Lv 0". Now
they correctly show skull-red and display "Lv ??" to match WoW.
2026-03-17 14:16:14 -07:00
Kelsi
8b9d626aec feat: show directional arrow on world map player marker
Replace the static filled circle with a red triangle arrow that
rotates to match the character's current facing direction.
Uses the same render-space yaw convention as the 3D scene so
the arrow matches in-world orientation.
2026-03-17 14:10:56 -07:00
Kelsi
b23dbc9ab7 feat: apply out-of-range red tint to ranged items on action bar
Extend the existing out-of-range check to cover ITEM slots whose
inventory type is Ranged (bow/gun/crossbow, 40 yd), RangedRight
(wand, 40 yd), or Thrown (30 yd). The check runs after barItemDef
is resolved so the inventory type is available.
2026-03-17 13:59:42 -07:00
Kelsi
5031351736 fix: add free-list to WardenEmulator heap allocator to prevent exhaustion
The bump-pointer allocator never reused freed blocks, causing the 16 MB
emulated heap to exhaust in long sessions even when blocks were freed.

- First-fit reuse from a free-list before advancing the bump pointer
- Coalesce adjacent free blocks to limit fragmentation
- Roll back the bump pointer when the top free block reaches it
- Reset allocator state on initialize() so re-runs start clean
2026-03-17 13:55:37 -07:00
Kelsi
ae40d393c3 feat: show tactical role badges in party frames; fix talent reset
- Add MT/MA/Asst badges to party frames (matching raid frame treatment)
- Clear learnedTalents_ on SMSG_TALENTS_INVOLUNTARILY_RESET so the
  talent screen stays accurate after a server-side talent wipe
2026-03-17 13:50:49 -07:00
Kelsi
f70df191a9 feat: show tactical role badges (MT/MA/Asst) in raid frames
Render "MT" (orange), "MA" (blue), and "A" (light blue) in the
bottom-left of each raid cell using member flags from SMSG_GROUP_LIST
and SMSG_REAL_GROUP_UPDATE (bits 0x02/0x04/0x01). Complements the
existing LFG role badges at bottom-right.
2026-03-17 13:47:53 -07:00
Kelsi
1daead3767 feat: implement SMSG_REAL_GROUP_UPDATE handler
Parse group type, member flags, and leader GUID instead of silently
discarding the packet. Updates partyData so group frames reflect
role changes and leadership transitions in real time.
2026-03-17 13:44:14 -07:00
Kelsi
a43a43ed8e fix: evict oldest minimap tile textures when cache exceeds 128 entries
Prevents unbounded GPU memory growth in long play sessions where the player
visits many zones. Tiles are inserted into a FIFO deque; when the count of
successfully-loaded tiles exceeds MAX_TILE_CACHE (128), the oldest entry is
destroyed and removed from both the cache map and the deque.

At 256×256×4 bytes per tile this caps minimap GPU usage at ~32 MB.
2026-03-17 13:38:18 -07:00
Kelsi
217edc81d9 feat: add item quality link colours to loot roll, loot notify, and loot all-passed messages 2026-03-17 13:33:07 -07:00
Kelsi
6260ac281e feat: extend item link quality colours to vendor purchase, pet feed, and LFG reward messages 2026-03-17 13:27:27 -07:00
Kelsi
29b5b6f959 feat: show item quality colours in loot, quest-item, and auction chat messages
Add buildItemLink() helper that formats |cff...|Hitem:...|h[Name]|h|r links so
the chat renderer draws item names in their quality colour (grey/white/green/
blue/purple/orange) with a small icon and tooltip on hover.

Applied to: loot received (SMSG_ITEM_PUSH_RESULT), looted from corpse
(handleLootRemoved), quest item count updates, and all three auction
house notifications (sold, outbid, expired).
2026-03-17 13:25:33 -07:00
Kelsi
4049f73ca6 refactor: replace raw console output with LOG_* macros in warden_emulator, transport_manager, keybinding_manager 2026-03-17 13:09:18 -07:00
Kelsi
bf5219c822 refactor: replace std::cout/cerr with LOG_* macros in warden_module.cpp
Convert 60+ raw console output calls to structured LOG_INFO/WARNING/ERROR
macros for consistent logging, proper timestamps, and filtering support.
Remove unused <iostream> include.
2026-03-17 13:04:25 -07:00
Kelsi
8169f5d5c0 feat: add audio feedback for level-up, achievements, duels, group invites, and inventory errors
Wire up remaining UISoundManager calls for milestone and notification events:
- playLevelUp() on SMSG_LEVELUP_INFO
- playAchievementAlert() on SMSG_ACHIEVEMENT_EARNED (self only)
- playTargetSelect() on duel request and group invite
- playError() on inventory change failure
2026-03-17 12:37:19 -07:00
Kelsi
119002626e feat: show chat message when a spell is removed from spellbook
handleRemovedSpell now displays "You have unlearned: [SpellName]."
matching the existing handleLearnedSpell feedback pattern.
2026-03-17 12:35:05 -07:00
Kelsi
6fbf5b5797 feat: add audio feedback for item loot, vendor buy/sell, and spell learning
Wire up remaining UISoundManager calls for core gameplay actions:
- playLootItem() on SMSG_ITEM_PUSH_RESULT and handleLootRemoved
- playPickupBag() on successful vendor purchase (SMSG_BUY_ITEM)
- playDropOnGround() on successful item sell (SMSG_SELL_ITEM)
- playQuestActivate() on trainer spell purchase success
2026-03-17 12:31:38 -07:00
Kelsi
a0b978f95b feat: add audio feedback for quest accept/complete and transaction errors
Wire up UISoundManager calls that were loaded but never invoked:
- playQuestActivate() on quest accept
- playQuestComplete() on server-confirmed quest completion
- playError() on trainer buy failure, vendor buy failure, and sell failure
2026-03-17 12:28:15 -07:00
Kelsi
8c3060f261 feat: show XP percentage in experience bar tooltip
The XP bar tooltip now displays current progress as a percentage
(e.g., "Current: 45000 / 100000 XP (45.0%)"), making it easier to
gauge leveling progress at a glance.
2026-03-17 12:17:23 -07:00
Kelsi
b80d88bded feat: add 'Hold Shift to compare' hint to ItemDef tooltip
The ItemQueryResponseData tooltip overload had this hint but the
primary ItemDef overload did not. Players hovering gear in their
inventory now see the comparison prompt when an equipped equivalent
exists.
2026-03-17 12:12:11 -07:00
Kelsi
1c3f2f4ae3 feat: show exploration XP as floating combat text
Area discovery XP was only shown in the system chat log. Now it also
appears as a floating "+XP" number like kill XP, giving immediate
visual feedback when discovering new zones.
2026-03-17 12:02:17 -07:00
Kelsi
67e6c9a984 fix: TBC parseMailList returns true on empty mailbox for consistency
WotLK and Classic parsers return true on success regardless of mail
count, but TBC returned !inbox.empty() which falsely signals parse
failure on an empty mailbox, potentially causing callers to skip
valid empty-mailbox state.
2026-03-17 11:58:20 -07:00
Kelsi
9750110436 fix: complete item tooltip stat comparison for all secondary stats
The shift-hover gear comparison was missing secondary stat types
(Defense, Dodge, Parry, Block Rating, Hit/Crit/Haste variants,
Healing, Spell Damage, Spell Pen) — only 10 of 22 stat types had
labels. Also adds full extra stats and DPS comparison to the
ItemQueryResponseData tooltip overload (loot window) which had none.
2026-03-17 11:54:01 -07:00
Kelsi
c017c61d2c fix: remove unused syncCounts variable in Warden handler
Eliminates the -Wunused-variable warning for the syncCounts array
that was declared but never populated in the synchronous Warden
check response path.
2026-03-17 11:37:49 -07:00
Kelsi
ef5532cf15 fix: add TBC chat message parser to prevent 12-byte misalignment
TBC 2.4.3 SMSG_MESSAGECHAT has no senderGuid(u64) or unknown(u32)
prefix before type-specific data. The WotLK base parser reads these
12 bytes unconditionally, causing complete misalignment of all chat
message fields — every chat message on a TBC server would parse
garbage for sender, channel, and message content.
2026-03-17 11:23:37 -07:00
Kelsi
e1be8667ed fix: add TBC game object query parser for correct string count
TBC 2.4.3 SMSG_GAMEOBJECT_QUERY_RESPONSE has 2 extra strings after
name[4] (iconName + castBarCaption). WotLK has 3 (adds unk1). Without
this override, the WotLK parser's third readString() consumed bytes
from the data[24] fields, corrupting game object type-specific data
and breaking interactions with doors, chests, mailboxes, and
transports on TBC servers.
2026-03-17 11:20:50 -07:00
Kelsi
1b86f76d31 fix: add TBC overrides for quest giver status and channel packets
TBC 2.4.3 sends quest giver status as uint32 (like Classic), not uint8
(WotLK). Without this override, reading uint8 consumed only 1 of 4
bytes, misaligning all subsequent packet data and breaking quest
markers on NPCs.

TBC channel join/leave packets use Classic format (name+password only).
The WotLK base prepends channelId/hasVoice/joinedByZone, causing
servers to reject the malformed packets and breaking channel features.
2026-03-17 11:16:02 -07:00
Kelsi
dc8619464a fix: add TBC guild roster parser to avoid gender byte misalignment
TBC 2.4.3 SMSG_GUILD_ROSTER has the same rank structure as WotLK
(variable rankCount + goldLimit + bank tab permissions), but does NOT
include a gender byte per member (WotLK added it). Without this
override, TBC fell through to the WotLK parser which read a spurious
gender byte, causing every subsequent field in each member entry to
misalign.
2026-03-17 11:10:54 -07:00
Kelsi
a7f7c4aa93 feat: show power type names in combat log energize/drain entries
Combat log now shows specific power type names (Mana, Rage, Energy,
Focus, Happiness, Runic Power) instead of generic "power" for ENERGIZE
and POWER_DRAIN events. Uses the powerType field added to CombatLogEntry
in the previous commit.
2026-03-17 11:03:20 -07:00
Kelsi
01685cc0bb feat: add ghost mode visual overlay when player is dead
Apply a cold blue-grey fullscreen overlay when the player is in ghost
form, creating a desaturated, muted appearance that clearly signals the
death state. Uses the existing overlay pipeline infrastructure. Applied
in both parallel and non-parallel rendering paths, after underwater tint
but before brightness adjustment so UI elements remain unaffected.
2026-03-17 10:58:07 -07:00
Kelsi
2d53ff0c07 feat: show environmental damage type in combat text and log
Fall, lava, drowning, fatigue, slime, and fire damage now display their
specific type instead of generic "Environmental damage" in both floating
combat text and the combat log window. The envType byte from
SMSG_ENVIRONMENTAL_DAMAGE_LOG is propagated via the powerType field to
the display layer. Added powerType to CombatLogEntry for consistent
access in the persistent combat log.
2026-03-17 10:54:07 -07:00
Kelsi
1152a70201 fix: handle transport data in other player movement packets
Other players on transports (boats, zeppelins, trams) were not properly
tracked because handleOtherPlayerMovement() did not read transport data
from MSG_MOVE_* packets. This caused entities to slide off transports
between movement updates since no transport attachment was established.

Now reads the transport GUID and local offset from the packet using
expansion-aware wire flags (0x200 for WotLK/TBC, 0x02000000 for
Classic/Turtle), registers a transport attachment so the entity follows
the transport smoothly via updateAttachedTransportChildren(), and clears
the attachment when the player disembarks.
2026-03-17 10:40:35 -07:00
Kelsi
f5297f9945 feat: show craft queue count on cast bar during batch crafting 2026-03-17 10:30:18 -07:00
Kelsi
9aed192503 fix: load skill DBCs on login and handle loot slot changes
- Load SkillLine.dbc and SkillLineAbility.dbc during SMSG_INITIAL_SPELLS
  so isProfessionSpell() works immediately without visiting a trainer
- Implement SMSG_LOOT_SLOT_CHANGED handler to remove items taken by
  other players in group loot, keeping the loot window in sync
2026-03-17 10:20:29 -07:00
Kelsi
7b03d5363b feat: profession crafting improvements and combat sound fixes
- Suppress spell sounds for profession/tradeskill spells (crafting is silent)
- Add craft quantity UI to profession trainer: recipe selector, quantity
  input, Create button, and Stop button for active queue
- Known recipes show Create button to cast directly from trainer window
- Craft queue auto-recasts on CREATE_ITEM completion, cancels on failure
- Fix missing combat sounds: player spell impacts on enemies, enemy spell
  cast sounds targeting player, instant melee ability weapon sounds
2026-03-17 10:12:49 -07:00
Kelsi
502d506a44 feat: make bag windows draggable 2026-03-17 10:12:35 -07:00
Kelsi
192c6175b8 feat: add brightness slider to Video settings
Black overlay dims below 50%, white overlay brightens above 50%.
Persisted in settings.cfg, with restore-defaults support.
2026-03-17 09:04:53 -07:00
Kelsi
cf3fe70f1f fix: hide window on shutdown to prevent OS force-close dialog
SDL_HideWindow immediately on shutdown so the OS doesn't show a
"not responding" dialog during the slow cleanup process.
2026-03-17 09:04:47 -07:00
Kelsi
3667ff4998 fix: use uniform 22-byte loot item size for Classic/TBC/Turtle
SMSG_LOOT_RESPONSE items include randomSuffix and randomPropertyId
fields across all expansions, not just WotLK. Using 14-byte size for
Classic/TBC caused item data to be read at wrong offsets.
2026-03-17 09:04:40 -07:00
Kelsi
203514abc7 fix: correct minimap orientation and arrow direction, compact key ring UI
Remove stray X-flip in minimap display shader that mirrored the map
horizontally (West on right instead of East). Fix arrow rotation
fallback path (missing negation) and add character-facing-relative
arrow in rotateWithCamera mode.

Compact key ring: 24px slots in 8-column grid, only show rows with
items, hide when empty. Add Show Key Ring toggle in Settings with
persistence.
2026-03-17 08:18:46 -07:00
Kelsi
e38324619e fix: resolve missing Classic spell icons on action bar and talents
When Classic is active, loadDBC("Spell.dbc") finds the WotLK base DBC
(234 fields) since no binary Classic DBC exists. The Classic layout says
IconID is at field 117, but in the WotLK DBC that field contains
unrelated data (mostly zeros). This caused all spell icon lookups to
fail silently.

Now detects the DBC/layout field count mismatch and falls back to the
WotLK field index 133, which is correct for the base DBC. Classic spell
IDs are a subset of WotLK, so the icon mapping works correctly.
2026-03-17 07:42:01 -07:00
Kelsi
8378eb9232 fix: correct sync Warden MODULE check returning 0x01 instead of 0x00
The sync path's MODULE handler was returning 0x01 (module found) for
unwanted cheat DLLs (WPESPY, TAMIA, PRXDRVPE, etc.) instead of 0x00
(not found). Since VMaNGOS compares the result as a boolean, returning
any non-zero value for a cheat module tells the server "this cheat DLL
is loaded," triggering Warden penalties that accumulate into a kick
after ~3-5 minutes.

Also adds ±4KB hint window search to searchCodePattern for faster
PAGE_A resolution without full brute-force, and restores the turtle
PAGE_A fallback (confirmed patterns are runtime-patched offsets not
present in the on-disk PE).
2026-03-17 07:19:37 -07:00
Kelsi
ad511dad5e fix: correct KUSER_SHARED_DATA field offsets for Warden anticheat
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Multiple fields were at wrong offsets causing MEM_CHECK comparison
failures against expected Windows 7 SP1 values. Key fixes:
- LargePageMinimum: 0x248→0x244
- NtProductType at 0x264 was 0, now 1 (VER_NT_WORKSTATION)
- ProductTypeIsValid at 0x268 was missing
- ProcessorFeatures at 0x274 was clobbered by misplaced NtProductType
- NumberOfPhysicalPages: 0x300→0x2E8
- ActiveConsoleId at 0x2D8 was 4, now 1
- Added SuiteMask, NXSupportPolicy, and other missing fields
2026-03-16 20:55:30 -07:00
Kelsi
e3c2269b16 fix: increase descriptor pool sizes to prevent Vulkan crash
Terrain pool 16384→65536, WMO pool 8192→32768. The previous sizes
were too small for the load/unload radii, causing pool exhaustion
and a hard crash when streaming terrain on large maps.
2026-03-16 17:46:32 -07:00
Kelsi
6fd32ecdc6 fix: skip Warden HASH_RESULT on strict servers when no CR match
Sending a wrong hash to AzerothCore/WotLK servers triggers an
account ban. When no pre-computed challenge-response entry matches
the server seed, skip the response entirely so the server times out
with a kick (recoverable) instead of verifying a bad hash and
banning (unrecoverable). Turtle/Classic servers remain unchanged
as they only log Warden failures.

Also adds RX silence detection and fixes Turtle isTurtle flag
propagation in MEM_CHECK path.
2026-03-16 17:38:25 -07:00
Kelsi
a3279ea1ad fix: async Warden PAGE_A/PAGE_B checks to prevent main-loop stalls
Move 5-second brute-force HMAC-SHA1 code pattern searches to a
background thread via std::async. The main loop now detects PAGE_A/B
checks, launches the response builder async, and drains the result
in update() — encrypting and sending on the main thread to keep
wardenCrypto_ RC4 state thread-safe.

Also adds Turtle WoW PE binary support (isTurtle flag, dedicated exe
search, runtime patches), searchCodePattern with result caching,
writeLE32 public API, and Warden scan entry verification.
2026-03-16 16:46:29 -07:00
Kelsi
f0a515ff9c fix: stabilize classic/turtle world session handling
Some checks failed
Build / Build (arm64) (push) Has been cancelled
Build / Build (x86-64) (push) Has been cancelled
Build / Build (macOS arm64) (push) Has been cancelled
Build / Build (windows-arm64) (push) Has been cancelled
Build / Build (windows-x86-64) (push) Has been cancelled
Security / CodeQL (C/C++) (push) Has been cancelled
Security / Semgrep (push) Has been cancelled
Security / Sanitizer Build (ASan/UBSan) (push) Has been cancelled
2026-03-15 06:13:36 -07:00
Kelsi
43ebae217c fix: align turtle world packet parsing
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
2026-03-15 03:40:58 -07:00
Kelsi
6ede9a2968 refactor: derive turtle opcodes from classic 2026-03-15 02:55:05 -07:00
Kelsi
0b6265bc55 fix: align turtle protocol compatibility 2026-03-15 01:47:36 -07:00
Kelsi
b0fafe5efa fix: stabilize turtle world entry session handling 2026-03-15 01:21:23 -07:00
Kelsi
4dba20b757 fix: avoid unsigned subtraction checks in packet bounds 2026-03-14 22:27:42 -07:00
Kelsi
eea3784976 fix: harden turtle movement parsing and warden fallback 2026-03-14 22:18:28 -07:00
Kelsi
f44ef7b9ea fix: optimize turtle monster move wrapped parsing 2026-03-14 22:01:26 -07:00
Kelsi
bce1f4d211 fix: reject malformed monster move payloads 2026-03-14 21:52:03 -07:00
Kelsi
f57893a459 fix(combatlog): reject truncated spell damage log tails 2026-03-14 21:52:03 -07:00
Kelsi
f07b730473 fix(combatlog): reject truncated resist logs 2026-03-14 21:52:03 -07:00
Kelsi
5c8a2afa35 fix(combatlog): accept extended TBC spell damage payloads 2026-03-14 21:52:03 -07:00
Kelsi
385ac1e66c fix(combatlog): reject truncated instakill logs without spell id 2026-03-14 21:52:03 -07:00
Kelsi
83a368aa85 fix(combatlog): reject spell start packets missing target flags 2026-03-14 21:52:03 -07:00
Kelsi
f4ecef2ec5 fix(combatlog): reject truncated classic attacker-state packets 2026-03-14 21:52:03 -07:00
Kelsi
4d4e5ed3b9 fix(combatlog): enforce TBC attacker-state packet bounds 2026-03-14 21:52:03 -07:00
Kelsi
71e34e41b7 fix(combatlog): clamp attacker-state subdamage count to payload 2026-03-14 21:52:03 -07:00
Kelsi
90bc9118f9 fix(combatlog): validate packed GUID bounds in spell energize log 2026-03-14 21:52:03 -07:00
Kelsi
80d59a80aa fix(combatlog): relax packed GUID minimum-size gates 2026-03-14 21:52:03 -07:00
Kelsi
c9467778dc fix(combatlog): enforce TBC spell damage/heal packet bounds 2026-03-14 21:52:03 -07:00
Kelsi
6ccfdc9d11 fix(combatlog): validate packed GUID bounds in spell damage/heal logs 2026-03-14 21:52:03 -07:00
Kelsi
24a63beb3c fix(combatlog): reject truncated spell start target GUIDs 2026-03-14 21:52:03 -07:00
Kelsi
bcfdcce062 fix(combatlog): reject truncated spell go packets missing counts 2026-03-14 21:52:03 -07:00
Kelsi
b24da8463c fix(combatlog): avoid partial spell miss log entries on truncation 2026-03-14 21:52:03 -07:00
Kelsi
f0ba85fa80 fix(combatlog): reset spell go parser output before decode 2026-03-14 21:52:03 -07:00
Kelsi
6b290009aa fix(combatlog): fail classic and tbc spell go parse on truncation 2026-03-14 21:52:03 -07:00
Kelsi
e0ac81450d fix(combatlog): enforce full spell start fixed-field bounds 2026-03-14 21:52:03 -07:00
Kelsi
918762501f fix(combatlog): fail spell go parse on truncated target lists 2026-03-14 21:52:03 -07:00
Kelsi
ffa6dda4d9 fix(combatlog): validate packed GUID bounds in attacker state parsers 2026-03-14 21:52:03 -07:00
Kelsi
5a9be91fac fix(combatlog): validate packed guid bounds in spell go parser 2026-03-14 21:52:03 -07:00
Kelsi
4561eb8696 fix(combatlog): validate packed GUID bounds in spell start parser 2026-03-14 21:52:03 -07:00
Kelsi
c9858655f6 fix(combatlog): validate packed guid bounds in classic spell cast parsers 2026-03-14 21:52:03 -07:00
Kelsi
69ff91e9a2 fix(combatlog): validate packed GUID bounds in spell cast parsers 2026-03-14 21:52:03 -07:00
Kelsi
5ecc46623a fix(combatlog): consume full spell go target lists when capped 2026-03-14 21:52:03 -07:00
Kelsi
c90c8fb8cf fix(combatlog): parse full spell miss target lists 2026-03-14 21:52:03 -07:00
Kelsi
a962422b12 fix(combatlog): map alternate immune2 spell miss value 2026-03-14 21:52:03 -07:00
Kelsi
753f4ef1be fix(combatlog): map immune2 spell miss results correctly 2026-03-14 21:52:03 -07:00
Kelsi
5911b8eb01 fix(combatlog): show resisted amount from resist log packets 2026-03-14 21:52:03 -07:00
Kelsi
5575fc6f28 fix(combatlog): preserve unknown source for environmental entries 2026-03-14 21:52:03 -07:00
Kelsi Rae Davis
ecb56e9a35
Merge pull request #17 from Kelsidavis/maint
Merge branch 'master' into maint
2026-03-14 21:47:07 -07:00
Kelsi
d34a3967f6 Merge branch 'master' into maint 2026-03-14 09:24:19 -07:00
Kelsi
075b4c1772 fix(gameplay): tighten TB elevator bounds and reset stale combat visuals
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
2026-03-14 09:19:16 -07:00
Kelsi
448560a0d2 fix(ui): correct minimap center compass arrow orientation 2026-03-14 09:06:55 -07:00
Kelsi
38210ec186 fix(gameplay): keep timeout animation stable on repeated presses and harden M2 elevator sync 2026-03-14 09:02:20 -07:00
Kelsi
f7a996ab26 fix(ui): avoid double-processing bag toggle hotkey 2026-03-14 08:44:45 -07:00
Kelsi
2c32b72f95 feat(ui): show keyring in inventory 2026-03-14 08:42:25 -07:00
Kelsi
800862c50a fix(ui): cache ghost opacity updates to state changes 2026-03-14 08:31:08 -07:00
Kelsi
cebca9a882 fix(gameplay): stabilize run animation and clean ghost/death visuals 2026-03-14 08:27:32 -07:00
Kelsi
1a4b21955c fix(transport): add Thunder Bluff lift-specific M2 attach bounds 2026-03-14 08:09:23 -07:00
Kelsi
422ff99b2a fix(ui): close trainer window immediately on close request 2026-03-14 07:43:52 -07:00
Kelsi
f235b8641f fix(animation): avoid forced stand reset after spline move 2026-03-14 07:41:50 -07:00
352 changed files with 86049 additions and 30130 deletions

47
.clang-tidy Normal file
View file

@ -0,0 +1,47 @@
# clang-tidy configuration for WoWee
# Targets C++20. Checks are tuned for a Vulkan/game-engine codebase:
# - reinterpret_cast, pointer arithmetic, and magic numbers are frequent
# in low-level graphics/network code, so the most aggressive
# cppcoreguidelines and readability-magic-numbers checks are disabled.
---
Checks: >
bugprone-*,
clang-analyzer-*,
performance-*,
modernize-use-nullptr,
modernize-use-override,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-loop-convert,
modernize-deprecated-headers,
modernize-make-unique,
modernize-make-shared,
modernize-use-nodiscard,
modernize-use-designated-initializers,
readability-braces-around-statements,
readability-container-size-empty,
readability-delete-null-pointer,
readability-else-after-return,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-simplify-boolean-expr,
readability-string-compare,
-bugprone-easily-swappable-parameters,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-performance-avoid-endl
WarningsAsErrors: ''
# Suppress the noise from GCC-only LTO flags in compile_commands.json.
# clang doesn't support -fno-fat-lto-objects; this silences the harmless warning.
ExtraArgs:
- -std=c++20
- -Wno-ignored-optimization-argument
HeaderFilterRegex: '^.*/include/.*\.hpp$'
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment
value: true

View file

@ -1 +0,0 @@
{"sessionId":"55a28c7e-8043-44c2-9829-702f303c84ba","pid":3880168,"acquiredAt":1773085726967}

50
.dockerignore Normal file
View file

@ -0,0 +1,50 @@
# .dockerignore — Exclude files from the Docker build context.
# Keeps the context small and prevents leaking build artifacts or secrets.
# Build outputs
build/
cache/
# Git history
.git/
.gitignore
.github/
# Large external directories (fetched at build time inside the container)
extern/FidelityFX-FSR2/
extern/FidelityFX-SDK/
# IDE / editor files
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
# Documentation (not needed for build)
docs/
*.md
!container/*.md
# Test / tool outputs
logs/
# Host build scripts that run outside the container (not needed inside)
build.sh
build.bat
build.ps1
rebuild.sh
rebuild.bat
rebuild.ps1
clean.sh
debug_texture.*
extract_assets.*
extract_warden_rsa.py
restart-worldserver.sh
test.sh
# macOS SDK tarballs that may be temporarily placed here
*.tar.xz
*.tar.gz
*.tar.bz2

View file

@ -7,6 +7,7 @@ on:
branches: [master]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
WOWEE_AMD_FSR2_REPO: https://github.com/GPUOpen-Effects/FidelityFX-FSR2.git
WOWEE_AMD_FSR2_REF: master
WOWEE_FFX_SDK_REPO: https://github.com/Kelsidavis/FidelityFX-SDK.git

View file

@ -4,6 +4,9 @@ on:
push:
tags: ['v*']
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: write

View file

@ -7,6 +7,9 @@ on:
branches: [master]
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read

20
.gitignore vendored
View file

@ -1,5 +1,6 @@
# Build directories
build/
build-debug/
build-sanitize/
bin/
lib/
@ -34,6 +35,9 @@ Makefile
*.app
wowee
# Claude Code internal state
.claude/
# IDE files
.vscode/
.idea/
@ -42,12 +46,28 @@ wowee
*~
.DS_Store
# Compilation database (regenerated by cmake)
compile_commands.json
# Language server caches
.ccls
.ccls-cache/
.cache/clangd/
# Tags
tags
TAGS
.tags
cscope.out
# External dependencies (except submodules and vendored headers)
extern/*
!extern/.gitkeep
!extern/imgui
!extern/vk-bootstrap
!extern/vk_mem_alloc.h
!extern/lua-5.1.5
!extern/VERSIONS.md
# ImGui state
imgui.ini

8
.semgrepignore Normal file
View file

@ -0,0 +1,8 @@
# Vendored third-party code (frozen releases, not ours to modify)
extern/lua-5.1.5/
extern/imgui/
extern/stb_image.h
extern/stb_image_write.h
extern/vk-bootstrap/
extern/FidelityFX-FSR2/
extern/FidelityFX-SDK/

View file

@ -12,7 +12,7 @@ This document provides platform-specific build instructions for WoWee.
sudo apt update
sudo apt install -y \
build-essential cmake pkg-config git \
libsdl2-dev libglew-dev libglm-dev \
libsdl2-dev libglm-dev \
libssl-dev zlib1g-dev \
libvulkan-dev vulkan-tools glslc \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
@ -28,7 +28,7 @@ sudo apt install -y \
```bash
sudo pacman -S --needed \
base-devel cmake pkgconf git \
sdl2 glew glm openssl zlib \
sdl2 glm openssl zlib \
vulkan-headers vulkan-icd-loader vulkan-tools shaderc \
ffmpeg unicorn stormlib
```
@ -83,7 +83,7 @@ Vulkan on macOS is provided via MoltenVK (a Vulkan-to-Metal translation layer),
which is included in the `vulkan-loader` Homebrew package.
```bash
brew install cmake pkg-config sdl2 glew glm openssl@3 zlib ffmpeg unicorn \
brew install cmake pkg-config sdl2 glm openssl@3 zlib ffmpeg unicorn \
stormlib vulkan-loader vulkan-headers shaderc
```
@ -137,7 +137,6 @@ pacman -S --needed \
mingw-w64-x86_64-ninja \
mingw-w64-x86_64-pkgconf \
mingw-w64-x86_64-SDL2 \
mingw-w64-x86_64-glew \
mingw-w64-x86_64-glm \
mingw-w64-x86_64-openssl \
mingw-w64-x86_64-zlib \
@ -174,7 +173,7 @@ For users who prefer Visual Studio over MSYS2.
### vcpkg Dependencies
```powershell
vcpkg install sdl2 glew glm openssl zlib ffmpeg stormlib --triplet x64-windows
vcpkg install sdl2 glm openssl zlib ffmpeg stormlib --triplet x64-windows
```
### Clone

85
CHANGELOG.md Normal file
View file

@ -0,0 +1,85 @@
# Changelog
## [Unreleased] — changes since v1.8.9-preview
### Architecture
- Break Application::getInstance() singleton from GameHandler via GameServices struct
- EntityController refactoring (SOLID decomposition)
- Extract 8 domain handler classes from GameHandler
- Replace 3,300-line switch with dispatch table
- Multi-platform Docker build system (Linux, macOS arm64/x86_64, Windows cross-compilation)
### Bug Fixes (v1.8.2v1.8.9)
- Fix VkTexture ownsSampler_ flag after move/destroy (prevented double-free)
- Fix unsigned underflow in Warden PE section loading (buffer overflow on malformed modules)
- Add bounds checks to Warden readLE32/readLE16 (out-of-bounds on untrusted PE data)
- Fix undefined behavior: SDL_BUTTON(0) computed 1 << -1 (negative shift)
- Fix BigNum::toHex/toDecimal null dereference on OpenSSL allocation failure
- Remove duplicate zone weather entry silently overwriting Dustwallow Marsh
- Fix LLVM apt repo codename (jammy→noble) in macOS Docker build
- Add missing mkdir in Linux Docker build script
- Clamp player percentage stats (block/dodge/parry/crit) to prevent NaN from corrupted packets
- Guard fsPath underflow in tryLoadPngOverride
### Code Quality (v1.8.2v1.8.9)
- 30+ named constants replacing magic numbers across game, rendering, and pipeline code
- 55+ why-comments documenting WoW protocol quirks, format specifics, and design rationale
- 8 DRY extractions (findOnUseSpellId, createFallbackTextures, finalizeSampler,
renderClassRestriction/renderRaceRestriction, and more)
- Scope macOS -undefined dynamic_lookup linker flag to wowee target only
- Replace goto patterns with structured control flow (do/while(false), lambdas)
- Zero out GameServices in Application::shutdown to prevent dangling pointers
---
## [v1.8.1-preview] — 2026-03-23
### Performance
- Eliminate ~70 unnecessary sqrt ops per frame; constexpr reciprocals and cache optimizations
- Skip bone animation for LOD3 models; frustum-cull water surfaces
- Eliminate per-frame heap allocations in M2 renderer
- Convert entity/skill/DBC/warden maps to unordered_map; fix 3x contacts scan
- Eliminate double map lookups and dynamic_cast in render loops
- Use second GPU queue for parallel texture/buffer uploads
- Time-budget tile finalization to prevent 1+ second main-loop stalls
- Add Vulkan pipeline cache persistence for faster startup
### Bug Fixes
- Fix spline parsing with expansion context; preload DBC caches at world entry
- Fix NPC/player attack animation to use weapon-appropriate anim ID
- Fix equipment visibility and follow-target run speed
- Fix inspect (packed GUID) and client-side auto-walk for follow
- Fix mail money uint64, other-player cape textures, zone toast dedup, TCP_NODELAY
- Guard spline point loop against unsigned underflow; guard hexDecode/stoi/stof
- Fix infinite recursion in toLowerInPlace and operator precedence bugs
- Fix 3D audio coords for PLAY_OBJECT_SOUND; correct melee swing sound paths
- Prevent Vulkan sampler exhaustion crash; skip pipeline cache on NVIDIA
- Skip FSR3 frame gen on non-AMD GPUs to prevent driver crash
- Fix chest GO interaction (send GAMEOBJ_USE+LOOT together)
- Restore WMO wall collision threshold; fix off-screen bag positions
- Guard texture log dedup sets with mutex for thread safety
- Fix lua_pcall return check in ACTIONBAR_PAGE_CHANGED
### Features
- Render equipment on other players (helmets, weapons, belts, wrists, shoulders)
- Target frame right-click context menu
- Crafting sounds and Create All button
- Server-synced bag sort
- Log GPU vendor/name at init
### Security
- Add path traversal rejection and packet length validation
### Code Quality
- Packet API: add readPackedGuid, writePackedGuid, writeFloat, getRemainingSize,
hasRemaining, hasData, skipAll (replacing 1300+ verbose expressions)
- GameHandler helpers: isInWorld, isPreWotlk, guidToUnitId, lookupName,
getUnitByGuid, fireAddonEvent, withSoundManager
- Dispatch table: registerHandler, registerSkipHandler, registerWorldHandler,
registerErrorHandler (replacing 120+ lambda wrappers)
- Shared ui_colors.hpp with named constants replacing 200+ inline color literals
- Promote 50+ static const arrays to constexpr across audio/core/rendering/UI
- Deduplicate class name/color functions, enchantment cache, item-set DBC keys
- Extract settings tabs, GameHandler::update() phases, loadWeaponM2 into methods
- Remove 12 duplicate dispatch registrations and C-style casts
- Extract toHexString, toLowerInPlace, duration formatting, Lua return helpers

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15)
project(wowee VERSION 1.0.0 LANGUAGES CXX)
project(wowee VERSION 1.0.0 LANGUAGES C CXX)
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 20)
@ -248,34 +248,98 @@ endif()
find_package(SDL2 REQUIRED)
find_package(Vulkan QUIET)
if(NOT Vulkan_FOUND)
# Fallback: some distros / CMake versions need pkg-config to locate Vulkan.
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(VULKAN_PKG vulkan)
if(VULKAN_PKG_FOUND)
add_library(Vulkan::Vulkan INTERFACE IMPORTED)
set_target_properties(Vulkan::Vulkan PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${VULKAN_PKG_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${VULKAN_PKG_LIBRARIES}"
)
if(VULKAN_PKG_LIBRARY_DIRS)
# For Windows cross-compilation the host pkg-config finds the Linux libvulkan-dev
# and injects /usr/include as an INTERFACE_INCLUDE_DIRECTORY, which causes
# MinGW clang to pull in glibc headers (bits/libc-header-start.h) instead of
# the MinGW sysroot headers. Skip the host pkg-config path entirely and instead
# locate Vulkan via vcpkg-installed vulkan-headers or the MinGW toolchain.
if(CMAKE_CROSSCOMPILING AND WIN32)
# The cross-compile build script generates a Vulkan import library
# (libvulkan-1.a) in ${CMAKE_BINARY_DIR}/vulkan-import from the headers.
set(_VULKAN_IMPORT_DIR "${CMAKE_BINARY_DIR}/vulkan-import")
find_package(VulkanHeaders CONFIG QUIET)
if(VulkanHeaders_FOUND)
if(NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan INTERFACE IMPORTED)
endif()
# Vulkan::Headers is provided by vcpkg's vulkan-headers port and carries
# the correct MinGW include path — no Linux system headers involved.
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Vulkan::Headers)
# Link against the Vulkan loader import library (vulkan-1.dll).
if(EXISTS "${_VULKAN_IMPORT_DIR}/libvulkan-1.a")
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_DIRECTORIES "${VULKAN_PKG_LIBRARY_DIRS}")
INTERFACE_LINK_DIRECTORIES "${_VULKAN_IMPORT_DIR}")
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_LIBRARIES vulkan-1)
endif()
set(Vulkan_FOUND TRUE)
message(STATUS "Found Vulkan via pkg-config: ${VULKAN_PKG_LIBRARIES}")
message(STATUS "Found Vulkan headers for Windows cross-compile via vcpkg VulkanHeaders")
else()
# Last-resort: check the LLVM-MinGW toolchain sysroot directly.
find_path(_VULKAN_MINGW_INCLUDE NAMES vulkan/vulkan.h
PATHS /opt/llvm-mingw/x86_64-w64-mingw32/include NO_DEFAULT_PATH)
if(_VULKAN_MINGW_INCLUDE)
if(NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan INTERFACE IMPORTED)
endif()
set_target_properties(Vulkan::Vulkan PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_VULKAN_MINGW_INCLUDE}")
# Link against the Vulkan loader import library (vulkan-1.dll).
if(EXISTS "${_VULKAN_IMPORT_DIR}/libvulkan-1.a")
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_DIRECTORIES "${_VULKAN_IMPORT_DIR}")
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_LIBRARIES vulkan-1)
endif()
set(Vulkan_FOUND TRUE)
message(STATUS "Found Vulkan headers in LLVM-MinGW sysroot: ${_VULKAN_MINGW_INCLUDE}")
endif()
endif()
elseif(CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# macOS cross-compilation: use vcpkg-installed vulkan-headers.
# The host pkg-config would find Linux libvulkan-dev headers which the
# macOS cross-compiler cannot use (different sysroot).
find_package(VulkanHeaders CONFIG QUIET)
if(VulkanHeaders_FOUND)
if(NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan INTERFACE IMPORTED)
endif()
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Vulkan::Headers)
set(Vulkan_FOUND TRUE)
message(STATUS "Found Vulkan headers for macOS cross-compile via vcpkg VulkanHeaders")
endif()
else()
# Fallback: some distros / CMake versions need pkg-config to locate Vulkan.
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(VULKAN_PKG vulkan)
if(VULKAN_PKG_FOUND)
add_library(Vulkan::Vulkan INTERFACE IMPORTED)
set_target_properties(Vulkan::Vulkan PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${VULKAN_PKG_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${VULKAN_PKG_LIBRARIES}"
)
if(VULKAN_PKG_LIBRARY_DIRS)
set_property(TARGET Vulkan::Vulkan APPEND PROPERTY
INTERFACE_LINK_DIRECTORIES "${VULKAN_PKG_LIBRARY_DIRS}")
endif()
set(Vulkan_FOUND TRUE)
message(STATUS "Found Vulkan via pkg-config: ${VULKAN_PKG_LIBRARIES}")
endif()
endif()
endif()
if(NOT Vulkan_FOUND)
message(FATAL_ERROR "Could not find Vulkan. Install libvulkan-dev (Linux), vulkan-loader (macOS), or the Vulkan SDK (Windows).")
endif()
endif()
# GL/GLEW kept temporarily for unconverted sub-renderers during Vulkan migration.
# These files compile against GL types but their code is never called — the Vulkan
# path is the only active rendering backend. Remove in Phase 7 when all renderers
# are converted and grep confirms zero GL references.
find_package(OpenGL QUIET)
find_package(GLEW QUIET)
# macOS cross-compilation: the Vulkan loader (MoltenVK) is not available at link
# time. Allow unresolved Vulkan symbols — they are resolved at runtime.
if(CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(WOWEE_MACOS_CROSS_COMPILE TRUE)
endif()
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
@ -450,6 +514,15 @@ set(WOWEE_SOURCES
src/game/opcode_table.cpp
src/game/update_field_table.cpp
src/game/game_handler.cpp
src/game/chat_handler.cpp
src/game/movement_handler.cpp
src/game/combat_handler.cpp
src/game/spell_handler.cpp
src/game/inventory_handler.cpp
src/game/social_handler.cpp
src/game/quest_handler.cpp
src/game/entity_controller.cpp
src/game/warden_handler.cpp
src/game/warden_crypto.cpp
src/game/warden_module.cpp
src/game/warden_emulator.cpp
@ -505,12 +578,9 @@ set(WOWEE_SOURCES
# Rendering
src/rendering/renderer.cpp
src/rendering/amd_fsr3_runtime.cpp
src/rendering/shader.cpp
src/rendering/mesh.cpp
src/rendering/camera.cpp
src/rendering/camera_controller.cpp
src/rendering/material.cpp
src/rendering/scene.cpp
src/rendering/terrain_renderer.cpp
src/rendering/terrain_manager.cpp
src/rendering/frustum.cpp
@ -529,6 +599,7 @@ set(WOWEE_SOURCES
src/rendering/character_preview.cpp
src/rendering/wmo_renderer.cpp
src/rendering/m2_renderer.cpp
src/rendering/m2_model_classifier.cpp
src/rendering/quest_marker_renderer.cpp
src/rendering/minimap.cpp
src/rendering/world_map.cpp
@ -537,7 +608,6 @@ set(WOWEE_SOURCES
src/rendering/levelup_effect.cpp
src/rendering/charge_effect.cpp
src/rendering/loading_screen.cpp
$<$<BOOL:${HAVE_FFMPEG}>:${CMAKE_CURRENT_SOURCE_DIR}/src/rendering/video_player.cpp>
# UI
src/ui/ui_manager.cpp
@ -552,6 +622,11 @@ set(WOWEE_SOURCES
src/ui/talent_screen.cpp
src/ui/keybinding_manager.cpp
# Addons
src/addons/addon_manager.cpp
src/addons/lua_engine.cpp
src/addons/toc_parser.cpp
# Main
src/main.cpp
)
@ -619,12 +694,9 @@ set(WOWEE_HEADERS
include/rendering/vk_pipeline.hpp
include/rendering/vk_render_target.hpp
include/rendering/renderer.hpp
include/rendering/shader.hpp
include/rendering/mesh.hpp
include/rendering/camera.hpp
include/rendering/camera_controller.hpp
include/rendering/material.hpp
include/rendering/scene.hpp
include/rendering/terrain_renderer.hpp
include/rendering/terrain_manager.hpp
include/rendering/frustum.hpp
@ -643,7 +715,6 @@ set(WOWEE_HEADERS
include/rendering/character_preview.hpp
include/rendering/wmo_renderer.hpp
include/rendering/loading_screen.hpp
include/rendering/video_player.hpp
include/ui/ui_manager.hpp
include/ui/auth_screen.hpp
@ -659,20 +730,50 @@ set(WOWEE_HEADERS
set(WOWEE_PLATFORM_SOURCES)
if(WIN32)
# Copy icon into build tree so llvm-rc can find it via the relative path in wowee.rc
# Copy icon into build tree so windres can find it via the relative path
# in wowee.rc ("assets\\wowee.ico"). Tell the RC compiler to also search
# the build directory — GNU windres uses cwd (already the build dir) but
# llvm-windres resolves relative to the .rc file, so it needs the hint.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/assets/Wowee.ico
${CMAKE_CURRENT_BINARY_DIR}/assets/wowee.ico
COPYONLY
)
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -I ${CMAKE_CURRENT_BINARY_DIR} -I ${CMAKE_CURRENT_SOURCE_DIR}")
list(APPEND WOWEE_PLATFORM_SOURCES resources/wowee.rc)
endif()
# ---- Lua 5.1.5 (vendored, static library) ----
set(LUA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/lua-5.1.5/src)
set(LUA_SOURCES
${LUA_DIR}/lapi.c ${LUA_DIR}/lcode.c ${LUA_DIR}/ldebug.c
${LUA_DIR}/ldo.c ${LUA_DIR}/ldump.c ${LUA_DIR}/lfunc.c
${LUA_DIR}/lgc.c ${LUA_DIR}/llex.c ${LUA_DIR}/lmem.c
${LUA_DIR}/lobject.c ${LUA_DIR}/lopcodes.c ${LUA_DIR}/lparser.c
${LUA_DIR}/lstate.c ${LUA_DIR}/lstring.c ${LUA_DIR}/ltable.c
${LUA_DIR}/ltm.c ${LUA_DIR}/lundump.c ${LUA_DIR}/lvm.c
${LUA_DIR}/lzio.c ${LUA_DIR}/lauxlib.c ${LUA_DIR}/lbaselib.c
${LUA_DIR}/ldblib.c ${LUA_DIR}/liolib.c ${LUA_DIR}/lmathlib.c
${LUA_DIR}/loslib.c ${LUA_DIR}/ltablib.c ${LUA_DIR}/lstrlib.c
${LUA_DIR}/linit.c
)
add_library(lua51 STATIC ${LUA_SOURCES})
set_target_properties(lua51 PROPERTIES LINKER_LANGUAGE C C_STANDARD 99 POSITION_INDEPENDENT_CODE ON)
target_include_directories(lua51 PUBLIC ${LUA_DIR})
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(lua51 PRIVATE -w)
endif()
# Create executable
add_executable(wowee ${WOWEE_SOURCES} ${WOWEE_HEADERS} ${WOWEE_PLATFORM_SOURCES})
if(TARGET opcodes-generate)
add_dependencies(wowee opcodes-generate)
endif()
# macOS cross-compilation: MoltenVK is not available at link time.
# Allow unresolved Vulkan symbols — resolved at runtime. Scoped to wowee only.
if(WOWEE_MACOS_CROSS_COMPILE)
target_link_options(wowee PRIVATE "-undefined" "dynamic_lookup")
endif()
# FidelityFX-SDK headers can trigger compiler-specific pragma/unused-static noise
# when included through the runtime bridge; keep suppression scoped to that TU.
@ -709,17 +810,10 @@ target_link_libraries(wowee PRIVATE
OpenSSL::Crypto
Threads::Threads
ZLIB::ZLIB
lua51
${CMAKE_DL_LIBS}
)
# GL/GLEW linked temporarily for unconverted sub-renderers (removed in Phase 7)
if(TARGET OpenGL::GL)
target_link_libraries(wowee PRIVATE OpenGL::GL)
endif()
if(TARGET GLEW::GLEW)
target_link_libraries(wowee PRIVATE GLEW::GLEW)
endif()
if(HAVE_FFMPEG)
target_compile_definitions(wowee PRIVATE HAVE_FFMPEG)
target_link_libraries(wowee PRIVATE ${FFMPEG_LIBRARIES})
@ -856,6 +950,17 @@ add_custom_command(TARGET wowee POST_BUILD
COMMENT "Syncing assets to $<TARGET_FILE_DIR:wowee>/assets"
)
# Symlink Data/ next to the executable so expansion profiles, opcode tables,
# and other runtime data files are found when running from the build directory.
if(NOT WIN32)
add_custom_command(TARGET wowee POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/Data
$<TARGET_FILE_DIR:wowee>/Data
COMMENT "Symlinking Data to $<TARGET_FILE_DIR:wowee>/Data"
)
endif()
# On Windows, SDL 2.28+ uses LoadLibraryExW with LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
# which does NOT include System32. Copy vulkan-1.dll into the output directory so
# SDL_Vulkan_LoadLibrary can locate it without needing a full system PATH search.

72
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,72 @@
# Contributing to Wowee
## Build Setup
See [BUILD_INSTRUCTIONS.md](BUILD_INSTRUCTIONS.md) for full platform-specific details.
The short version: CMake + Make on Linux/macOS, MSYS2 on Windows.
```
cmake -B build -DCMAKE_BUILD_TYPE=Debug
make -C build -j$(nproc)
```
## Code Style
- **C++20**. Use `#pragma once` for include guards.
- Namespaces: `wowee::game`, `wowee::rendering`, `wowee::ui`, `wowee::core`, `wowee::network`.
- Conventional commit messages in imperative mood:
- `feat:` new feature
- `fix:` bug fix
- `refactor:` code restructuring with no behavior change
- `perf:` performance improvement
- Prefer `constexpr` over `static const` for compile-time data.
- Mark functions whose return value should not be ignored with `[[nodiscard]]`.
## Pull Request Process
1. Branch from `master`.
2. Keep commits focused -- one logical change per commit.
3. Describe *what* changed and *why* in the PR description.
4. Ensure the project compiles cleanly before submitting.
5. Manual testing against a WoW 3.3.5a server (e.g. AzerothCore/ChromieCraft) is expected
for gameplay-affecting changes.
## Architecture Overview
See [docs/architecture.md](docs/architecture.md) for the full picture. Key namespaces:
| Namespace | Responsibility |
|---|---|
| `wowee::game` | Game state, packet handling (`GameHandler`), opcode dispatch |
| `wowee::rendering` | Vulkan renderer, M2/WMO/terrain, sky system |
| `wowee::ui` | ImGui windows and HUD (`GameScreen`) |
| `wowee::core` | Coordinates, math, utilities |
| `wowee::network` | Connection, `Packet` read/write API |
## Packet Handlers
The standard pattern for adding a new server packet handler:
1. Define a `struct FooData` holding the parsed fields.
2. Write `void GameHandler::handleFoo(network::Packet& packet)` to parse into `FooData`.
3. Register it in the dispatch table: `registerHandler(LogicalOpcode::SMSG_FOO, &GameHandler::handleFoo)`.
Helper variants: `registerWorldHandler` (requires `isInWorld()`), `registerSkipHandler` (discard),
`registerErrorHandler` (log warning).
## Testing
There is no automated test suite. Changes are verified by manual testing against
WoW 3.3.5a private servers (primarily ChromieCraft/AzerothCore). Classic and TBC
expansion paths are tested against their respective server builds.
## Key Files for New Contributors
| File | What it does |
|---|---|
| `include/game/game_handler.hpp` | Central game state and all packet handler declarations |
| `src/game/game_handler.cpp` | Packet dispatch registration and handler implementations |
| `include/network/packet.hpp` | `Packet` class -- the read/write API every handler uses |
| `include/ui/game_screen.hpp` | Main gameplay UI screen (ImGui) |
| `src/rendering/m2_renderer.cpp` | M2 model loading and rendering |
| `docs/architecture.md` | High-level system architecture reference |

View file

@ -1,99 +1,260 @@
{
"Spell": {
"ID": 0, "Attributes": 5, "IconID": 117,
"Name": 120, "Tooltip": 147, "Rank": 129, "SchoolEnum": 1,
"CastingTimeIndex": 15, "PowerType": 28, "ManaCost": 29, "RangeIndex": 33,
"DispelType": 4
"AreaTable": {
"ExploreFlag": 3,
"ID": 0,
"MapID": 1,
"ParentAreaNum": 2
},
"SpellRange": { "MaxRange": 2 },
"ItemDisplayInfo": {
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
"CharHairGeosets": {
"GeosetID": 4,
"RaceID": 1,
"SexID": 2,
"Variation": 3
},
"CharSections": {
"RaceID": 1, "SexID": 2, "BaseSection": 3,
"VariationIndex": 4, "ColorIndex": 5,
"Texture1": 6, "Texture2": 7, "Texture3": 8,
"Flags": 9
},
"SpellIcon": { "ID": 0, "Path": 1 },
"FactionTemplate": {
"ID": 0, "Faction": 1, "FactionGroup": 3,
"FriendGroup": 4, "EnemyGroup": 5,
"Enemy0": 6, "Enemy1": 7, "Enemy2": 8, "Enemy3": 9
},
"Faction": {
"ID": 0, "ReputationRaceMask0": 2, "ReputationRaceMask1": 3,
"ReputationRaceMask2": 4, "ReputationRaceMask3": 5,
"ReputationBase0": 10, "ReputationBase1": 11,
"ReputationBase2": 12, "ReputationBase3": 13
},
"AreaTable": { "ID": 0, "MapID": 1, "ParentAreaNum": 2, "ExploreFlag": 3 },
"CreatureDisplayInfoExtra": {
"ID": 0, "RaceID": 1, "SexID": 2, "SkinID": 3, "FaceID": 4,
"HairStyleID": 5, "HairColorID": 6, "FacialHairID": 7,
"EquipDisplay0": 8, "EquipDisplay1": 9, "EquipDisplay2": 10,
"EquipDisplay3": 11, "EquipDisplay4": 12, "EquipDisplay5": 13,
"EquipDisplay6": 14, "EquipDisplay7": 15, "EquipDisplay8": 16,
"EquipDisplay9": 17, "EquipDisplay10": 18, "BakeName": 20
},
"CreatureDisplayInfo": {
"ID": 0, "ModelID": 1, "ExtraDisplayId": 3,
"Skin1": 6, "Skin2": 7, "Skin3": 8
},
"TaxiNodes": {
"ID": 0, "MapID": 1, "X": 2, "Y": 3, "Z": 4, "Name": 5
},
"TaxiPath": { "ID": 0, "FromNode": 1, "ToNode": 2, "Cost": 3 },
"TaxiPathNode": {
"ID": 0, "PathID": 1, "NodeIndex": 2, "MapID": 3,
"X": 4, "Y": 5, "Z": 6
},
"TalentTab": {
"ID": 0, "Name": 1, "ClassMask": 12,
"OrderIndex": 14, "BackgroundFile": 15
},
"Talent": {
"ID": 0, "TabID": 1, "Row": 2, "Column": 3,
"RankSpell0": 4, "PrereqTalent0": 9, "PrereqRank0": 12
},
"SkillLineAbility": { "SkillLineID": 1, "SpellID": 2 },
"SkillLine": { "ID": 0, "Category": 1, "Name": 3 },
"Map": { "ID": 0, "InternalName": 1 },
"CreatureModelData": { "ID": 0, "ModelPath": 2 },
"CharHairGeosets": {
"RaceID": 1, "SexID": 2, "Variation": 3, "GeosetID": 4
"BaseSection": 3,
"ColorIndex": 5,
"Flags": 9,
"RaceID": 1,
"SexID": 2,
"Texture1": 6,
"Texture2": 7,
"Texture3": 8,
"VariationIndex": 4
},
"CharacterFacialHairStyles": {
"RaceID": 0, "SexID": 1, "Variation": 2,
"Geoset100": 3, "Geoset300": 4, "Geoset200": 5
"Geoset100": 3,
"Geoset200": 5,
"Geoset300": 4,
"RaceID": 0,
"SexID": 1,
"Variation": 2
},
"CreatureDisplayInfo": {
"ExtraDisplayId": 3,
"ID": 0,
"ModelID": 1,
"Skin1": 6,
"Skin2": 7,
"Skin3": 8
},
"CreatureDisplayInfoExtra": {
"BakeName": 20,
"EquipDisplay0": 8,
"EquipDisplay1": 9,
"EquipDisplay10": 18,
"EquipDisplay2": 10,
"EquipDisplay3": 11,
"EquipDisplay4": 12,
"EquipDisplay5": 13,
"EquipDisplay6": 14,
"EquipDisplay7": 15,
"EquipDisplay8": 16,
"EquipDisplay9": 17,
"FaceID": 4,
"FacialHairID": 7,
"HairColorID": 6,
"HairStyleID": 5,
"ID": 0,
"RaceID": 1,
"SexID": 2,
"SkinID": 3
},
"CreatureModelData": {
"ID": 0,
"ModelPath": 2
},
"Emotes": {
"AnimID": 2,
"ID": 0
},
"GameObjectDisplayInfo": { "ID": 0, "ModelName": 1 },
"Emotes": { "ID": 0, "AnimID": 2 },
"EmotesText": {
"ID": 0, "Command": 1, "EmoteRef": 2,
"OthersTargetTextID": 3, "SenderTargetTextID": 5,
"OthersNoTargetTextID": 7, "SenderNoTargetTextID": 9
"Command": 1,
"EmoteRef": 2,
"ID": 0,
"OthersNoTargetTextID": 7,
"OthersTargetTextID": 3,
"SenderNoTargetTextID": 9,
"SenderTargetTextID": 5
},
"EmotesTextData": {
"ID": 0,
"Text": 1
},
"Faction": {
"ID": 0,
"ReputationBase0": 10,
"ReputationBase1": 11,
"ReputationBase2": 12,
"ReputationBase3": 13,
"ReputationRaceMask0": 2,
"ReputationRaceMask1": 3,
"ReputationRaceMask2": 4,
"ReputationRaceMask3": 5
},
"FactionTemplate": {
"Enemy0": 6,
"Enemy1": 7,
"Enemy2": 8,
"Enemy3": 9,
"EnemyGroup": 5,
"Faction": 1,
"FactionGroup": 3,
"FriendGroup": 4,
"ID": 0
},
"GameObjectDisplayInfo": {
"ID": 0,
"ModelName": 1
},
"ItemDisplayInfo": {
"GeosetGroup1": 7,
"GeosetGroup3": 9,
"ID": 0,
"InventoryIcon": 5,
"LeftModel": 1,
"LeftModelTexture": 3,
"TextureArmLower": 15,
"TextureArmUpper": 14,
"TextureFoot": 21,
"TextureHand": 16,
"TextureLegLower": 20,
"TextureLegUpper": 19,
"TextureTorsoLower": 18,
"TextureTorsoUpper": 17
},
"EmotesTextData": { "ID": 0, "Text": 1 },
"Light": {
"ID": 0, "MapID": 1, "X": 2, "Z": 3, "Y": 4,
"InnerRadius": 5, "OuterRadius": 6, "LightParamsID": 7,
"LightParamsIDRain": 8, "LightParamsIDUnderwater": 9
},
"LightParams": { "LightParamsID": 0 },
"LightIntBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"ID": 0,
"InnerRadius": 5,
"LightParamsID": 7,
"LightParamsIDRain": 8,
"LightParamsIDUnderwater": 9,
"MapID": 1,
"OuterRadius": 6,
"X": 2,
"Y": 4,
"Z": 3
},
"LightFloatBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightIntBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightParams": {
"LightParamsID": 0
},
"Map": {
"ID": 0,
"InternalName": 1
},
"SkillLine": {
"Category": 1,
"ID": 0,
"Name": 3
},
"SkillLineAbility": {
"SkillLineID": 1,
"SpellID": 2
},
"Spell": {
"Attributes": 5,
"AttributesEx": 6,
"CastingTimeIndex": 15,
"DispelType": 4,
"DurationIndex": 40,
"EffectBasePoints0": 80,
"EffectBasePoints1": 81,
"EffectBasePoints2": 82,
"ID": 0,
"IconID": 117,
"ManaCost": 29,
"Name": 120,
"PowerType": 28,
"RangeIndex": 33,
"Rank": 129,
"SchoolEnum": 1,
"Tooltip": 147
},
"SpellIcon": {
"ID": 0,
"Path": 1
},
"SpellRange": {
"MaxRange": 2
},
"SpellVisual": {
"CastKit": 2,
"ID": 0,
"ImpactKit": 3,
"MissileModel": 8
},
"SpellVisualEffectName": {
"FilePath": 2,
"ID": 0
},
"SpellVisualKit": {
"BaseEffect": 5,
"ID": 0,
"SpecialEffect0": 11,
"SpecialEffect1": 12,
"SpecialEffect2": 13
},
"Talent": {
"Column": 3,
"ID": 0,
"PrereqRank0": 12,
"PrereqTalent0": 9,
"RankSpell0": 4,
"Row": 2,
"TabID": 1
},
"TalentTab": {
"BackgroundFile": 15,
"ClassMask": 12,
"ID": 0,
"Name": 1,
"OrderIndex": 14
},
"TaxiNodes": {
"ID": 0,
"MapID": 1,
"Name": 5,
"X": 2,
"Y": 3,
"Z": 4
},
"TaxiPath": {
"Cost": 3,
"FromNode": 1,
"ID": 0,
"ToNode": 2
},
"TaxiPathNode": {
"ID": 0,
"MapID": 3,
"NodeIndex": 2,
"PathID": 1,
"X": 4,
"Y": 5,
"Z": 6
},
"WorldMapArea": {
"ID": 0, "MapID": 1, "AreaID": 2, "AreaName": 3,
"LocLeft": 4, "LocRight": 5, "LocTop": 6, "LocBottom": 7,
"DisplayMapID": 8, "ParentWorldMapID": 10
"AreaID": 2,
"AreaName": 3,
"DisplayMapID": 8,
"ID": 0,
"LocBottom": 7,
"LocLeft": 4,
"LocRight": 5,
"LocTop": 6,
"MapID": 1,
"ParentWorldMapID": 10
}
}

View file

@ -273,7 +273,7 @@
"SMSG_INVENTORY_CHANGE_FAILURE": "0x112",
"SMSG_OPEN_CONTAINER": "0x113",
"CMSG_INSPECT": "0x114",
"SMSG_INSPECT": "0x115",
"SMSG_INSPECT_RESULTS_UPDATE": "0x115",
"CMSG_INITIATE_TRADE": "0x116",
"CMSG_BEGIN_TRADE": "0x117",
"CMSG_BUSY_TRADE": "0x118",
@ -300,7 +300,7 @@
"CMSG_NEW_SPELL_SLOT": "0x12D",
"CMSG_CAST_SPELL": "0x12E",
"CMSG_CANCEL_CAST": "0x12F",
"SMSG_CAST_RESULT": "0x130",
"SMSG_CAST_FAILED": "0x130",
"SMSG_SPELL_START": "0x131",
"SMSG_SPELL_GO": "0x132",
"SMSG_SPELL_FAILURE": "0x133",
@ -504,8 +504,7 @@
"CMSG_GM_SET_SECURITY_GROUP": "0x1F9",
"CMSG_GM_NUKE": "0x1FA",
"MSG_RANDOM_ROLL": "0x1FB",
"SMSG_ENVIRONMENTALDAMAGELOG": "0x1FC",
"CMSG_RWHOIS_OBSOLETE": "0x1FD",
"SMSG_ENVIRONMENTAL_DAMAGE_LOG": "0x1FC",
"SMSG_RWHOIS": "0x1FE",
"MSG_LOOKING_FOR_GROUP": "0x1FF",
"CMSG_SET_LOOKING_FOR_GROUP": "0x200",
@ -528,7 +527,6 @@
"CMSG_GMTICKET_GETTICKET": "0x211",
"SMSG_GMTICKET_GETTICKET": "0x212",
"CMSG_UNLEARN_TALENTS": "0x213",
"SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE": "0x214",
"SMSG_GAMEOBJECT_DESPAWN_ANIM": "0x215",
"MSG_CORPSE_QUERY": "0x216",
"CMSG_GMTICKET_DELETETICKET": "0x217",
@ -538,7 +536,7 @@
"SMSG_GMTICKET_SYSTEMSTATUS": "0x21B",
"CMSG_SPIRIT_HEALER_ACTIVATE": "0x21C",
"CMSG_SET_STAT_CHEAT": "0x21D",
"SMSG_SET_REST_START": "0x21E",
"SMSG_QUEST_FORCE_REMOVE": "0x21E",
"CMSG_SKILL_BUY_STEP": "0x21F",
"CMSG_SKILL_BUY_RANK": "0x220",
"CMSG_XP_CHEAT": "0x221",
@ -571,8 +569,6 @@
"CMSG_BATTLEFIELD_LIST": "0x23C",
"SMSG_BATTLEFIELD_LIST": "0x23D",
"CMSG_BATTLEFIELD_JOIN": "0x23E",
"SMSG_BATTLEFIELD_WIN_OBSOLETE": "0x23F",
"SMSG_BATTLEFIELD_LOSE_OBSOLETE": "0x240",
"CMSG_TAXICLEARNODE": "0x241",
"CMSG_TAXIENABLENODE": "0x242",
"CMSG_ITEM_TEXT_QUERY": "0x243",
@ -605,7 +601,6 @@
"SMSG_AUCTION_BIDDER_NOTIFICATION": "0x25E",
"SMSG_AUCTION_OWNER_NOTIFICATION": "0x25F",
"SMSG_PROCRESIST": "0x260",
"SMSG_STANDSTATE_CHANGE_FAILURE_OBSOLETE": "0x261",
"SMSG_DISPEL_FAILED": "0x262",
"SMSG_SPELLORDAMAGE_IMMUNE": "0x263",
"CMSG_AUCTION_LIST_BIDDER_ITEMS": "0x264",
@ -693,8 +688,8 @@
"SMSG_SCRIPT_MESSAGE": "0x2B6",
"SMSG_DUEL_COUNTDOWN": "0x2B7",
"SMSG_AREA_TRIGGER_MESSAGE": "0x2B8",
"CMSG_TOGGLE_HELM": "0x2B9",
"CMSG_TOGGLE_CLOAK": "0x2BA",
"CMSG_SHOWING_HELM": "0x2B9",
"CMSG_SHOWING_CLOAK": "0x2BA",
"SMSG_MEETINGSTONE_JOINFAILED": "0x2BB",
"SMSG_PLAYER_SKINNED": "0x2BC",
"SMSG_DURABILITY_DAMAGE_DEATH": "0x2BD",
@ -821,6 +816,5 @@
"SMSG_LOTTERY_RESULT_OBSOLETE": "0x337",
"SMSG_CHARACTER_PROFILE": "0x338",
"SMSG_CHARACTER_PROFILE_REALM_CONNECTED": "0x339",
"SMSG_UNK": "0x33A",
"SMSG_DEFENSE_MESSAGE": "0x33B"
}

View file

@ -1,48 +1,49 @@
{
"CONTAINER_FIELD_NUM_SLOTS": 48,
"CONTAINER_FIELD_SLOT_1": 50,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_DURABILITY": 48,
"ITEM_FIELD_MAXDURABILITY": 49,
"ITEM_FIELD_STACK_COUNT": 14,
"OBJECT_FIELD_ENTRY": 3,
"OBJECT_FIELD_SCALE_X": 4,
"UNIT_FIELD_TARGET_LO": 16,
"UNIT_FIELD_TARGET_HI": 17,
"PLAYER_BYTES": 191,
"PLAYER_BYTES_2": 192,
"PLAYER_END": 1282,
"PLAYER_EXPLORED_ZONES_START": 1111,
"PLAYER_FIELD_BANKBAG_SLOT_1": 612,
"PLAYER_FIELD_BANK_SLOT_1": 564,
"PLAYER_FIELD_COINAGE": 1176,
"PLAYER_FIELD_INV_SLOT_HEAD": 486,
"PLAYER_FIELD_PACK_SLOT_1": 532,
"PLAYER_FLAGS": 190,
"PLAYER_NEXT_LEVEL_XP": 717,
"PLAYER_QUEST_LOG_START": 198,
"PLAYER_REST_STATE_EXPERIENCE": 1175,
"PLAYER_SKILL_INFO_START": 718,
"PLAYER_XP": 716,
"UNIT_DYNAMIC_FLAGS": 143,
"UNIT_END": 188,
"UNIT_FIELD_AURAFLAGS": 98,
"UNIT_FIELD_AURAS": 50,
"UNIT_FIELD_BYTES_0": 36,
"UNIT_FIELD_HEALTH": 22,
"UNIT_FIELD_POWER1": 23,
"UNIT_FIELD_MAXHEALTH": 28,
"UNIT_FIELD_MAXPOWER1": 29,
"UNIT_FIELD_LEVEL": 34,
"UNIT_FIELD_BYTES_1": 133,
"UNIT_FIELD_DISPLAYID": 131,
"UNIT_FIELD_FACTIONTEMPLATE": 35,
"UNIT_FIELD_FLAGS": 46,
"UNIT_FIELD_DISPLAYID": 131,
"UNIT_FIELD_HEALTH": 22,
"UNIT_FIELD_LEVEL": 34,
"UNIT_FIELD_MAXHEALTH": 28,
"UNIT_FIELD_MAXPOWER1": 29,
"UNIT_FIELD_MOUNTDISPLAYID": 133,
"UNIT_FIELD_AURAS": 50,
"UNIT_FIELD_AURAFLAGS": 98,
"UNIT_NPC_FLAGS": 147,
"UNIT_DYNAMIC_FLAGS": 143,
"UNIT_FIELD_POWER1": 23,
"UNIT_FIELD_RESISTANCES": 154,
"UNIT_FIELD_STAT0": 138,
"UNIT_FIELD_STAT1": 139,
"UNIT_FIELD_STAT2": 140,
"UNIT_FIELD_STAT3": 141,
"UNIT_FIELD_STAT4": 142,
"UNIT_END": 188,
"PLAYER_FLAGS": 190,
"PLAYER_BYTES": 191,
"PLAYER_BYTES_2": 192,
"PLAYER_XP": 716,
"PLAYER_NEXT_LEVEL_XP": 717,
"PLAYER_REST_STATE_EXPERIENCE": 1175,
"PLAYER_FIELD_COINAGE": 1176,
"PLAYER_QUEST_LOG_START": 198,
"PLAYER_FIELD_INV_SLOT_HEAD": 486,
"PLAYER_FIELD_PACK_SLOT_1": 532,
"PLAYER_FIELD_BANK_SLOT_1": 564,
"PLAYER_FIELD_BANKBAG_SLOT_1": 612,
"PLAYER_SKILL_INFO_START": 718,
"PLAYER_EXPLORED_ZONES_START": 1111,
"PLAYER_END": 1282,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_STACK_COUNT": 14,
"ITEM_FIELD_DURABILITY": 48,
"ITEM_FIELD_MAXDURABILITY": 49,
"CONTAINER_FIELD_NUM_SLOTS": 48,
"CONTAINER_FIELD_SLOT_1": 50
"UNIT_FIELD_TARGET_HI": 17,
"UNIT_FIELD_TARGET_LO": 16,
"UNIT_NPC_FLAGS": 147
}

View file

@ -1,115 +1,307 @@
{
"Spell": {
"ID": 0, "Attributes": 5, "IconID": 124,
"Name": 127, "Tooltip": 154, "Rank": 136, "SchoolMask": 215,
"CastingTimeIndex": 22, "PowerType": 35, "ManaCost": 36, "RangeIndex": 40,
"DispelType": 3
"AreaTable": {
"ExploreFlag": 3,
"ID": 0,
"MapID": 1,
"ParentAreaNum": 2
},
"SpellRange": { "MaxRange": 4 },
"ItemDisplayInfo": {
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
"CharHairGeosets": {
"GeosetID": 4,
"RaceID": 1,
"SexID": 2,
"Variation": 3
},
"CharSections": {
"RaceID": 1, "SexID": 2, "BaseSection": 3,
"VariationIndex": 4, "ColorIndex": 5,
"Texture1": 6, "Texture2": 7, "Texture3": 8,
"Flags": 9
"BaseSection": 3,
"ColorIndex": 5,
"Flags": 9,
"RaceID": 1,
"SexID": 2,
"Texture1": 6,
"Texture2": 7,
"Texture3": 8,
"VariationIndex": 4
},
"SpellIcon": { "ID": 0, "Path": 1 },
"FactionTemplate": {
"ID": 0, "Faction": 1, "FactionGroup": 3,
"FriendGroup": 4, "EnemyGroup": 5,
"Enemy0": 6, "Enemy1": 7, "Enemy2": 8, "Enemy3": 9
},
"Faction": {
"ID": 0, "ReputationRaceMask0": 2, "ReputationRaceMask1": 3,
"ReputationRaceMask2": 4, "ReputationRaceMask3": 5,
"ReputationBase0": 10, "ReputationBase1": 11,
"ReputationBase2": 12, "ReputationBase3": 13
},
"CharTitles": { "ID": 0, "Title": 2, "TitleBit": 20 },
"AreaTable": { "ID": 0, "MapID": 1, "ParentAreaNum": 2, "ExploreFlag": 3 },
"CreatureDisplayInfoExtra": {
"ID": 0, "RaceID": 1, "SexID": 2, "SkinID": 3, "FaceID": 4,
"HairStyleID": 5, "HairColorID": 6, "FacialHairID": 7,
"EquipDisplay0": 8, "EquipDisplay1": 9, "EquipDisplay2": 10,
"EquipDisplay3": 11, "EquipDisplay4": 12, "EquipDisplay5": 13,
"EquipDisplay6": 14, "EquipDisplay7": 15, "EquipDisplay8": 16,
"EquipDisplay9": 17, "EquipDisplay10": 18, "BakeName": 20
},
"CreatureDisplayInfo": {
"ID": 0, "ModelID": 1, "ExtraDisplayId": 3,
"Skin1": 6, "Skin2": 7, "Skin3": 8
},
"TaxiNodes": {
"ID": 0, "MapID": 1, "X": 2, "Y": 3, "Z": 4, "Name": 5,
"MountDisplayIdAllianceFallback": 12, "MountDisplayIdHordeFallback": 13,
"MountDisplayIdAlliance": 14, "MountDisplayIdHorde": 15
},
"TaxiPath": { "ID": 0, "FromNode": 1, "ToNode": 2, "Cost": 3 },
"TaxiPathNode": {
"ID": 0, "PathID": 1, "NodeIndex": 2, "MapID": 3,
"X": 4, "Y": 5, "Z": 6
},
"TalentTab": {
"ID": 0, "Name": 1, "ClassMask": 12,
"OrderIndex": 14, "BackgroundFile": 15
},
"Talent": {
"ID": 0, "TabID": 1, "Row": 2, "Column": 3,
"RankSpell0": 4, "PrereqTalent0": 9, "PrereqRank0": 12
},
"SkillLineAbility": { "SkillLineID": 1, "SpellID": 2 },
"SkillLine": { "ID": 0, "Category": 1, "Name": 3 },
"Map": { "ID": 0, "InternalName": 1 },
"CreatureModelData": { "ID": 0, "ModelPath": 2 },
"CharHairGeosets": {
"RaceID": 1, "SexID": 2, "Variation": 3, "GeosetID": 4
"CharTitles": {
"ID": 0,
"Title": 2,
"TitleBit": 20
},
"CharacterFacialHairStyles": {
"RaceID": 0, "SexID": 1, "Variation": 2,
"Geoset100": 3, "Geoset300": 4, "Geoset200": 5
"Geoset100": 3,
"Geoset200": 5,
"Geoset300": 4,
"RaceID": 0,
"SexID": 1,
"Variation": 2
},
"CreatureDisplayInfo": {
"ExtraDisplayId": 3,
"ID": 0,
"ModelID": 1,
"Skin1": 6,
"Skin2": 7,
"Skin3": 8
},
"CreatureDisplayInfoExtra": {
"BakeName": 20,
"EquipDisplay0": 8,
"EquipDisplay1": 9,
"EquipDisplay10": 18,
"EquipDisplay2": 10,
"EquipDisplay3": 11,
"EquipDisplay4": 12,
"EquipDisplay5": 13,
"EquipDisplay6": 14,
"EquipDisplay7": 15,
"EquipDisplay8": 16,
"EquipDisplay9": 17,
"FaceID": 4,
"FacialHairID": 7,
"HairColorID": 6,
"HairStyleID": 5,
"ID": 0,
"RaceID": 1,
"SexID": 2,
"SkinID": 3
},
"CreatureModelData": {
"ID": 0,
"ModelPath": 2
},
"Emotes": {
"AnimID": 2,
"ID": 0
},
"GameObjectDisplayInfo": { "ID": 0, "ModelName": 1 },
"Emotes": { "ID": 0, "AnimID": 2 },
"EmotesText": {
"ID": 0, "Command": 1, "EmoteRef": 2,
"OthersTargetTextID": 3, "SenderTargetTextID": 5,
"OthersNoTargetTextID": 7, "SenderNoTargetTextID": 9
"Command": 1,
"EmoteRef": 2,
"ID": 0,
"OthersNoTargetTextID": 7,
"OthersTargetTextID": 3,
"SenderNoTargetTextID": 9,
"SenderTargetTextID": 5
},
"EmotesTextData": { "ID": 0, "Text": 1 },
"Light": {
"ID": 0, "MapID": 1, "X": 2, "Z": 3, "Y": 4,
"InnerRadius": 5, "OuterRadius": 6, "LightParamsID": 7,
"LightParamsIDRain": 8, "LightParamsIDUnderwater": 9
"EmotesTextData": {
"ID": 0,
"Text": 1
},
"LightParams": { "LightParamsID": 0 },
"LightIntBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"Faction": {
"ID": 0,
"ReputationBase0": 10,
"ReputationBase1": 11,
"ReputationBase2": 12,
"ReputationBase3": 13,
"ReputationRaceMask0": 2,
"ReputationRaceMask1": 3,
"ReputationRaceMask2": 4,
"ReputationRaceMask3": 5
},
"LightFloatBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"FactionTemplate": {
"Enemy0": 6,
"Enemy1": 7,
"Enemy2": 8,
"Enemy3": 9,
"EnemyGroup": 5,
"Faction": 1,
"FactionGroup": 3,
"FriendGroup": 4,
"ID": 0
},
"WorldMapArea": {
"ID": 0, "MapID": 1, "AreaID": 2, "AreaName": 3,
"LocLeft": 4, "LocRight": 5, "LocTop": 6, "LocBottom": 7,
"DisplayMapID": 8, "ParentWorldMapID": 10
"GameObjectDisplayInfo": {
"ID": 0,
"ModelName": 1
},
"SpellItemEnchantment": {
"ID": 0, "Name": 8
"ItemDisplayInfo": {
"GeosetGroup1": 7,
"GeosetGroup3": 9,
"ID": 0,
"InventoryIcon": 5,
"LeftModel": 1,
"LeftModelTexture": 3,
"TextureArmLower": 15,
"TextureArmUpper": 14,
"TextureFoot": 21,
"TextureHand": 16,
"TextureLegLower": 20,
"TextureLegUpper": 19,
"TextureTorsoLower": 18,
"TextureTorsoUpper": 17
},
"ItemSet": {
"ID": 0, "Name": 1,
"Item0": 18, "Item1": 19, "Item2": 20, "Item3": 21, "Item4": 22,
"Item5": 23, "Item6": 24, "Item7": 25, "Item8": 26, "Item9": 27,
"Spell0": 28, "Spell1": 29, "Spell2": 30, "Spell3": 31, "Spell4": 32,
"Spell5": 33, "Spell6": 34, "Spell7": 35, "Spell8": 36, "Spell9": 37,
"Threshold0": 38, "Threshold1": 39, "Threshold2": 40, "Threshold3": 41,
"Threshold4": 42, "Threshold5": 43, "Threshold6": 44, "Threshold7": 45,
"Threshold8": 46, "Threshold9": 47
"ID": 0,
"Item0": 18,
"Item1": 19,
"Item2": 20,
"Item3": 21,
"Item4": 22,
"Item5": 23,
"Item6": 24,
"Item7": 25,
"Item8": 26,
"Item9": 27,
"Name": 1,
"Spell0": 28,
"Spell1": 29,
"Spell2": 30,
"Spell3": 31,
"Spell4": 32,
"Spell5": 33,
"Spell6": 34,
"Spell7": 35,
"Spell8": 36,
"Spell9": 37,
"Threshold0": 38,
"Threshold1": 39,
"Threshold2": 40,
"Threshold3": 41,
"Threshold4": 42,
"Threshold5": 43,
"Threshold6": 44,
"Threshold7": 45,
"Threshold8": 46,
"Threshold9": 47
},
"Light": {
"ID": 0,
"InnerRadius": 5,
"LightParamsID": 7,
"LightParamsIDRain": 8,
"LightParamsIDUnderwater": 9,
"MapID": 1,
"OuterRadius": 6,
"X": 2,
"Y": 4,
"Z": 3
},
"LightFloatBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightIntBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightParams": {
"LightParamsID": 0
},
"Map": {
"ID": 0,
"InternalName": 1
},
"SkillLine": {
"Category": 1,
"ID": 0,
"Name": 3
},
"SkillLineAbility": {
"SkillLineID": 1,
"SpellID": 2
},
"Spell": {
"Attributes": 5,
"AttributesEx": 6,
"CastingTimeIndex": 22,
"DispelType": 3,
"DurationIndex": 40,
"EffectBasePoints0": 80,
"EffectBasePoints1": 81,
"EffectBasePoints2": 82,
"ID": 0,
"IconID": 124,
"ManaCost": 36,
"Name": 127,
"PowerType": 35,
"RangeIndex": 40,
"Rank": 136,
"SchoolMask": 215,
"Tooltip": 154
},
"SpellIcon": {
"ID": 0,
"Path": 1
},
"SpellItemEnchantment": {
"ID": 0,
"Name": 8
},
"SpellRange": {
"MaxRange": 4
},
"SpellVisual": {
"CastKit": 2,
"ID": 0,
"ImpactKit": 3,
"MissileModel": 8
},
"SpellVisualEffectName": {
"FilePath": 2,
"ID": 0
},
"SpellVisualKit": {
"BaseEffect": 5,
"ID": 0,
"SpecialEffect0": 11,
"SpecialEffect1": 12,
"SpecialEffect2": 13
},
"Talent": {
"Column": 3,
"ID": 0,
"PrereqRank0": 12,
"PrereqTalent0": 9,
"RankSpell0": 4,
"Row": 2,
"TabID": 1
},
"TalentTab": {
"BackgroundFile": 15,
"ClassMask": 12,
"ID": 0,
"Name": 1,
"OrderIndex": 14
},
"TaxiNodes": {
"ID": 0,
"MapID": 1,
"MountDisplayIdAlliance": 14,
"MountDisplayIdAllianceFallback": 12,
"MountDisplayIdHorde": 15,
"MountDisplayIdHordeFallback": 13,
"Name": 5,
"X": 2,
"Y": 3,
"Z": 4
},
"TaxiPath": {
"Cost": 3,
"FromNode": 1,
"ID": 0,
"ToNode": 2
},
"TaxiPathNode": {
"ID": 0,
"MapID": 3,
"NodeIndex": 2,
"PathID": 1,
"X": 4,
"Y": 5,
"Z": 6
},
"WorldMapArea": {
"AreaID": 2,
"AreaName": 3,
"DisplayMapID": 8,
"ID": 0,
"LocBottom": 7,
"LocLeft": 4,
"LocRight": 5,
"LocTop": 6,
"MapID": 1,
"ParentWorldMapID": 10
}
}

View file

@ -1,46 +1,49 @@
{
"CONTAINER_FIELD_NUM_SLOTS": 64,
"CONTAINER_FIELD_SLOT_1": 66,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_DURABILITY": 60,
"ITEM_FIELD_MAXDURABILITY": 61,
"ITEM_FIELD_STACK_COUNT": 14,
"OBJECT_FIELD_ENTRY": 3,
"OBJECT_FIELD_SCALE_X": 4,
"UNIT_FIELD_TARGET_LO": 16,
"UNIT_FIELD_TARGET_HI": 17,
"PLAYER_BYTES": 237,
"PLAYER_BYTES_2": 238,
"PLAYER_EXPLORED_ZONES_START": 1312,
"PLAYER_FIELD_ARENA_CURRENCY": 1506,
"PLAYER_FIELD_BANKBAG_SLOT_1": 784,
"PLAYER_FIELD_BANK_SLOT_1": 728,
"PLAYER_FIELD_COINAGE": 1441,
"PLAYER_FIELD_HONOR_CURRENCY": 1505,
"PLAYER_FIELD_INV_SLOT_HEAD": 650,
"PLAYER_FIELD_PACK_SLOT_1": 696,
"PLAYER_FLAGS": 236,
"PLAYER_NEXT_LEVEL_XP": 927,
"PLAYER_QUEST_LOG_START": 244,
"PLAYER_REST_STATE_EXPERIENCE": 1440,
"PLAYER_SKILL_INFO_START": 928,
"PLAYER_XP": 926,
"UNIT_DYNAMIC_FLAGS": 164,
"UNIT_END": 234,
"UNIT_FIELD_BYTES_0": 36,
"UNIT_FIELD_HEALTH": 22,
"UNIT_FIELD_POWER1": 23,
"UNIT_FIELD_MAXHEALTH": 28,
"UNIT_FIELD_MAXPOWER1": 29,
"UNIT_FIELD_LEVEL": 34,
"UNIT_FIELD_BYTES_1": 137,
"UNIT_FIELD_DISPLAYID": 152,
"UNIT_FIELD_FACTIONTEMPLATE": 35,
"UNIT_FIELD_FLAGS": 46,
"UNIT_FIELD_FLAGS_2": 47,
"UNIT_FIELD_DISPLAYID": 152,
"UNIT_FIELD_HEALTH": 22,
"UNIT_FIELD_LEVEL": 34,
"UNIT_FIELD_MAXHEALTH": 28,
"UNIT_FIELD_MAXPOWER1": 29,
"UNIT_FIELD_MOUNTDISPLAYID": 154,
"UNIT_NPC_FLAGS": 168,
"UNIT_DYNAMIC_FLAGS": 164,
"UNIT_FIELD_POWER1": 23,
"UNIT_FIELD_RESISTANCES": 185,
"UNIT_FIELD_STAT0": 159,
"UNIT_FIELD_STAT1": 160,
"UNIT_FIELD_STAT2": 161,
"UNIT_FIELD_STAT3": 162,
"UNIT_FIELD_STAT4": 163,
"UNIT_END": 234,
"PLAYER_FLAGS": 236,
"PLAYER_BYTES": 237,
"PLAYER_BYTES_2": 238,
"PLAYER_XP": 926,
"PLAYER_NEXT_LEVEL_XP": 927,
"PLAYER_REST_STATE_EXPERIENCE": 1440,
"PLAYER_FIELD_COINAGE": 1441,
"PLAYER_QUEST_LOG_START": 244,
"PLAYER_FIELD_INV_SLOT_HEAD": 650,
"PLAYER_FIELD_PACK_SLOT_1": 696,
"PLAYER_FIELD_BANK_SLOT_1": 728,
"PLAYER_FIELD_BANKBAG_SLOT_1": 784,
"PLAYER_SKILL_INFO_START": 928,
"PLAYER_EXPLORED_ZONES_START": 1312,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_STACK_COUNT": 14,
"ITEM_FIELD_DURABILITY": 60,
"ITEM_FIELD_MAXDURABILITY": 61,
"CONTAINER_FIELD_NUM_SLOTS": 64,
"CONTAINER_FIELD_SLOT_1": 66
"UNIT_FIELD_TARGET_HI": 17,
"UNIT_FIELD_TARGET_LO": 16,
"UNIT_NPC_FLAGS": 168
}

View file

@ -1,112 +1,297 @@
{
"Spell": {
"ID": 0, "Attributes": 5, "IconID": 117,
"Name": 120, "Tooltip": 147, "Rank": 129, "SchoolEnum": 1,
"CastingTimeIndex": 15, "PowerType": 28, "ManaCost": 29, "RangeIndex": 33,
"DispelType": 4
"AreaTable": {
"ExploreFlag": 3,
"ID": 0,
"MapID": 1,
"ParentAreaNum": 2
},
"SpellRange": { "MaxRange": 2 },
"ItemDisplayInfo": {
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
"CharHairGeosets": {
"GeosetID": 4,
"RaceID": 1,
"SexID": 2,
"Variation": 3
},
"CharSections": {
"RaceID": 1, "SexID": 2, "BaseSection": 3,
"VariationIndex": 4, "ColorIndex": 5,
"Texture1": 6, "Texture2": 7, "Texture3": 8,
"Flags": 9
},
"SpellIcon": { "ID": 0, "Path": 1 },
"FactionTemplate": {
"ID": 0, "Faction": 1, "FactionGroup": 3,
"FriendGroup": 4, "EnemyGroup": 5,
"Enemy0": 6, "Enemy1": 7, "Enemy2": 8, "Enemy3": 9
},
"Faction": {
"ID": 0, "ReputationRaceMask0": 2, "ReputationRaceMask1": 3,
"ReputationRaceMask2": 4, "ReputationRaceMask3": 5,
"ReputationBase0": 10, "ReputationBase1": 11,
"ReputationBase2": 12, "ReputationBase3": 13
},
"AreaTable": { "ID": 0, "MapID": 1, "ParentAreaNum": 2, "ExploreFlag": 3 },
"CreatureDisplayInfoExtra": {
"ID": 0, "RaceID": 1, "SexID": 2, "SkinID": 3, "FaceID": 4,
"HairStyleID": 5, "HairColorID": 6, "FacialHairID": 7,
"EquipDisplay0": 8, "EquipDisplay1": 9, "EquipDisplay2": 10,
"EquipDisplay3": 11, "EquipDisplay4": 12, "EquipDisplay5": 13,
"EquipDisplay6": 14, "EquipDisplay7": 15, "EquipDisplay8": 16,
"EquipDisplay9": 17, "BakeName": 18
},
"CreatureDisplayInfo": {
"ID": 0, "ModelID": 1, "ExtraDisplayId": 3,
"Skin1": 6, "Skin2": 7, "Skin3": 8
},
"TaxiNodes": {
"ID": 0, "MapID": 1, "X": 2, "Y": 3, "Z": 4, "Name": 5
},
"TaxiPath": { "ID": 0, "FromNode": 1, "ToNode": 2, "Cost": 3 },
"TaxiPathNode": {
"ID": 0, "PathID": 1, "NodeIndex": 2, "MapID": 3,
"X": 4, "Y": 5, "Z": 6
},
"TalentTab": {
"ID": 0, "Name": 1, "ClassMask": 12,
"OrderIndex": 14, "BackgroundFile": 15
},
"Talent": {
"ID": 0, "TabID": 1, "Row": 2, "Column": 3,
"RankSpell0": 4, "PrereqTalent0": 9, "PrereqRank0": 12
},
"SkillLineAbility": { "SkillLineID": 1, "SpellID": 2 },
"SkillLine": { "ID": 0, "Category": 1, "Name": 3 },
"Map": { "ID": 0, "InternalName": 1 },
"CreatureModelData": { "ID": 0, "ModelPath": 2 },
"CharHairGeosets": {
"RaceID": 1, "SexID": 2, "Variation": 3, "GeosetID": 4
"BaseSection": 3,
"ColorIndex": 5,
"Flags": 9,
"RaceID": 1,
"SexID": 2,
"Texture1": 6,
"Texture2": 7,
"Texture3": 8,
"VariationIndex": 4
},
"CharacterFacialHairStyles": {
"RaceID": 0, "SexID": 1, "Variation": 2,
"Geoset100": 3, "Geoset300": 4, "Geoset200": 5
"Geoset100": 3,
"Geoset200": 5,
"Geoset300": 4,
"RaceID": 0,
"SexID": 1,
"Variation": 2
},
"CreatureDisplayInfo": {
"ExtraDisplayId": 3,
"ID": 0,
"ModelID": 1,
"Skin1": 6,
"Skin2": 7,
"Skin3": 8
},
"CreatureDisplayInfoExtra": {
"BakeName": 18,
"EquipDisplay0": 8,
"EquipDisplay1": 9,
"EquipDisplay2": 10,
"EquipDisplay3": 11,
"EquipDisplay4": 12,
"EquipDisplay5": 13,
"EquipDisplay6": 14,
"EquipDisplay7": 15,
"EquipDisplay8": 16,
"EquipDisplay9": 17,
"FaceID": 4,
"FacialHairID": 7,
"HairColorID": 6,
"HairStyleID": 5,
"ID": 0,
"RaceID": 1,
"SexID": 2,
"SkinID": 3
},
"CreatureModelData": {
"ID": 0,
"ModelPath": 2
},
"Emotes": {
"AnimID": 2,
"ID": 0
},
"GameObjectDisplayInfo": { "ID": 0, "ModelName": 1 },
"Emotes": { "ID": 0, "AnimID": 2 },
"EmotesText": {
"ID": 0, "Command": 1, "EmoteRef": 2,
"OthersTargetTextID": 3, "SenderTargetTextID": 5,
"OthersNoTargetTextID": 7, "SenderNoTargetTextID": 9
"Command": 1,
"EmoteRef": 2,
"ID": 0,
"OthersNoTargetTextID": 7,
"OthersTargetTextID": 3,
"SenderNoTargetTextID": 9,
"SenderTargetTextID": 5
},
"EmotesTextData": { "ID": 0, "Text": 1 },
"Light": {
"ID": 0, "MapID": 1, "X": 2, "Z": 3, "Y": 4,
"InnerRadius": 5, "OuterRadius": 6, "LightParamsID": 7,
"LightParamsIDRain": 8, "LightParamsIDUnderwater": 9
"EmotesTextData": {
"ID": 0,
"Text": 1
},
"LightParams": { "LightParamsID": 0 },
"LightIntBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"Faction": {
"ID": 0,
"ReputationBase0": 10,
"ReputationBase1": 11,
"ReputationBase2": 12,
"ReputationBase3": 13,
"ReputationRaceMask0": 2,
"ReputationRaceMask1": 3,
"ReputationRaceMask2": 4,
"ReputationRaceMask3": 5
},
"LightFloatBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"FactionTemplate": {
"Enemy0": 6,
"Enemy1": 7,
"Enemy2": 8,
"Enemy3": 9,
"EnemyGroup": 5,
"Faction": 1,
"FactionGroup": 3,
"FriendGroup": 4,
"ID": 0
},
"WorldMapArea": {
"ID": 0, "MapID": 1, "AreaID": 2, "AreaName": 3,
"LocLeft": 4, "LocRight": 5, "LocTop": 6, "LocBottom": 7,
"DisplayMapID": 8, "ParentWorldMapID": 10
"GameObjectDisplayInfo": {
"ID": 0,
"ModelName": 1
},
"SpellItemEnchantment": {
"ID": 0, "Name": 8
"ItemDisplayInfo": {
"GeosetGroup1": 7,
"GeosetGroup3": 9,
"ID": 0,
"InventoryIcon": 5,
"LeftModel": 1,
"LeftModelTexture": 3,
"TextureArmLower": 15,
"TextureArmUpper": 14,
"TextureFoot": 21,
"TextureHand": 16,
"TextureLegLower": 20,
"TextureLegUpper": 19,
"TextureTorsoLower": 18,
"TextureTorsoUpper": 17
},
"ItemSet": {
"ID": 0, "Name": 1,
"Item0": 10, "Item1": 11, "Item2": 12, "Item3": 13, "Item4": 14,
"Item5": 15, "Item6": 16, "Item7": 17, "Item8": 18, "Item9": 19,
"Spell0": 20, "Spell1": 21, "Spell2": 22, "Spell3": 23, "Spell4": 24,
"Spell5": 25, "Spell6": 26, "Spell7": 27, "Spell8": 28, "Spell9": 29,
"Threshold0": 30, "Threshold1": 31, "Threshold2": 32, "Threshold3": 33,
"Threshold4": 34, "Threshold5": 35, "Threshold6": 36, "Threshold7": 37,
"Threshold8": 38, "Threshold9": 39
"ID": 0,
"Item0": 10,
"Item1": 11,
"Item2": 12,
"Item3": 13,
"Item4": 14,
"Item5": 15,
"Item6": 16,
"Item7": 17,
"Item8": 18,
"Item9": 19,
"Name": 1,
"Spell0": 20,
"Spell1": 21,
"Spell2": 22,
"Spell3": 23,
"Spell4": 24,
"Spell5": 25,
"Spell6": 26,
"Spell7": 27,
"Spell8": 28,
"Spell9": 29,
"Threshold0": 30,
"Threshold1": 31,
"Threshold2": 32,
"Threshold3": 33,
"Threshold4": 34,
"Threshold5": 35,
"Threshold6": 36,
"Threshold7": 37,
"Threshold8": 38,
"Threshold9": 39
},
"Light": {
"ID": 0,
"InnerRadius": 5,
"LightParamsID": 7,
"LightParamsIDRain": 8,
"LightParamsIDUnderwater": 9,
"MapID": 1,
"OuterRadius": 6,
"X": 2,
"Y": 4,
"Z": 3
},
"LightFloatBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightIntBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightParams": {
"LightParamsID": 0
},
"Map": {
"ID": 0,
"InternalName": 1
},
"SkillLine": {
"Category": 1,
"ID": 0,
"Name": 3
},
"SkillLineAbility": {
"SkillLineID": 1,
"SpellID": 2
},
"Spell": {
"Attributes": 5,
"AttributesEx": 6,
"CastingTimeIndex": 15,
"DispelType": 4,
"DurationIndex": 40,
"EffectBasePoints0": 80,
"EffectBasePoints1": 81,
"EffectBasePoints2": 82,
"ID": 0,
"IconID": 117,
"ManaCost": 29,
"Name": 120,
"PowerType": 28,
"RangeIndex": 33,
"Rank": 129,
"SchoolEnum": 1,
"Tooltip": 147
},
"SpellIcon": {
"ID": 0,
"Path": 1
},
"SpellItemEnchantment": {
"ID": 0,
"Name": 8
},
"SpellRange": {
"MaxRange": 2
},
"SpellVisual": {
"CastKit": 2,
"ID": 0,
"ImpactKit": 3,
"MissileModel": 8
},
"SpellVisualEffectName": {
"FilePath": 2,
"ID": 0
},
"SpellVisualKit": {
"BaseEffect": 5,
"ID": 0,
"SpecialEffect0": 11,
"SpecialEffect1": 12,
"SpecialEffect2": 13
},
"Talent": {
"Column": 3,
"ID": 0,
"PrereqRank0": 12,
"PrereqTalent0": 9,
"RankSpell0": 4,
"Row": 2,
"TabID": 1
},
"TalentTab": {
"BackgroundFile": 15,
"ClassMask": 12,
"ID": 0,
"Name": 1,
"OrderIndex": 14
},
"TaxiNodes": {
"ID": 0,
"MapID": 1,
"Name": 5,
"X": 2,
"Y": 3,
"Z": 4
},
"TaxiPath": {
"Cost": 3,
"FromNode": 1,
"ID": 0,
"ToNode": 2
},
"TaxiPathNode": {
"ID": 0,
"MapID": 3,
"NodeIndex": 2,
"PathID": 1,
"X": 4,
"Y": 5,
"Z": 6
},
"WorldMapArea": {
"AreaID": 2,
"AreaName": 3,
"DisplayMapID": 8,
"ID": 0,
"LocBottom": 7,
"LocLeft": 4,
"LocRight": 5,
"LocTop": 6,
"MapID": 1,
"ParentWorldMapID": 10
}
}

View file

@ -1,300 +1,6 @@
{
"CMSG_PING": "0x1DC",
"CMSG_AUTH_SESSION": "0x1ED",
"CMSG_CHAR_CREATE": "0x036",
"CMSG_CHAR_ENUM": "0x037",
"CMSG_CHAR_DELETE": "0x038",
"CMSG_PLAYER_LOGIN": "0x03D",
"MSG_MOVE_START_FORWARD": "0x0B5",
"MSG_MOVE_START_BACKWARD": "0x0B6",
"MSG_MOVE_STOP": "0x0B7",
"MSG_MOVE_START_STRAFE_LEFT": "0x0B8",
"MSG_MOVE_START_STRAFE_RIGHT": "0x0B9",
"MSG_MOVE_STOP_STRAFE": "0x0BA",
"MSG_MOVE_JUMP": "0x0BB",
"MSG_MOVE_START_TURN_LEFT": "0x0BC",
"MSG_MOVE_START_TURN_RIGHT": "0x0BD",
"MSG_MOVE_STOP_TURN": "0x0BE",
"MSG_MOVE_SET_FACING": "0x0DA",
"MSG_MOVE_FALL_LAND": "0x0C9",
"MSG_MOVE_START_SWIM": "0x0CA",
"MSG_MOVE_STOP_SWIM": "0x0CB",
"MSG_MOVE_HEARTBEAT": "0x0EE",
"SMSG_AUTH_CHALLENGE": "0x1EC",
"SMSG_AUTH_RESPONSE": "0x1EE",
"SMSG_CHAR_CREATE": "0x03A",
"SMSG_CHAR_ENUM": "0x03B",
"SMSG_CHAR_DELETE": "0x03C",
"SMSG_CHARACTER_LOGIN_FAILED": "0x041",
"SMSG_PONG": "0x1DD",
"SMSG_LOGIN_VERIFY_WORLD": "0x236",
"SMSG_INIT_WORLD_STATES": "0x2C2",
"SMSG_LOGIN_SETTIMESPEED": "0x042",
"SMSG_TUTORIAL_FLAGS": "0x0FD",
"SMSG_INITIALIZE_FACTIONS": "0x122",
"SMSG_WARDEN_DATA": "0x2E6",
"CMSG_WARDEN_DATA": "0x2E7",
"SMSG_NOTIFICATION": "0x1CB",
"SMSG_ACCOUNT_DATA_TIMES": "0x209",
"SMSG_UPDATE_OBJECT": "0x0A9",
"SMSG_COMPRESSED_UPDATE_OBJECT": "0x1F6",
"SMSG_PARTYKILLLOG": "0x1F5",
"SMSG_MONSTER_MOVE_TRANSPORT": "0x2AE",
"SMSG_SPLINE_MOVE_SET_WALK_MODE": "0x30E",
"SMSG_SPLINE_MOVE_SET_RUN_MODE": "0x30D",
"SMSG_SPLINE_SET_RUN_SPEED": "0x2FE",
"SMSG_SPLINE_SET_RUN_BACK_SPEED": "0x2FF",
"SMSG_SPLINE_SET_SWIM_SPEED": "0x300",
"SMSG_DESTROY_OBJECT": "0x0AA",
"CMSG_MESSAGECHAT": "0x095",
"SMSG_MESSAGECHAT": "0x096",
"CMSG_WHO": "0x062",
"SMSG_WHO": "0x063",
"CMSG_PLAYED_TIME": "0x1CC",
"SMSG_PLAYED_TIME": "0x1CD",
"CMSG_QUERY_TIME": "0x1CE",
"SMSG_QUERY_TIME_RESPONSE": "0x1CF",
"SMSG_FRIEND_STATUS": "0x068",
"SMSG_CONTACT_LIST": "0x067",
"CMSG_ADD_FRIEND": "0x069",
"CMSG_DEL_FRIEND": "0x06A",
"CMSG_ADD_IGNORE": "0x06C",
"CMSG_DEL_IGNORE": "0x06D",
"CMSG_PLAYER_LOGOUT": "0x04A",
"CMSG_LOGOUT_REQUEST": "0x04B",
"CMSG_LOGOUT_CANCEL": "0x04E",
"SMSG_LOGOUT_RESPONSE": "0x04C",
"SMSG_LOGOUT_COMPLETE": "0x04D",
"CMSG_STANDSTATECHANGE": "0x101",
"CMSG_SHOWING_HELM": "0x2B9",
"CMSG_SHOWING_CLOAK": "0x2BA",
"CMSG_TOGGLE_PVP": "0x253",
"CMSG_GUILD_INVITE": "0x082",
"CMSG_GUILD_ACCEPT": "0x084",
"CMSG_GUILD_DECLINE": "0x085",
"CMSG_GUILD_INFO": "0x087",
"CMSG_GUILD_ROSTER": "0x089",
"CMSG_GUILD_PROMOTE": "0x08B",
"CMSG_GUILD_DEMOTE": "0x08C",
"CMSG_GUILD_LEAVE": "0x08D",
"CMSG_GUILD_MOTD": "0x091",
"SMSG_GUILD_INFO": "0x088",
"SMSG_GUILD_ROSTER": "0x08A",
"CMSG_GUILD_QUERY": "0x054",
"SMSG_GUILD_QUERY_RESPONSE": "0x055",
"SMSG_GUILD_INVITE": "0x083",
"CMSG_GUILD_REMOVE": "0x08E",
"SMSG_GUILD_EVENT": "0x092",
"SMSG_GUILD_COMMAND_RESULT": "0x093",
"MSG_RAID_READY_CHECK": "0x322",
"SMSG_ITEM_PUSH_RESULT": "0x166",
"CMSG_DUEL_ACCEPTED": "0x16C",
"CMSG_DUEL_CANCELLED": "0x16D",
"SMSG_DUEL_REQUESTED": "0x167",
"CMSG_INITIATE_TRADE": "0x116",
"MSG_RANDOM_ROLL": "0x1FB",
"CMSG_SET_SELECTION": "0x13D",
"CMSG_NAME_QUERY": "0x050",
"SMSG_NAME_QUERY_RESPONSE": "0x051",
"CMSG_CREATURE_QUERY": "0x060",
"SMSG_CREATURE_QUERY_RESPONSE": "0x061",
"CMSG_GAMEOBJECT_QUERY": "0x05E",
"SMSG_GAMEOBJECT_QUERY_RESPONSE": "0x05F",
"CMSG_SET_ACTIVE_MOVER": "0x26A",
"CMSG_BINDER_ACTIVATE": "0x1B5",
"SMSG_LOG_XPGAIN": "0x1D0",
"_NOTE_MONSTER_MOVE": "These look swapped vs vanilla (0x0DD/0x2FB) but may be intentional Turtle WoW changes. Check if NPC movement breaks.",
"SMSG_MONSTER_MOVE": "0x2FB",
"SMSG_COMPRESSED_MOVES": "0x06B",
"CMSG_ATTACKSWING": "0x141",
"CMSG_ATTACKSTOP": "0x142",
"SMSG_ATTACKSTART": "0x143",
"SMSG_ATTACKSTOP": "0x144",
"SMSG_ATTACKERSTATEUPDATE": "0x14A",
"SMSG_AI_REACTION": "0x13C",
"SMSG_SPELLNONMELEEDAMAGELOG": "0x250",
"SMSG_PLAY_SPELL_VISUAL": "0x1F3",
"SMSG_SPELLHEALLOG": "0x150",
"SMSG_SPELLENERGIZELOG": "0x151",
"SMSG_PERIODICAURALOG": "0x24E",
"SMSG_ENVIRONMENTAL_DAMAGE_LOG": "0x1FC",
"CMSG_CAST_SPELL": "0x12E",
"CMSG_CANCEL_CAST": "0x12F",
"CMSG_CANCEL_AURA": "0x136",
"SMSG_CAST_FAILED": "0x130",
"SMSG_SPELL_START": "0x131",
"SMSG_SPELL_GO": "0x132",
"SMSG_SPELL_FAILURE": "0x133",
"SMSG_SPELL_COOLDOWN": "0x134",
"SMSG_COOLDOWN_EVENT": "0x135",
"SMSG_EQUIPMENT_SET_SAVED": "0x137",
"SMSG_INITIAL_SPELLS": "0x12A",
"SMSG_LEARNED_SPELL": "0x12B",
"SMSG_SUPERCEDED_SPELL": "0x12C",
"SMSG_REMOVED_SPELL": "0x203",
"SMSG_SPELL_DELAYED": "0x1E2",
"SMSG_SET_FLAT_SPELL_MODIFIER": "0x266",
"SMSG_SET_PCT_SPELL_MODIFIER": "0x267",
"CMSG_LEARN_TALENT": "0x251",
"MSG_TALENT_WIPE_CONFIRM": "0x2AA",
"CMSG_GROUP_INVITE": "0x06E",
"SMSG_GROUP_INVITE": "0x06F",
"CMSG_GROUP_ACCEPT": "0x072",
"CMSG_GROUP_DECLINE": "0x073",
"SMSG_GROUP_DECLINE": "0x074",
"CMSG_GROUP_UNINVITE_GUID": "0x076",
"SMSG_GROUP_UNINVITE": "0x077",
"CMSG_GROUP_SET_LEADER": "0x078",
"SMSG_GROUP_SET_LEADER": "0x079",
"CMSG_GROUP_DISBAND": "0x07B",
"SMSG_GROUP_LIST": "0x07D",
"SMSG_PARTY_COMMAND_RESULT": "0x07F",
"MSG_RAID_TARGET_UPDATE": "0x321",
"CMSG_REQUEST_RAID_INFO": "0x2CD",
"SMSG_RAID_INSTANCE_INFO": "0x2CC",
"CMSG_AUTOSTORE_LOOT_ITEM": "0x108",
"CMSG_LOOT": "0x15D",
"CMSG_LOOT_MONEY": "0x15E",
"CMSG_LOOT_RELEASE": "0x15F",
"SMSG_LOOT_RESPONSE": "0x160",
"SMSG_LOOT_RELEASE_RESPONSE": "0x161",
"SMSG_LOOT_REMOVED": "0x162",
"SMSG_LOOT_MONEY_NOTIFY": "0x163",
"SMSG_LOOT_CLEAR_MONEY": "0x165",
"CMSG_ACTIVATETAXI": "0x1AD",
"CMSG_GOSSIP_HELLO": "0x17B",
"CMSG_GOSSIP_SELECT_OPTION": "0x17C",
"SMSG_GOSSIP_MESSAGE": "0x17D",
"SMSG_GOSSIP_COMPLETE": "0x17E",
"SMSG_NPC_TEXT_UPDATE": "0x180",
"CMSG_GAMEOBJ_USE": "0x0B1",
"CMSG_QUESTGIVER_STATUS_QUERY": "0x182",
"SMSG_QUESTGIVER_STATUS": "0x183",
"CMSG_QUESTGIVER_HELLO": "0x184",
"SMSG_QUESTGIVER_QUEST_LIST": "0x185",
"CMSG_QUESTGIVER_QUERY_QUEST": "0x186",
"SMSG_QUESTGIVER_QUEST_DETAILS": "0x188",
"CMSG_QUESTGIVER_ACCEPT_QUEST": "0x189",
"CMSG_QUESTGIVER_COMPLETE_QUEST": "0x18A",
"SMSG_QUESTGIVER_REQUEST_ITEMS": "0x18B",
"CMSG_QUESTGIVER_REQUEST_REWARD": "0x18C",
"SMSG_QUESTGIVER_OFFER_REWARD": "0x18D",
"CMSG_QUESTGIVER_CHOOSE_REWARD": "0x18E",
"SMSG_QUESTGIVER_QUEST_INVALID": "0x18F",
"SMSG_QUESTGIVER_QUEST_COMPLETE": "0x191",
"CMSG_QUESTLOG_REMOVE_QUEST": "0x194",
"SMSG_QUESTUPDATE_ADD_KILL": "0x199",
"SMSG_QUESTUPDATE_COMPLETE": "0x198",
"SMSG_QUEST_FORCE_REMOVE": "0x21E",
"CMSG_QUEST_QUERY": "0x05C",
"SMSG_QUEST_QUERY_RESPONSE": "0x05D",
"SMSG_QUESTLOG_FULL": "0x195",
"CMSG_LIST_INVENTORY": "0x19E",
"SMSG_LIST_INVENTORY": "0x19F",
"CMSG_SELL_ITEM": "0x1A0",
"SMSG_SELL_ITEM": "0x1A1",
"CMSG_BUY_ITEM": "0x1A2",
"CMSG_BUYBACK_ITEM": "0x1A6",
"SMSG_BUY_FAILED": "0x1A5",
"CMSG_TRAINER_LIST": "0x1B0",
"SMSG_TRAINER_LIST": "0x1B1",
"CMSG_TRAINER_BUY_SPELL": "0x1B2",
"SMSG_TRAINER_BUY_FAILED": "0x1B4",
"CMSG_ITEM_QUERY_SINGLE": "0x056",
"SMSG_ITEM_QUERY_SINGLE_RESPONSE": "0x058",
"CMSG_USE_ITEM": "0x0AB",
"CMSG_AUTOEQUIP_ITEM": "0x10A",
"CMSG_SWAP_ITEM": "0x10C",
"CMSG_SWAP_INV_ITEM": "0x10D",
"SMSG_INVENTORY_CHANGE_FAILURE": "0x112",
"CMSG_INSPECT": "0x114",
"SMSG_INSPECT_RESULTS_UPDATE": "0x115",
"CMSG_REPOP_REQUEST": "0x15A",
"SMSG_RESURRECT_REQUEST": "0x15B",
"CMSG_RESURRECT_RESPONSE": "0x15C",
"CMSG_SPIRIT_HEALER_ACTIVATE": "0x21C",
"SMSG_SPIRIT_HEALER_CONFIRM": "0x222",
"MSG_MOVE_TELEPORT_ACK": "0x0C7",
"SMSG_TRANSFER_PENDING": "0x03F",
"SMSG_NEW_WORLD": "0x03E",
"MSG_MOVE_WORLDPORT_ACK": "0x0DC",
"SMSG_TRANSFER_ABORTED": "0x040",
"SMSG_FORCE_RUN_SPEED_CHANGE": "0x0E2",
"SMSG_CLIENT_CONTROL_UPDATE": "0x159",
"CMSG_FORCE_RUN_SPEED_CHANGE_ACK": "0x0E3",
"SMSG_SHOWTAXINODES": "0x1A9",
"SMSG_ACTIVATETAXIREPLY": "0x1AE",
"SMSG_NEW_TAXI_PATH": "0x1AF",
"CMSG_ACTIVATETAXIEXPRESS": "0x312",
"CMSG_TAXINODE_STATUS_QUERY": "0x1AA",
"SMSG_TAXINODE_STATUS": "0x1AB",
"SMSG_TRAINER_BUY_SUCCEEDED": "0x1B3",
"SMSG_BINDPOINTUPDATE": "0x155",
"SMSG_SET_PROFICIENCY": "0x127",
"SMSG_ACTION_BUTTONS": "0x129",
"SMSG_LEVELUP_INFO": "0x1D4",
"SMSG_PLAY_SOUND": "0x2D2",
"CMSG_UPDATE_ACCOUNT_DATA": "0x20B",
"CMSG_BATTLEFIELD_LIST": "0x23C",
"SMSG_BATTLEFIELD_LIST": "0x23D",
"CMSG_BATTLEFIELD_JOIN": "0x23E",
"CMSG_BATTLEFIELD_STATUS": "0x2D3",
"SMSG_BATTLEFIELD_STATUS": "0x2D4",
"CMSG_BATTLEFIELD_PORT": "0x2D5",
"CMSG_BATTLEMASTER_HELLO": "0x2D7",
"MSG_PVP_LOG_DATA": "0x2E0",
"CMSG_LEAVE_BATTLEFIELD": "0x2E1",
"SMSG_GROUP_JOINED_BATTLEGROUND": "0x2E8",
"MSG_BATTLEGROUND_PLAYER_POSITIONS": "0x2E9",
"SMSG_BATTLEGROUND_PLAYER_JOINED": "0x2EC",
"SMSG_BATTLEGROUND_PLAYER_LEFT": "0x2ED",
"CMSG_BATTLEMASTER_JOIN": "0x2EE",
"CMSG_EMOTE": "0x102",
"SMSG_EMOTE": "0x103",
"CMSG_TEXT_EMOTE": "0x104",
"SMSG_TEXT_EMOTE": "0x105",
"CMSG_JOIN_CHANNEL": "0x097",
"CMSG_LEAVE_CHANNEL": "0x098",
"SMSG_CHANNEL_NOTIFY": "0x099",
"CMSG_CHANNEL_LIST": "0x09A",
"SMSG_CHANNEL_LIST": "0x09B",
"SMSG_INSPECT_TALENT": "0x3F4",
"SMSG_SHOW_MAILBOX": "0x297",
"CMSG_GET_MAIL_LIST": "0x23A",
"SMSG_MAIL_LIST_RESULT": "0x23B",
"CMSG_SEND_MAIL": "0x238",
"SMSG_SEND_MAIL_RESULT": "0x239",
"CMSG_MAIL_TAKE_MONEY": "0x245",
"CMSG_MAIL_TAKE_ITEM": "0x246",
"CMSG_MAIL_DELETE": "0x249",
"CMSG_MAIL_MARK_AS_READ": "0x247",
"SMSG_RECEIVED_MAIL": "0x285",
"MSG_QUERY_NEXT_MAIL_TIME": "0x284",
"CMSG_BANKER_ACTIVATE": "0x1B7",
"SMSG_SHOW_BANK": "0x1B8",
"CMSG_BUY_BANK_SLOT": "0x1B9",
"SMSG_BUY_BANK_SLOT_RESULT": "0x1BA",
"CMSG_AUTOSTORE_BANK_ITEM": "0x282",
"CMSG_AUTOBANK_ITEM": "0x283",
"MSG_AUCTION_HELLO": "0x255",
"CMSG_AUCTION_SELL_ITEM": "0x256",
"CMSG_AUCTION_REMOVE_ITEM": "0x257",
"CMSG_AUCTION_LIST_ITEMS": "0x258",
"CMSG_AUCTION_LIST_OWNER_ITEMS": "0x259",
"CMSG_AUCTION_PLACE_BID": "0x25A",
"SMSG_AUCTION_COMMAND_RESULT": "0x25B",
"SMSG_AUCTION_LIST_RESULT": "0x25C",
"SMSG_AUCTION_OWNER_LIST_RESULT": "0x25D",
"SMSG_AUCTION_OWNER_NOTIFICATION": "0x25E",
"SMSG_AUCTION_BIDDER_NOTIFICATION": "0x260",
"CMSG_AUCTION_LIST_BIDDER_ITEMS": "0x264",
"SMSG_AUCTION_BIDDER_LIST_RESULT": "0x265",
"MSG_MOVE_TIME_SKIPPED": "0x319",
"SMSG_CANCEL_AUTO_REPEAT": "0x29C",
"SMSG_WEATHER": "0x2F4",
"SMSG_QUESTUPDATE_ADD_ITEM": "0x19A",
"CMSG_GUILD_DISBAND": "0x08F",
"CMSG_GUILD_LEADER": "0x090",
"CMSG_GUILD_SET_PUBLIC_NOTE": "0x234",
"CMSG_GUILD_SET_OFFICER_NOTE": "0x235"
"_extends": "../classic/opcodes.json",
"_remove": [
"MSG_SET_DUNGEON_DIFFICULTY"
]
}

View file

@ -1,48 +1,49 @@
{
"CONTAINER_FIELD_NUM_SLOTS": 48,
"CONTAINER_FIELD_SLOT_1": 50,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_DURABILITY": 48,
"ITEM_FIELD_MAXDURABILITY": 49,
"ITEM_FIELD_STACK_COUNT": 14,
"OBJECT_FIELD_ENTRY": 3,
"OBJECT_FIELD_SCALE_X": 4,
"UNIT_FIELD_TARGET_LO": 16,
"UNIT_FIELD_TARGET_HI": 17,
"PLAYER_BYTES": 191,
"PLAYER_BYTES_2": 192,
"PLAYER_END": 1282,
"PLAYER_EXPLORED_ZONES_START": 1111,
"PLAYER_FIELD_BANKBAG_SLOT_1": 612,
"PLAYER_FIELD_BANK_SLOT_1": 564,
"PLAYER_FIELD_COINAGE": 1176,
"PLAYER_FIELD_INV_SLOT_HEAD": 486,
"PLAYER_FIELD_PACK_SLOT_1": 532,
"PLAYER_FLAGS": 190,
"PLAYER_NEXT_LEVEL_XP": 717,
"PLAYER_QUEST_LOG_START": 198,
"PLAYER_REST_STATE_EXPERIENCE": 1175,
"PLAYER_SKILL_INFO_START": 718,
"PLAYER_XP": 716,
"UNIT_DYNAMIC_FLAGS": 143,
"UNIT_END": 188,
"UNIT_FIELD_AURAFLAGS": 98,
"UNIT_FIELD_AURAS": 50,
"UNIT_FIELD_BYTES_0": 36,
"UNIT_FIELD_HEALTH": 22,
"UNIT_FIELD_POWER1": 23,
"UNIT_FIELD_MAXHEALTH": 28,
"UNIT_FIELD_MAXPOWER1": 29,
"UNIT_FIELD_LEVEL": 34,
"UNIT_FIELD_BYTES_1": 133,
"UNIT_FIELD_DISPLAYID": 131,
"UNIT_FIELD_FACTIONTEMPLATE": 35,
"UNIT_FIELD_FLAGS": 46,
"UNIT_FIELD_DISPLAYID": 131,
"UNIT_FIELD_HEALTH": 22,
"UNIT_FIELD_LEVEL": 34,
"UNIT_FIELD_MAXHEALTH": 28,
"UNIT_FIELD_MAXPOWER1": 29,
"UNIT_FIELD_MOUNTDISPLAYID": 133,
"UNIT_FIELD_AURAS": 50,
"UNIT_FIELD_AURAFLAGS": 98,
"UNIT_NPC_FLAGS": 147,
"UNIT_DYNAMIC_FLAGS": 143,
"UNIT_FIELD_POWER1": 23,
"UNIT_FIELD_RESISTANCES": 154,
"UNIT_FIELD_STAT0": 138,
"UNIT_FIELD_STAT1": 139,
"UNIT_FIELD_STAT2": 140,
"UNIT_FIELD_STAT3": 141,
"UNIT_FIELD_STAT4": 142,
"UNIT_END": 188,
"PLAYER_FLAGS": 190,
"PLAYER_BYTES": 191,
"PLAYER_BYTES_2": 192,
"PLAYER_XP": 716,
"PLAYER_NEXT_LEVEL_XP": 717,
"PLAYER_REST_STATE_EXPERIENCE": 1175,
"PLAYER_FIELD_COINAGE": 1176,
"PLAYER_QUEST_LOG_START": 198,
"PLAYER_FIELD_INV_SLOT_HEAD": 486,
"PLAYER_FIELD_PACK_SLOT_1": 532,
"PLAYER_FIELD_BANK_SLOT_1": 564,
"PLAYER_FIELD_BANKBAG_SLOT_1": 612,
"PLAYER_SKILL_INFO_START": 718,
"PLAYER_EXPLORED_ZONES_START": 1111,
"PLAYER_END": 1282,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_STACK_COUNT": 14,
"ITEM_FIELD_DURABILITY": 48,
"ITEM_FIELD_MAXDURABILITY": 49,
"CONTAINER_FIELD_NUM_SLOTS": 48,
"CONTAINER_FIELD_SLOT_1": 50
}
"UNIT_FIELD_TARGET_HI": 17,
"UNIT_FIELD_TARGET_LO": 16,
"UNIT_NPC_FLAGS": 147
}

View file

@ -1,120 +1,323 @@
{
"Spell": {
"ID": 0, "Attributes": 4, "IconID": 133,
"Name": 136, "Tooltip": 139, "Rank": 153, "SchoolMask": 225,
"PowerType": 14, "ManaCost": 39, "CastingTimeIndex": 47, "RangeIndex": 49,
"DispelType": 2
"Achievement": {
"Description": 21,
"ID": 0,
"Points": 39,
"Title": 4
},
"SpellRange": { "MaxRange": 4 },
"ItemDisplayInfo": {
"ID": 0, "LeftModel": 1, "LeftModelTexture": 3,
"InventoryIcon": 5, "GeosetGroup1": 7, "GeosetGroup3": 9,
"TextureArmUpper": 14, "TextureArmLower": 15, "TextureHand": 16,
"TextureTorsoUpper": 17, "TextureTorsoLower": 18,
"TextureLegUpper": 19, "TextureLegLower": 20, "TextureFoot": 21
"AchievementCriteria": {
"AchievementID": 1,
"Description": 9,
"ID": 0,
"Quantity": 4
},
"AreaTable": {
"ExploreFlag": 3,
"ID": 0,
"MapID": 1,
"ParentAreaNum": 2
},
"CharHairGeosets": {
"GeosetID": 4,
"RaceID": 1,
"SexID": 2,
"Variation": 3
},
"CharSections": {
"RaceID": 1, "SexID": 2, "BaseSection": 3,
"VariationIndex": 4, "ColorIndex": 5,
"Texture1": 6, "Texture2": 7, "Texture3": 8,
"Flags": 9
"BaseSection": 3,
"ColorIndex": 5,
"Flags": 9,
"RaceID": 1,
"SexID": 2,
"Texture1": 6,
"Texture2": 7,
"Texture3": 8,
"VariationIndex": 4
},
"SpellIcon": { "ID": 0, "Path": 1 },
"FactionTemplate": {
"ID": 0, "Faction": 1, "FactionGroup": 3,
"FriendGroup": 4, "EnemyGroup": 5,
"Enemy0": 6, "Enemy1": 7, "Enemy2": 8, "Enemy3": 9
},
"Faction": {
"ID": 0, "ReputationRaceMask0": 2, "ReputationRaceMask1": 3,
"ReputationRaceMask2": 4, "ReputationRaceMask3": 5,
"ReputationBase0": 10, "ReputationBase1": 11,
"ReputationBase2": 12, "ReputationBase3": 13
},
"CharTitles": { "ID": 0, "Title": 2, "TitleBit": 36 },
"Achievement": { "ID": 0, "Title": 4, "Description": 21, "Points": 39 },
"AchievementCriteria": { "ID": 0, "AchievementID": 1, "Quantity": 4, "Description": 9 },
"AreaTable": { "ID": 0, "MapID": 1, "ParentAreaNum": 2, "ExploreFlag": 3 },
"CreatureDisplayInfoExtra": {
"ID": 0, "RaceID": 1, "SexID": 2, "SkinID": 3, "FaceID": 4,
"HairStyleID": 5, "HairColorID": 6, "FacialHairID": 7,
"EquipDisplay0": 8, "EquipDisplay1": 9, "EquipDisplay2": 10,
"EquipDisplay3": 11, "EquipDisplay4": 12, "EquipDisplay5": 13,
"EquipDisplay6": 14, "EquipDisplay7": 15, "EquipDisplay8": 16,
"EquipDisplay9": 17, "EquipDisplay10": 18, "BakeName": 20
},
"CreatureDisplayInfo": {
"ID": 0, "ModelID": 1, "ExtraDisplayId": 3,
"Skin1": 6, "Skin2": 7, "Skin3": 8
},
"TaxiNodes": {
"ID": 0, "MapID": 1, "X": 2, "Y": 3, "Z": 4, "Name": 5,
"MountDisplayIdAllianceFallback": 20, "MountDisplayIdHordeFallback": 21,
"MountDisplayIdAlliance": 22, "MountDisplayIdHorde": 23
},
"TaxiPath": { "ID": 0, "FromNode": 1, "ToNode": 2, "Cost": 3 },
"TaxiPathNode": {
"ID": 0, "PathID": 1, "NodeIndex": 2, "MapID": 3,
"X": 4, "Y": 5, "Z": 6
},
"TalentTab": {
"ID": 0, "Name": 1, "ClassMask": 20,
"OrderIndex": 22, "BackgroundFile": 23
},
"Talent": {
"ID": 0, "TabID": 1, "Row": 2, "Column": 3,
"RankSpell0": 4, "PrereqTalent0": 9, "PrereqRank0": 12
},
"SkillLineAbility": { "SkillLineID": 1, "SpellID": 2 },
"SkillLine": { "ID": 0, "Category": 1, "Name": 3 },
"Map": { "ID": 0, "InternalName": 1 },
"CreatureModelData": { "ID": 0, "ModelPath": 2 },
"CharHairGeosets": {
"RaceID": 1, "SexID": 2, "Variation": 3, "GeosetID": 4
"CharTitles": {
"ID": 0,
"Title": 2,
"TitleBit": 36
},
"CharacterFacialHairStyles": {
"RaceID": 0, "SexID": 1, "Variation": 2,
"Geoset100": 3, "Geoset300": 4, "Geoset200": 5
"Geoset100": 3,
"Geoset200": 5,
"Geoset300": 4,
"RaceID": 0,
"SexID": 1,
"Variation": 2
},
"CreatureDisplayInfo": {
"ExtraDisplayId": 3,
"ID": 0,
"ModelID": 1,
"Skin1": 6,
"Skin2": 7,
"Skin3": 8
},
"CreatureDisplayInfoExtra": {
"BakeName": 20,
"EquipDisplay0": 8,
"EquipDisplay1": 9,
"EquipDisplay10": 18,
"EquipDisplay2": 10,
"EquipDisplay3": 11,
"EquipDisplay4": 12,
"EquipDisplay5": 13,
"EquipDisplay6": 14,
"EquipDisplay7": 15,
"EquipDisplay8": 16,
"EquipDisplay9": 17,
"FaceID": 4,
"FacialHairID": 7,
"HairColorID": 6,
"HairStyleID": 5,
"ID": 0,
"RaceID": 1,
"SexID": 2,
"SkinID": 3
},
"CreatureModelData": {
"ID": 0,
"ModelPath": 2
},
"Emotes": {
"AnimID": 2,
"ID": 0
},
"GameObjectDisplayInfo": { "ID": 0, "ModelName": 1 },
"Emotes": { "ID": 0, "AnimID": 2 },
"EmotesText": {
"ID": 0, "Command": 1, "EmoteRef": 2,
"OthersTargetTextID": 3, "SenderTargetTextID": 5,
"OthersNoTargetTextID": 7, "SenderNoTargetTextID": 9
"Command": 1,
"EmoteRef": 2,
"ID": 0,
"OthersNoTargetTextID": 7,
"OthersTargetTextID": 3,
"SenderNoTargetTextID": 9,
"SenderTargetTextID": 5
},
"EmotesTextData": { "ID": 0, "Text": 1 },
"Light": {
"ID": 0, "MapID": 1, "X": 2, "Z": 3, "Y": 4,
"InnerRadius": 5, "OuterRadius": 6, "LightParamsID": 7,
"LightParamsIDRain": 8, "LightParamsIDUnderwater": 9
"EmotesTextData": {
"ID": 0,
"Text": 1
},
"LightParams": { "LightParamsID": 0 },
"LightIntBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"Faction": {
"ID": 0,
"ReputationBase0": 10,
"ReputationBase1": 11,
"ReputationBase2": 12,
"ReputationBase3": 13,
"ReputationRaceMask0": 2,
"ReputationRaceMask1": 3,
"ReputationRaceMask2": 4,
"ReputationRaceMask3": 5
},
"LightFloatBand": {
"BlockIndex": 1, "NumKeyframes": 2, "TimeKey0": 3, "Value0": 19
"FactionTemplate": {
"Enemy0": 6,
"Enemy1": 7,
"Enemy2": 8,
"Enemy3": 9,
"EnemyGroup": 5,
"Faction": 1,
"FactionGroup": 3,
"FriendGroup": 4,
"ID": 0
},
"WorldMapArea": {
"ID": 0, "MapID": 1, "AreaID": 2, "AreaName": 3,
"LocLeft": 4, "LocRight": 5, "LocTop": 6, "LocBottom": 7,
"DisplayMapID": 8, "ParentWorldMapID": 10
"GameObjectDisplayInfo": {
"ID": 0,
"ModelName": 1
},
"SpellItemEnchantment": {
"ID": 0, "Name": 8
"ItemDisplayInfo": {
"GeosetGroup1": 7,
"GeosetGroup3": 9,
"ID": 0,
"InventoryIcon": 5,
"LeftModel": 1,
"LeftModelTexture": 3,
"TextureArmLower": 15,
"TextureArmUpper": 14,
"TextureFoot": 21,
"TextureHand": 16,
"TextureLegLower": 20,
"TextureLegUpper": 19,
"TextureTorsoLower": 18,
"TextureTorsoUpper": 17
},
"ItemSet": {
"ID": 0, "Name": 1,
"Item0": 18, "Item1": 19, "Item2": 20, "Item3": 21, "Item4": 22,
"Item5": 23, "Item6": 24, "Item7": 25, "Item8": 26, "Item9": 27,
"Spell0": 28, "Spell1": 29, "Spell2": 30, "Spell3": 31, "Spell4": 32,
"Spell5": 33, "Spell6": 34, "Spell7": 35, "Spell8": 36, "Spell9": 37,
"Threshold0": 38, "Threshold1": 39, "Threshold2": 40, "Threshold3": 41,
"Threshold4": 42, "Threshold5": 43, "Threshold6": 44, "Threshold7": 45,
"Threshold8": 46, "Threshold9": 47
"ID": 0,
"Item0": 18,
"Item1": 19,
"Item2": 20,
"Item3": 21,
"Item4": 22,
"Item5": 23,
"Item6": 24,
"Item7": 25,
"Item8": 26,
"Item9": 27,
"Name": 1,
"Spell0": 28,
"Spell1": 29,
"Spell2": 30,
"Spell3": 31,
"Spell4": 32,
"Spell5": 33,
"Spell6": 34,
"Spell7": 35,
"Spell8": 36,
"Spell9": 37,
"Threshold0": 38,
"Threshold1": 39,
"Threshold2": 40,
"Threshold3": 41,
"Threshold4": 42,
"Threshold5": 43,
"Threshold6": 44,
"Threshold7": 45,
"Threshold8": 46,
"Threshold9": 47
},
"LFGDungeons": {
"ID": 0, "Name": 1
"ID": 0,
"Name": 1
},
"Light": {
"ID": 0,
"InnerRadius": 5,
"LightParamsID": 7,
"LightParamsIDRain": 8,
"LightParamsIDUnderwater": 9,
"MapID": 1,
"OuterRadius": 6,
"X": 2,
"Y": 4,
"Z": 3
},
"LightFloatBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightIntBand": {
"BlockIndex": 1,
"NumKeyframes": 2,
"TimeKey0": 3,
"Value0": 19
},
"LightParams": {
"LightParamsID": 0
},
"Map": {
"ID": 0,
"InternalName": 1
},
"SkillLine": {
"Category": 1,
"ID": 0,
"Name": 3
},
"SkillLineAbility": {
"SkillLineID": 1,
"SpellID": 2
},
"Spell": {
"Attributes": 4,
"AttributesEx": 5,
"CastingTimeIndex": 47,
"DispelType": 2,
"DurationIndex": 40,
"EffectBasePoints0": 80,
"EffectBasePoints1": 81,
"EffectBasePoints2": 82,
"ID": 0,
"IconID": 133,
"ManaCost": 39,
"Name": 136,
"PowerType": 14,
"RangeIndex": 49,
"Rank": 153,
"SchoolMask": 225,
"Tooltip": 139
},
"SpellIcon": {
"ID": 0,
"Path": 1
},
"SpellItemEnchantment": {
"ID": 0,
"Name": 8
},
"SpellRange": {
"MaxRange": 4
},
"SpellVisual": {
"CastKit": 2,
"ID": 0,
"ImpactKit": 3,
"MissileModel": 8
},
"SpellVisualEffectName": {
"FilePath": 2,
"ID": 0
},
"SpellVisualKit": {
"BaseEffect": 5,
"ID": 0,
"SpecialEffect0": 11,
"SpecialEffect1": 12,
"SpecialEffect2": 13
},
"Talent": {
"Column": 3,
"ID": 0,
"PrereqRank0": 12,
"PrereqTalent0": 9,
"RankSpell0": 4,
"Row": 2,
"TabID": 1
},
"TalentTab": {
"BackgroundFile": 23,
"ClassMask": 20,
"ID": 0,
"Name": 1,
"OrderIndex": 22
},
"TaxiNodes": {
"ID": 0,
"MapID": 1,
"MountDisplayIdAlliance": 22,
"MountDisplayIdAllianceFallback": 20,
"MountDisplayIdHorde": 23,
"MountDisplayIdHordeFallback": 21,
"Name": 5,
"X": 2,
"Y": 3,
"Z": 4
},
"TaxiPath": {
"Cost": 3,
"FromNode": 1,
"ID": 0,
"ToNode": 2
},
"TaxiPathNode": {
"ID": 0,
"MapID": 3,
"NodeIndex": 2,
"PathID": 1,
"X": 4,
"Y": 5,
"Z": 6
},
"WorldMapArea": {
"AreaID": 2,
"AreaName": 3,
"DisplayMapID": 8,
"ID": 0,
"LocBottom": 7,
"LocLeft": 4,
"LocRight": 5,
"LocTop": 6,
"MapID": 1,
"ParentWorldMapID": 10
}
}

View file

@ -1,58 +1,61 @@
{
"CONTAINER_FIELD_NUM_SLOTS": 64,
"CONTAINER_FIELD_SLOT_1": 66,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_DURABILITY": 60,
"ITEM_FIELD_MAXDURABILITY": 61,
"ITEM_FIELD_STACK_COUNT": 14,
"OBJECT_FIELD_ENTRY": 3,
"OBJECT_FIELD_SCALE_X": 4,
"UNIT_FIELD_TARGET_LO": 6,
"UNIT_FIELD_TARGET_HI": 7,
"PLAYER_BLOCK_PERCENTAGE": 1024,
"PLAYER_BYTES": 153,
"PLAYER_BYTES_2": 154,
"PLAYER_CHOSEN_TITLE": 1349,
"PLAYER_CRIT_PERCENTAGE": 1029,
"PLAYER_DODGE_PERCENTAGE": 1025,
"PLAYER_EXPLORED_ZONES_START": 1041,
"PLAYER_FIELD_ARENA_CURRENCY": 1423,
"PLAYER_FIELD_BANKBAG_SLOT_1": 458,
"PLAYER_FIELD_BANK_SLOT_1": 402,
"PLAYER_FIELD_COINAGE": 1170,
"PLAYER_FIELD_COMBAT_RATING_1": 1231,
"PLAYER_FIELD_HONOR_CURRENCY": 1422,
"PLAYER_FIELD_INV_SLOT_HEAD": 324,
"PLAYER_FIELD_MOD_DAMAGE_DONE_POS": 1171,
"PLAYER_FIELD_MOD_HEALING_DONE_POS": 1192,
"PLAYER_FIELD_PACK_SLOT_1": 370,
"PLAYER_FLAGS": 150,
"PLAYER_NEXT_LEVEL_XP": 635,
"PLAYER_PARRY_PERCENTAGE": 1026,
"PLAYER_QUEST_LOG_START": 158,
"PLAYER_RANGED_CRIT_PERCENTAGE": 1030,
"PLAYER_REST_STATE_EXPERIENCE": 1169,
"PLAYER_SKILL_INFO_START": 636,
"PLAYER_SPELL_CRIT_PERCENTAGE1": 1032,
"PLAYER_XP": 634,
"UNIT_DYNAMIC_FLAGS": 147,
"UNIT_END": 148,
"UNIT_FIELD_ATTACK_POWER": 123,
"UNIT_FIELD_BYTES_0": 23,
"UNIT_FIELD_HEALTH": 24,
"UNIT_FIELD_POWER1": 25,
"UNIT_FIELD_MAXHEALTH": 32,
"UNIT_FIELD_MAXPOWER1": 33,
"UNIT_FIELD_LEVEL": 54,
"UNIT_FIELD_BYTES_1": 137,
"UNIT_FIELD_DISPLAYID": 67,
"UNIT_FIELD_FACTIONTEMPLATE": 55,
"UNIT_FIELD_FLAGS": 59,
"UNIT_FIELD_FLAGS_2": 60,
"UNIT_FIELD_DISPLAYID": 67,
"UNIT_FIELD_HEALTH": 24,
"UNIT_FIELD_LEVEL": 54,
"UNIT_FIELD_MAXHEALTH": 32,
"UNIT_FIELD_MAXPOWER1": 33,
"UNIT_FIELD_MOUNTDISPLAYID": 69,
"UNIT_NPC_FLAGS": 82,
"UNIT_DYNAMIC_FLAGS": 147,
"UNIT_FIELD_POWER1": 25,
"UNIT_FIELD_RANGED_ATTACK_POWER": 126,
"UNIT_FIELD_RESISTANCES": 99,
"UNIT_FIELD_STAT0": 84,
"UNIT_FIELD_STAT1": 85,
"UNIT_FIELD_STAT2": 86,
"UNIT_FIELD_STAT3": 87,
"UNIT_FIELD_STAT4": 88,
"UNIT_END": 148,
"UNIT_FIELD_ATTACK_POWER": 123,
"UNIT_FIELD_RANGED_ATTACK_POWER": 126,
"PLAYER_FLAGS": 150,
"PLAYER_BYTES": 153,
"PLAYER_BYTES_2": 154,
"PLAYER_XP": 634,
"PLAYER_NEXT_LEVEL_XP": 635,
"PLAYER_REST_STATE_EXPERIENCE": 1169,
"PLAYER_FIELD_COINAGE": 1170,
"PLAYER_QUEST_LOG_START": 158,
"PLAYER_FIELD_INV_SLOT_HEAD": 324,
"PLAYER_FIELD_PACK_SLOT_1": 370,
"PLAYER_FIELD_BANK_SLOT_1": 402,
"PLAYER_FIELD_BANKBAG_SLOT_1": 458,
"PLAYER_SKILL_INFO_START": 636,
"PLAYER_EXPLORED_ZONES_START": 1041,
"PLAYER_CHOSEN_TITLE": 1349,
"PLAYER_FIELD_MOD_DAMAGE_DONE_POS": 1171,
"PLAYER_FIELD_MOD_HEALING_DONE_POS": 1192,
"PLAYER_BLOCK_PERCENTAGE": 1024,
"PLAYER_DODGE_PERCENTAGE": 1025,
"PLAYER_PARRY_PERCENTAGE": 1026,
"PLAYER_CRIT_PERCENTAGE": 1029,
"PLAYER_RANGED_CRIT_PERCENTAGE": 1030,
"PLAYER_SPELL_CRIT_PERCENTAGE1": 1032,
"PLAYER_FIELD_COMBAT_RATING_1": 1231,
"GAMEOBJECT_DISPLAYID": 8,
"ITEM_FIELD_STACK_COUNT": 14,
"ITEM_FIELD_DURABILITY": 60,
"ITEM_FIELD_MAXDURABILITY": 61,
"CONTAINER_FIELD_NUM_SLOTS": 64,
"CONTAINER_FIELD_SLOT_1": 66
"UNIT_FIELD_TARGET_HI": 7,
"UNIT_FIELD_TARGET_LO": 6,
"UNIT_NPC_FLAGS": 82
}

View file

@ -0,0 +1,36 @@
-- HelloWorld addon — demonstrates the WoWee addon system
-- Initialize saved variables (persisted across sessions)
if not HelloWorldDB then
HelloWorldDB = { loginCount = 0 }
end
HelloWorldDB.loginCount = (HelloWorldDB.loginCount or 0) + 1
-- Create a frame and register for events (standard WoW addon pattern)
local f = CreateFrame("Frame", "HelloWorldFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("CHAT_MSG_SAY")
f:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" then
local name = UnitName("player")
local level = UnitLevel("player")
print("|cff00ff00[HelloWorld]|r Welcome, " .. name .. "! (Level " .. level .. ")")
print("|cff00ff00[HelloWorld]|r Login count: " .. HelloWorldDB.loginCount)
elseif event == "CHAT_MSG_SAY" then
local msg, sender = ...
if msg and sender then
print("|cff00ff00[HelloWorld]|r " .. sender .. " said: " .. msg)
end
end
end)
-- Register a custom slash command
SLASH_HELLOWORLD1 = "/hello"
SLASH_HELLOWORLD2 = "/hw"
SlashCmdList["HELLOWORLD"] = function(args)
print("|cff00ff00[HelloWorld]|r Hello! " .. (args ~= "" and args or "Type /hello <message>"))
print("|cff00ff00[HelloWorld]|r Sessions: " .. HelloWorldDB.loginCount)
end
print("|cff00ff00[HelloWorld]|r Addon loaded. Type /hello to test.")

View file

@ -0,0 +1,5 @@
## Interface: 30300
## Title: Hello World
## Notes: Test addon for the WoWee addon system
## SavedVariables: HelloWorldDB
HelloWorld.lua

View file

@ -41,7 +41,6 @@
"SMSG_SPLINE_MOVE_SET_RUN_BACK_SPEED": "SMSG_SPLINE_SET_RUN_BACK_SPEED",
"SMSG_SPLINE_MOVE_SET_RUN_SPEED": "SMSG_SPLINE_SET_RUN_SPEED",
"SMSG_SPLINE_MOVE_SET_SWIM_SPEED": "SMSG_SPLINE_SET_SWIM_SPEED",
"SMSG_UPDATE_AURA_DURATION": "SMSG_EQUIPMENT_SET_SAVED",
"SMSG_VICTIMSTATEUPDATE_OBSOLETE": "SMSG_BATTLEFIELD_PORT_DENIED"
}
}

View file

@ -7,6 +7,7 @@ WoWee supports three World of Warcraft expansions in a unified codebase using an
- **Vanilla (Classic) 1.12** - Original World of Warcraft
- **The Burning Crusade (TBC) 2.4.3** - First expansion
- **Wrath of the Lich King (WotLK) 3.3.5a** - Second expansion
- **Turtle WoW 1.17** - Custom Vanilla-based server with extended content
## Architecture Overview
@ -17,9 +18,9 @@ The multi-expansion support is built on the **Expansion Profile** system:
- Specifies which packet parsers to use
2. **Packet Parsers** - Expansion-specific message handling
- `packet_parsers_classic.cpp` - Vanilla 1.12 message parsing
- `packet_parsers_classic.cpp` - Vanilla 1.12 / Turtle WoW message parsing
- `packet_parsers_tbc.cpp` - TBC 2.4.3 message parsing
- `packet_parsers_wotlk.cpp` (default) - WotLK 3.3.5a message parsing
- Default (WotLK 3.3.5a) parsers in `game_handler.cpp` and domain handlers
3. **Update Fields** - Expansion-specific entity data layout
- Loaded from `update_fields.json` in expansion data directory
@ -78,17 +79,19 @@ WOWEE_EXPANSION=classic ./wowee # Force Classic
### Checking Current Expansion
```cpp
#include "game/expansion_profile.hpp"
#include "game/game_utils.hpp"
// Global helper
bool isClassicLikeExpansion() {
auto profile = ExpansionProfile::getActive();
return profile && (profile->name == "Classic" || profile->name == "Vanilla");
// Shared helpers (defined in game_utils.hpp)
if (isActiveExpansion("tbc")) {
// TBC-specific code
}
// Specific check
if (GameHandler::getInstance().isActiveExpansion("tbc")) {
// TBC-specific code
if (isClassicLikeExpansion()) {
// Classic or Turtle WoW
}
if (isPreWotlk()) {
// Classic, Turtle, or TBC (not WotLK)
}
```
@ -96,7 +99,7 @@ if (GameHandler::getInstance().isActiveExpansion("tbc")) {
```cpp
// In packet_parsers_*.cpp, implement expansion-specific logic
bool parseXxxPacket(BitStream& data, ...) {
bool TbcPacketParsers::parseXxx(network::Packet& packet, XxxData& data) {
// Custom logic for this expansion's packet format
}
```
@ -121,6 +124,7 @@ bool parseXxxPacket(BitStream& data, ...) {
## References
- `include/game/expansion_profile.hpp` - Expansion metadata
- `docs/status.md` - Current feature support by expansion
- `src/game/packet_parsers_*.cpp` - Format-specific parsing logic
- `include/game/game_utils.hpp` - `isActiveExpansion()`, `isClassicLikeExpansion()`, `isPreWotlk()`
- `src/game/packet_parsers_classic.cpp` / `packet_parsers_tbc.cpp` - Expansion-specific parsing
- `docs/status.md` - Current feature support
- `docs/` directory - Additional protocol documentation

View file

@ -39,20 +39,24 @@ WoWee needs game assets from your WoW installation:
**Using provided script (Windows)**:
```powershell
.\extract_assets.ps1 -WowDirectory "C:\Program Files\World of Warcraft"
.\extract_assets.ps1 "C:\Games\WoW-3.3.5a\Data"
```
**Manual extraction**:
1. Install [StormLib](https://github.com/ladislav-zezula/StormLib)
2. Extract to `./Data/`:
2. Use `asset_extract` or extract manually to `./Data/`:
```
Data/
├── dbc/ # DBC files
├── map/ # World map data
├── adt/ # Terrain chunks
├── wmo/ # Building models
├── m2/ # Character/creature models
└── blp/ # Textures
├── manifest.json # File index (generated by asset_extract)
├── expansions/<id>/ # Per-expansion config and DB
├── character/ # Character textures
├── creature/ # Creature models/textures
├── interface/ # UI textures and icons
├── item/ # Item model textures
├── spell/ # Spell effect models
├── terrain/ # ADT terrain, WMO, M2 doodads
├── world/ # World map images
└── sound/ # Audio files
```
### Step 3: Connect to a Server
@ -84,15 +88,19 @@ WoWee needs game assets from your WoW installation:
| Strafe Right | D |
| Jump | Space |
| Toggle Chat | Enter |
| Interact (talk to NPC, loot) | F |
| Open Inventory | B |
| Open Character Screen | C |
| Open Inventory | I |
| Open All Bags | B |
| Open Spellbook | P |
| Open Talent Tree | T |
| Open Quest Log | Q |
| Open World Map | W (when not typing) |
| Toggle Minimap | M |
| Open Talents | N |
| Open Quest Log | L |
| Open World Map | M |
| Toggle Nameplates | V |
| Toggle Party Frames | F |
| Toggle Raid Frames | F |
| Open Guild Roster | O |
| Open Dungeon Finder | J |
| Open Achievements | Y |
| Open Skills | K |
| Toggle Settings | Escape |
| Target Next Enemy | Tab |
| Target Previous Enemy | Shift+Tab |
@ -171,7 +179,7 @@ WOWEE_EXPANSION=tbc ./wowee # Force TBC
### General Issues
- Comprehensive troubleshooting: See [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
- Check logs in `~/.wowee/logs/` for errors
- Check `logs/wowee.log` in the working directory for errors
- Verify expansion matches server requirements
## Server Configuration

View file

@ -9,28 +9,27 @@ arch=('x86_64')
url="https://github.com/Kelsidavis/WoWee"
license=('MIT')
depends=(
'sdl2'
'vulkan-icd-loader'
'openssl'
'zlib'
'ffmpeg'
'unicorn'
'glew'
'libx11'
'stormlib' # AUR — required at runtime by wowee-extract-assets (libstorm.so)
'sdl2' # Windowing and event loop
'vulkan-icd-loader' # Vulkan runtime (GPU driver communication)
'openssl' # SRP6a auth protocol (key exchange + RC4 encryption)
'zlib' # Network packet decompression and Warden module inflate
'ffmpeg' # Video playback (login cinematics)
'unicorn' # Warden anti-cheat x86 emulation (cross-platform, no Wine)
'libx11' # X11 windowing support
'stormlib' # AUR — MPQ extraction (wowee-extract-assets uses libstorm.so)
)
makedepends=(
'git'
'cmake'
'pkgconf'
'glm'
'vulkan-headers'
'shaderc'
'python'
'git' # Clone submodules (imgui, vk-bootstrap)
'cmake' # Build system
'pkgconf' # Dependency detection
'glm' # Header-only math library (vectors, matrices, quaternions)
'vulkan-headers' # Vulkan API definitions (build-time only)
'shaderc' # GLSL → SPIR-V shader compilation
'python' # Opcode registry generation and DBC validation scripts
)
provides=('wowee')
conflicts=('wowee')
source=("${pkgname}::git+https://github.com/Kelsidavis/WoWee.git#branch=main"
source=("${pkgname}::git+https://github.com/Kelsidavis/WoWee.git#branch=master"
"git+https://github.com/ocornut/imgui.git"
"git+https://github.com/charles-lunarg/vk-bootstrap.git")
sha256sums=('SKIP' 'SKIP' 'SKIP')

View file

@ -19,13 +19,15 @@ Protocol Compatible with **Vanilla (Classic) 1.12 + TBC 2.4.3 + WotLK 3.3.5a**.
> **Legal Disclaimer**: This is an educational/research project. It does not include any Blizzard Entertainment assets, data files, or proprietary code. World of Warcraft and all related assets are the property of Blizzard Entertainment, Inc. This project is not affiliated with or endorsed by Blizzard Entertainment. Users are responsible for supplying their own legally obtained game data files and for ensuring compliance with all applicable laws in their jurisdiction.
## Status & Direction (2026-03-07)
## Status & Direction (2026-03-30)
- **Compatibility**: **Vanilla (Classic) 1.12 + TBC 2.4.3 + WotLK 3.3.5a** are all supported via expansion profiles and per-expansion packet parsers (`src/game/packet_parsers_classic.cpp`, `src/game/packet_parsers_tbc.cpp`). All three expansions are roughly on par — no single one is significantly more complete than the others.
- **Tested against**: AzerothCore, TrinityCore, Mangos, and Turtle WoW (1.17).
- **Current focus**: instance dungeons, visual accuracy (lava/water, shadow mapping, WMO interiors), and multi-expansion coverage.
- **Compatibility**: **Vanilla (Classic) 1.12 + TBC 2.4.3 + WotLK 3.3.5a** are all supported via expansion profiles and per-expansion packet parsers. All three expansions are roughly on par.
- **Tested against**: AzerothCore/ChromieCraft, TrinityCore, Mangos, and Turtle WoW (1.17).
- **Current focus**: code quality (SOLID decomposition, documentation), rendering stability, and multi-expansion coverage.
- **Warden**: Full module execution via Unicorn Engine CPU emulation. Decrypts (RC4→RSA→zlib), parses and relocates the PE module, executes via x86 emulation with Windows API interception. Module cache at `~/.local/share/wowee/warden_cache/`.
- **CI**: GitHub Actions builds for Linux (x86-64, ARM64), Windows (MSYS2), and macOS (ARM64). Security scans via CodeQL, Semgrep, and sanitizers.
- **CI**: GitHub Actions builds for Linux (x86-64, ARM64), Windows (MSYS2 x86-64 + ARM64), and macOS (ARM64). Security scans via CodeQL, Semgrep, and sanitizers.
- **Container builds**: Multi-platform Docker build system for Linux, macOS (arm64/x86_64 via osxcross), and Windows (LLVM-MinGW) cross-compilation.
- **Release**: v1.8.9-preview — 530+ WoW API functions, 140+ events, 664 opcode handlers.
## Features
@ -52,7 +54,7 @@ Protocol Compatible with **Vanilla (Classic) 1.12 + TBC 2.4.3 + WotLK 3.3.5a**.
- **Movement** -- WASD movement, camera orbit, spline path following, transport riding (trams, ships, zeppelins), movement ACK responses
- **Combat** -- Auto-attack, spell casting with cooldowns, damage calculation, death handling, spirit healer resurrection
- **Targeting** -- Tab-cycling with hostility filtering, click-to-target, faction-based hostility (using Faction.dbc)
- **Inventory** -- 23 equipment slots, 16 backpack slots, drag-drop, auto-equip, item tooltips with weapon damage/speed
- **Inventory** -- 23 equipment slots, 16 backpack slots, drag-drop, auto-equip, item tooltips with weapon damage/speed, server-synced bag sort (quality/type/stack), independent bag windows
- **Bank** -- Full bank support for all expansions, bag slots, drag-drop, right-click deposit (non-equippable items)
- **Spells** -- Spellbook with specialty, general, profession, mount, and companion tabs; drag-drop to action bar; item use support
- **Talents** -- Talent tree UI with proper visuals and functionality
@ -67,7 +69,8 @@ Protocol Compatible with **Vanilla (Classic) 1.12 + TBC 2.4.3 + WotLK 3.3.5a**.
- **Chat** -- Tabs/channels, emotes, chat bubbles, clickable URLs, clickable item links with tooltips
- **Party** -- Group invites, party list, out-of-range member health via SMSG_PARTY_MEMBER_STATS
- **Pets** -- Pet tracking via SMSG_PET_SPELLS, action bar (10 slots with icon/autocast tinting/tooltips), dismiss button
- **Map Exploration** -- Subzone-level fog-of-war reveal matching retail behavior
- **Map Exploration** -- Subzone-level fog-of-war reveal, world map with continent/zone views, quest POI markers, taxi node markers, party member dots
- **NPC Voices** -- Race/gender-specific NPC greeting, farewell, vendor, pissed, aggro, and flee sounds for all playable races including Blood Elf and Draenei
- **Warden** -- Warden anti-cheat module execution via Unicorn Engine x86 emulation (cross-platform, no Wine)
- **UI** -- Loading screens with progress bar, settings window with graphics quality presets (LOW/MEDIUM/HIGH/ULTRA), shadow distance slider, minimap with zoom/rotation/square mode, top-right minimap mute speaker, separate bag windows with compact-empty mode (aggregate view)

View file

@ -151,9 +151,7 @@ Graphics Preset: HIGH or ULTRA
## Getting Help
### Check Logs
Detailed logs are saved to:
- **Linux/macOS**: `~/.wowee/logs/`
- **Windows**: `%APPDATA%\wowee\logs\`
Detailed logs are saved to `logs/wowee.log` in the working directory (typically `build/bin/`).
Include relevant log entries when reporting issues.

View file

@ -1,38 +0,0 @@
#version 330 core
in vec3 FragPos;
in vec3 Normal;
in vec2 TexCoord;
out vec4 FragColor;
uniform vec3 uLightPos;
uniform vec3 uViewPos;
uniform vec4 uColor;
uniform sampler2D uTexture;
uniform bool uUseTexture;
void main() {
// Ambient
vec3 ambient = 0.3 * vec3(1.0);
// Diffuse
vec3 norm = normalize(Normal);
vec3 lightDir = normalize(uLightPos - FragPos);
float diff = max(dot(norm, lightDir), 0.0);
vec3 diffuse = diff * vec3(1.0);
// Specular
vec3 viewDir = normalize(uViewPos - FragPos);
vec3 reflectDir = reflect(-lightDir, norm);
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0);
vec3 specular = 0.5 * spec * vec3(1.0);
vec3 result = (ambient + diffuse + specular);
if (uUseTexture) {
FragColor = texture(uTexture, TexCoord) * vec4(result, 1.0);
} else {
FragColor = uColor * vec4(result, 1.0);
}
}

View file

@ -1,22 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPosition;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoord;
out vec3 FragPos;
out vec3 Normal;
out vec2 TexCoord;
uniform mat4 uModel;
uniform mat4 uView;
uniform mat4 uProjection;
void main() {
FragPos = vec3(uModel * vec4(aPosition, 1.0));
// Use mat3(uModel) directly - avoids expensive inverse() per vertex
Normal = mat3(uModel) * aNormal;
TexCoord = aTexCoord;
gl_Position = uProjection * uView * vec4(FragPos, 1.0);
}

View file

@ -40,7 +40,7 @@ void main() {
float cs = cos(push.rotation);
float sn = sin(push.rotation);
vec2 rotated = vec2(center.x * cs - center.y * sn, center.x * sn + center.y * cs);
vec2 mapUV = push.playerUV + vec2(-rotated.x, rotated.y) * push.zoomRadius * 2.0;
vec2 mapUV = push.playerUV + vec2(rotated.x, rotated.y) * push.zoomRadius * 2.0;
vec4 mapColor = texture(uComposite, mapUV);
@ -48,9 +48,10 @@ void main() {
vec2 local = center; // [-0.5, 0.5] around minimap center
float ac = cos(push.arrowRotation);
float as = sin(push.arrowRotation);
vec2 tip = vec2(0.0, 0.09);
vec2 left = vec2(-0.045, -0.02);
vec2 right = vec2( 0.045, -0.02);
// TexCoord Y grows downward on screen; use negative Y so 0-angle points North (up).
vec2 tip = vec2(0.0, -0.09);
vec2 left = vec2(-0.045, 0.02);
vec2 right = vec2( 0.045, 0.02);
mat2 rot = mat2(ac, -as, as, ac);
tip = rot * tip;
left = rot * left;

View file

@ -1,146 +0,0 @@
#version 330 core
in vec3 FragPos;
in vec3 Normal;
in vec2 TexCoord;
in vec2 LayerUV;
out vec4 FragColor;
// Texture layers (up to 4)
uniform sampler2D uBaseTexture;
uniform sampler2D uLayer1Texture;
uniform sampler2D uLayer2Texture;
uniform sampler2D uLayer3Texture;
// Alpha maps for blending
uniform sampler2D uLayer1Alpha;
uniform sampler2D uLayer2Alpha;
uniform sampler2D uLayer3Alpha;
// Layer control
uniform int uLayerCount;
uniform bool uHasLayer1;
uniform bool uHasLayer2;
uniform bool uHasLayer3;
// Lighting
uniform vec3 uLightDir;
uniform vec3 uLightColor;
uniform vec3 uAmbientColor;
// Camera
uniform vec3 uViewPos;
// Fog
uniform vec3 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
// Shadow mapping
uniform sampler2DShadow uShadowMap;
uniform mat4 uLightSpaceMatrix;
uniform bool uShadowEnabled;
uniform float uShadowStrength;
float calcShadow() {
vec4 lsPos = uLightSpaceMatrix * vec4(FragPos, 1.0);
vec3 proj = lsPos.xyz / lsPos.w * 0.5 + 0.5;
if (proj.z > 1.0) return 1.0;
float edgeDist = max(abs(proj.x - 0.5), abs(proj.y - 0.5));
float coverageFade = 1.0 - smoothstep(0.40, 0.49, edgeDist);
vec3 norm = normalize(Normal);
vec3 lightDir = normalize(-uLightDir);
float bias = max(0.005 * (1.0 - dot(norm, lightDir)), 0.001);
// 5-tap PCF tuned for slightly sharper detail while keeping stability.
vec2 texel = vec2(1.0 / 2048.0);
float ref = proj.z - bias;
vec2 off = texel * 0.7;
float shadow = 0.0;
shadow += texture(uShadowMap, vec3(proj.xy, ref)) * 0.55;
shadow += texture(uShadowMap, vec3(proj.xy + vec2(off.x, 0.0), ref)) * 0.1125;
shadow += texture(uShadowMap, vec3(proj.xy - vec2(off.x, 0.0), ref)) * 0.1125;
shadow += texture(uShadowMap, vec3(proj.xy + vec2(0.0, off.y), ref)) * 0.1125;
shadow += texture(uShadowMap, vec3(proj.xy - vec2(0.0, off.y), ref)) * 0.1125;
return mix(1.0, shadow, coverageFade);
}
float sampleAlpha(sampler2D tex, vec2 uv) {
// Slight blur near alpha-map borders to hide seams between chunks.
vec2 edge = min(uv, 1.0 - uv);
float border = min(edge.x, edge.y);
float doBlur = step(border, 2.0 / 64.0); // within ~2 texels of edge
if (doBlur < 0.5) {
return texture(tex, uv).r;
}
vec2 texel = vec2(1.0 / 64.0);
float a = 0.0;
a += texture(tex, uv + vec2(-texel.x, 0.0)).r;
a += texture(tex, uv + vec2(texel.x, 0.0)).r;
a += texture(tex, uv + vec2(0.0, -texel.y)).r;
a += texture(tex, uv + vec2(0.0, texel.y)).r;
return a * 0.25;
}
void main() {
// Sample base texture
vec4 baseColor = texture(uBaseTexture, TexCoord);
vec4 finalColor = baseColor;
// Apply texture layers with alpha blending
// TexCoord = tiling UVs for texture sampling (repeats across chunk)
// LayerUV = 0-1 per-chunk UVs for alpha map sampling
float a1 = uHasLayer1 ? sampleAlpha(uLayer1Alpha, LayerUV) : 0.0;
float a2 = uHasLayer2 ? sampleAlpha(uLayer2Alpha, LayerUV) : 0.0;
float a3 = uHasLayer3 ? sampleAlpha(uLayer3Alpha, LayerUV) : 0.0;
// Normalize weights to reduce quilting seams at chunk borders.
float w0 = 1.0;
float w1 = a1;
float w2 = a2;
float w3 = a3;
float sum = w0 + w1 + w2 + w3;
if (sum > 0.0) {
w0 /= sum; w1 /= sum; w2 /= sum; w3 /= sum;
}
finalColor = baseColor * w0;
if (uHasLayer1) {
vec4 layer1Color = texture(uLayer1Texture, TexCoord);
finalColor += layer1Color * w1;
}
if (uHasLayer2) {
vec4 layer2Color = texture(uLayer2Texture, TexCoord);
finalColor += layer2Color * w2;
}
if (uHasLayer3) {
vec4 layer3Color = texture(uLayer3Texture, TexCoord);
finalColor += layer3Color * w3;
}
// Normalize normal
vec3 norm = normalize(Normal);
vec3 lightDir = normalize(-uLightDir);
// Ambient lighting
vec3 ambient = uAmbientColor * finalColor.rgb;
// Diffuse lighting (two-sided for terrain hills)
float diff = abs(dot(norm, lightDir));
diff = max(diff, 0.2); // Minimum light to prevent completely dark faces
vec3 diffuse = diff * uLightColor * finalColor.rgb;
// Shadow
float shadow = uShadowEnabled ? calcShadow() : 1.0;
shadow = mix(1.0, shadow, clamp(uShadowStrength, 0.0, 1.0));
// Combine lighting (terrain is purely diffuse — no specular on ground)
vec3 result = ambient + shadow * diffuse;
// Apply fog
float distance = length(uViewPos - FragPos);
float fogFactor = clamp((uFogEnd - distance) / (uFogEnd - uFogStart), 0.0, 1.0);
result = mix(uFogColor, result, fogFactor);
FragColor = vec4(result, 1.0);
}

View file

@ -1,28 +0,0 @@
#version 330 core
layout(location = 0) in vec3 aPosition;
layout(location = 1) in vec3 aNormal;
layout(location = 2) in vec2 aTexCoord;
layout(location = 3) in vec2 aLayerUV;
out vec3 FragPos;
out vec3 Normal;
out vec2 TexCoord;
out vec2 LayerUV;
uniform mat4 uModel;
uniform mat4 uView;
uniform mat4 uProjection;
void main() {
vec4 worldPos = uModel * vec4(aPosition, 1.0);
FragPos = worldPos.xyz;
// Terrain uses identity model matrix, so normal passes through directly
Normal = aNormal;
TexCoord = aTexCoord;
LayerUV = aLayerUV;
gl_Position = uProjection * uView * worldPos;
}

View file

@ -47,12 +47,16 @@ layout(location = 0) out vec4 outColor;
// Dual-scroll detail normals (multi-octave ripple overlay)
// ============================================================
vec3 dualScrollWaveNormal(vec2 p, float time) {
vec2 d1 = normalize(vec2(0.86, 0.51));
vec2 d2 = normalize(vec2(-0.47, 0.88));
vec2 d3 = normalize(vec2(0.32, -0.95));
float f1 = 0.19, f2 = 0.43, f3 = 0.72;
float s1 = 0.95, s2 = 1.73, s3 = 2.40;
float a1 = 0.22, a2 = 0.10, a3 = 0.05;
// Three wave octaves at different angles, frequencies, and speeds.
// Directions are non-axis-aligned to prevent visible tiling patterns.
// Frequency increases and amplitude decreases per octave (standard
// multi-octave noise layering for natural water appearance).
vec2 d1 = normalize(vec2(0.86, 0.51)); // ~30° from +X
vec2 d2 = normalize(vec2(-0.47, 0.88)); // ~118° (opposing cross-wave)
vec2 d3 = normalize(vec2(0.32, -0.95)); // ~-71° (third axis for variety)
float f1 = 0.19, f2 = 0.43, f3 = 0.72; // spatial frequency (higher = tighter ripples)
float s1 = 0.95, s2 = 1.73, s3 = 2.40; // scroll speed (higher octaves move faster)
float a1 = 0.22, a2 = 0.10, a3 = 0.05; // amplitude (decreasing for natural falloff)
vec2 p1 = p + d1 * (time * s1 * 4.0);
vec2 p2 = p + d2 * (time * s2 * 4.0);

33
assets/textures/README.md Normal file
View file

@ -0,0 +1,33 @@
# HD Texture Assets
**Source**: TurtleHD Texture Pack (Turtle WoW)
**Imported**: 2026-01-27
**Total Files**: 298 BLP textures
**Total Size**: 10MB
## Directory Structure
```
textures/
├── character/
│ └── human/ # 274 human male textures
├── creature/ # 15 creature textures
├── item/ # (reserved for future)
└── world/
├── generic/ # 1 generic world texture
└── stormwind/ # 8 Stormwind building textures
```
## Usage
These HD BLP textures are ready for integration with:
- **WMO Renderer**: Building texture mapping
- **Character Renderer**: M2 model skin/face textures
- **Creature Renderer**: NPC texture application
## Integration Status
Textures are loaded via the BLP pipeline and applied to WMO/M2 renderers.
HD texture overrides (e.g. TurtleHD packs) can be placed as PNG files
alongside the original BLP paths — the asset manager checks for `.png`
overrides before loading the `.blp` version.

283
container/FLOW.md Normal file
View file

@ -0,0 +1,283 @@
# Container Build Flow
Comprehensive documentation of the Docker-based build pipeline for each target platform.
---
## Architecture Overview
Each platform follows the same two-phase pattern:
1. **Image Build** (one-time, cached by Docker) — installs compilers, toolchains, and pre-builds vcpkg dependencies.
2. **Container Run** (each build) — copies source into the container, runs CMake configure + build, outputs artifacts to the host.
```
Host Docker
─────────────────────────────────────────────────────────────
run-{platform}.sh/.ps1
├─ docker build builder-{platform}.Dockerfile
│ (cached after first run) ├─ install compilers
│ ├─ install vcpkg + packages
│ └─ COPY build-{platform}.sh
└─ docker run build-{platform}.sh (entrypoint)
├─ bind /src (readonly) ├─ tar copy source → /wowee-build-src
└─ bind /out (writable) ├─ git clone FidelityFX SDKs
├─ cmake -S . -B /out
├─ cmake --build /out
└─ artifacts appear in /out
```
---
## Linux Build Flow
**Image:** `wowee-builder-linux`
**Dockerfile:** `builder-linux.Dockerfile`
**Toolchain:** GCC + Ninja (native amd64)
**Base:** Ubuntu 24.04
### Docker Image Build Steps
| Step | What | Why |
|------|------|-----|
| 1 | `apt-get install` cmake, ninja-build, build-essential, pkg-config, git, python3 | Core build tools |
| 2 | `apt-get install` glslang-tools, spirv-tools | Vulkan shader compilation |
| 3 | `apt-get install` libsdl2-dev, libglew-dev, libglm-dev, libssl-dev, zlib1g-dev | Runtime dependencies (system packages) |
| 4 | `apt-get install` libavformat-dev, libavcodec-dev, libswscale-dev, libavutil-dev | FFmpeg libraries |
| 5 | `apt-get install` libvulkan-dev, vulkan-tools | Vulkan SDK |
| 6 | `apt-get install` libstorm-dev, libunicorn-dev | MPQ archive + CPU emulation |
| 7 | COPY `build-linux.sh``/build-platform.sh` | Container entrypoint |
### Container Run Steps (build-linux.sh)
```
1. tar copy /src → /wowee-build-src (excludes build/, .git/, large Data/ dirs)
2. git clone FidelityFX-FSR2 (if missing)
3. git clone FidelityFX-SDK (if missing)
4. cmake configure:
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
5. cmake --build (parallel)
6. Create Data symlink: build/linux/bin/Data → ../../../Data
```
### Output
- `build/linux/bin/wowee` — ELF 64-bit x86-64 executable
- `build/linux/bin/Data` — symlink to project Data/ directory
---
## macOS Build Flow
**Image:** `wowee-builder-macos`
**Dockerfile:** `builder-macos.Dockerfile` (multi-stage)
**Toolchain:** osxcross (Clang 18 + Apple ld64)
**Base:** Ubuntu 24.04
**Targets:** arm64-apple-darwin24.5 (default), x86_64-apple-darwin24.5
### Docker Image Build — Stage 1: SDK Fetcher
The macOS SDK is fetched automatically from Apple's public software update catalog.
No manual download required.
| Step | What | Why |
|------|------|-----|
| 1 | `FROM ubuntu:24.04 AS sdk-fetcher` | Lightweight stage for SDK download |
| 2 | `apt-get install` ca-certificates, python3, cpio, tar, gzip, xz-utils | SDK extraction tools |
| 3 | COPY `macos/sdk-fetcher.py``/opt/sdk-fetcher.py` | Python script that scrapes Apple's SUCATALOG |
| 4 | `python3 /opt/sdk-fetcher.py /opt/sdk` | Downloads, extracts, and packages MacOSX15.5.sdk.tar.gz |
**SDK Fetcher internals** (`macos/sdk-fetcher.py`):
1. Queries Apple SUCATALOG URLs for the latest macOS package
2. Downloads the `CLTools_macOSNMOS_SDK.pkg` package
3. Extracts the XAR archive (using `bsdtar` or pure-Python fallback)
4. Decompresses the PBZX payload stream
5. Extracts via `cpio` to get the SDK directory
6. Packages as `MacOSX<version>.sdk.tar.gz`
### Docker Image Build — Stage 2: Builder
| Step | What | Why |
|------|------|-----|
| 1 | `FROM ubuntu:24.04 AS builder` | Full build environment |
| 2 | `apt-get install` cmake, ninja-build, git, python3, curl, wget, xz-utils, zip, unzip, tar, make, patch, libssl-dev, zlib1g-dev, pkg-config, libbz2-dev, libxml2-dev, uuid-dev | Build tools + osxcross build deps |
| 3 | Install Clang 18 from LLVM apt repo (`llvm-toolchain-jammy-18`) | Cross-compiler backend |
| 4 | Symlink clang-18 → clang, clang++-18 → clang++, etc. | osxcross expects unversioned names |
| 5 | `git clone osxcross``/opt/osxcross` | Apple cross-compile toolchain wrapper |
| 6 | `COPY --from=sdk-fetcher /opt/sdk/ → /opt/osxcross/tarballs/` | SDK from stage 1 |
| 7 | `UNATTENDED=1 ./build.sh` | Builds osxcross (LLVM wrappers + cctools + ld64) |
| 8 | Create unprefixed symlinks (install_name_tool, otool, lipo, codesign) | vcpkg/CMake need these without arch prefix |
| 9 | COPY `macos/osxcross-toolchain.cmake``/opt/osxcross-toolchain.cmake` | Auto-detecting CMake toolchain |
| 10 | COPY `macos/triplets/``/opt/vcpkg-triplets/` | vcpkg cross-compile triplet definitions |
| 11 | `apt-get install` file, nasm | Mach-O detection + ffmpeg x86 asm |
| 12 | Bootstrap vcpkg → `/opt/vcpkg` | Package manager |
| 13 | `vcpkg install` sdl2, openssl, glew, glm, zlib, ffmpeg `--triplet arm64-osx-cross` | arm64 dependencies |
| 14 | `vcpkg install` same packages `--triplet x64-osx-cross` | x86_64 dependencies |
| 15 | `apt-get install` libvulkan-dev, glslang-tools | Vulkan headers (for compilation, not runtime) |
| 16 | COPY `build-macos.sh``/build-platform.sh` | Container entrypoint |
### Custom Toolchain Files
**`macos/osxcross-toolchain.cmake`** — Auto-detecting CMake toolchain:
- Detects SDK path via `file(GLOB)` in `/opt/osxcross/target/SDK/MacOSX*.sdk`
- Detects darwin version from compiler binary names (e.g., `arm64-apple-darwin24.5-clang`)
- Picks architecture from `CMAKE_OSX_ARCHITECTURES`
- Sets `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`, `CMAKE_AR`, `CMAKE_RANLIB`, `CMAKE_STRIP`
**`macos/triplets/arm64-osx-cross.cmake`**:
```cmake
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /opt/osxcross-toolchain.cmake)
```
### Container Run Steps (build-macos.sh)
```
1. Determine arch from MACOS_ARCH env (default: arm64)
2. Pick vcpkg triplet: arm64-osx-cross or x64-osx-cross
3. Auto-detect darwin target from osxcross binaries
4. tar copy /src → /wowee-build-src
5. git clone FidelityFX-FSR2 + FidelityFX-SDK (if missing)
6. cmake configure:
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_OSX_ARCHITECTURES=${ARCH}
-DCMAKE_C_COMPILER=osxcross clang
-DCMAKE_CXX_COMPILER=osxcross clang++
-DCMAKE_TOOLCHAIN_FILE=vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=arm64-osx-cross
-DVCPKG_OVERLAY_TRIPLETS=/opt/vcpkg-triplets
7. cmake --build (parallel)
```
### CMakeLists.txt Integration
The main CMakeLists.txt has a macOS cross-compile branch that:
- Finds Vulkan headers via vcpkg (`VulkanHeaders` package) instead of the Vulkan SDK
- Adds `-undefined dynamic_lookup` linker flag for Vulkan loader symbols (resolved at runtime via MoltenVK)
### Output
- `build/macos/bin/wowee` — Mach-O 64-bit arm64 (or x86_64) executable (~40 MB)
---
## Windows Build Flow
**Image:** `wowee-builder-windows`
**Dockerfile:** `builder-windows.Dockerfile`
**Toolchain:** LLVM-MinGW (Clang + LLD) targeting x86_64-w64-mingw32-ucrt
**Base:** Ubuntu 24.04
### Docker Image Build Steps
| Step | What | Why |
|------|------|-----|
| 1 | `apt-get install` ca-certificates, build-essential, cmake, ninja-build, git, python3, curl, zip, unzip, tar, xz-utils, pkg-config, nasm, libssl-dev, zlib1g-dev | Build tools |
| 2 | Download + extract LLVM-MinGW (v20240619 ucrt) → `/opt/llvm-mingw` | Clang/LLD cross-compiler for Windows |
| 3 | Add `/opt/llvm-mingw/bin` to PATH | Makes `x86_64-w64-mingw32-clang` etc. available |
| 4 | Bootstrap vcpkg → `/opt/vcpkg` | Package manager |
| 5 | `vcpkg install` sdl2, openssl, glew, glm, zlib, ffmpeg `--triplet x64-mingw-static` | Static Windows dependencies |
| 6 | `apt-get install` libvulkan-dev, glslang-tools | Vulkan headers + shader tools |
| 7 | Create no-op `powershell.exe` stub | vcpkg MinGW post-build hook needs it |
| 8 | COPY `build-windows.sh``/build-platform.sh` | Container entrypoint |
### Container Run Steps (build-windows.sh)
```
1. Set up no-op powershell.exe (if not already present)
2. tar copy /src → /wowee-build-src
3. git clone FidelityFX-FSR2 + FidelityFX-SDK (if missing)
4. Generate Vulkan import library:
a. Extract vk* symbols from vulkan_core.h
b. Create vulkan-1.def file
c. Run dlltool to create libvulkan-1.a
5. Lock PKG_CONFIG_LIBDIR to vcpkg packages only
6. cmake configure:
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++
-DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres
-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld
-DCMAKE_TOOLCHAIN_FILE=vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=x64-mingw-static
-DVCPKG_APPLOCAL_DEPS=OFF
7. cmake --build (parallel)
```
### Vulkan Import Library Generation
Windows applications link against `vulkan-1.dll` (the Khronos Vulkan loader). Since the LLVM-MinGW toolchain doesn't ship a Vulkan import library, the build script generates one:
1. Parses `vulkan_core.h` for `VKAPI_CALL vk*` function names
2. Creates a `.def` file mapping symbols to `vulkan-1.dll`
3. Uses `dlltool` to produce `libvulkan-1.a` (PE import library)
This allows the linker to resolve Vulkan symbols at build time, while deferring actual loading to the runtime DLL.
### Output
- `build/windows/bin/wowee.exe` — PE32+ x86-64 executable (~135 MB)
---
## Shared Patterns
### Source Tree Copy
All three platforms use the same tar-based copy with exclusions:
```bash
tar -C /src \
--exclude='./build' --exclude='./logs' --exclude='./cache' \
--exclude='./container' --exclude='./.git' \
--exclude='./Data/character' --exclude='./Data/creature' \
--exclude='./Data/db' --exclude='./Data/environment' \
--exclude='./Data/interface' --exclude='./Data/item' \
--exclude='./Data/misc' --exclude='./Data/sound' \
--exclude='./Data/spell' --exclude='./Data/terrain' \
--exclude='./Data/world' \
-cf - . | tar -C /wowee-build-src -xf -
```
**Kept:** `Data/opcodes/`, `Data/expansions/` (small, needed at build time for configuration).
**Excluded:** Large game asset directories (character, creature, environment, etc.) not needed for compilation.
### FidelityFX SDK Fetch
All platforms clone the same two repos at build time:
1. **FidelityFX-FSR2** — FSR 2.0 upscaling
2. **FidelityFX-SDK** — FSR 3.0 frame generation (repo URL/ref configurable via env vars)
### .dockerignore
The `.dockerignore` at the project root minimizes the Docker build context by excluding:
- `build/`, `cache/`, `logs/`, `.git/`
- Large external dirs (`extern/FidelityFX-*`)
- IDE files, documentation, host-only scripts
- SDK tarballs (`*.tar.xz`, `*.tar.gz`, etc.)
---
## Timing Estimates
These are approximate times on a 4-core machine with 16 GB RAM:
| Phase | Linux | macOS | Windows |
|-------|-------|-------|---------|
| Docker image build (first time) | ~5 min | ~25 min | ~15 min |
| Docker image build (cached) | seconds | seconds | seconds |
| Source copy + SDK fetch | ~10 sec | ~10 sec | ~10 sec |
| CMake configure | ~20 sec | ~30 sec | ~30 sec |
| Compilation | ~8 min | ~8 min | ~8 min |
| **Total (first build)** | **~14 min** | **~34 min** | **~24 min** |
| **Total (subsequent)** | **~9 min** | **~9 min** | **~9 min** |
macOS image is slowest because osxcross builds a subset of LLVM + cctools, and vcpkg packages are compiled for two architectures (arm64 + x64).

119
container/README.md Normal file
View file

@ -0,0 +1,119 @@
# Container Builds
Build WoWee for **Linux**, **macOS**, or **Windows** with a single command.
All builds run inside Docker — no toolchains to install on your host.
## Prerequisites
- [Docker](https://docs.docker.com/get-docker/) (Docker Desktop on Windows/macOS, or Docker Engine on Linux)
- ~20 GB free disk space (toolchains + vcpkg packages are cached in the Docker image)
## Quick Start
Run **from the project root directory**.
### Linux (native amd64)
```bash
# Bash / Linux / macOS terminal
./container/run-linux.sh
```
```powershell
# PowerShell (Windows)
.\container\run-linux.ps1
```
Output: `build/linux/bin/wowee`
### macOS (cross-compile, arm64 default)
```bash
./container/run-macos.sh
```
```powershell
.\container\run-macos.ps1
```
Output: `build/macos/bin/wowee`
For Intel (x86_64):
```bash
MACOS_ARCH=x86_64 ./container/run-macos.sh
```
```powershell
.\container\run-macos.ps1 -Arch x86_64
```
### Windows (cross-compile, x86_64)
```bash
./container/run-windows.sh
```
```powershell
.\container\run-windows.ps1
```
Output: `build/windows/bin/wowee.exe`
## Options
| Option | Bash | PowerShell | Description |
|--------|------|------------|-------------|
| Rebuild image | `--rebuild-image` | `-RebuildImage` | Force a fresh Docker image build |
| macOS arch | `MACOS_ARCH=x86_64` | `-Arch x86_64` | Build for Intel instead of Apple Silicon |
| FidelityFX SDK repo | `WOWEE_FFX_SDK_REPO=<url>` | `$env:WOWEE_FFX_SDK_REPO="<url>"` | Custom FidelityFX SDK git URL |
| FidelityFX SDK ref | `WOWEE_FFX_SDK_REF=<ref>` | `$env:WOWEE_FFX_SDK_REF="<ref>"` | Custom FidelityFX SDK git ref/tag |
## Docker Image Caching
The first build takes longer because Docker builds the toolchain image (installing compilers, vcpkg packages, etc.). Subsequent builds reuse the cached image and only run the compilation step.
To force a full image rebuild:
```bash
./container/run-linux.sh --rebuild-image
```
## Output Locations
| Target | Binary | Size |
|--------|--------|------|
| Linux | `build/linux/bin/wowee` | ~135 MB |
| macOS | `build/macos/bin/wowee` | ~40 MB |
| Windows | `build/windows/bin/wowee.exe` | ~135 MB |
## File Structure
```
container/
├── run-linux.sh / .ps1 # Host launchers (bash / PowerShell)
├── run-macos.sh / .ps1
├── run-windows.sh / .ps1
├── build-linux.sh # Container entrypoints (run inside Docker)
├── build-macos.sh
├── build-windows.sh
├── builder-linux.Dockerfile # Docker image definitions
├── builder-macos.Dockerfile
├── builder-windows.Dockerfile
├── macos/
│ ├── sdk-fetcher.py # Auto-fetches macOS SDK from Apple's catalog
│ ├── osxcross-toolchain.cmake # CMake toolchain for osxcross
│ └── triplets/ # vcpkg cross-compile triplets
│ ├── arm64-osx-cross.cmake
│ └── x64-osx-cross.cmake
├── README.md # This file
└── FLOW.md # Detailed build flow documentation
```
## Troubleshooting
**"docker is not installed or not in PATH"**
Install Docker and ensure the `docker` command is available in your terminal.
**Build fails on first run**
Some vcpkg packages (ffmpeg, SDL2) take a while to compile. Ensure you have enough RAM (4 GB+) and disk space.
**macOS build: "could not find osxcross compiler"**
The Docker image may not have built correctly. Run with `--rebuild-image` to rebuild from scratch.
**Windows build: linker errors about vulkan-1.dll**
The build script auto-generates a Vulkan import library. If this fails, ensure the Docker image has `libvulkan-dev` installed (it should, by default).

View file

@ -1,19 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
podman build \
-f "${SCRIPT_DIR}/builder-ubuntu.Dockerfile" \
-t wowee-builder-ubuntu
BUILD_DIR="$(mktemp --tmpdir -d wowee.XXXXX \
--suffix=".$(cd "${PROJECT_ROOT}"; git rev-parse --short HEAD)")"
podman run \
--mount "type=bind,src=${PROJECT_ROOT},dst=/WoWee-src,ro=true" \
--mount "type=bind,src=${BUILD_DIR},dst=/build" \
localhost/wowee-builder-ubuntu \
./build-wowee.sh

63
container/build-linux.sh Executable file
View file

@ -0,0 +1,63 @@
#!/bin/bash
# Linux amd64 build entrypoint — runs INSIDE the linux container.
# Bind-mounts:
# /src (ro) — project source
# /out (rw) — host ./build/linux
set -euo pipefail
SRC=/src
OUT=/out
NPROC=$(nproc)
echo "==> [linux] Copying source tree..."
mkdir -p /wowee-build-src
tar -C "${SRC}" \
--exclude='./build' --exclude='./logs' --exclude='./cache' \
--exclude='./container' --exclude='./.git' \
--exclude='./Data/character' --exclude='./Data/creature' \
--exclude='./Data/db' --exclude='./Data/environment' \
--exclude='./Data/interface' --exclude='./Data/item' \
--exclude='./Data/misc' --exclude='./Data/sound' \
--exclude='./Data/spell' --exclude='./Data/terrain' \
--exclude='./Data/world' \
-cf - . | tar -C /wowee-build-src -xf -
cd /wowee-build-src
echo "==> [linux] Fetching external SDKs (if needed)..."
if [ ! -f extern/FidelityFX-FSR2/src/ffx-fsr2-api/ffx_fsr2.h ]; then
git clone --depth 1 \
https://github.com/GPUOpen-Effects/FidelityFX-FSR2.git \
extern/FidelityFX-FSR2 || echo "Warning: FSR2 clone failed — continuing without FSR2"
fi
SDK_REPO="${WOWEE_FFX_SDK_REPO:-https://github.com/Kelsidavis/FidelityFX-SDK.git}"
SDK_REF="${WOWEE_FFX_SDK_REF:-main}"
if [ ! -f "extern/FidelityFX-SDK/sdk/include/FidelityFX/host/ffx_frameinterpolation.h" ]; then
git clone --depth 1 --branch "${SDK_REF}" "${SDK_REPO}" extern/FidelityFX-SDK \
|| echo "Warning: FidelityFX-SDK clone failed — continuing without FSR3"
fi
echo "==> [linux] Configuring with CMake (Release, Ninja, amd64)..."
cmake -S . -B "${OUT}" \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
echo "==> [linux] Building with ${NPROC} cores..."
cmake --build "${OUT}" --parallel "${NPROC}"
echo "==> [linux] Creating Data symlink..."
mkdir -p "${OUT}/bin"
if [ ! -e "${OUT}/bin/Data" ]; then
# Relative symlink so it resolves correctly on the host:
# build/linux/bin/Data -> ../../../Data (project root)
ln -s ../../../Data "${OUT}/bin/Data"
fi
echo ""
echo "==> [linux] Build complete. Artifacts in: ./build/linux/"
echo " Binary: ./build/linux/bin/wowee"

83
container/build-macos.sh Executable file
View file

@ -0,0 +1,83 @@
#!/bin/bash
# macOS cross-compile entrypoint — runs INSIDE the macos container.
# Toolchain: osxcross + Apple Clang, target: arm64-apple-darwin (default) or
# x86_64-apple-darwin when MACOS_ARCH=x86_64.
# Bind-mounts:
# /src (ro) — project source
# /out (rw) — host ./build/macos
set -euo pipefail
SRC=/src
OUT=/out
NPROC=$(nproc)
# Arch selection: arm64 (Apple Silicon) is the default primary target.
ARCH="${MACOS_ARCH:-arm64}"
case "${ARCH}" in
arm64) VCPKG_TRIPLET=arm64-osx-cross ;;
x86_64) VCPKG_TRIPLET=x64-osx-cross ;;
*) echo "ERROR: unsupported MACOS_ARCH '${ARCH}'. Use arm64 or x86_64." ; exit 1 ;;
esac
# Auto-detect darwin target from osxcross binaries (e.g. arm64-apple-darwin24.5).
OSXCROSS_BIN=/opt/osxcross/target/bin
TARGET=$(basename "$(ls "${OSXCROSS_BIN}/${ARCH}-apple-darwin"*-clang 2>/dev/null | head -1)" | sed 's/-clang$//')
if [[ -z "${TARGET}" ]]; then
echo "ERROR: could not find osxcross ${ARCH} compiler in ${OSXCROSS_BIN}" >&2
exit 1
fi
echo "==> Detected osxcross target: ${TARGET}"
echo "==> [macos/${ARCH}] Copying source tree..."
mkdir -p /wowee-build-src
tar -C "${SRC}" \
--exclude='./build' --exclude='./logs' --exclude='./cache' \
--exclude='./container' --exclude='./.git' \
--exclude='./Data/character' --exclude='./Data/creature' \
--exclude='./Data/db' --exclude='./Data/environment' \
--exclude='./Data/interface' --exclude='./Data/item' \
--exclude='./Data/misc' --exclude='./Data/sound' \
--exclude='./Data/spell' --exclude='./Data/terrain' \
--exclude='./Data/world' \
-cf - . | tar -C /wowee-build-src -xf -
cd /wowee-build-src
echo "==> [macos/${ARCH}] Fetching external SDKs (if needed)..."
if [ ! -f extern/FidelityFX-FSR2/src/ffx-fsr2-api/ffx_fsr2.h ]; then
git clone --depth 1 \
https://github.com/GPUOpen-Effects/FidelityFX-FSR2.git \
extern/FidelityFX-FSR2 || echo "Warning: FSR2 clone failed"
fi
SDK_REPO="${WOWEE_FFX_SDK_REPO:-https://github.com/Kelsidavis/FidelityFX-SDK.git}"
SDK_REF="${WOWEE_FFX_SDK_REF:-main}"
if [ ! -f "extern/FidelityFX-SDK/sdk/include/FidelityFX/host/ffx_frameinterpolation.h" ]; then
git clone --depth 1 --branch "${SDK_REF}" "${SDK_REPO}" extern/FidelityFX-SDK \
|| echo "Warning: FidelityFX-SDK clone failed"
fi
echo "==> [macos/${ARCH}] Configuring with CMake (Release, Ninja, osxcross ${TARGET})..."
cmake -S . -B "${OUT}" \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_ARCHITECTURES="${ARCH}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET:-13.0}" \
-DCMAKE_C_COMPILER="${OSXCROSS_BIN}/${TARGET}-clang" \
-DCMAKE_CXX_COMPILER="${OSXCROSS_BIN}/${TARGET}-clang++" \
-DCMAKE_AR="${OSXCROSS_BIN}/${TARGET}-ar" \
-DCMAKE_RANLIB="${OSXCROSS_BIN}/${TARGET}-ranlib" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="${VCPKG_TRIPLET}" \
-DVCPKG_OVERLAY_TRIPLETS=/opt/vcpkg-triplets \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DWOWEE_ENABLE_ASAN=OFF
echo "==> [macos/${ARCH}] Building with ${NPROC} cores..."
cmake --build "${OUT}" --parallel "${NPROC}"
echo ""
echo "==> [macos/${ARCH}] Build complete. Artifacts in: ./build/macos/"
echo " Binary: ./build/macos/bin/wowee"

110
container/build-windows.sh Executable file
View file

@ -0,0 +1,110 @@
#!/bin/bash
# Windows cross-compile entrypoint — runs INSIDE the windows container.
# Toolchain: LLVM-MinGW (Clang + LLD), target: x86_64-w64-mingw32-ucrt
# Bind-mounts:
# /src (ro) — project source
# /out (rw) — host ./build/windows
set -euo pipefail
SRC=/src
OUT=/out
NPROC=$(nproc)
TARGET=x86_64-w64-mingw32
# vcpkg's MinGW applocal hook always appends a powershell.exe post-build step to
# copy DLLs next to each binary, even when VCPKG_APPLOCAL_DEPS=OFF. For the
# x64-mingw-static triplet the bin/ dir is empty (no DLLs) so the script does
# nothing — but it still needs to exit 0. Provide a no-op stub if the real
# PowerShell isn't available.
if ! command -v powershell.exe &>/dev/null; then
printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/powershell.exe
chmod +x /usr/local/bin/powershell.exe
fi
echo "==> [windows] Copying source tree..."
mkdir -p /wowee-build-src
tar -C "${SRC}" \
--exclude='./build' --exclude='./logs' --exclude='./cache' \
--exclude='./container' --exclude='./.git' \
--exclude='./Data/character' --exclude='./Data/creature' \
--exclude='./Data/db' --exclude='./Data/environment' \
--exclude='./Data/interface' --exclude='./Data/item' \
--exclude='./Data/misc' --exclude='./Data/sound' \
--exclude='./Data/spell' --exclude='./Data/terrain' \
--exclude='./Data/world' \
-cf - . | tar -C /wowee-build-src -xf -
cd /wowee-build-src
echo "==> [windows] Fetching external SDKs (if needed)..."
if [ ! -f extern/FidelityFX-FSR2/src/ffx-fsr2-api/ffx_fsr2.h ]; then
git clone --depth 1 \
https://github.com/GPUOpen-Effects/FidelityFX-FSR2.git \
extern/FidelityFX-FSR2 || echo "Warning: FSR2 clone failed"
fi
SDK_REPO="${WOWEE_FFX_SDK_REPO:-https://github.com/Kelsidavis/FidelityFX-SDK.git}"
SDK_REF="${WOWEE_FFX_SDK_REF:-main}"
if [ ! -f "extern/FidelityFX-SDK/sdk/include/FidelityFX/host/ffx_frameinterpolation.h" ]; then
git clone --depth 1 --branch "${SDK_REF}" "${SDK_REPO}" extern/FidelityFX-SDK \
|| echo "Warning: FidelityFX-SDK clone failed"
fi
echo "==> [windows] Generating Vulkan import library for cross-compile..."
# Windows applications link against vulkan-1.dll (the Khronos Vulkan loader).
# The cross-compile toolchain only ships Vulkan *headers* (via vcpkg), not the
# import library. Generate a minimal libvulkan-1.a from the header prototypes
# so the linker can resolve vk* symbols → vulkan-1.dll at runtime.
# We use the host libvulkan-dev header for function name extraction — the Vulkan
# API prototypes are platform-independent.
VULKAN_IMP_DIR="${OUT}/vulkan-import"
if [ ! -f "${VULKAN_IMP_DIR}/libvulkan-1.a" ]; then
mkdir -p "${VULKAN_IMP_DIR}"
# Try vcpkg-installed header first (available on incremental builds),
# then fall back to the host libvulkan-dev header (always present in the image).
VK_HEADER="${OUT}/vcpkg_installed/x64-mingw-static/include/vulkan/vulkan_core.h"
if [ ! -f "${VK_HEADER}" ]; then
VK_HEADER="/usr/include/vulkan/vulkan_core.h"
fi
{
echo "LIBRARY vulkan-1.dll"
echo "EXPORTS"
grep -oP 'VKAPI_ATTR \S+ VKAPI_CALL \K(vk\w+)' "${VK_HEADER}" | sort -u | sed 's/^/ /'
} > "${VULKAN_IMP_DIR}/vulkan-1.def"
"${TARGET}-dlltool" -d "${VULKAN_IMP_DIR}/vulkan-1.def" \
-l "${VULKAN_IMP_DIR}/libvulkan-1.a" -m i386:x86-64
echo " Generated $(wc -l < "${VULKAN_IMP_DIR}/vulkan-1.def") export entries"
fi
echo "==> [windows] Configuring with CMake (Release, Ninja, LLVM-MinGW cross)..."
# Lock pkg-config to the cross-compiled vcpkg packages only.
# Without this, CMake's Vulkan pkg-config fallback finds the *Linux* libvulkan-dev
# and injects /usr/include into every MinGW compile command, which then fails
# because the glibc-specific bits/libc-header-start.h is not in the MinGW sysroot.
export PKG_CONFIG_LIBDIR="${OUT}/vcpkg_installed/x64-mingw-static/lib/pkgconfig"
export PKG_CONFIG_PATH=""
cmake -S . -B "${OUT}" \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER="${TARGET}-clang" \
-DCMAKE_CXX_COMPILER="${TARGET}-clang++" \
-DCMAKE_RC_COMPILER="${TARGET}-windres" \
-DCMAKE_AR="/opt/llvm-mingw/bin/llvm-ar" \
-DCMAKE_RANLIB="/opt/llvm-mingw/bin/llvm-ranlib" \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DVCPKG_APPLOCAL_DEPS=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DWOWEE_ENABLE_ASAN=OFF
echo "==> [windows] Building with ${NPROC} cores..."
cmake --build "${OUT}" --parallel "${NPROC}"
echo ""
echo "==> [windows] Build complete. Artifacts in: ./build/windows/"
echo " Binary: ./build/windows/bin/wowee.exe"

View file

@ -1,14 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
cp -r /WoWee-src /WoWee
pushd /WoWee
./build.sh
popd
pushd /WoWee/build
cmake --install . --prefix=/build
popd

View file

@ -0,0 +1,33 @@
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
cmake \
ninja-build \
build-essential \
pkg-config \
git \
python3 \
glslang-tools \
spirv-tools \
libsdl2-dev \
libglew-dev \
libglm-dev \
libssl-dev \
zlib1g-dev \
libavformat-dev \
libavcodec-dev \
libswscale-dev \
libavutil-dev \
libvulkan-dev \
vulkan-tools \
libstorm-dev \
libunicorn-dev && \
rm -rf /var/lib/apt/lists/*
COPY build-linux.sh /build-platform.sh
RUN chmod +x /build-platform.sh
ENTRYPOINT ["/build-platform.sh"]

View file

@ -0,0 +1,142 @@
FROM ubuntu:24.04 AS sdk-fetcher
# Stage 1: Fetch macOS SDK from Apple's public software update catalog.
# This avoids requiring the user to supply the SDK tarball manually.
# The SDK is downloaded, extracted, and packaged as a .tar.gz.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
python3 \
python3-defusedxml \
cpio \
tar \
gzip \
xz-utils && \
rm -rf /var/lib/apt/lists/*
COPY macos/sdk-fetcher.py /opt/sdk-fetcher.py
RUN python3 /opt/sdk-fetcher.py /opt/sdk
# ---------------------------------------------------------------------------
FROM ubuntu:24.04 AS builder
# Stage 2: macOS cross-compile image using osxcross + Clang 18.
#
# Target triplets (auto-detected from osxcross):
# arm64-apple-darwinNN (Apple Silicon)
# x86_64-apple-darwinNN (Intel)
# Default: arm64. Override with MACOS_ARCH=x86_64 env var at run time.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
ninja-build \
git \
python3 \
curl \
wget \
xz-utils \
zip \
unzip \
tar \
make \
patch \
libssl-dev \
zlib1g-dev \
pkg-config \
libbz2-dev \
libxml2-dev \
libz-dev \
liblzma-dev \
uuid-dev \
python3-lxml \
gnupg \
software-properties-common && \
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" > /etc/apt/sources.list.d/llvm-18.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
clang-18 \
lld-18 \
llvm-18 && \
ln -sf /usr/bin/clang-18 /usr/bin/clang && \
ln -sf /usr/bin/clang++-18 /usr/bin/clang++ && \
ln -sf /usr/bin/lld-18 /usr/bin/lld && \
ln -sf /usr/bin/ld.lld-18 /usr/bin/ld.lld && \
ln -sf /usr/bin/llvm-ar-18 /usr/bin/llvm-ar && \
rm -rf /var/lib/apt/lists/*
# Build osxcross with SDK from stage 1
RUN git clone --depth 1 https://github.com/tpoechtrager/osxcross.git /opt/osxcross
COPY --from=sdk-fetcher /opt/sdk/ /opt/osxcross/tarballs/
ENV MACOSX_DEPLOYMENT_TARGET=13.0
RUN cd /opt/osxcross && \
UNATTENDED=1 ./build.sh && \
rm -rf /opt/osxcross/build /opt/osxcross/tarballs
ENV PATH="/opt/osxcross/target/bin:${PATH}"
ENV OSXCROSS_TARGET_DIR="/opt/osxcross/target"
ENV MACOSX_DEPLOYMENT_TARGET=13.0
# Create unprefixed symlinks for macOS tools that vcpkg/CMake expect
RUN cd /opt/osxcross/target/bin && \
for tool in install_name_tool otool lipo codesign; do \
src="$(ls *-apple-darwin*-"${tool}" 2>/dev/null | head -1)"; \
if [ -n "$src" ]; then \
ln -sf "$src" "$tool"; \
fi; \
done
# Custom osxcross toolchain + vcpkg triplets
COPY macos/osxcross-toolchain.cmake /opt/osxcross-toolchain.cmake
COPY macos/triplets/ /opt/vcpkg-triplets/
# Extra tools needed by vcpkg's Mach-O rpath fixup and ffmpeg x86 asm
RUN apt-get update && \
apt-get install -y --no-install-recommends file nasm && \
rm -rf /var/lib/apt/lists/*
# vcpkg — macOS cross triplets (arm64-osx-cross / x64-osx-cross)
ENV VCPKG_ROOT=/opt/vcpkg
RUN git clone --depth 1 https://github.com/microsoft/vcpkg.git "${VCPKG_ROOT}" && \
"${VCPKG_ROOT}/bootstrap-vcpkg.sh" -disableMetrics
# Pre-install deps for both arches; the launcher script picks the right one at run time.
RUN "${VCPKG_ROOT}/vcpkg" install \
sdl2[vulkan] \
openssl \
glew \
glm \
zlib \
ffmpeg \
--triplet arm64-osx-cross \
--overlay-triplets=/opt/vcpkg-triplets
RUN "${VCPKG_ROOT}/vcpkg" install \
sdl2[vulkan] \
openssl \
glew \
glm \
zlib \
ffmpeg \
--triplet x64-osx-cross \
--overlay-triplets=/opt/vcpkg-triplets
# Vulkan SDK headers (MoltenVK is the runtime — headers only needed to compile)
RUN apt-get update && \
apt-get install -y --no-install-recommends libvulkan-dev glslang-tools && \
rm -rf /var/lib/apt/lists/*
COPY build-macos.sh /build-platform.sh
RUN chmod +x /build-platform.sh
ENTRYPOINT ["/build-platform.sh"]

View file

@ -1,25 +0,0 @@
FROM ubuntu:24.04
RUN apt-get update && \
apt install -y \
cmake \
build-essential \
pkg-config \
git \
libsdl2-dev \
libglew-dev \
libglm-dev \
libssl-dev \
zlib1g-dev \
libavformat-dev \
libavcodec-dev \
libswscale-dev \
libavutil-dev \
libvulkan-dev \
vulkan-tools \
libstorm-dev && \
rm -rf /var/lib/apt/lists/*
COPY build-wowee.sh /
ENTRYPOINT ./build-wowee.sh

View file

@ -0,0 +1,67 @@
FROM ubuntu:24.04
# Windows cross-compile using LLVM-MinGW — best-in-class Clang/LLD toolchain
# targeting x86_64-w64-mingw32. Produces native .exe/.dll without MSVC or Wine.
# LLVM-MinGW ships: clang, clang++, lld, libc++ / libunwind headers, winpthreads.
ENV DEBIAN_FRONTEND=noninteractive
ENV LLVM_MINGW_VERSION=20240619
ENV LLVM_MINGW_URL=https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-ubuntu-20.04-x86_64.tar.xz
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
cmake \
ninja-build \
git \
python3 \
curl \
zip \
unzip \
tar \
xz-utils \
pkg-config \
nasm \
libssl-dev \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*
# Install LLVM-MinGW toolchain
RUN curl -fsSL "${LLVM_MINGW_URL}" -o /tmp/llvm-mingw.tar.xz && \
tar -xf /tmp/llvm-mingw.tar.xz -C /opt && \
mv /opt/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-ubuntu-20.04-x86_64 /opt/llvm-mingw && \
rm /tmp/llvm-mingw.tar.xz
ENV PATH="/opt/llvm-mingw/bin:${PATH}"
# Windows dependencies via vcpkg (static, x64-mingw-static triplet)
ENV VCPKG_ROOT=/opt/vcpkg
RUN git clone --depth 1 https://github.com/microsoft/vcpkg.git "${VCPKG_ROOT}" && \
"${VCPKG_ROOT}/bootstrap-vcpkg.sh" -disableMetrics
ENV VCPKG_DEFAULT_TRIPLET=x64-mingw-static
RUN "${VCPKG_ROOT}/vcpkg" install \
sdl2[vulkan] \
openssl \
glew \
glm \
zlib \
ffmpeg \
--triplet x64-mingw-static
# Vulkan SDK headers (loader is linked statically via SDL2's vulkan surface)
RUN apt-get update && \
apt-get install -y --no-install-recommends libvulkan-dev glslang-tools && \
rm -rf /var/lib/apt/lists/*
# Provide a no-op powershell.exe so vcpkg's MinGW applocal post-build hook
# exits cleanly. The x64-mingw-static triplet is fully static (no DLLs to
# copy), so the script has nothing to do — it just needs to not fail.
RUN printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/powershell.exe && \
chmod +x /usr/local/bin/powershell.exe
COPY build-windows.sh /build-platform.sh
RUN chmod +x /build-platform.sh
ENTRYPOINT ["/build-platform.sh"]

View file

@ -0,0 +1,62 @@
# osxcross CMake toolchain file for cross-compiling to macOS from Linux.
# Used by vcpkg triplets and the WoWee build.
# Auto-detects SDK, darwin version, and arch from the osxcross installation
# and the VCPKG_OSX_ARCHITECTURES / CMAKE_OSX_ARCHITECTURES setting.
set(CMAKE_SYSTEM_NAME Darwin)
# osxcross paths
set(_target_dir "/opt/osxcross/target")
if(DEFINED ENV{OSXCROSS_TARGET_DIR})
set(_target_dir "$ENV{OSXCROSS_TARGET_DIR}")
endif()
# Auto-detect SDK (pick the newest if several are present)
file(GLOB _sdk_dirs "${_target_dir}/SDK/MacOSX*.sdk")
list(SORT _sdk_dirs)
list(GET _sdk_dirs -1 _sdk_dir)
set(CMAKE_OSX_SYSROOT "${_sdk_dir}" CACHE PATH "" FORCE)
# Deployment target
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "" FORCE)
if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
endif()
# auto-detect darwin version from compiler names
file(GLOB _darwin_compilers "${_target_dir}/bin/*-apple-darwin*-clang")
list(GET _darwin_compilers 0 _first_compiler)
get_filename_component(_compiler_name "${_first_compiler}" NAME)
string(REGEX MATCH "apple-darwin[0-9.]+" _darwin_part "${_compiler_name}")
# pick architecture
# CMAKE_OSX_ARCHITECTURES is set by vcpkg from VCPKG_OSX_ARCHITECTURES
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(_arch "arm64")
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
set(_arch "x86_64")
elseif(DEFINED ENV{OSXCROSS_ARCH})
set(_arch "$ENV{OSXCROSS_ARCH}")
else()
set(_arch "arm64")
endif()
set(_host "${_arch}-${_darwin_part}")
set(CMAKE_SYSTEM_PROCESSOR "${_arch}" CACHE STRING "" FORCE)
# compilers
set(CMAKE_C_COMPILER "${_target_dir}/bin/${_host}-clang" CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER "${_target_dir}/bin/${_host}-clang++" CACHE FILEPATH "" FORCE)
# tools
set(CMAKE_AR "${_target_dir}/bin/${_host}-ar" CACHE FILEPATH "" FORCE)
set(CMAKE_RANLIB "${_target_dir}/bin/${_host}-ranlib" CACHE FILEPATH "" FORCE)
set(CMAKE_STRIP "${_target_dir}/bin/${_host}-strip" CACHE FILEPATH "" FORCE)
set(CMAKE_INSTALL_NAME_TOOL "${_target_dir}/bin/${_host}-install_name_tool" CACHE FILEPATH "" FORCE)
# search paths
set(CMAKE_FIND_ROOT_PATH "${_sdk_dir}" "${_target_dir}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View file

@ -0,0 +1,380 @@
#!/usr/bin/env python3
"""Download and extract macOS SDK from Apple's Command Line Tools package.
Apple publishes Command Line Tools (CLT) packages via their publicly
accessible software update catalog. This script downloads the latest CLT,
extracts just the macOS SDK, and packages it as a .tar.gz tarball suitable
for osxcross.
No Apple ID or paid developer account required.
Usage:
python3 sdk-fetcher.py [output_dir]
The script prints the absolute path of the resulting tarball to stdout.
All progress / status messages go to stderr.
If a cached SDK tarball already exists in output_dir, it is reused.
Dependencies: python3 (>= 3.6), cpio, tar, gzip
Optional: bsdtar (libarchive-tools) or xar -- faster XAR extraction.
Falls back to a pure-Python XAR parser when neither is available.
"""
import glob
import gzip
import lzma
import os
import plistlib
import re
import shutil
import struct
import subprocess
import sys
import tempfile
import urllib.request
import zlib
try:
import defusedxml.ElementTree as ET
except ImportError as exc:
raise ImportError(
"defusedxml is required: pip install defusedxml"
) from exc
# -- Configuration -----------------------------------------------------------
CATALOG_URLS = [
# Try newest catalog first; first successful fetch wins.
"https://swscan.apple.com/content/catalogs/others/"
"index-16-15-14-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-"
"mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz",
"https://swscan.apple.com/content/catalogs/others/"
"index-15-14-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-"
"mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz",
"https://swscan.apple.com/content/catalogs/others/"
"index-14-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-"
"mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz",
]
USER_AGENT = "Software%20Update"
# -- Helpers -----------------------------------------------------------------
def _validate_url(url):
"""Reject non-HTTPS URLs to prevent file:// and other scheme attacks."""
if not url.startswith("https://"):
raise ValueError(f"Refusing non-HTTPS URL: {url}")
def log(msg):
print(msg, file=sys.stderr, flush=True)
# -- 1) Catalog & URL discovery ----------------------------------------------
def find_sdk_pkg_url():
"""Search Apple catalogs for the latest CLTools_macOSNMOS_SDK.pkg URL."""
for cat_url in CATALOG_URLS:
short = cat_url.split("/index-")[1][:25] + "..."
log(f" Trying catalog: {short}")
try:
_validate_url(cat_url)
req = urllib.request.Request(cat_url, headers={"User-Agent": USER_AGENT})
with urllib.request.urlopen(req, timeout=60) as resp: # nosemgrep: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected
raw = gzip.decompress(resp.read())
catalog = plistlib.loads(raw)
except Exception as exc:
log(f" -> fetch failed: {exc}")
continue
products = catalog.get("Products", {})
candidates = []
for pid, product in products.items():
post_date = str(product.get("PostDate", ""))
for pkg in product.get("Packages", []):
url = pkg.get("URL", "")
size = pkg.get("Size", 0)
if "CLTools_macOSNMOS_SDK" in url and url.endswith(".pkg"):
candidates.append((post_date, url, size, pid))
if not candidates:
log(f" -> no CLTools SDK packages in this catalog, trying next...")
continue
candidates.sort(reverse=True)
_date, url, size, pid = candidates[0]
log(f"==> Found: CLTools_macOSNMOS_SDK (product {pid}, {size // 1048576} MB)")
return url
log("ERROR: No CLTools SDK packages found in any Apple catalog.")
sys.exit(1)
# -- 2) Download -------------------------------------------------------------
def download(url, dest):
"""Download *url* to *dest* with a basic progress indicator."""
_validate_url(url)
req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
with urllib.request.urlopen(req, timeout=600) as resp: # nosemgrep: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected
total = int(resp.headers.get("Content-Length", 0))
done = 0
with open(dest, "wb") as f:
while True:
chunk = resp.read(1 << 20)
if not chunk:
break
f.write(chunk)
done += len(chunk)
if total:
pct = done * 100 // total
log(f"\r {done // 1048576} / {total // 1048576} MB ({pct}%)")
log("")
# -- 3) XAR extraction -------------------------------------------------------
def extract_xar(pkg_path, dest_dir):
"""Extract a XAR (.pkg) archive -- external tool or pure-Python fallback."""
for tool in ("bsdtar", "xar"):
if shutil.which(tool):
log(f"==> Extracting .pkg with {tool}...")
r = subprocess.run([tool, "-xf", pkg_path, "-C", dest_dir],
capture_output=True)
if r.returncode == 0:
return
log(f" {tool} exited {r.returncode}, trying next method...")
log("==> Extracting .pkg with built-in Python XAR parser...")
_extract_xar_python(pkg_path, dest_dir)
def _extract_xar_python(pkg_path, dest_dir):
"""Pure-Python XAR extractor (no external dependencies)."""
with open(pkg_path, "rb") as f:
raw = f.read(28)
if len(raw) < 28:
raise ValueError("File too small to be a valid XAR archive")
magic, hdr_size, _ver, toc_clen, _toc_ulen, _ck = struct.unpack(
">4sHHQQI", raw,
)
if magic != b"xar!":
raise ValueError(f"Not a XAR file (magic: {magic!r})")
f.seek(hdr_size)
toc_xml = zlib.decompress(f.read(toc_clen))
heap_off = hdr_size + toc_clen
root = ET.fromstring(toc_xml)
toc = root.find("toc")
if toc is None:
raise ValueError("Malformed XAR: no <toc> element")
def _walk(elem, base):
for fe in elem.findall("file"):
name = fe.findtext("name", "")
ftype = fe.findtext("type", "file")
path = os.path.join(base, name)
if ftype == "directory":
os.makedirs(path, exist_ok=True)
_walk(fe, path)
continue
de = fe.find("data")
if de is None:
continue
offset = int(de.findtext("offset", "0"))
size = int(de.findtext("size", "0"))
enc_el = de.find("encoding")
enc = enc_el.get("style", "") if enc_el is not None else ""
os.makedirs(os.path.dirname(path), exist_ok=True)
f.seek(heap_off + offset)
if "gzip" in enc:
with open(path, "wb") as out:
out.write(zlib.decompress(f.read(size), 15 + 32))
elif "bzip2" in enc:
import bz2
with open(path, "wb") as out:
out.write(bz2.decompress(f.read(size)))
else:
with open(path, "wb") as out:
rem = size
while rem > 0:
blk = f.read(min(rem, 1 << 20))
if not blk:
break
out.write(blk)
rem -= len(blk)
_walk(toc, dest_dir)
# -- 4) Payload extraction (pbzx / gzip cpio) --------------------------------
def _pbzx_stream(path):
"""Yield decompressed chunks from a pbzx-compressed file."""
with open(path, "rb") as f:
if f.read(4) != b"pbzx":
raise ValueError("Not a pbzx file")
f.read(8)
while True:
hdr = f.read(16)
if len(hdr) < 16:
break
_usize, csize = struct.unpack(">QQ", hdr)
data = f.read(csize)
if len(data) < csize:
break
if csize == _usize:
yield data
else:
yield lzma.decompress(data)
def _gzip_stream(path):
"""Yield decompressed chunks from a gzip file."""
with gzip.open(path, "rb") as f:
while True:
chunk = f.read(1 << 20)
if not chunk:
break
yield chunk
def _raw_stream(path):
"""Yield raw 1 MiB chunks (last resort)."""
with open(path, "rb") as f:
while True:
chunk = f.read(1 << 20)
if not chunk:
break
yield chunk
def extract_payload(payload_path, out_dir):
"""Decompress a CLT Payload (pbzx or gzip cpio) into *out_dir*."""
with open(payload_path, "rb") as pf:
magic = pf.read(4)
if magic == b"pbzx":
log(" Payload format: pbzx (LZMA chunks)")
stream = _pbzx_stream(payload_path)
elif magic[:2] == b"\x1f\x8b":
log(" Payload format: gzip")
stream = _gzip_stream(payload_path)
else:
log(f" Payload format: unknown (magic: {magic.hex()}), trying raw cpio...")
stream = _raw_stream(payload_path)
proc = subprocess.Popen(
["cpio", "-id", "--quiet"],
stdin=subprocess.PIPE,
cwd=out_dir,
stderr=subprocess.PIPE,
)
for chunk in stream:
try:
proc.stdin.write(chunk)
except BrokenPipeError:
break
proc.stdin.close()
proc.wait()
# -- Main --------------------------------------------------------------------
def main():
output_dir = os.path.abspath(sys.argv[1]) if len(sys.argv) > 1 else os.getcwd()
os.makedirs(output_dir, exist_ok=True)
# Re-use a previously fetched SDK if present.
cached = glob.glob(os.path.join(output_dir, "MacOSX*.sdk.tar.*"))
if cached:
cached.sort()
result = os.path.realpath(cached[-1])
log(f"==> Using cached SDK: {os.path.basename(result)}")
print(result)
return
work = tempfile.mkdtemp(prefix="fetch-macos-sdk-")
try:
# 1 -- Locate SDK package URL from Apple's catalog
log("==> Searching Apple software-update catalogs...")
sdk_url = find_sdk_pkg_url()
# 2 -- Download (just the SDK component, ~55 MB)
pkg = os.path.join(work, "sdk.pkg")
log("==> Downloading CLTools SDK package...")
download(sdk_url, pkg)
# 3 -- Extract the flat .pkg (XAR format) to get the Payload
pkg_dir = os.path.join(work, "pkg")
os.makedirs(pkg_dir)
extract_xar(pkg, pkg_dir)
os.unlink(pkg)
# 4 -- Locate the Payload file
log("==> Locating SDK payload...")
sdk_payload = None
for dirpath, _dirs, files in os.walk(pkg_dir):
if "Payload" in files:
sdk_payload = os.path.join(dirpath, "Payload")
log(f" Found: {os.path.relpath(sdk_payload, pkg_dir)}")
break
if sdk_payload is None:
log("ERROR: No Payload found in extracted package")
sys.exit(1)
# 5 -- Decompress Payload -> cpio -> filesystem
sdk_root = os.path.join(work, "sdk")
os.makedirs(sdk_root)
log("==> Extracting SDK from payload (this may take a minute)...")
extract_payload(sdk_payload, sdk_root)
shutil.rmtree(pkg_dir)
# 6 -- Find MacOSX*.sdk directory
sdk_found = None
for dirpath, dirs, _files in os.walk(sdk_root):
for d in dirs:
if re.match(r"MacOSX\d+(\.\d+)?\.sdk$", d):
sdk_found = os.path.join(dirpath, d)
break
if sdk_found:
break
if not sdk_found:
log("ERROR: MacOSX*.sdk directory not found. Extracted contents:")
for dp, ds, fs in os.walk(sdk_root):
depth = dp.replace(sdk_root, "").count(os.sep)
if depth < 4:
log(f" {' ' * depth}{os.path.basename(dp)}/")
sys.exit(1)
sdk_name = os.path.basename(sdk_found)
log(f"==> Found: {sdk_name}")
# 7 -- Package as .tar.gz
tarball = os.path.join(output_dir, f"{sdk_name}.tar.gz")
log(f"==> Packaging: {sdk_name}.tar.gz ...")
subprocess.run(
["tar", "-czf", tarball, "-C", os.path.dirname(sdk_found), sdk_name],
check=True,
)
log(f"==> macOS SDK ready: {tarball}")
print(tarball)
finally:
shutil.rmtree(work, ignore_errors=True)
if __name__ == "__main__":
main()

View file

@ -0,0 +1,10 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)
set(VCPKG_OSX_DEPLOYMENT_TARGET 13.0)
# osxcross toolchain
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /opt/osxcross-toolchain.cmake)

View file

@ -0,0 +1,10 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)
set(VCPKG_OSX_DEPLOYMENT_TARGET 13.0)
# osxcross toolchain
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /opt/osxcross-toolchain.cmake)

64
container/run-linux.ps1 Normal file
View file

@ -0,0 +1,64 @@
# run-linux.ps1 — Build WoWee for Linux (amd64) inside a Docker container.
#
# Usage (run from project root):
# .\container\run-linux.ps1 [-RebuildImage]
#
# Environment variables:
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
param(
[switch]$RebuildImage
)
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$ProjectRoot = (Resolve-Path "$ScriptDir\..").Path
$ImageName = "wowee-builder-linux"
$BuildOutput = "$ProjectRoot\build\linux"
# Verify Docker is available
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
Write-Error "docker is not installed or not in PATH."
exit 1
}
# Build the image (skip if already present and -RebuildImage not given)
$imageExists = docker image inspect $ImageName 2>$null
if ($RebuildImage -or -not $imageExists) {
Write-Host "==> Building Docker image: $ImageName"
docker build `
-f "$ScriptDir\builder-linux.Dockerfile" `
-t $ImageName `
"$ScriptDir"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} else {
Write-Host "==> Using existing Docker image: $ImageName"
}
# Create output directory on the host
New-Item -ItemType Directory -Force -Path $BuildOutput | Out-Null
Write-Host "==> Starting Linux build (output: $BuildOutput)"
$dockerArgs = @(
"run", "--rm",
"--mount", "type=bind,src=$ProjectRoot,dst=/src,readonly",
"--mount", "type=bind,src=$BuildOutput,dst=/out"
)
if ($env:WOWEE_FFX_SDK_REPO) {
$dockerArgs += @("--env", "WOWEE_FFX_SDK_REPO=$env:WOWEE_FFX_SDK_REPO")
}
if ($env:WOWEE_FFX_SDK_REF) {
$dockerArgs += @("--env", "WOWEE_FFX_SDK_REF=$env:WOWEE_FFX_SDK_REF")
}
$dockerArgs += $ImageName
& docker @dockerArgs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "==> Linux build complete. Artifacts in: $BuildOutput"

58
container/run-linux.sh Executable file
View file

@ -0,0 +1,58 @@
#!/usr/bin/env bash
# run-linux.sh — Build WoWee for Linux (amd64) inside a Docker container.
#
# Usage (run from project root):
# ./container/run-linux.sh [--rebuild-image]
#
# Environment variables:
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
# REBUILD_IMAGE — Set to 1 to force a fresh docker build (same as --rebuild-image)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
IMAGE_NAME="wowee-builder-linux"
BUILD_OUTPUT="${PROJECT_ROOT}/build/linux"
# Parse arguments
REBUILD_IMAGE="${REBUILD_IMAGE:-0}"
for arg in "$@"; do
case "$arg" in
--rebuild-image) REBUILD_IMAGE=1 ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done
# Verify Docker is available
if ! command -v docker &>/dev/null; then
echo "Error: docker is not installed or not in PATH." >&2
exit 1
fi
# Build the image (skip if already present and --rebuild-image not given)
if [[ "$REBUILD_IMAGE" == "1" ]] || ! docker image inspect "$IMAGE_NAME" &>/dev/null; then
echo "==> Building Docker image: ${IMAGE_NAME}"
docker build \
-f "${SCRIPT_DIR}/builder-linux.Dockerfile" \
-t "$IMAGE_NAME" \
"${SCRIPT_DIR}"
else
echo "==> Using existing Docker image: ${IMAGE_NAME}"
fi
# Create output directory on the host
mkdir -p "$BUILD_OUTPUT"
echo "==> Starting Linux build (output: ${BUILD_OUTPUT})"
docker run --rm \
--mount "type=bind,src=${PROJECT_ROOT},dst=/src,readonly" \
--mount "type=bind,src=${BUILD_OUTPUT},dst=/out" \
${WOWEE_FFX_SDK_REPO:+--env "WOWEE_FFX_SDK_REPO=${WOWEE_FFX_SDK_REPO}"} \
${WOWEE_FFX_SDK_REF:+--env "WOWEE_FFX_SDK_REF=${WOWEE_FFX_SDK_REF}"} \
"$IMAGE_NAME"
echo "==> Linux build complete. Artifacts in: ${BUILD_OUTPUT}"

71
container/run-macos.ps1 Normal file
View file

@ -0,0 +1,71 @@
# run-macos.ps1 — Cross-compile WoWee for macOS (arm64 or x86_64) inside a Docker container.
#
# Usage (run from project root):
# .\container\run-macos.ps1 [-RebuildImage] [-Arch arm64|x86_64]
#
# The macOS SDK is fetched automatically inside the Docker build from Apple's
# public software update catalog. No manual SDK download required.
#
# Environment variables:
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
param(
[switch]$RebuildImage,
[ValidateSet("arm64", "x86_64")]
[string]$Arch = "arm64"
)
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$ProjectRoot = (Resolve-Path "$ScriptDir\..").Path
$ImageName = "wowee-builder-macos"
$BuildOutput = "$ProjectRoot\build\macos"
# Verify Docker is available
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
Write-Error "docker is not installed or not in PATH."
exit 1
}
# Build the image (skip if already present and -RebuildImage not given)
$imageExists = docker image inspect $ImageName 2>$null
if ($RebuildImage -or -not $imageExists) {
Write-Host "==> Building Docker image: $ImageName"
Write-Host " (SDK will be fetched automatically from Apple's catalog)"
docker build `
-f "$ScriptDir\builder-macos.Dockerfile" `
-t $ImageName `
"$ScriptDir"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} else {
Write-Host "==> Using existing Docker image: $ImageName"
}
# Create output directory on the host
New-Item -ItemType Directory -Force -Path $BuildOutput | Out-Null
Write-Host "==> Starting macOS cross-compile build (arch=$Arch, output: $BuildOutput)"
$dockerArgs = @(
"run", "--rm",
"--mount", "type=bind,src=$ProjectRoot,dst=/src,readonly",
"--mount", "type=bind,src=$BuildOutput,dst=/out",
"--env", "MACOS_ARCH=$Arch"
)
if ($env:WOWEE_FFX_SDK_REPO) {
$dockerArgs += @("--env", "WOWEE_FFX_SDK_REPO=$env:WOWEE_FFX_SDK_REPO")
}
if ($env:WOWEE_FFX_SDK_REF) {
$dockerArgs += @("--env", "WOWEE_FFX_SDK_REF=$env:WOWEE_FFX_SDK_REF")
}
$dockerArgs += $ImageName
& docker @dockerArgs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "==> macOS cross-compile build complete. Artifacts in: $BuildOutput"

74
container/run-macos.sh Executable file
View file

@ -0,0 +1,74 @@
#!/usr/bin/env bash
# run-macos.sh — Cross-compile WoWee for macOS (arm64 or x86_64) inside a Docker container.
#
# Usage (run from project root):
# ./container/run-macos.sh [--rebuild-image]
#
# The macOS SDK is fetched automatically inside the Docker build from Apple's
# public software update catalog. No manual SDK download required.
#
# Environment variables:
# MACOS_ARCH — Target arch: arm64 (default) or x86_64
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
# REBUILD_IMAGE — Set to 1 to force a fresh docker build (same as --rebuild-image)
#
# Toolchain: osxcross (Clang + Apple ld)
# vcpkg triplets: arm64-osx-cross (arm64) / x64-osx-cross (x86_64)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
IMAGE_NAME="wowee-builder-macos"
MACOS_ARCH="${MACOS_ARCH:-arm64}"
BUILD_OUTPUT="${PROJECT_ROOT}/build/macos"
# Parse arguments
REBUILD_IMAGE="${REBUILD_IMAGE:-0}"
for arg in "$@"; do
case "$arg" in
--rebuild-image) REBUILD_IMAGE=1 ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done
# Validate arch
if [[ "$MACOS_ARCH" != "arm64" && "$MACOS_ARCH" != "x86_64" ]]; then
echo "Error: MACOS_ARCH must be 'arm64' or 'x86_64' (got: ${MACOS_ARCH})" >&2
exit 1
fi
# Verify Docker is available
if ! command -v docker &>/dev/null; then
echo "Error: docker is not installed or not in PATH." >&2
exit 1
fi
# Build the image (skip if already present and --rebuild-image not given)
if [[ "$REBUILD_IMAGE" == "1" ]] || ! docker image inspect "$IMAGE_NAME" &>/dev/null; then
echo "==> Building Docker image: ${IMAGE_NAME}"
echo " (SDK will be fetched automatically from Apple's catalog)"
docker build \
-f "${SCRIPT_DIR}/builder-macos.Dockerfile" \
-t "$IMAGE_NAME" \
"${SCRIPT_DIR}"
else
echo "==> Using existing Docker image: ${IMAGE_NAME}"
fi
# Create output directory on the host
mkdir -p "$BUILD_OUTPUT"
echo "==> Starting macOS cross-compile build (arch=${MACOS_ARCH}, output: ${BUILD_OUTPUT})"
docker run --rm \
--mount "type=bind,src=${PROJECT_ROOT},dst=/src,readonly" \
--mount "type=bind,src=${BUILD_OUTPUT},dst=/out" \
--env "MACOS_ARCH=${MACOS_ARCH}" \
${WOWEE_FFX_SDK_REPO:+--env "WOWEE_FFX_SDK_REPO=${WOWEE_FFX_SDK_REPO}"} \
${WOWEE_FFX_SDK_REF:+--env "WOWEE_FFX_SDK_REF=${WOWEE_FFX_SDK_REF}"} \
"$IMAGE_NAME"
echo "==> macOS cross-compile build complete. Artifacts in: ${BUILD_OUTPUT}"

64
container/run-windows.ps1 Normal file
View file

@ -0,0 +1,64 @@
# run-windows.ps1 — Cross-compile WoWee for Windows (x86_64) inside a Docker container.
#
# Usage (run from project root):
# .\container\run-windows.ps1 [-RebuildImage]
#
# Environment variables:
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
param(
[switch]$RebuildImage
)
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$ProjectRoot = (Resolve-Path "$ScriptDir\..").Path
$ImageName = "wowee-builder-windows"
$BuildOutput = "$ProjectRoot\build\windows"
# Verify Docker is available
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
Write-Error "docker is not installed or not in PATH."
exit 1
}
# Build the image (skip if already present and -RebuildImage not given)
$imageExists = docker image inspect $ImageName 2>$null
if ($RebuildImage -or -not $imageExists) {
Write-Host "==> Building Docker image: $ImageName"
docker build `
-f "$ScriptDir\builder-windows.Dockerfile" `
-t $ImageName `
"$ScriptDir"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
} else {
Write-Host "==> Using existing Docker image: $ImageName"
}
# Create output directory on the host
New-Item -ItemType Directory -Force -Path $BuildOutput | Out-Null
Write-Host "==> Starting Windows cross-compile build (output: $BuildOutput)"
$dockerArgs = @(
"run", "--rm",
"--mount", "type=bind,src=$ProjectRoot,dst=/src,readonly",
"--mount", "type=bind,src=$BuildOutput,dst=/out"
)
if ($env:WOWEE_FFX_SDK_REPO) {
$dockerArgs += @("--env", "WOWEE_FFX_SDK_REPO=$env:WOWEE_FFX_SDK_REPO")
}
if ($env:WOWEE_FFX_SDK_REF) {
$dockerArgs += @("--env", "WOWEE_FFX_SDK_REF=$env:WOWEE_FFX_SDK_REF")
}
$dockerArgs += $ImageName
& docker @dockerArgs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "==> Windows cross-compile build complete. Artifacts in: $BuildOutput"

61
container/run-windows.sh Executable file
View file

@ -0,0 +1,61 @@
#!/usr/bin/env bash
# run-windows.sh — Cross-compile WoWee for Windows (x86_64) inside a Docker container.
#
# Usage (run from project root):
# ./container/run-windows.sh [--rebuild-image]
#
# Environment variables:
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
# REBUILD_IMAGE — Set to 1 to force a fresh docker build (same as --rebuild-image)
#
# Toolchain: LLVM-MinGW (Clang + LLD) targeting x86_64-w64-mingw32-ucrt
# vcpkg triplet: x64-mingw-static
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
IMAGE_NAME="wowee-builder-windows"
BUILD_OUTPUT="${PROJECT_ROOT}/build/windows"
# Parse arguments
REBUILD_IMAGE="${REBUILD_IMAGE:-0}"
for arg in "$@"; do
case "$arg" in
--rebuild-image) REBUILD_IMAGE=1 ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done
# Verify Docker is available
if ! command -v docker &>/dev/null; then
echo "Error: docker is not installed or not in PATH." >&2
exit 1
fi
# Build the image (skip if already present and --rebuild-image not given)
if [[ "$REBUILD_IMAGE" == "1" ]] || ! docker image inspect "$IMAGE_NAME" &>/dev/null; then
echo "==> Building Docker image: ${IMAGE_NAME}"
docker build \
-f "${SCRIPT_DIR}/builder-windows.Dockerfile" \
-t "$IMAGE_NAME" \
"${SCRIPT_DIR}"
else
echo "==> Using existing Docker image: ${IMAGE_NAME}"
fi
# Create output directory on the host
mkdir -p "$BUILD_OUTPUT"
echo "==> Starting Windows cross-compile build (output: ${BUILD_OUTPUT})"
docker run --rm \
--mount "type=bind,src=${PROJECT_ROOT},dst=/src,readonly" \
--mount "type=bind,src=${BUILD_OUTPUT},dst=/out" \
${WOWEE_FFX_SDK_REPO:+--env "WOWEE_FFX_SDK_REPO=${WOWEE_FFX_SDK_REPO}"} \
${WOWEE_FFX_SDK_REF:+--env "WOWEE_FFX_SDK_REF=${WOWEE_FFX_SDK_REF}"} \
"$IMAGE_NAME"
echo "==> Windows cross-compile build complete. Artifacts in: ${BUILD_OUTPUT}"

View file

@ -93,13 +93,16 @@ The RSA public modulus is extracted from WoW.exe (`.rdata` section at offset 0x0
## Key Files
```
include/game/warden_handler.hpp - Packet handler interface
src/game/warden_handler.cpp - handleWardenData + module manager init
include/game/warden_module.hpp - Module loader interface
src/game/warden_module.cpp - 8-step pipeline
include/game/warden_emulator.hpp - Emulator interface
src/game/warden_emulator.cpp - Unicorn Engine executor + API hooks
include/game/warden_crypto.hpp - Crypto interface
src/game/warden_crypto.cpp - RC4 / key derivation
src/game/game_handler.cpp - Packet handler (handleWardenData)
include/game/warden_memory.hpp - PE image + memory patch interface
src/game/warden_memory.cpp - PE loader, runtime globals patching
```
---

View file

@ -58,10 +58,11 @@ strict Warden enforcement in that mode.
## Key Files
```
src/game/warden_module.hpp/cpp - Module loader (8-step pipeline)
src/game/warden_emulator.hpp/cpp - Unicorn Engine executor
src/game/warden_crypto.hpp/cpp - RC4/MD5/SHA1/RSA crypto
src/game/game_handler.cpp - Packet handler (handleWardenData)
include/game/warden_handler.hpp + src/game/warden_handler.cpp - Packet handler
include/game/warden_module.hpp + src/game/warden_module.cpp - Module loader (8-step pipeline)
include/game/warden_emulator.hpp + src/game/warden_emulator.cpp - Unicorn Engine executor
include/game/warden_crypto.hpp + src/game/warden_crypto.cpp - RC4/MD5/SHA1/RSA crypto
include/game/warden_memory.hpp + src/game/warden_memory.cpp - PE image + memory patching
```
---

View file

@ -8,7 +8,7 @@ Wowee follows a modular architecture with clear separation of concerns:
┌─────────────────────────────────────────────┐
│ Application (main loop) │
│ - State management (auth/realms/game) │
│ - Update cycle (60 FPS)
│ - Update cycle
│ - Event dispatch │
└──────────────┬──────────────────────────────┘
@ -16,8 +16,8 @@ Wowee follows a modular architecture with clear separation of concerns:
│ │
┌──────▼──────┐ ┌─────▼──────┐
│ Window │ │ Input │
│ (SDL2) │ │ (Keyboard/ │
│ │ Mouse) │
│ (SDL2 + │ │ (Keyboard/ │
Vulkan) │ │ Mouse) │
└──────┬──────┘ └─────┬──────┘
│ │
└───────┬────────┘
@ -26,517 +26,294 @@ Wowee follows a modular architecture with clear separation of concerns:
│ │
┌───▼────────┐ ┌───────▼──────┐
│ Renderer │ │ UI Manager │
(OpenGL) │ │ (ImGui) │
(Vulkan) │ │ (ImGui) │
└───┬────────┘ └──────────────┘
├─ Camera
├─ Scene Graph
├─ Shaders
├─ Meshes
└─ Textures
├─ Camera + CameraController
├─ TerrainRenderer (ADT streaming)
├─ WMORenderer (buildings, collision)
├─ M2Renderer (models, particles, ribbons)
├─ CharacterRenderer (skeletal animation)
├─ WaterRenderer (refraction, lava, slime)
├─ SkyBox + StarField + Weather
├─ LightingManager (Light.dbc volumes)
└─ SwimEffects, ChargeEffect, Lightning
```
## Core Systems
### 1. Application Layer (`src/core/`)
**Application** - Main controller
- Owns all subsystems
- Manages application state
**Application** (`application.hpp/cpp`) - Main controller
- Owns all subsystems (renderer, game handler, asset manager, UI)
- Manages application state (AUTH → REALM_SELECT → CHAR_SELECT → IN_WORLD)
- Runs update/render loop
- Handles lifecycle (init/shutdown)
- Populates `GameServices` struct and passes to `GameHandler` at construction
**Window** - SDL2 wrapper
- Creates window and OpenGL context
**Window** (`window.hpp/cpp`) - SDL2 + Vulkan wrapper
- Creates SDL2 window with Vulkan surface
- Owns `VkContext` (Vulkan device, swapchain, render passes)
- Handles resize events
- Manages VSync and fullscreen
**Input** - Input management
- Keyboard state tracking
- Mouse position and buttons
- Mouse locking for camera control
**Input** (`input.hpp/cpp`) - Input management
- Keyboard state tracking (SDL scancodes)
- Mouse position, buttons (1-based SDL indices), wheel delta
- Per-frame delta calculation
**Logger** - Logging system
- Thread-safe logging
**Logger** (`logger.hpp/cpp`) - Thread-safe logging
- Multiple log levels (DEBUG, INFO, WARNING, ERROR, FATAL)
- Timestamp formatting
- File output to `logs/wowee.log`
- Configurable via `WOWEE_LOG_LEVEL` env var
### 2. Rendering System (`src/rendering/`)
**Renderer** - Main rendering coordinator
- Manages OpenGL state
- Coordinates frame rendering
- Owns camera and scene
**Renderer** (`renderer.hpp/cpp`) - Main rendering coordinator
- Manages Vulkan pipeline state
- Coordinates frame rendering across all sub-renderers
- Owns camera, sky, weather, lighting, and all sub-renderers
- Shadow mapping with PCF filtering
**Camera** - View/projection matrices
**VkContext** (`vk_context.hpp/cpp`) - Vulkan infrastructure
- Device selection, queue families, swapchain
- Render passes, framebuffers, command pools
- Sampler cache (FNV-1a hashed dedup)
- Pipeline cache persistence for fast startup
**Camera** (`camera.hpp/cpp`) - View/projection matrices
- Position and orientation
- FOV and aspect ratio
- View frustum (for culling)
- FOV, aspect ratio, near/far planes
- Sub-pixel jitter for TAA/FSR2 (column 2 NDC offset)
- Frustum extraction for culling
**Scene** - Scene graph
- Mesh collection
- Spatial organization
- Visibility determination
**TerrainRenderer** - ADT terrain streaming
- Async chunk loading within configurable radius
- 4-layer texture splatting with alpha blending
- Frustum + distance culling
- Vegetation/foliage placement via deterministic RNG
**Shader** - GLSL program wrapper
- Loads vertex/fragment shaders
- Uniform management
- Compilation and linking
**WMORenderer** - World Map Objects (buildings)
- Multi-material batch rendering
- Portal-based visibility culling
- Floor/wall collision (normal-based classification)
- Interior glass transparency, doodad placement
**Mesh** - Geometry container
- Vertex buffer (position, normal, texcoord)
- Index buffer
- VAO/VBO/EBO management
**M2Renderer** - Models (creatures, doodads, spell effects)
- Skeletal animation with GPU bone transforms
- Particle emitters (WotLK FBlock format)
- Ribbon emitters (charge trails, enchant glows)
- Portal spin effects, foliage wind displacement
- Per-instance animation state
**Texture** - Texture management
- Loading (BLP via `AssetManager`, optional PNG overrides for development)
- OpenGL texture object
- Mipmap generation
**CharacterRenderer** - Player/NPC character models
- GPU vertex skinning (256 bones)
- Race/gender-aware textures via CharSections.dbc
- Equipment rendering (geoset visibility per slot)
- Fallback textures (white/transparent/flat-normal) for missing assets
**Material** - Surface properties
- Shader assignment
- Texture binding
- Color/properties
**WaterRenderer** - Terrain and WMO water
- Refraction/reflection rendering
- Magma/slime with multi-octave FBM noise flow
- Beer-Lambert absorption
**Skybox + StarField + Weather**
- Procedural sky dome with time-of-day lighting
- Star field with day/night fade (dusk 18:0020:00, dawn 04:0006:00)
- Rain/snow particle systems per zone (via zone weather table)
**LightingManager** - Light.dbc volume sampling
- Time-of-day color bands (half-minutes, 02879)
- Distance-weighted light volume blending
- Fog color/distance parameters
### 3. Networking (`src/network/`)
**Socket** (Abstract base class)
- Connection interface
- Packet send/receive
- Callback system
**TCPSocket** (`tcp_socket.hpp/cpp`) - Platform TCP
- Non-blocking I/O with per-frame recv budgets
- 4 KB recv buffer per call
- Portable across Linux/macOS/Windows
**TCPSocket** - Linux TCP sockets
- Non-blocking I/O
- Raw TCP (replaces WebSocket)
- Packet framing
**WorldSocket** (`world_socket.hpp/cpp`) - WoW world connection
- RC4 header encryption (derived from SRP session key)
- Packet parsing with configurable per-frame budgets
- Compressed move packet handling
**Packet** - Binary data container
- Read/write primitives
- Byte order handling
- Opcode management
**Packet** (`packet.hpp/cpp`) - Binary data container
- Read/write primitives (uint8uint64, float, string, packed GUID)
- Bounds-checked reads (return 0 past end)
### 4. Authentication (`src/auth/`)
**AuthHandler** - Auth server protocol
- Connects to port 3724
- SRP authentication flow
- Session key generation
**AuthHandler** - Auth server protocol (port 3724)
- SRP6a challenge/proof flow
- Security flags: PIN (0x01), Matrix (0x02), Authenticator (0x04)
- Realm list retrieval
**SRP** - Secure Remote Password
- SRP6a algorithm
- Big integer math
- Salt and verifier generation
**SRP** (`srp.hpp/cpp`) - Secure Remote Password
- SRP6a with 19-byte (152-bit) ephemeral
- OpenSSL BIGNUM math
- Session key generation (40 bytes)
**Crypto** - Cryptographic functions
- SHA1 hashing (OpenSSL)
- Random number generation
- Encryption helpers
**Integrity** - Client integrity verification
- Checksum computation for Warden compatibility
### 5. Game Logic (`src/game/`)
**GameHandler** - World server protocol
- Connects to port 8085 (configurable)
- Packet handlers for 100+ opcodes
- Session management with RC4 encryption
- Character enumeration and login flow
**GameHandler** (`game_handler.hpp/cpp`) - Central game state
- Dispatch table routing 664+ opcodes to domain handlers
- Owns all domain handlers via composition
- Receives dependencies via `GameServices` struct (no singleton access)
**World** - Game world state
- Map loading with async terrain streaming
- Entity management (players, NPCs, creatures)
- Zone management and exploration
- Time-of-day synchronization
**Domain Handlers** (SOLID decomposition from GameHandler):
- `EntityController` - UPDATE_OBJECT parsing, entity spawn/despawn
- `MovementHandler` - Movement packets, speed, taxi, swimming, flying
- `CombatHandler` - Damage, healing, death, auto-attack, threat
- `SpellHandler` - Spell casting, cooldowns, auras, talents, pet spells
- `InventoryHandler` - Equipment, bags, bank, mail, auction, vendors
- `QuestHandler` - Quest accept/complete, objectives, progress tracking
- `SocialHandler` - Party, guild, LFG, friends, who, duel, trade
- `ChatHandler` - Chat messages, channels, emotes, system messages
- `WardenHandler` - Anti-cheat module management
**Player** - Player character
- Position and movement (WASD + spline movement)
- Stats tracking (health, mana, XP, level)
- Equipment and inventory (23 + 16 slots)
- Action queue and spell casting
- Death and resurrection handling
**OpcodeTable** - Expansion-agnostic opcode mapping
- `LogicalOpcode` enum → wire opcode via JSON config per expansion
- Runtime remapping for Classic/TBC/WotLK/Turtle protocol differences
**Character** - Character data
- Race, class, gender, appearance
- Creation and customization
- 3D model preview
- Online character lifecycle and state synchronization
**Entity / EntityManager** - Entity lifecycle
- Shared entity base class with update fields (uint32 array)
- Player, Unit, GameObject subtypes
- GUID-based lookup, field extraction (health, level, display ID, etc.)
**Entity** - Game entities
- NPCs and creatures with display info
- Animation state (idle, combat, walk, run)
- GUID management (player, creature, item, gameobject)
- Targeting and selection
**TransportManager** - Transport path evaluation
- Catmull-Rom spline interpolation from TransportAnimation.dbc
- Clock-based motion with server time synchronization
- Time-closed looping paths (wrap point duplicated, no index wrapping)
**Inventory** - Item management
- Equipment slots (head, shoulders, chest, etc.)
- Backpack storage (16 slots)
- Item metadata (icons, stats, durability)
- Drag-drop system
- Auto-equip and unequip
**NPC Interactions** - handled through `GameHandler`
- Gossip system
- Quest givers with markers (! and ?)
- Vendors (buy/sell)
- Trainers (placeholder)
- Combat animations
**ZoneManager** - Zone and area tracking
- Map exploration
- Area discovery
- Zone change detection
**Opcodes** - Protocol definitions
- 100+ Client→Server opcodes (CMSG_*)
- 100+ Server→Client opcodes (SMSG_*)
- WoW 3.3.5a (build 12340) specific
**Expansion Helpers** (`game_utils.hpp`):
- `isActiveExpansion("classic")` / `isActiveExpansion("tbc")` / `isActiveExpansion("wotlk")`
- `isClassicLikeExpansion()` (Classic or Turtle WoW)
- `isPreWotlk()` (Classic, Turtle, or TBC)
### 6. Asset Pipeline (`src/pipeline/`)
**AssetManager** - Runtime asset access
- Loads an extracted loose-file tree indexed by `Data/manifest.json`
- Extracted loose-file tree indexed by `Data/manifest.json`
- Layered resolution via optional overlay manifests (multi-expansion dedup)
- File cache + path normalization
- File cache with configurable budget (256 MB min, 12 GB max)
- PNG override support (checks for .png before .blp)
**asset_extract (tool)** - MPQ extraction
- Uses StormLib to extract MPQs into `Data/` and generate `manifest.json`
- Driven by `extract_assets.sh`
- Driven by `extract_assets.sh` / `extract_assets.ps1`
**BLPLoader** - Texture parser
- BLP format (Blizzard texture format)
- DXT1/3/5 compression support
- Mipmap extraction and generation
- OpenGL texture object creation
**BLPLoader** - Texture decompression
- DXT1/3/5 block compression (RGB565 color endpoints)
- Palette mode with 1/4/8-bit alpha
- Mipmap extraction
**M2Loader** - Model parser
- Character/creature models with materials
- Skeletal animation data (256 bones max)
- Bone hierarchies and transforms
- Animation sequences (idle, walk, run, attack, etc.)
- Particle emitters (WotLK FBlock format)
- Attachment points (weapons, mounts, etc.)
- Geoset support (hide/show body parts)
- Multiple texture units and render batches
**M2Loader** - Model binary parsing
- Version-aware header (Classic v256 vs WotLK v264)
- Skeletal animation tracks (embedded vs external .anim files, flag 0x20)
- Compressed quaternions (int16 offset mapping)
- Particle emitters, ribbon emitters, attachment points
- Geoset support (group × 100 + variant encoding)
**WMOLoader** - World object parser
- Buildings and structures
- Multi-material batches
- Portal system (visibility culling)
- Doodad placement (decorations)
- Group-based rendering
- Liquid data (indoor water)
**WMOLoader** - World object parsing
- Multi-group rendering with portal visibility
- Doodad placement (24-bit name index + 8-bit flags packing)
- Liquid data, collision geometry
**ADTLoader** - Terrain parser
- 64x64 tiles per map (map_XX_YY.adt)
- 16x16 chunks per tile (MCNK)
- Height map data (9x9 outer + 8x8 inner vertices)
- Texture layers (up to 4 per chunk with alpha blending)
- Liquid data (water/lava/slime with height and flags)
- Object placement (M2 and WMO references)
- Terrain holes
**ADTLoader** - Terrain parsing
- 64×64 tiles per map, 16×16 chunks per tile (MCNK)
- MCVT height grid (145 vertices: 9 outer + 8 inner per row × 9 rows)
- Texture layers (up to 4 with alpha blending, RLE-compressed alpha maps)
- Async loading to prevent frame stalls
**DBCLoader** - Database parser
- 20+ DBC files loaded (Spell, Item, Creature, SkillLine, Faction, etc.)
- Type-safe record access
- String block parsing
- Memory-efficient caching
- Used for:
- Spell icons and tooltips (Spell.dbc, SpellIcon.dbc)
- Item data (Item.dbc, ItemDisplayInfo.dbc)
- Creature display info (CreatureDisplayInfo.dbc, CreatureModelData.dbc)
- Class and race info (ChrClasses.dbc, ChrRaces.dbc)
- Skill lines (SkillLine.dbc, SkillLineAbility.dbc)
- Faction and reputation (Faction.dbc)
- Map and area names (Map.dbc, AreaTable.dbc)
**DBCLoader** - Database table parsing
- Binary DBC format (fixed 4-byte uint32 fields + string block)
- CSV fallback for pre-extracted data
- Expansion-aware field layout via `dbc_layouts.json`
- 20+ DBC files: Spell, Item, Creature, Faction, Map, AreaTable, etc.
### 7. UI System (`src/ui/`)
**UIManager** - ImGui coordinator
- ImGui initialization with SDL2/OpenGL backend
- ImGui initialization with SDL2/Vulkan backend
- Screen state management and transitions
- Event handling and input routing
- Render dispatch with opacity control
- Screen state management
**AuthScreen** - Login interface
- Username/password input fields
- Server address configuration
- Connection status and error messages
**Screens:**
- `AuthScreen` - Login with username/password, server address, security code
- `RealmScreen` - Realm list with population and type indicators
- `CharacterScreen` - Character selection with 3D animated preview
- `CharacterCreateScreen` - Race/class/gender/appearance customization
- `GameScreen` - Main HUD: chat, action bar, target frame, minimap, nameplates, combat text, tooltips
- `InventoryScreen` - Equipment paper doll, backpack, bag windows, item tooltips with stats
- `SpellbookScreen` - Tabbed spell list with icons, drag-drop to action bar
- `QuestLogScreen` - Quest list with objectives, details, and rewards
- `TalentScreen` - Talent tree UI with point allocation
- `SettingsScreen` - Graphics presets (LOW/MEDIUM/HIGH/ULTRA), audio, keybindings
**RealmScreen** - Server selection
- Realm list display with names and types
- Population info (Low/Medium/High/Full)
- Realm type indicators (PvP/PvE/RP/RPPvP)
- Auto-select for single realm
### 8. Audio System (`src/audio/`)
**CharacterScreen** - Character selection
- Character list with 3D animated preview
- Stats panel (level, race, class, location)
- Create/delete character buttons
- Enter world button
- Auto-select for single character
**AudioEngine** - miniaudio-based playback
- WAV decode cache (256 entries, LRU eviction)
- 2D and 3D positional audio
- Sample rate preservation (explicit to avoid miniaudio pitch distortion)
**CharacterCreateScreen** - Character creation
- Race selection (all Alliance and Horde races)
- Class selection (class availability by race)
- Gender selection
- Appearance customization (face, skin, hair, color, features)
- Name input with validation
- 3D character preview
**Sound Managers:**
- `AmbientSoundManager` - Wind, water, fire, birds, crickets, city ambience, bell tolls
- `ActivitySoundManager` - Swimming strokes, jumping, landing
- `MovementSoundManager` - Footsteps (terrain-aware), mount movement
- `MountSoundManager` - Mount-specific movement audio
- `MusicManager` - Zone music with day/night variants
**GameScreen** - In-game HUD
- Chat window with message history and formatting
- Action bar (12 slots with icons, cooldowns, keybindings)
- Target frame (name, level, health, hostile/friendly coloring)
- Player stats (health, mana/rage/energy)
- Minimap with quest markers
- Experience bar
### 9. Warden Anti-Cheat (`src/game/`)
**InventoryScreen** - Inventory management
- Equipment paper doll (23 slots: head, shoulders, chest, etc.)
- Backpack grid (16 slots)
- Item icons with tooltips
- Drag-drop to equip/unequip
- Item stats and durability
- Gold display
**SpellbookScreen** - Spells and abilities
- Tabbed interface (class specialties + General)
- Spell icons organized by SkillLine
- Spell tooltips (name, rank, cost, cooldown, description)
- Drag-drop to action bar
- Known spell tracking
**QuestLogScreen** - Quest tracking
- Active quest list
- Quest objectives and progress
- Quest details (description, objectives, rewards)
- Abandon quest button
- Quest level and recommended party size
**TalentScreen** - Talent trees
- Placeholder for talent system
- Tree visualization (TODO)
- Talent point allocation (TODO)
**Settings Window** - Configuration
- UI opacity slider
- Graphics options (TODO)
- Audio controls (TODO)
- Keybinding customization (TODO)
**Loading Screen** - Map loading progress
- Progress bar with percentage
- Background image (map-specific, TODO)
- Loading tips (TODO)
- Shown during world entry and map transitions
## Data Flow Examples
### Authentication Flow
```
User Input (username/password)
AuthHandler::authenticate()
SRP::calculateVerifier()
TCPSocket::send(LOGON_CHALLENGE)
Server Response (LOGON_CHALLENGE)
AuthHandler receives packet
SRP::calculateProof()
TCPSocket::send(LOGON_PROOF)
Server Response (LOGON_PROOF) → Success
Application::setState(REALM_SELECTION)
```
### Rendering Flow
```
Application::render()
Renderer::beginFrame()
├─ glClearColor() - Clear screen
└─ glClear() - Clear buffers
Renderer::renderWorld(world)
├─ Update camera matrices
├─ Frustum culling
├─ For each visible chunk:
│ ├─ Bind shader
│ ├─ Set uniforms (matrices, lighting)
│ ├─ Bind textures
│ └─ Mesh::draw() → glDrawElements()
└─ For each entity:
├─ Calculate bone transforms
└─ Render skinned mesh
UIManager::render()
├─ ImGui::NewFrame()
├─ Render current UI screen
└─ ImGui::Render()
Renderer::endFrame()
Window::swapBuffers()
```
### Asset Loading Flow
```
World::loadMap(mapId)
AssetManager::readFile("World/Maps/{map}/map.adt")
ADTLoader::load(adtData)
├─ Parse MCNK chunks (terrain)
├─ Parse MCLY chunks (textures)
├─ Parse MCVT chunks (vertices)
└─ Parse MCNR chunks (normals)
For each texture reference:
AssetManager::readFile(texturePath)
BLPLoader::load(blpData)
Texture::loadFromMemory(imageData)
Create Mesh from vertices/normals/texcoords
Add to Scene
Renderer draws in next frame
```
4-layer architecture:
- `WardenHandler` - Packet handling (SMSG/CMSG_WARDEN_DATA)
- `WardenModuleManager` - Module lifecycle and caching
- `WardenModule` - 8-step pipeline: decrypt (RC4), strip RSA-2048 signature, decompress (zlib), parse PE headers, relocate, resolve imports, execute
- `WardenEmulator` - Unicorn Engine x86 CPU emulation with Windows API interception
- `WardenMemory` - PE image loading with bounds-checked reads, runtime global patching
## Threading Model
Currently **single-threaded** with async operations:
- Main thread: Window events, update, render
- Network I/O: Non-blocking in main thread (event-driven)
- Asset loading: Async terrain streaming (non-blocking chunk loads)
**Async Systems Implemented:**
- Terrain streaming loads ADT chunks asynchronously to prevent frame stalls
- Network packets processed in batches per frame
- UI rendering deferred until after world rendering
**Future multi-threading opportunities:**
- Asset loading thread pool (background texture/model decompression)
- Network thread (dedicated for socket I/O)
- Physics thread (if collision detection is added)
- Audio streaming thread
- **Main thread**: Window events, game logic update, rendering
- **Async terrain**: Non-blocking chunk loading (std::async)
- **Network I/O**: Non-blocking recv in main thread with per-frame budgets
- **Normal maps**: Background CPU generation with mutex-protected result queue
- **GPU uploads**: Second Vulkan queue for parallel texture/buffer transfers
## Memory Management
- **Smart pointers:** Used throughout (std::unique_ptr, std::shared_ptr)
- **RAII:** All resources (OpenGL, SDL) cleaned up automatically
- **No manual memory management:** No raw new/delete
- **OpenGL resources:** Wrapped in classes with proper destructors
## Performance Considerations
### Rendering
- **Frustum culling:** Only render visible chunks (terrain and WMO groups)
- **Distance culling:** WMO groups culled beyond 160 units
- **Batching:** Group draw calls by material and shader
- **LOD:** Distance-based level of detail (TODO)
- **Occlusion:** Portal-based visibility (WMO system)
- **GPU skinning:** Character animation computed on GPU (256 bones)
- **Instancing:** Future optimization for repeated models
### Asset Streaming
- **Async loading:** Terrain chunks load asynchronously (prevents frame stalls)
- **Lazy loading:** Load chunks as player moves within streaming radius
- **Unloading:** Free distant chunks automatically
- **Caching:** Keep frequently used assets in memory (textures, models)
- **Priority queue:** Load visible chunks first
### Network
- **Non-blocking I/O:** Never stall main thread
- **Packet buffering:** Handle multiple packets per frame
- **Batch processing:** Process received packets in batches
- **RC4 encryption:** Efficient header encryption (minimal overhead)
- **Compression:** Some packets are compressed (TODO)
### Memory Management
- **Smart pointers:** Automatic cleanup, no memory leaks
- **Object pooling:** Reuse particle objects (weather system)
- **DBC caching:** Load once, access fast
- **Texture sharing:** Same texture used by multiple models
## Error Handling
- **Logging:** All errors logged with context
- **Graceful degradation:** Missing assets show placeholder
- **State recovery:** Network disconnect → back to auth screen
- **No crashes:** Exceptions caught at application level
## Configuration
Currently hardcoded, future config system:
- Window size and fullscreen
- Graphics quality settings
- Server addresses
- Keybindings
- Audio volume
## Testing Strategy
**Unit Testing** (TODO):
- Packet serialization/deserialization
- SRP math functions
- Asset parsers with sample files
- DBC record parsing
- Inventory slot calculations
**Integration Testing** (TODO):
- Full auth flow against test server
- Realm list retrieval
- Character creation and selection
- Quest turn-in flow
- Vendor transactions
**Manual Testing:**
- Visual verification of rendering (terrain, water, models, particles)
- Performance profiling (F1 performance HUD)
- Memory leak checking (valgrind)
- Online gameplay against AzerothCore/TrinityCore/MaNGOS servers
- UI interactions (drag-drop, click events)
**Current Test Coverage:**
- Full authentication flow tested against live servers
- Character creation and selection verified
- Quest system tested (accept, track, turn-in)
- Vendor system tested (buy, sell)
- Combat system tested (targeting, auto-attack, spells)
- Inventory system tested (equip, unequip, drag-drop)
- **Smart pointers**: `std::unique_ptr` / `std::shared_ptr` throughout
- **RAII**: All Vulkan resources wrapped with proper destructors
- **VMA**: Vulkan Memory Allocator for GPU memory
- **Object pooling**: Weather particles, combat text entries
- **DBC caching**: Lazy-loaded mutable caches in const getters
## Build System
**CMake:**
- Modular target structure
- Automatic dependency discovery
- Cross-platform (Linux focus, but portable)
- Out-of-source builds
**CMake** with modular targets:
- `wowee` - Main executable
- `asset_extract` - MPQ extraction tool (requires StormLib)
- `dbc_to_csv` / `auth_probe` / `blp_convert` - Utility tools
**Dependencies:**
- SDL2 (system)
- OpenGL/GLEW (system)
- OpenSSL (system)
- GLM (system or header-only)
- SDL2, Vulkan SDK, OpenSSL, GLM, zlib (system)
- ImGui (submodule in extern/)
- StormLib (system, optional)
- VMA, vk-bootstrap, stb_image (vendored in extern/)
- StormLib (system, optional — only for asset_extract)
- Unicorn Engine (system, optional — only for Warden emulation)
- FFmpeg (system, optional — for video playback)
**CI**: GitHub Actions for Linux (x86-64, ARM64), Windows (MSYS2), macOS (ARM64)
**Container builds**: Docker cross-compilation for Linux, macOS (osxcross), Windows (LLVM-MinGW)
## Code Style
- **C++20 standard**
- **Namespaces:** wowee::core, wowee::rendering, etc.
- **Naming:** PascalCase for classes, camelCase for functions/variables
- **Headers:** .hpp extension
- **Includes:** Relative to project root
---
This architecture provides a solid foundation for a full-featured native WoW client!
- **Namespaces**: `wowee::core`, `wowee::rendering`, `wowee::game`, `wowee::ui`, `wowee::network`, `wowee::auth`, `wowee::audio`, `wowee::pipeline`
- **Naming**: PascalCase for classes, camelCase for functions/variables, kPascalCase for constants
- **Headers**: `.hpp` extension, `#pragma once`
- **Commits**: Conventional style (`feat:`, `fix:`, `refactor:`, `docs:`, `perf:`)

View file

@ -563,5 +563,4 @@ The client is now ready for character operations and world entry! 🎮
---
**Implementation Status:** 100% Complete for authentication
**Next Milestone:** Character enumeration and world entry
**Implementation Status:** Complete — authentication, character enumeration, and world entry all working.

View file

@ -397,6 +397,4 @@ The authentication system can now reliably communicate with WoW 3.3.5a servers!
---
**Status:** ✅ Complete and tested
**Next Steps:** Test with live server and implement realm list protocol.
**Status:** ✅ Complete and tested against AzerothCore, TrinityCore, Mangos, and Turtle WoW.

View file

@ -19,17 +19,11 @@ For a more honest snapshot of gaps and current direction, see `docs/status.md`.
### 1. Clone
```bash
git clone https://github.com/Kelsidavis/WoWee.git
cd wowee
git clone --recurse-submodules https://github.com/Kelsidavis/WoWee.git
cd WoWee
```
### 2. Install ImGui
```bash
git clone https://github.com/ocornut/imgui.git extern/imgui
```
### 3. Build
### 2. Build
```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
@ -96,7 +90,7 @@ Use `BUILD_INSTRUCTIONS.md` for distro-specific package lists.
- Verify auth/world server is running
- Check host/port settings
- Check server logs and client logs in `build/bin/logs/`
- Check server logs and client logs in `logs/wowee.log`
### Missing assets (models/textures/terrain)

View file

@ -609,6 +609,6 @@ Once you have a working local server connection:
---
**Status**: Ready for local server testing
**Last Updated**: 2026-01-27
**Client Version**: 1.0.3
**Server Compatibility**: WoW 3.3.5a (12340)
**Last Updated**: 2026-03-30
**Client Version**: v1.8.9-preview
**Server Compatibility**: Vanilla 1.12, TBC 2.4.3, WotLK 3.3.5a (12340), Turtle WoW 1.17

View file

@ -351,13 +351,13 @@ The expensive operation (session key computation) only happens once per login.
2. **No Plaintext Storage:** Password is immediately hashed, never stored
3. **Forward Secrecy:** Ephemeral keys (a, A) are generated per session
4. **Mutual Authentication:** Both client and server prove knowledge of password
5. **Secure Channel:** Session key K can be used for encryption (not implemented yet)
5. **Secure Channel:** Session key K is used for RC4 header encryption after auth completes
## References
- [SRP Protocol](http://srp.stanford.edu/)
- [WoWDev Wiki - SRP](https://wowdev.wiki/SRP)
- Original wowee: `/wowee/src/lib/crypto/srp.js`
- Implementation: `src/auth/srp.cpp`, `include/auth/srp.hpp`
- OpenSSL BIGNUM: https://www.openssl.org/docs/man1.1.1/man3/BN_new.html
---

View file

@ -1,6 +1,6 @@
# Project Status
**Last updated**: 2026-03-11
**Last updated**: 2026-03-30
## What This Repo Is
@ -25,19 +25,23 @@ Implemented (working in normal use):
- Talent tree UI with proper visuals and functionality
- Pet tracking (SMSG_PET_SPELLS), dismiss pet button
- Party: group invites, party list, out-of-range member health (SMSG_PARTY_MEMBER_STATS)
- Nameplates: NPC subtitles, guild names, elite/boss/rare borders, quest/raid indicators, cast bars, debuff dots
- Floating combat text: world-space damage/heal numbers above entities with 3D projection
- Target/focus frames: guild name, creature type, rank badges, combo points, cast bars
- Map exploration: subzone-level fog-of-war reveal
- Warden anti-cheat: full module execution via Unicorn Engine x86 emulation; module caching
- Audio: ambient, movement, combat, spell, and UI sound systems
- Bag UI: separate bag windows, open-bag indicator on bag bar, optional collapse-empty mode in aggregate bag view
- Audio: ambient, movement, combat, spell, and UI sound systems; NPC voice lines for all playable races (greeting/farewell/vendor/pissed/aggro/flee)
- Bag UI: independent bag windows (any bag closable independently), open-bag indicator on bag bar, server-synced bag sort, off-screen position reset, optional collapse-empty mode in aggregate view
- DBC auto-detection: CharSections.dbc field layout auto-detected at runtime (handles stock WotLK vs HD-textured clients)
- Multi-expansion: Classic/Vanilla, TBC, WotLK, and Turtle WoW (1.17) protocol and asset variants
- CI: GitHub Actions for Linux (x86-64, ARM64), Windows (MSYS2), macOS (ARM64); container builds via Podman
- CI: GitHub Actions for Linux (x86-64, ARM64), Windows (MSYS2 x86-64 + ARM64), macOS (ARM64); container builds via Podman
In progress / known gaps:
- Transports: M2 transports (trams) working with position-delta riding; WMO transports (ships, zeppelins) working with path following; some edge cases remain
- Visual edge cases: some M2/WMO rendering gaps (character shin mesh, some particle effects)
- Lava steam particles: sparse in some areas (tuning opportunity)
- Water refraction: implemented but disabled by default (can cause VK_ERROR_DEVICE_LOST on some GPUs); currently requires FSR to be active
- Quest GO interaction: CMSG_GAMEOBJ_USE + CMSG_LOOT sent correctly, but some AzerothCore/ChromieCraft servers don't grant quest credit for chest-type GOs (server-side limitation)
- Visual edge cases: some M2/WMO rendering gaps (some particle effects)
- Water refraction: enabled by default; srcAccessMask barrier fix (2026-03-18) resolved prior VK_ERROR_DEVICE_LOST on AMD/Mali GPUs
## Where To Look

14
extern/VERSIONS.md vendored Normal file
View file

@ -0,0 +1,14 @@
# Vendored Library Versions
Versions of third-party libraries vendored in `extern/`. Update this file
when upgrading any dependency so maintainers can track drift.
| Library | Version | Source | Notes |
|---------|---------|--------|-------|
| Dear ImGui | 1.92.6 WIP | https://github.com/ocornut/imgui | Git submodule |
| vk-bootstrap | latest | https://github.com/charles-lunarg/vk-bootstrap | Git submodule |
| Vulkan Memory Allocator | 3.4.0 | https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator | Single header |
| miniaudio | 0.11.24 | https://miniaud.io/ | Single header |
| stb_image | 2.30 | https://github.com/nothings/stb | Single header |
| stb_image_write | 1.16 | https://github.com/nothings/stb | Single header |
| Lua | 5.1.5 | https://www.lua.org/ | Intentionally 5.1 for WoW addon API compatibility |

34
extern/lua-5.1.5/COPYRIGHT vendored Normal file
View file

@ -0,0 +1,34 @@
Lua License
-----------
Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.
For details and rationale, see http://www.lua.org/license.html .
===============================================================================
Copyright (C) 1994-2012 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================================================
(end of COPYRIGHT)

183
extern/lua-5.1.5/HISTORY vendored Normal file
View file

@ -0,0 +1,183 @@
HISTORY for Lua 5.1
* Changes from version 5.0 to 5.1
-------------------------------
Language:
+ new module system.
+ new semantics for control variables of fors.
+ new semantics for setn/getn.
+ new syntax/semantics for varargs.
+ new long strings and comments.
+ new `mod' operator (`%')
+ new length operator #t
+ metatables for all types
API:
+ new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
+ user supplies memory allocator (lua_open becomes lua_newstate).
+ luaopen_* functions must be called through Lua.
Implementation:
+ new configuration scheme via luaconf.h.
+ incremental garbage collection.
+ better handling of end-of-line in the lexer.
+ fully reentrant parser (new Lua function `load')
+ better support for 64-bit machines.
+ native loadlib support for Mac OS X.
+ standard distribution in only one library (lualib.a merged into lua.a)
* Changes from version 4.0 to 5.0
-------------------------------
Language:
+ lexical scoping.
+ Lua coroutines.
+ standard libraries now packaged in tables.
+ tags replaced by metatables and tag methods replaced by metamethods,
stored in metatables.
+ proper tail calls.
+ each function can have its own global table, which can be shared.
+ new __newindex metamethod, called when we insert a new key into a table.
+ new block comments: --[[ ... ]].
+ new generic for.
+ new weak tables.
+ new boolean type.
+ new syntax "local function".
+ (f()) returns the first value returned by f.
+ {f()} fills a table with all values returned by f.
+ \n ignored in [[\n .
+ fixed and-or priorities.
+ more general syntax for function definition (e.g. function a.x.y:f()...end).
+ more general syntax for function calls (e.g. (print or write)(9)).
+ new functions (time/date, tmpfile, unpack, require, load*, etc.).
API:
+ chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer.
+ introduced lightweight userdata, a simple "void*" without a metatable.
+ new error handling protocol: the core no longer prints error messages;
all errors are reported to the caller on the stack.
+ new lua_atpanic for host cleanup.
+ new, signal-safe, hook scheme.
Implementation:
+ new license: MIT.
+ new, faster, register-based virtual machine.
+ support for external multithreading and coroutines.
+ new and consistent error message format.
+ the core no longer needs "stdio.h" for anything (except for a single
use of sprintf to convert numbers to strings).
+ lua.c now runs the environment variable LUA_INIT, if present. It can
be "@filename", to run a file, or the chunk itself.
+ support for user extensions in lua.c.
sample implementation given for command line editing.
+ new dynamic loading library, active by default on several platforms.
+ safe garbage-collector metamethods.
+ precompiled bytecodes checked for integrity (secure binary dostring).
+ strings are fully aligned.
+ position capture in string.find.
+ read('*l') can read lines with embedded zeros.
* Changes from version 3.2 to 4.0
-------------------------------
Language:
+ new "break" and "for" statements (both numerical and for tables).
+ uniform treatment of globals: globals are now stored in a Lua table.
+ improved error messages.
+ no more '$debug': full speed *and* full debug information.
+ new read form: read(N) for next N bytes.
+ general read patterns now deprecated.
(still available with -DCOMPAT_READPATTERNS.)
+ all return values are passed as arguments for the last function
(old semantics still available with -DLUA_COMPAT_ARGRET)
+ garbage collection tag methods for tables now deprecated.
+ there is now only one tag method for order.
API:
+ New API: fully re-entrant, simpler, and more efficient.
+ New debug API.
Implementation:
+ faster than ever: cleaner virtual machine and new hashing algorithm.
+ non-recursive garbage-collector algorithm.
+ reduced memory usage for programs with many strings.
+ improved treatment for memory allocation errors.
+ improved support for 16-bit machines (we hope).
+ code now compiles unmodified as both ANSI C and C++.
+ numbers in bases other than 10 are converted using strtoul.
+ new -f option in Lua to support #! scripts.
+ luac can now combine text and binaries.
* Changes from version 3.1 to 3.2
-------------------------------
+ redirected all output in Lua's core to _ERRORMESSAGE and _ALERT.
+ increased limit on the number of constants and globals per function
(from 2^16 to 2^24).
+ debugging info (lua_debug and hooks) moved into lua_state and new API
functions provided to get and set this info.
+ new debug lib gives full debugging access within Lua.
+ new table functions "foreachi", "sort", "tinsert", "tremove", "getn".
+ new io functions "flush", "seek".
* Changes from version 3.0 to 3.1
-------------------------------
+ NEW FEATURE: anonymous functions with closures (via "upvalues").
+ new syntax:
- local variables in chunks.
- better scope control with DO block END.
- constructors can now be also written: { record-part; list-part }.
- more general syntax for function calls and lvalues, e.g.:
f(x).y=1
o:f(x,y):g(z)
f"string" is sugar for f("string")
+ strings may now contain arbitrary binary data (e.g., embedded zeros).
+ major code re-organization and clean-up; reduced module interdependecies.
+ no arbitrary limits on the total number of constants and globals.
+ support for multiple global contexts.
+ better syntax error messages.
+ new traversal functions "foreach" and "foreachvar".
+ the default for numbers is now double.
changing it to use floats or longs is easy.
+ complete debug information stored in pre-compiled chunks.
+ sample interpreter now prompts user when run interactively, and also
handles control-C interruptions gracefully.
* Changes from version 2.5 to 3.0
-------------------------------
+ NEW CONCEPT: "tag methods".
Tag methods replace fallbacks as the meta-mechanism for extending the
semantics of Lua. Whereas fallbacks had a global nature, tag methods
work on objects having the same tag (e.g., groups of tables).
Existing code that uses fallbacks should work without change.
+ new, general syntax for constructors {[exp] = exp, ... }.
+ support for handling variable number of arguments in functions (varargs).
+ support for conditional compilation ($if ... $else ... $end).
+ cleaner semantics in API simplifies host code.
+ better support for writing libraries (auxlib.h).
+ better type checking and error messages in the standard library.
+ luac can now also undump.
* Changes from version 2.4 to 2.5
-------------------------------
+ io and string libraries are now based on pattern matching;
the old libraries are still available for compatibility
+ dofile and dostring can now return values (via return statement)
+ better support for 16- and 64-bit machines
+ expanded documentation, with more examples
* Changes from version 2.2 to 2.4
-------------------------------
+ external compiler creates portable binary files that can be loaded faster
+ interface for debugging and profiling
+ new "getglobal" fallback
+ new functions for handling references to Lua objects
+ new functions in standard lib
+ only one copy of each string is stored
+ expanded documentation, with more examples
* Changes from version 2.1 to 2.2
-------------------------------
+ functions now may be declared with any "lvalue" as a name
+ garbage collection of functions
+ support for pipes
* Changes from version 1.1 to 2.1
-------------------------------
+ object-oriented support
+ fallbacks
+ simplified syntax for tables
+ many internal improvements
(end of HISTORY)

99
extern/lua-5.1.5/INSTALL vendored Normal file
View file

@ -0,0 +1,99 @@
INSTALL for Lua 5.1
* Building Lua
------------
Lua is built in the src directory, but the build process can be
controlled from the top-level Makefile.
Building Lua on Unix systems should be very easy. First do "make" and
see if your platform is listed. If so, just do "make xxx", where xxx
is your platform name. The platforms currently supported are:
aix ansi bsd freebsd generic linux macosx mingw posix solaris
If your platform is not listed, try the closest one or posix, generic,
ansi, in this order.
See below for customization instructions and for instructions on how
to build with other Windows compilers.
If you want to check that Lua has been built correctly, do "make test"
after building Lua. Also, have a look at the example programs in test.
* Installing Lua
--------------
Once you have built Lua, you may want to install it in an official
place in your system. In this case, do "make install". The official
place and the way to install files are defined in Makefile. You must
have the right permissions to install files.
If you want to build and install Lua in one step, do "make xxx install",
where xxx is your platform name.
If you want to install Lua locally, then do "make local". This will
create directories bin, include, lib, man, and install Lua there as
follows:
bin: lua luac
include: lua.h luaconf.h lualib.h lauxlib.h lua.hpp
lib: liblua.a
man/man1: lua.1 luac.1
These are the only directories you need for development.
There are man pages for lua and luac, in both nroff and html, and a
reference manual in html in doc, some sample code in test, and some
useful stuff in etc. You don't need these directories for development.
If you want to install Lua locally, but in some other directory, do
"make install INSTALL_TOP=xxx", where xxx is your chosen directory.
See below for instructions for Windows and other systems.
* Customization
-------------
Three things can be customized by editing a file:
- Where and how to install Lua -- edit Makefile.
- How to build Lua -- edit src/Makefile.
- Lua features -- edit src/luaconf.h.
You don't actually need to edit the Makefiles because you may set the
relevant variables when invoking make.
On the other hand, if you need to select some Lua features, you'll need
to edit src/luaconf.h. The edited file will be the one installed, and
it will be used by any Lua clients that you build, to ensure consistency.
We strongly recommend that you enable dynamic loading. This is done
automatically for all platforms listed above that have this feature
(and also Windows). See src/luaconf.h and also src/Makefile.
* Building Lua on Windows and other systems
-----------------------------------------
If you're not using the usual Unix tools, then the instructions for
building Lua depend on the compiler you use. You'll need to create
projects (or whatever your compiler uses) for building the library,
the interpreter, and the compiler, as follows:
library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c
ltable.c ltm.c lundump.c lvm.c lzio.c
lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
ltablib.c lstrlib.c loadlib.c linit.c
interpreter: library, lua.c
compiler: library, luac.c print.c
If you use Visual Studio .NET, you can use etc/luavs.bat in its
"Command Prompt".
If all you want is to build the Lua interpreter, you may put all .c files
in a single project, except for luac.c and print.c. Or just use etc/all.c.
To use Lua as a library in your own programs, you'll need to know how to
create and use libraries with your compiler.
As mentioned above, you may edit luaconf.h to select some features before
building Lua.
(end of INSTALL)

128
extern/lua-5.1.5/Makefile vendored Normal file
View file

@ -0,0 +1,128 @@
# makefile for installing Lua
# see INSTALL for installation instructions
# see src/Makefile and src/luaconf.h for further customization
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
PLAT= none
# Where to install. The installation starts in the src and doc directories,
# so take care if INSTALL_TOP is not an absolute path.
INSTALL_TOP= /usr/local
INSTALL_BIN= $(INSTALL_TOP)/bin
INSTALL_INC= $(INSTALL_TOP)/include
INSTALL_LIB= $(INSTALL_TOP)/lib
INSTALL_MAN= $(INSTALL_TOP)/man/man1
#
# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
# How to install. If your install program does not support "-p", then you
# may have to run ranlib on the installed liblua.a (do "make ranlib").
INSTALL= install -p
INSTALL_EXEC= $(INSTALL) -m 0755
INSTALL_DATA= $(INSTALL) -m 0644
#
# If you don't have install you can use cp instead.
# INSTALL= cp -p
# INSTALL_EXEC= $(INSTALL)
# INSTALL_DATA= $(INSTALL)
# Utilities.
MKDIR= mkdir -p
RANLIB= ranlib
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
# Convenience platforms targets.
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
TO_LIB= liblua.a
TO_MAN= lua.1 luac.1
# Lua version and release.
V= 5.1
R= 5.1.5
all: $(PLAT)
$(PLATS) clean:
cd src && $(MAKE) $@
test: dummy
src/lua test/hello.lua
install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
ranlib:
cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
local:
$(MAKE) install INSTALL_TOP=..
none:
@echo "Please do"
@echo " make PLATFORM"
@echo "where PLATFORM is one of these:"
@echo " $(PLATS)"
@echo "See INSTALL for complete instructions."
# make may get confused with test/ and INSTALL in a case-insensitive OS
dummy:
# echo config parameters
echo:
@echo ""
@echo "These are the parameters currently set in src/Makefile to build Lua $R:"
@echo ""
@cd src && $(MAKE) -s echo
@echo ""
@echo "These are the parameters currently set in Makefile to install Lua $R:"
@echo ""
@echo "PLAT = $(PLAT)"
@echo "INSTALL_TOP = $(INSTALL_TOP)"
@echo "INSTALL_BIN = $(INSTALL_BIN)"
@echo "INSTALL_INC = $(INSTALL_INC)"
@echo "INSTALL_LIB = $(INSTALL_LIB)"
@echo "INSTALL_MAN = $(INSTALL_MAN)"
@echo "INSTALL_LMOD = $(INSTALL_LMOD)"
@echo "INSTALL_CMOD = $(INSTALL_CMOD)"
@echo "INSTALL_EXEC = $(INSTALL_EXEC)"
@echo "INSTALL_DATA = $(INSTALL_DATA)"
@echo ""
@echo "See also src/luaconf.h ."
@echo ""
# echo private config parameters
pecho:
@echo "V = $(V)"
@echo "R = $(R)"
@echo "TO_BIN = $(TO_BIN)"
@echo "TO_INC = $(TO_INC)"
@echo "TO_LIB = $(TO_LIB)"
@echo "TO_MAN = $(TO_MAN)"
# echo config parameters as Lua code
# uncomment the last sed expression if you want nil instead of empty strings
lecho:
@echo "-- installation parameters for Lua $R"
@echo "VERSION = '$V'"
@echo "RELEASE = '$R'"
@$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/'
@echo "-- EOF"
# list targets that do not create files (but not all makes understand .PHONY)
.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
# (end of Makefile)

37
extern/lua-5.1.5/README vendored Normal file
View file

@ -0,0 +1,37 @@
README for Lua 5.1
See INSTALL for installation instructions.
See HISTORY for a summary of changes since the last released version.
* What is Lua?
------------
Lua is a powerful, light-weight programming language designed for extending
applications. Lua is also frequently used as a general-purpose, stand-alone
language. Lua is free software.
For complete information, visit Lua's web site at http://www.lua.org/ .
For an executive summary, see http://www.lua.org/about.html .
Lua has been used in many different projects around the world.
For a short list, see http://www.lua.org/uses.html .
* Availability
------------
Lua is freely available for both academic and commercial purposes.
See COPYRIGHT and http://www.lua.org/license.html for details.
Lua can be downloaded at http://www.lua.org/download.html .
* Installation
------------
Lua is implemented in pure ANSI C, and compiles unmodified in all known
platforms that have an ANSI C compiler. In most Unix-like platforms, simply
do "make" with a suitable target. See INSTALL for detailed instructions.
* Origin
------
Lua is developed at Lua.org, a laboratory of the Department of Computer
Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro
in Brazil).
For more information about the authors, see http://www.lua.org/authors.html .
(end of README)

497
extern/lua-5.1.5/doc/contents.html vendored Normal file
View file

@ -0,0 +1,497 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Lua 5.1 Reference Manual - contents</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<STYLE TYPE="text/css">
ul {
list-style-type: none ;
}
</STYLE>
</HEAD>
<BODY>
<HR>
<H1>
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="" BORDER=0></A>
Lua 5.1 Reference Manual
</H1>
<P>
The reference manual is the official definition of the Lua language.
For a complete introduction to Lua programming, see the book
<A HREF="http://www.lua.org/docs.html#pil">Programming in Lua</A>.
<P>
This manual is also available as a book:
<BLOCKQUOTE>
<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
<IMG SRC="cover.png" ALT="" TITLE="buy from Amazon" BORDER=1 ALIGN="left" HSPACE=12>
</A>
<B>Lua 5.1 Reference Manual</B>
<BR>by R. Ierusalimschy, L. H. de Figueiredo, W. Celes
<BR>Lua.org, August 2006
<BR>ISBN 85-903798-3-3
<BR CLEAR="all">
</BLOCKQUOTE>
<P>
<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">Buy a copy</A>
of this book and
<A HREF="http://www.lua.org/donations.html">help to support</A>
the Lua project.
<P>
<A HREF="manual.html">start</A>
&middot;
<A HREF="#contents">contents</A>
&middot;
<A HREF="#index">index</A>
&middot;
<A HREF="http://www.lua.org/manual/">other versions</A>
<HR>
<SMALL>
Copyright &copy; 2006&ndash;2012 Lua.org, PUC-Rio.
Freely available under the terms of the
<A HREF="http://www.lua.org/license.html">Lua license</A>.
</SMALL>
<H2><A NAME="contents">Contents</A></H2>
<UL style="padding: 0">
<LI><A HREF="manual.html">1 &ndash; Introduction</A>
<P>
<LI><A HREF="manual.html#2">2 &ndash; The Language</A>
<UL>
<LI><A HREF="manual.html#2.1">2.1 &ndash; Lexical Conventions</A>
<LI><A HREF="manual.html#2.2">2.2 &ndash; Values and Types</A>
<UL>
<LI><A HREF="manual.html#2.2.1">2.2.1 &ndash; Coercion</A>
</UL>
<LI><A HREF="manual.html#2.3">2.3 &ndash; Variables</A>
<LI><A HREF="manual.html#2.4">2.4 &ndash; Statements</A>
<UL>
<LI><A HREF="manual.html#2.4.1">2.4.1 &ndash; Chunks</A>
<LI><A HREF="manual.html#2.4.2">2.4.2 &ndash; Blocks</A>
<LI><A HREF="manual.html#2.4.3">2.4.3 &ndash; Assignment</A>
<LI><A HREF="manual.html#2.4.4">2.4.4 &ndash; Control Structures</A>
<LI><A HREF="manual.html#2.4.5">2.4.5 &ndash; For Statement</A>
<LI><A HREF="manual.html#2.4.6">2.4.6 &ndash; Function Calls as Statements</A>
<LI><A HREF="manual.html#2.4.7">2.4.7 &ndash; Local Declarations</A>
</UL>
<LI><A HREF="manual.html#2.5">2.5 &ndash; Expressions</A>
<UL>
<LI><A HREF="manual.html#2.5.1">2.5.1 &ndash; Arithmetic Operators</A>
<LI><A HREF="manual.html#2.5.2">2.5.2 &ndash; Relational Operators</A>
<LI><A HREF="manual.html#2.5.3">2.5.3 &ndash; Logical Operators</A>
<LI><A HREF="manual.html#2.5.4">2.5.4 &ndash; Concatenation</A>
<LI><A HREF="manual.html#2.5.5">2.5.5 &ndash; The Length Operator</A>
<LI><A HREF="manual.html#2.5.6">2.5.6 &ndash; Precedence</A>
<LI><A HREF="manual.html#2.5.7">2.5.7 &ndash; Table Constructors</A>
<LI><A HREF="manual.html#2.5.8">2.5.8 &ndash; Function Calls</A>
<LI><A HREF="manual.html#2.5.9">2.5.9 &ndash; Function Definitions</A>
</UL>
<LI><A HREF="manual.html#2.6">2.6 &ndash; Visibility Rules</A>
<LI><A HREF="manual.html#2.7">2.7 &ndash; Error Handling</A>
<LI><A HREF="manual.html#2.8">2.8 &ndash; Metatables</A>
<LI><A HREF="manual.html#2.9">2.9 &ndash; Environments</A>
<LI><A HREF="manual.html#2.10">2.10 &ndash; Garbage Collection</A>
<UL>
<LI><A HREF="manual.html#2.10.1">2.10.1 &ndash; Garbage-Collection Metamethods</A>
<LI><A HREF="manual.html#2.10.2">2.10.2 &ndash; Weak Tables</A>
</UL>
<LI><A HREF="manual.html#2.11">2.11 &ndash; Coroutines</A>
</UL>
<P>
<LI><A HREF="manual.html#3">3 &ndash; The Application Program Interface</A>
<UL>
<LI><A HREF="manual.html#3.1">3.1 &ndash; The Stack</A>
<LI><A HREF="manual.html#3.2">3.2 &ndash; Stack Size</A>
<LI><A HREF="manual.html#3.3">3.3 &ndash; Pseudo-Indices</A>
<LI><A HREF="manual.html#3.4">3.4 &ndash; C Closures</A>
<LI><A HREF="manual.html#3.5">3.5 &ndash; Registry</A>
<LI><A HREF="manual.html#3.6">3.6 &ndash; Error Handling in C</A>
<LI><A HREF="manual.html#3.7">3.7 &ndash; Functions and Types</A>
<LI><A HREF="manual.html#3.8">3.8 &ndash; The Debug Interface</A>
</UL>
<P>
<LI><A HREF="manual.html#4">4 &ndash; The Auxiliary Library</A>
<UL>
<LI><A HREF="manual.html#4.1">4.1 &ndash; Functions and Types</A>
</UL>
<P>
<LI><A HREF="manual.html#5">5 &ndash; Standard Libraries</A>
<UL>
<LI><A HREF="manual.html#5.1">5.1 &ndash; Basic Functions</A>
<LI><A HREF="manual.html#5.2">5.2 &ndash; Coroutine Manipulation</A>
<LI><A HREF="manual.html#5.3">5.3 &ndash; Modules</A>
<LI><A HREF="manual.html#5.4">5.4 &ndash; String Manipulation</A>
<UL>
<LI><A HREF="manual.html#5.4.1">5.4.1 &ndash; Patterns</A>
</UL>
<LI><A HREF="manual.html#5.5">5.5 &ndash; Table Manipulation</A>
<LI><A HREF="manual.html#5.6">5.6 &ndash; Mathematical Functions</A>
<LI><A HREF="manual.html#5.7">5.7 &ndash; Input and Output Facilities</A>
<LI><A HREF="manual.html#5.8">5.8 &ndash; Operating System Facilities</A>
<LI><A HREF="manual.html#5.9">5.9 &ndash; The Debug Library</A>
</UL>
<P>
<LI><A HREF="manual.html#6">6 &ndash; Lua Stand-alone</A>
<P>
<LI><A HREF="manual.html#7">7 &ndash; Incompatibilities with the Previous Version</A>
<UL>
<LI><A HREF="manual.html#7.1">7.1 &ndash; Changes in the Language</A>
<LI><A HREF="manual.html#7.2">7.2 &ndash; Changes in the Libraries</A>
<LI><A HREF="manual.html#7.3">7.3 &ndash; Changes in the API</A>
</UL>
<P>
<LI><A HREF="manual.html#8">8 &ndash; The Complete Syntax of Lua</A>
</UL>
<H2><A NAME="index">Index</A></H2>
<TABLE WIDTH="100%">
<TR VALIGN="top">
<TD>
<H3><A NAME="functions">Lua functions</A></H3>
<A HREF="manual.html#pdf-_G">_G</A><BR>
<A HREF="manual.html#pdf-_VERSION">_VERSION</A><BR>
<P>
<A HREF="manual.html#pdf-assert">assert</A><BR>
<A HREF="manual.html#pdf-collectgarbage">collectgarbage</A><BR>
<A HREF="manual.html#pdf-dofile">dofile</A><BR>
<A HREF="manual.html#pdf-error">error</A><BR>
<A HREF="manual.html#pdf-getfenv">getfenv</A><BR>
<A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR>
<A HREF="manual.html#pdf-ipairs">ipairs</A><BR>
<A HREF="manual.html#pdf-load">load</A><BR>
<A HREF="manual.html#pdf-loadfile">loadfile</A><BR>
<A HREF="manual.html#pdf-loadstring">loadstring</A><BR>
<A HREF="manual.html#pdf-module">module</A><BR>
<A HREF="manual.html#pdf-next">next</A><BR>
<A HREF="manual.html#pdf-pairs">pairs</A><BR>
<A HREF="manual.html#pdf-pcall">pcall</A><BR>
<A HREF="manual.html#pdf-print">print</A><BR>
<A HREF="manual.html#pdf-rawequal">rawequal</A><BR>
<A HREF="manual.html#pdf-rawget">rawget</A><BR>
<A HREF="manual.html#pdf-rawset">rawset</A><BR>
<A HREF="manual.html#pdf-require">require</A><BR>
<A HREF="manual.html#pdf-select">select</A><BR>
<A HREF="manual.html#pdf-setfenv">setfenv</A><BR>
<A HREF="manual.html#pdf-setmetatable">setmetatable</A><BR>
<A HREF="manual.html#pdf-tonumber">tonumber</A><BR>
<A HREF="manual.html#pdf-tostring">tostring</A><BR>
<A HREF="manual.html#pdf-type">type</A><BR>
<A HREF="manual.html#pdf-unpack">unpack</A><BR>
<A HREF="manual.html#pdf-xpcall">xpcall</A><BR>
<P>
<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>
<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>
<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>
<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>
<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR>
<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR>
<P>
<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR>
<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR>
<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR>
<A HREF="manual.html#pdf-debug.getinfo">debug.getinfo</A><BR>
<A HREF="manual.html#pdf-debug.getlocal">debug.getlocal</A><BR>
<A HREF="manual.html#pdf-debug.getmetatable">debug.getmetatable</A><BR>
<A HREF="manual.html#pdf-debug.getregistry">debug.getregistry</A><BR>
<A HREF="manual.html#pdf-debug.getupvalue">debug.getupvalue</A><BR>
<A HREF="manual.html#pdf-debug.setfenv">debug.setfenv</A><BR>
<A HREF="manual.html#pdf-debug.sethook">debug.sethook</A><BR>
<A HREF="manual.html#pdf-debug.setlocal">debug.setlocal</A><BR>
<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR>
<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR>
<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR>
</TD>
<TD>
<H3>&nbsp;</H3>
<A HREF="manual.html#pdf-file:close">file:close</A><BR>
<A HREF="manual.html#pdf-file:flush">file:flush</A><BR>
<A HREF="manual.html#pdf-file:lines">file:lines</A><BR>
<A HREF="manual.html#pdf-file:read">file:read</A><BR>
<A HREF="manual.html#pdf-file:seek">file:seek</A><BR>
<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR>
<A HREF="manual.html#pdf-file:write">file:write</A><BR>
<P>
<A HREF="manual.html#pdf-io.close">io.close</A><BR>
<A HREF="manual.html#pdf-io.flush">io.flush</A><BR>
<A HREF="manual.html#pdf-io.input">io.input</A><BR>
<A HREF="manual.html#pdf-io.lines">io.lines</A><BR>
<A HREF="manual.html#pdf-io.open">io.open</A><BR>
<A HREF="manual.html#pdf-io.output">io.output</A><BR>
<A HREF="manual.html#pdf-io.popen">io.popen</A><BR>
<A HREF="manual.html#pdf-io.read">io.read</A><BR>
<A HREF="manual.html#pdf-io.stderr">io.stderr</A><BR>
<A HREF="manual.html#pdf-io.stdin">io.stdin</A><BR>
<A HREF="manual.html#pdf-io.stdout">io.stdout</A><BR>
<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR>
<A HREF="manual.html#pdf-io.type">io.type</A><BR>
<A HREF="manual.html#pdf-io.write">io.write</A><BR>
<P>
<A HREF="manual.html#pdf-math.abs">math.abs</A><BR>
<A HREF="manual.html#pdf-math.acos">math.acos</A><BR>
<A HREF="manual.html#pdf-math.asin">math.asin</A><BR>
<A HREF="manual.html#pdf-math.atan">math.atan</A><BR>
<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR>
<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR>
<A HREF="manual.html#pdf-math.cos">math.cos</A><BR>
<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR>
<A HREF="manual.html#pdf-math.deg">math.deg</A><BR>
<A HREF="manual.html#pdf-math.exp">math.exp</A><BR>
<A HREF="manual.html#pdf-math.floor">math.floor</A><BR>
<A HREF="manual.html#pdf-math.fmod">math.fmod</A><BR>
<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR>
<A HREF="manual.html#pdf-math.huge">math.huge</A><BR>
<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR>
<A HREF="manual.html#pdf-math.log">math.log</A><BR>
<A HREF="manual.html#pdf-math.log10">math.log10</A><BR>
<A HREF="manual.html#pdf-math.max">math.max</A><BR>
<A HREF="manual.html#pdf-math.min">math.min</A><BR>
<A HREF="manual.html#pdf-math.modf">math.modf</A><BR>
<A HREF="manual.html#pdf-math.pi">math.pi</A><BR>
<A HREF="manual.html#pdf-math.pow">math.pow</A><BR>
<A HREF="manual.html#pdf-math.rad">math.rad</A><BR>
<A HREF="manual.html#pdf-math.random">math.random</A><BR>
<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR>
<A HREF="manual.html#pdf-math.sin">math.sin</A><BR>
<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR>
<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR>
<A HREF="manual.html#pdf-math.tan">math.tan</A><BR>
<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR>
<P>
<A HREF="manual.html#pdf-os.clock">os.clock</A><BR>
<A HREF="manual.html#pdf-os.date">os.date</A><BR>
<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR>
<A HREF="manual.html#pdf-os.execute">os.execute</A><BR>
<A HREF="manual.html#pdf-os.exit">os.exit</A><BR>
<A HREF="manual.html#pdf-os.getenv">os.getenv</A><BR>
<A HREF="manual.html#pdf-os.remove">os.remove</A><BR>
<A HREF="manual.html#pdf-os.rename">os.rename</A><BR>
<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR>
<A HREF="manual.html#pdf-os.time">os.time</A><BR>
<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR>
<P>
<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR>
<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR>
<A HREF="manual.html#pdf-package.loaders">package.loaders</A><BR>
<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR>
<A HREF="manual.html#pdf-package.path">package.path</A><BR>
<A HREF="manual.html#pdf-package.preload">package.preload</A><BR>
<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR>
<P>
<A HREF="manual.html#pdf-string.byte">string.byte</A><BR>
<A HREF="manual.html#pdf-string.char">string.char</A><BR>
<A HREF="manual.html#pdf-string.dump">string.dump</A><BR>
<A HREF="manual.html#pdf-string.find">string.find</A><BR>
<A HREF="manual.html#pdf-string.format">string.format</A><BR>
<A HREF="manual.html#pdf-string.gmatch">string.gmatch</A><BR>
<A HREF="manual.html#pdf-string.gsub">string.gsub</A><BR>
<A HREF="manual.html#pdf-string.len">string.len</A><BR>
<A HREF="manual.html#pdf-string.lower">string.lower</A><BR>
<A HREF="manual.html#pdf-string.match">string.match</A><BR>
<A HREF="manual.html#pdf-string.rep">string.rep</A><BR>
<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR>
<A HREF="manual.html#pdf-string.sub">string.sub</A><BR>
<A HREF="manual.html#pdf-string.upper">string.upper</A><BR>
<P>
<A HREF="manual.html#pdf-table.concat">table.concat</A><BR>
<A HREF="manual.html#pdf-table.insert">table.insert</A><BR>
<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR>
<A HREF="manual.html#pdf-table.remove">table.remove</A><BR>
<A HREF="manual.html#pdf-table.sort">table.sort</A><BR>
</TD>
<TD>
<H3>C API</H3>
<A HREF="manual.html#lua_Alloc">lua_Alloc</A><BR>
<A HREF="manual.html#lua_CFunction">lua_CFunction</A><BR>
<A HREF="manual.html#lua_Debug">lua_Debug</A><BR>
<A HREF="manual.html#lua_Hook">lua_Hook</A><BR>
<A HREF="manual.html#lua_Integer">lua_Integer</A><BR>
<A HREF="manual.html#lua_Number">lua_Number</A><BR>
<A HREF="manual.html#lua_Reader">lua_Reader</A><BR>
<A HREF="manual.html#lua_State">lua_State</A><BR>
<A HREF="manual.html#lua_Writer">lua_Writer</A><BR>
<P>
<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR>
<A HREF="manual.html#lua_call">lua_call</A><BR>
<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR>
<A HREF="manual.html#lua_close">lua_close</A><BR>
<A HREF="manual.html#lua_concat">lua_concat</A><BR>
<A HREF="manual.html#lua_cpcall">lua_cpcall</A><BR>
<A HREF="manual.html#lua_createtable">lua_createtable</A><BR>
<A HREF="manual.html#lua_dump">lua_dump</A><BR>
<A HREF="manual.html#lua_equal">lua_equal</A><BR>
<A HREF="manual.html#lua_error">lua_error</A><BR>
<A HREF="manual.html#lua_gc">lua_gc</A><BR>
<A HREF="manual.html#lua_getallocf">lua_getallocf</A><BR>
<A HREF="manual.html#lua_getfenv">lua_getfenv</A><BR>
<A HREF="manual.html#lua_getfield">lua_getfield</A><BR>
<A HREF="manual.html#lua_getglobal">lua_getglobal</A><BR>
<A HREF="manual.html#lua_gethook">lua_gethook</A><BR>
<A HREF="manual.html#lua_gethookcount">lua_gethookcount</A><BR>
<A HREF="manual.html#lua_gethookmask">lua_gethookmask</A><BR>
<A HREF="manual.html#lua_getinfo">lua_getinfo</A><BR>
<A HREF="manual.html#lua_getlocal">lua_getlocal</A><BR>
<A HREF="manual.html#lua_getmetatable">lua_getmetatable</A><BR>
<A HREF="manual.html#lua_getstack">lua_getstack</A><BR>
<A HREF="manual.html#lua_gettable">lua_gettable</A><BR>
<A HREF="manual.html#lua_gettop">lua_gettop</A><BR>
<A HREF="manual.html#lua_getupvalue">lua_getupvalue</A><BR>
<A HREF="manual.html#lua_insert">lua_insert</A><BR>
<A HREF="manual.html#lua_isboolean">lua_isboolean</A><BR>
<A HREF="manual.html#lua_iscfunction">lua_iscfunction</A><BR>
<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR>
<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR>
<A HREF="manual.html#lua_isnil">lua_isnil</A><BR>
<A HREF="manual.html#lua_isnone">lua_isnone</A><BR>
<A HREF="manual.html#lua_isnoneornil">lua_isnoneornil</A><BR>
<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR>
<A HREF="manual.html#lua_isstring">lua_isstring</A><BR>
<A HREF="manual.html#lua_istable">lua_istable</A><BR>
<A HREF="manual.html#lua_isthread">lua_isthread</A><BR>
<A HREF="manual.html#lua_isuserdata">lua_isuserdata</A><BR>
<A HREF="manual.html#lua_lessthan">lua_lessthan</A><BR>
<A HREF="manual.html#lua_load">lua_load</A><BR>
<A HREF="manual.html#lua_newstate">lua_newstate</A><BR>
<A HREF="manual.html#lua_newtable">lua_newtable</A><BR>
<A HREF="manual.html#lua_newthread">lua_newthread</A><BR>
<A HREF="manual.html#lua_newuserdata">lua_newuserdata</A><BR>
<A HREF="manual.html#lua_next">lua_next</A><BR>
<A HREF="manual.html#lua_objlen">lua_objlen</A><BR>
<A HREF="manual.html#lua_pcall">lua_pcall</A><BR>
<A HREF="manual.html#lua_pop">lua_pop</A><BR>
<A HREF="manual.html#lua_pushboolean">lua_pushboolean</A><BR>
<A HREF="manual.html#lua_pushcclosure">lua_pushcclosure</A><BR>
<A HREF="manual.html#lua_pushcfunction">lua_pushcfunction</A><BR>
<A HREF="manual.html#lua_pushfstring">lua_pushfstring</A><BR>
<A HREF="manual.html#lua_pushinteger">lua_pushinteger</A><BR>
<A HREF="manual.html#lua_pushlightuserdata">lua_pushlightuserdata</A><BR>
<A HREF="manual.html#lua_pushliteral">lua_pushliteral</A><BR>
<A HREF="manual.html#lua_pushlstring">lua_pushlstring</A><BR>
<A HREF="manual.html#lua_pushnil">lua_pushnil</A><BR>
<A HREF="manual.html#lua_pushnumber">lua_pushnumber</A><BR>
<A HREF="manual.html#lua_pushstring">lua_pushstring</A><BR>
<A HREF="manual.html#lua_pushthread">lua_pushthread</A><BR>
<A HREF="manual.html#lua_pushvalue">lua_pushvalue</A><BR>
<A HREF="manual.html#lua_pushvfstring">lua_pushvfstring</A><BR>
<A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR>
<A HREF="manual.html#lua_rawget">lua_rawget</A><BR>
<A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR>
<A HREF="manual.html#lua_rawset">lua_rawset</A><BR>
<A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR>
<A HREF="manual.html#lua_register">lua_register</A><BR>
<A HREF="manual.html#lua_remove">lua_remove</A><BR>
<A HREF="manual.html#lua_replace">lua_replace</A><BR>
<A HREF="manual.html#lua_resume">lua_resume</A><BR>
<A HREF="manual.html#lua_setallocf">lua_setallocf</A><BR>
<A HREF="manual.html#lua_setfenv">lua_setfenv</A><BR>
<A HREF="manual.html#lua_setfield">lua_setfield</A><BR>
<A HREF="manual.html#lua_setglobal">lua_setglobal</A><BR>
<A HREF="manual.html#lua_sethook">lua_sethook</A><BR>
<A HREF="manual.html#lua_setlocal">lua_setlocal</A><BR>
<A HREF="manual.html#lua_setmetatable">lua_setmetatable</A><BR>
<A HREF="manual.html#lua_settable">lua_settable</A><BR>
<A HREF="manual.html#lua_settop">lua_settop</A><BR>
<A HREF="manual.html#lua_setupvalue">lua_setupvalue</A><BR>
<A HREF="manual.html#lua_status">lua_status</A><BR>
<A HREF="manual.html#lua_toboolean">lua_toboolean</A><BR>
<A HREF="manual.html#lua_tocfunction">lua_tocfunction</A><BR>
<A HREF="manual.html#lua_tointeger">lua_tointeger</A><BR>
<A HREF="manual.html#lua_tolstring">lua_tolstring</A><BR>
<A HREF="manual.html#lua_tonumber">lua_tonumber</A><BR>
<A HREF="manual.html#lua_topointer">lua_topointer</A><BR>
<A HREF="manual.html#lua_tostring">lua_tostring</A><BR>
<A HREF="manual.html#lua_tothread">lua_tothread</A><BR>
<A HREF="manual.html#lua_touserdata">lua_touserdata</A><BR>
<A HREF="manual.html#lua_type">lua_type</A><BR>
<A HREF="manual.html#lua_typename">lua_typename</A><BR>
<A HREF="manual.html#lua_upvalueindex">lua_upvalueindex</A><BR>
<A HREF="manual.html#lua_xmove">lua_xmove</A><BR>
<A HREF="manual.html#lua_yield">lua_yield</A><BR>
</TD>
<TD>
<H3>auxiliary library</H3>
<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR>
<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR>
<P>
<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR>
<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR>
<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR>
<A HREF="manual.html#luaL_addstring">luaL_addstring</A><BR>
<A HREF="manual.html#luaL_addvalue">luaL_addvalue</A><BR>
<A HREF="manual.html#luaL_argcheck">luaL_argcheck</A><BR>
<A HREF="manual.html#luaL_argerror">luaL_argerror</A><BR>
<A HREF="manual.html#luaL_buffinit">luaL_buffinit</A><BR>
<A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR>
<A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR>
<A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR>
<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR>
<A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR>
<A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR>
<A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR>
<A HREF="manual.html#luaL_checkoption">luaL_checkoption</A><BR>
<A HREF="manual.html#luaL_checkstack">luaL_checkstack</A><BR>
<A HREF="manual.html#luaL_checkstring">luaL_checkstring</A><BR>
<A HREF="manual.html#luaL_checktype">luaL_checktype</A><BR>
<A HREF="manual.html#luaL_checkudata">luaL_checkudata</A><BR>
<A HREF="manual.html#luaL_dofile">luaL_dofile</A><BR>
<A HREF="manual.html#luaL_dostring">luaL_dostring</A><BR>
<A HREF="manual.html#luaL_error">luaL_error</A><BR>
<A HREF="manual.html#luaL_getmetafield">luaL_getmetafield</A><BR>
<A HREF="manual.html#luaL_getmetatable">luaL_getmetatable</A><BR>
<A HREF="manual.html#luaL_gsub">luaL_gsub</A><BR>
<A HREF="manual.html#luaL_loadbuffer">luaL_loadbuffer</A><BR>
<A HREF="manual.html#luaL_loadfile">luaL_loadfile</A><BR>
<A HREF="manual.html#luaL_loadstring">luaL_loadstring</A><BR>
<A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR>
<A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR>
<A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR>
<A HREF="manual.html#luaL_optint">luaL_optint</A><BR>
<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR>
<A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR>
<A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR>
<A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR>
<A HREF="manual.html#luaL_optstring">luaL_optstring</A><BR>
<A HREF="manual.html#luaL_prepbuffer">luaL_prepbuffer</A><BR>
<A HREF="manual.html#luaL_pushresult">luaL_pushresult</A><BR>
<A HREF="manual.html#luaL_ref">luaL_ref</A><BR>
<A HREF="manual.html#luaL_register">luaL_register</A><BR>
<A HREF="manual.html#luaL_typename">luaL_typename</A><BR>
<A HREF="manual.html#luaL_typerror">luaL_typerror</A><BR>
<A HREF="manual.html#luaL_unref">luaL_unref</A><BR>
<A HREF="manual.html#luaL_where">luaL_where</A><BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<SMALL CLASS="footer">
Last update:
Mon Feb 13 18:53:32 BRST 2012
</SMALL>
<!--
Last change: revised for Lua 5.1.5
-->
</BODY>
</HTML>

BIN
extern/lua-5.1.5/doc/cover.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
extern/lua-5.1.5/doc/logo.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

163
extern/lua-5.1.5/doc/lua.1 vendored Normal file
View file

@ -0,0 +1,163 @@
.\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $
.TH LUA 1 "$Date: 2006/01/06 16:03:34 $"
.SH NAME
lua \- Lua interpreter
.SH SYNOPSIS
.B lua
[
.I options
]
[
.I script
[
.I args
]
]
.SH DESCRIPTION
.B lua
is the stand-alone Lua interpreter.
It loads and executes Lua programs,
either in textual source form or
in precompiled binary form.
(Precompiled binaries are output by
.BR luac ,
the Lua compiler.)
.B lua
can be used as a batch interpreter and also interactively.
.LP
The given
.I options
(see below)
are executed and then
the Lua program in file
.I script
is loaded and executed.
The given
.I args
are available to
.I script
as strings in a global table named
.BR arg .
If these arguments contain spaces or other characters special to the shell,
then they should be quoted
(but note that the quotes will be removed by the shell).
The arguments in
.B arg
start at 0,
which contains the string
.RI ' script '.
The index of the last argument is stored in
.BR arg.n .
The arguments given in the command line before
.IR script ,
including the name of the interpreter,
are available in negative indices in
.BR arg .
.LP
At the very start,
before even handling the command line,
.B lua
executes the contents of the environment variable
.BR LUA_INIT ,
if it is defined.
If the value of
.B LUA_INIT
is of the form
.RI '@ filename ',
then
.I filename
is executed.
Otherwise, the string is assumed to be a Lua statement and is executed.
.LP
Options start with
.B '\-'
and are described below.
You can use
.B "'\--'"
to signal the end of options.
.LP
If no arguments are given,
then
.B "\-v \-i"
is assumed when the standard input is a terminal;
otherwise,
.B "\-"
is assumed.
.LP
In interactive mode,
.B lua
prompts the user,
reads lines from the standard input,
and executes them as they are read.
If a line does not contain a complete statement,
then a secondary prompt is displayed and
lines are read until a complete statement is formed or
a syntax error is found.
So, one way to interrupt the reading of an incomplete statement is
to force a syntax error:
adding a
.B ';'
in the middle of a statement is a sure way of forcing a syntax error
(except inside multiline strings and comments; these must be closed explicitly).
If a line starts with
.BR '=' ,
then
.B lua
displays the values of all the expressions in the remainder of the
line. The expressions must be separated by commas.
The primary prompt is the value of the global variable
.BR _PROMPT ,
if this value is a string;
otherwise, the default prompt is used.
Similarly, the secondary prompt is the value of the global variable
.BR _PROMPT2 .
So,
to change the prompts,
set the corresponding variable to a string of your choice.
You can do that after calling the interpreter
or on the command line
(but in this case you have to be careful with quotes
if the prompt string contains a space; otherwise you may confuse the shell.)
The default prompts are "> " and ">> ".
.SH OPTIONS
.TP
.B \-
load and execute the standard input as a file,
that is,
not interactively,
even when the standard input is a terminal.
.TP
.BI \-e " stat"
execute statement
.IR stat .
You need to quote
.I stat
if it contains spaces, quotes,
or other characters special to the shell.
.TP
.B \-i
enter interactive mode after
.I script
is executed.
.TP
.BI \-l " name"
call
.BI require(' name ')
before executing
.IR script .
Typically used to load libraries.
.TP
.B \-v
show version information.
.SH "SEE ALSO"
.BR luac (1)
.br
http://www.lua.org/
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
R. Ierusalimschy,
L. H. de Figueiredo,
and
W. Celes
.\" EOF

83
extern/lua-5.1.5/doc/lua.css vendored Normal file
View file

@ -0,0 +1,83 @@
body {
color: #000000 ;
background-color: #FFFFFF ;
font-family: Helvetica, Arial, sans-serif ;
text-align: justify ;
margin-right: 30px ;
margin-left: 30px ;
}
h1, h2, h3, h4 {
font-family: Verdana, Geneva, sans-serif ;
font-weight: normal ;
font-style: italic ;
}
h2 {
padding-top: 0.4em ;
padding-bottom: 0.4em ;
padding-left: 30px ;
padding-right: 30px ;
margin-left: -30px ;
background-color: #E0E0FF ;
}
h3 {
padding-left: 0.5em ;
border-left: solid #E0E0FF 1em ;
}
table h3 {
padding-left: 0px ;
border-left: none ;
}
a:link {
color: #000080 ;
background-color: inherit ;
text-decoration: none ;
}
a:visited {
background-color: inherit ;
text-decoration: none ;
}
a:link:hover, a:visited:hover {
color: #000080 ;
background-color: #E0E0FF ;
}
a:link:active, a:visited:active {
color: #FF0000 ;
}
hr {
border: 0 ;
height: 1px ;
color: #a0a0a0 ;
background-color: #a0a0a0 ;
}
:target {
background-color: #F8F8F8 ;
padding: 8px ;
border: solid #a0a0a0 2px ;
}
.footer {
color: gray ;
font-size: small ;
}
input[type=text] {
border: solid #a0a0a0 2px ;
border-radius: 2em ;
-moz-border-radius: 2em ;
background-image: url('images/search.png') ;
background-repeat: no-repeat;
background-position: 4px center ;
padding-left: 20px ;
height: 2em ;
}

172
extern/lua-5.1.5/doc/lua.html vendored Normal file
View file

@ -0,0 +1,172 @@
<!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -->
<HTML>
<HEAD>
<TITLE>LUA man page</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2>NAME</H2>
lua - Lua interpreter
<H2>SYNOPSIS</H2>
<B>lua</B>
[
<I>options</I>
]
[
<I>script</I>
[
<I>args</I>
]
]
<H2>DESCRIPTION</H2>
<B>lua</B>
is the stand-alone Lua interpreter.
It loads and executes Lua programs,
either in textual source form or
in precompiled binary form.
(Precompiled binaries are output by
<B>luac</B>,
the Lua compiler.)
<B>lua</B>
can be used as a batch interpreter and also interactively.
<P>
The given
<I>options</I>
(see below)
are executed and then
the Lua program in file
<I>script</I>
is loaded and executed.
The given
<I>args</I>
are available to
<I>script</I>
as strings in a global table named
<B>arg</B>.
If these arguments contain spaces or other characters special to the shell,
then they should be quoted
(but note that the quotes will be removed by the shell).
The arguments in
<B>arg</B>
start at 0,
which contains the string
'<I>script</I>'.
The index of the last argument is stored in
<B>arg.n</B>.
The arguments given in the command line before
<I>script</I>,
including the name of the interpreter,
are available in negative indices in
<B>arg</B>.
<P>
At the very start,
before even handling the command line,
<B>lua</B>
executes the contents of the environment variable
<B>LUA_INIT</B>,
if it is defined.
If the value of
<B>LUA_INIT</B>
is of the form
'@<I>filename</I>',
then
<I>filename</I>
is executed.
Otherwise, the string is assumed to be a Lua statement and is executed.
<P>
Options start with
<B>'-'</B>
and are described below.
You can use
<B>'--'</B>
to signal the end of options.
<P>
If no arguments are given,
then
<B>"-v -i"</B>
is assumed when the standard input is a terminal;
otherwise,
<B>"-"</B>
is assumed.
<P>
In interactive mode,
<B>lua</B>
prompts the user,
reads lines from the standard input,
and executes them as they are read.
If a line does not contain a complete statement,
then a secondary prompt is displayed and
lines are read until a complete statement is formed or
a syntax error is found.
So, one way to interrupt the reading of an incomplete statement is
to force a syntax error:
adding a
<B>';'</B>
in the middle of a statement is a sure way of forcing a syntax error
(except inside multiline strings and comments; these must be closed explicitly).
If a line starts with
<B>'='</B>,
then
<B>lua</B>
displays the values of all the expressions in the remainder of the
line. The expressions must be separated by commas.
The primary prompt is the value of the global variable
<B>_PROMPT</B>,
if this value is a string;
otherwise, the default prompt is used.
Similarly, the secondary prompt is the value of the global variable
<B>_PROMPT2</B>.
So,
to change the prompts,
set the corresponding variable to a string of your choice.
You can do that after calling the interpreter
or on the command line
(but in this case you have to be careful with quotes
if the prompt string contains a space; otherwise you may confuse the shell.)
The default prompts are "&gt; " and "&gt;&gt; ".
<H2>OPTIONS</H2>
<P>
<B>-</B>
load and execute the standard input as a file,
that is,
not interactively,
even when the standard input is a terminal.
<P>
<B>-e </B><I>stat</I>
execute statement
<I>stat</I>.
You need to quote
<I>stat </I>
if it contains spaces, quotes,
or other characters special to the shell.
<P>
<B>-i</B>
enter interactive mode after
<I>script</I>
is executed.
<P>
<B>-l </B><I>name</I>
call
<B>require</B>('<I>name</I>')
before executing
<I>script</I>.
Typically used to load libraries.
<P>
<B>-v</B>
show version information.
<H2>SEE ALSO</H2>
<B>luac</B>(1)
<BR>
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
<H2>DIAGNOSTICS</H2>
Error messages should be self explanatory.
<H2>AUTHORS</H2>
R. Ierusalimschy,
L. H. de Figueiredo,
and
W. Celes
<!-- EOF -->
</BODY>
</HTML>

136
extern/lua-5.1.5/doc/luac.1 vendored Normal file
View file

@ -0,0 +1,136 @@
.\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $
.TH LUAC 1 "$Date: 2006/01/06 16:03:34 $"
.SH NAME
luac \- Lua compiler
.SH SYNOPSIS
.B luac
[
.I options
] [
.I filenames
]
.SH DESCRIPTION
.B luac
is the Lua compiler.
It translates programs written in the Lua programming language
into binary files that can be later loaded and executed.
.LP
The main advantages of precompiling chunks are:
faster loading,
protecting source code from accidental user changes,
and
off-line syntax checking.
.LP
Pre-compiling does not imply faster execution
because in Lua chunks are always compiled into bytecodes before being executed.
.B luac
simply allows those bytecodes to be saved in a file for later execution.
.LP
Pre-compiled chunks are not necessarily smaller than the corresponding source.
The main goal in pre-compiling is faster loading.
.LP
The binary files created by
.B luac
are portable only among architectures with the same word size and byte order.
.LP
.B luac
produces a single output file containing the bytecodes
for all source files given.
By default,
the output file is named
.BR luac.out ,
but you can change this with the
.B \-o
option.
.LP
In the command line,
you can mix
text files containing Lua source and
binary files containing precompiled chunks.
This is useful to combine several precompiled chunks,
even from different (but compatible) platforms,
into a single precompiled chunk.
.LP
You can use
.B "'\-'"
to indicate the standard input as a source file
and
.B "'\--'"
to signal the end of options
(that is,
all remaining arguments will be treated as files even if they start with
.BR "'\-'" ).
.LP
The internal format of the binary files produced by
.B luac
is likely to change when a new version of Lua is released.
So,
save the source files of all Lua programs that you precompile.
.LP
.SH OPTIONS
Options must be separate.
.TP
.B \-l
produce a listing of the compiled bytecode for Lua's virtual machine.
Listing bytecodes is useful to learn about Lua's virtual machine.
If no files are given, then
.B luac
loads
.B luac.out
and lists its contents.
.TP
.BI \-o " file"
output to
.IR file ,
instead of the default
.BR luac.out .
(You can use
.B "'\-'"
for standard output,
but not on platforms that open standard output in text mode.)
The output file may be a source file because
all files are loaded before the output file is written.
Be careful not to overwrite precious files.
.TP
.B \-p
load files but do not generate any output file.
Used mainly for syntax checking and for testing precompiled chunks:
corrupted files will probably generate errors when loaded.
Lua always performs a thorough integrity test on precompiled chunks.
Bytecode that passes this test is completely safe,
in the sense that it will not break the interpreter.
However,
there is no guarantee that such code does anything sensible.
(None can be given, because the halting problem is unsolvable.)
If no files are given, then
.B luac
loads
.B luac.out
and tests its contents.
No messages are displayed if the file passes the integrity test.
.TP
.B \-s
strip debug information before writing the output file.
This saves some space in very large chunks,
but if errors occur when running a stripped chunk,
then the error messages may not contain the full information they usually do.
For instance,
line numbers and names of local variables are lost.
.TP
.B \-v
show version information.
.SH FILES
.TP 15
.B luac.out
default output file
.SH "SEE ALSO"
.BR lua (1)
.br
http://www.lua.org/
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
L. H. de Figueiredo,
R. Ierusalimschy and
W. Celes
.\" EOF

145
extern/lua-5.1.5/doc/luac.html vendored Normal file
View file

@ -0,0 +1,145 @@
<!-- $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $ -->
<HTML>
<HEAD>
<TITLE>LUAC man page</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2>NAME</H2>
luac - Lua compiler
<H2>SYNOPSIS</H2>
<B>luac</B>
[
<I>options</I>
] [
<I>filenames</I>
]
<H2>DESCRIPTION</H2>
<B>luac</B>
is the Lua compiler.
It translates programs written in the Lua programming language
into binary files that can be later loaded and executed.
<P>
The main advantages of precompiling chunks are:
faster loading,
protecting source code from accidental user changes,
and
off-line syntax checking.
<P>
Precompiling does not imply faster execution
because in Lua chunks are always compiled into bytecodes before being executed.
<B>luac</B>
simply allows those bytecodes to be saved in a file for later execution.
<P>
Precompiled chunks are not necessarily smaller than the corresponding source.
The main goal in precompiling is faster loading.
<P>
The binary files created by
<B>luac</B>
are portable only among architectures with the same word size and byte order.
<P>
<B>luac</B>
produces a single output file containing the bytecodes
for all source files given.
By default,
the output file is named
<B>luac.out</B>,
but you can change this with the
<B>-o</B>
option.
<P>
In the command line,
you can mix
text files containing Lua source and
binary files containing precompiled chunks.
This is useful because several precompiled chunks,
even from different (but compatible) platforms,
can be combined into a single precompiled chunk.
<P>
You can use
<B>'-'</B>
to indicate the standard input as a source file
and
<B>'--'</B>
to signal the end of options
(that is,
all remaining arguments will be treated as files even if they start with
<B>'-'</B>).
<P>
The internal format of the binary files produced by
<B>luac</B>
is likely to change when a new version of Lua is released.
So,
save the source files of all Lua programs that you precompile.
<P>
<H2>OPTIONS</H2>
Options must be separate.
<P>
<B>-l</B>
produce a listing of the compiled bytecode for Lua's virtual machine.
Listing bytecodes is useful to learn about Lua's virtual machine.
If no files are given, then
<B>luac</B>
loads
<B>luac.out</B>
and lists its contents.
<P>
<B>-o </B><I>file</I>
output to
<I>file</I>,
instead of the default
<B>luac.out</B>.
(You can use
<B>'-'</B>
for standard output,
but not on platforms that open standard output in text mode.)
The output file may be a source file because
all files are loaded before the output file is written.
Be careful not to overwrite precious files.
<P>
<B>-p</B>
load files but do not generate any output file.
Used mainly for syntax checking and for testing precompiled chunks:
corrupted files will probably generate errors when loaded.
Lua always performs a thorough integrity test on precompiled chunks.
Bytecode that passes this test is completely safe,
in the sense that it will not break the interpreter.
However,
there is no guarantee that such code does anything sensible.
(None can be given, because the halting problem is unsolvable.)
If no files are given, then
<B>luac</B>
loads
<B>luac.out</B>
and tests its contents.
No messages are displayed if the file passes the integrity test.
<P>
<B>-s</B>
strip debug information before writing the output file.
This saves some space in very large chunks,
but if errors occur when running a stripped chunk,
then the error messages may not contain the full information they usually do.
For instance,
line numbers and names of local variables are lost.
<P>
<B>-v</B>
show version information.
<H2>FILES</H2>
<P>
<B>luac.out</B>
default output file
<H2>SEE ALSO</H2>
<B>lua</B>(1)
<BR>
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
<H2>DIAGNOSTICS</H2>
Error messages should be self explanatory.
<H2>AUTHORS</H2>
L. H. de Figueiredo,
R. Ierusalimschy and
W. Celes
<!-- EOF -->
</BODY>
</HTML>

24
extern/lua-5.1.5/doc/manual.css vendored Normal file
View file

@ -0,0 +1,24 @@
h3 code {
font-family: inherit ;
font-size: inherit ;
}
pre, code {
font-size: 12pt ;
}
span.apii {
float: right ;
font-family: inherit ;
font-style: normal ;
font-size: small ;
color: gray ;
}
p+h1, ul+h1 {
padding-top: 0.4em ;
padding-bottom: 0.4em ;
padding-left: 30px ;
margin-left: -30px ;
background-color: #E0E0FF ;
}

8804
extern/lua-5.1.5/doc/manual.html vendored Normal file

File diff suppressed because it is too large Load diff

40
extern/lua-5.1.5/doc/readme.html vendored Normal file
View file

@ -0,0 +1,40 @@
<HTML>
<HEAD>
<TITLE>Lua documentation</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
</HEAD>
<BODY>
<HR>
<H1>
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A>
Documentation
</H1>
This is the documentation included in the source distribution of Lua 5.1.5.
<UL>
<LI><A HREF="contents.html">Reference manual</A>
<LI><A HREF="lua.html">lua man page</A>
<LI><A HREF="luac.html">luac man page</A>
<LI><A HREF="../README">lua/README</A>
<LI><A HREF="../etc/README">lua/etc/README</A>
<LI><A HREF="../test/README">lua/test/README</A>
</UL>
Lua's
<A HREF="http://www.lua.org/">official web site</A>
contains updated documentation,
especially the
<A HREF="http://www.lua.org/manual/5.1/">reference manual</A>.
<P>
<HR>
<SMALL>
Last update:
Fri Feb 3 09:44:42 BRST 2012
</SMALL>
</BODY>
</HTML>

44
extern/lua-5.1.5/etc/Makefile vendored Normal file
View file

@ -0,0 +1,44 @@
# makefile for Lua etc
TOP= ..
LIB= $(TOP)/src
INC= $(TOP)/src
BIN= $(TOP)/src
SRC= $(TOP)/src
TST= $(TOP)/test
CC= gcc
CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS)
MYCFLAGS=
MYLDFLAGS= -Wl,-E
MYLIBS= -lm
#MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses
RM= rm -f
default:
@echo 'Please choose a target: min noparser one strict clean'
min: min.c
$(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS)
echo 'print"Hello there!"' | ./a.out
noparser: noparser.o
$(CC) noparser.o $(SRC)/lua.o -L$(LIB) -llua $(MYLIBS)
$(BIN)/luac $(TST)/hello.lua
-./a.out luac.out
-./a.out -e'a=1'
one:
$(CC) $(CFLAGS) all.c $(MYLIBS)
./a.out $(TST)/hello.lua
strict:
-$(BIN)/lua -e 'print(a);b=2'
-$(BIN)/lua -lstrict -e 'print(a)'
-$(BIN)/lua -e 'function f() b=2 end f()'
-$(BIN)/lua -lstrict -e 'function f() b=2 end f()'
clean:
$(RM) a.out core core.* *.o luac.out
.PHONY: default min noparser one strict clean

37
extern/lua-5.1.5/etc/README vendored Normal file
View file

@ -0,0 +1,37 @@
This directory contains some useful files and code.
Unlike the code in ../src, everything here is in the public domain.
If any of the makes fail, you're probably not using the same libraries
used to build Lua. Set MYLIBS in Makefile accordingly.
all.c
Full Lua interpreter in a single file.
Do "make one" for a demo.
lua.hpp
Lua header files for C++ using 'extern "C"'.
lua.ico
A Lua icon for Windows (and web sites: save as favicon.ico).
Drawn by hand by Markus Gritsch <gritsch@iue.tuwien.ac.at>.
lua.pc
pkg-config data for Lua
luavs.bat
Script to build Lua under "Visual Studio .NET Command Prompt".
Run it from the toplevel as etc\luavs.bat.
min.c
A minimal Lua interpreter.
Good for learning and for starting your own.
Do "make min" for a demo.
noparser.c
Linking with noparser.o avoids loading the parsing modules in lualib.a.
Do "make noparser" for a demo.
strict.lua
Traps uses of undeclared global variables.
Do "make strict" for a demo.

38
extern/lua-5.1.5/etc/all.c vendored Normal file
View file

@ -0,0 +1,38 @@
/*
* all.c -- Lua core, libraries and interpreter in a single file
*/
#define luaall_c
#include "lapi.c"
#include "lcode.c"
#include "ldebug.c"
#include "ldo.c"
#include "ldump.c"
#include "lfunc.c"
#include "lgc.c"
#include "llex.c"
#include "lmem.c"
#include "lobject.c"
#include "lopcodes.c"
#include "lparser.c"
#include "lstate.c"
#include "lstring.c"
#include "ltable.c"
#include "ltm.c"
#include "lundump.c"
#include "lvm.c"
#include "lzio.c"
#include "lauxlib.c"
#include "lbaselib.c"
#include "ldblib.c"
#include "liolib.c"
#include "linit.c"
#include "lmathlib.c"
#include "loadlib.c"
#include "loslib.c"
#include "lstrlib.c"
#include "ltablib.c"
#include "lua.c"

9
extern/lua-5.1.5/etc/lua.hpp vendored Normal file
View file

@ -0,0 +1,9 @@
// lua.hpp
// Lua header files for C++
// <<extern "C">> not supplied automatically because Lua also compiles as C++
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

BIN
extern/lua-5.1.5/etc/lua.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

31
extern/lua-5.1.5/etc/lua.pc vendored Normal file
View file

@ -0,0 +1,31 @@
# lua.pc -- pkg-config data for Lua
# vars from install Makefile
# grep '^V=' ../Makefile
V= 5.1
# grep '^R=' ../Makefile
R= 5.1.5
# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
prefix= /usr/local
INSTALL_BIN= ${prefix}/bin
INSTALL_INC= ${prefix}/include
INSTALL_LIB= ${prefix}/lib
INSTALL_MAN= ${prefix}/man/man1
INSTALL_LMOD= ${prefix}/share/lua/${V}
INSTALL_CMOD= ${prefix}/lib/lua/${V}
# canonical vars
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua -lm
Cflags: -I${includedir}
# (end of lua.pc)

28
extern/lua-5.1.5/etc/luavs.bat vendored Normal file
View file

@ -0,0 +1,28 @@
@rem Script to build Lua under "Visual Studio .NET Command Prompt".
@rem Do not run from this directory; run it from the toplevel: etc\luavs.bat .
@rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src.
@rem (contributed by David Manura and Mike Pall)
@setlocal
@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
@set MYLINK=link /nologo
@set MYMT=mt /nologo
cd src
%MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c
del lua.obj luac.obj
%MYLINK% /DLL /out:lua51.dll l*.obj
if exist lua51.dll.manifest^
%MYMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2
%MYCOMPILE% /DLUA_BUILD_AS_DLL lua.c
%MYLINK% /out:lua.exe lua.obj lua51.lib
if exist lua.exe.manifest^
%MYMT% -manifest lua.exe.manifest -outputresource:lua.exe
%MYCOMPILE% l*.c print.c
del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj^
loslib.obj ltablib.obj lstrlib.obj loadlib.obj
%MYLINK% /out:luac.exe *.obj
if exist luac.exe.manifest^
%MYMT% -manifest luac.exe.manifest -outputresource:luac.exe
del *.obj *.manifest
cd ..

39
extern/lua-5.1.5/etc/min.c vendored Normal file
View file

@ -0,0 +1,39 @@
/*
* min.c -- a minimal Lua interpreter
* loads stdin only with minimal error handling.
* no interaction, and no standard library, only a "print" function.
*/
#include <stdio.h>
#include "lua.h"
#include "lauxlib.h"
static int print(lua_State *L)
{
int n=lua_gettop(L);
int i;
for (i=1; i<=n; i++)
{
if (i>1) printf("\t");
if (lua_isstring(L,i))
printf("%s",lua_tostring(L,i));
else if (lua_isnil(L,i))
printf("%s","nil");
else if (lua_isboolean(L,i))
printf("%s",lua_toboolean(L,i) ? "true" : "false");
else
printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i));
}
printf("\n");
return 0;
}
int main(void)
{
lua_State *L=lua_open();
lua_register(L,"print",print);
if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1));
lua_close(L);
return 0;
}

50
extern/lua-5.1.5/etc/noparser.c vendored Normal file
View file

@ -0,0 +1,50 @@
/*
* The code below can be used to make a Lua core that does not contain the
* parsing modules (lcode, llex, lparser), which represent 35% of the total core.
* You'll only be able to load binary files and strings, precompiled with luac.
* (Of course, you'll have to build luac with the original parsing modules!)
*
* To use this module, simply compile it ("make noparser" does that) and list
* its object file before the Lua libraries. The linker should then not load
* the parsing modules. To try it, do "make luab".
*
* If you also want to avoid the dump module (ldump.o), define NODUMP.
* #define NODUMP
*/
#define LUA_CORE
#include "llex.h"
#include "lparser.h"
#include "lzio.h"
LUAI_FUNC void luaX_init (lua_State *L) {
UNUSED(L);
}
LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
UNUSED(z);
UNUSED(buff);
UNUSED(name);
lua_pushliteral(L,"parser not loaded");
lua_error(L);
return NULL;
}
#ifdef NODUMP
#include "lundump.h"
LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) {
UNUSED(f);
UNUSED(w);
UNUSED(data);
UNUSED(strip);
#if 1
UNUSED(L);
return 0;
#else
lua_pushliteral(L,"dumper not loaded");
lua_error(L);
#endif
}
#endif

41
extern/lua-5.1.5/etc/strict.lua vendored Normal file
View file

@ -0,0 +1,41 @@
--
-- strict.lua
-- checks uses of undeclared global variables
-- All global variables must be 'declared' through a regular assignment
-- (even assigning nil will do) in a main chunk before being used
-- anywhere or assigned to inside a function.
--
local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget
local mt = getmetatable(_G)
if mt == nil then
mt = {}
setmetatable(_G, mt)
end
mt.__declared = {}
local function what ()
local d = getinfo(3, "S")
return d and d.what or "C"
end
mt.__newindex = function (t, n, v)
if not mt.__declared[n] then
local w = what()
if w ~= "main" and w ~= "C" then
error("assign to undeclared variable '"..n.."'", 2)
end
mt.__declared[n] = true
end
rawset(t, n, v)
end
mt.__index = function (t, n)
if not mt.__declared[n] and what() ~= "C" then
error("variable '"..n.."' is not declared", 2)
end
return rawget(t, n)
end

182
extern/lua-5.1.5/src/Makefile vendored Normal file
View file

@ -0,0 +1,182 @@
# makefile for building Lua
# see ../INSTALL for installation instructions
# see ../Makefile and luaconf.h for further customization
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
PLAT= none
CC= gcc
CFLAGS= -O2 -Wall $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
LIBS= -lm $(MYLIBS)
MYCFLAGS=
MYLDFLAGS=
MYLIBS=
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
lstrlib.o loadlib.o linit.o
LUA_T= lua
LUA_O= lua.o
LUAC_T= luac
LUAC_O= luac.o print.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
default: $(PLAT)
all: $(ALL_T)
o: $(ALL_O)
a: $(ALL_A)
$(LUA_A): $(CORE_O) $(LIB_O)
$(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
$(RANLIB) $@
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
$(RM) $(ALL_T) $(ALL_O)
depend:
@$(CC) $(CFLAGS) -MM l*.c print.c
echo:
@echo "PLAT = $(PLAT)"
@echo "CC = $(CC)"
@echo "CFLAGS = $(CFLAGS)"
@echo "AR = $(AR)"
@echo "RANLIB = $(RANLIB)"
@echo "RM = $(RM)"
@echo "MYCFLAGS = $(MYCFLAGS)"
@echo "MYLDFLAGS = $(MYLDFLAGS)"
@echo "MYLIBS = $(MYLIBS)"
# convenience targets for popular platforms
none:
@echo "Please choose a platform:"
@echo " $(PLATS)"
aix:
$(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall"
ansi:
$(MAKE) all MYCFLAGS=-DLUA_ANSI
bsd:
$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
freebsd:
$(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline"
generic:
$(MAKE) all MYCFLAGS=
linux:
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
macosx:
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
# use this on Mac OS X 10.3-
# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
mingw:
$(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
"AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
"MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe
$(MAKE) "LUAC_T=luac.exe" luac.exe
posix:
$(MAKE) all MYCFLAGS=-DLUA_USE_POSIX
solaris:
$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl"
# list targets that do not create files (but not all makes understand .PHONY)
.PHONY: all $(PLATS) default o a clean depend echo none
# DO NOT DELETE
lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \
lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \
lundump.h lvm.h
lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h
lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h
lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \
lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \
ltable.h
ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h
ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \
llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \
lfunc.h lstring.h lgc.h ltable.h lvm.h
ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \
ltable.h lundump.h lvm.h
ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \
lzio.h lmem.h lundump.h
lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \
lstate.h ltm.h lzio.h
lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h
liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h
llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \
lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h
lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h
lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
ltm.h lzio.h lmem.h ldo.h
loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h
lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \
ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h
lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h
loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h
lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \
lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \
lfunc.h lstring.h lgc.h ltable.h
lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h
lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \
ltm.h lzio.h lstring.h lgc.h
lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h
ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h
ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h
ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \
lmem.h lstring.h lgc.h ltable.h
lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h
luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \
lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \
lundump.h
lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \
llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h
lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h
lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \
lzio.h
print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \
ltm.h lzio.h lmem.h lopcodes.h lundump.h
# (end of Makefile)

1087
extern/lua-5.1.5/src/lapi.c vendored Normal file

File diff suppressed because it is too large Load diff

16
extern/lua-5.1.5/src/lapi.h vendored Normal file
View file

@ -0,0 +1,16 @@
/*
** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions from Lua API
** See Copyright Notice in lua.h
*/
#ifndef lapi_h
#define lapi_h
#include "lobject.h"
LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);
#endif

652
extern/lua-5.1.5/src/lauxlib.c vendored Normal file
View file

@ -0,0 +1,652 @@
/*
** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* This file uses only the official API of Lua.
** Any function declared here could be written as an application function.
*/
#define lauxlib_c
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
#define FREELIST_REF 0 /* free list of references */
/* convert a stack index to positive */
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \
lua_gettop(L) + (i) + 1)
/*
** {======================================================
** Error-report functions
** =======================================================
*/
LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
lua_Debug ar;
if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
lua_getinfo(L, "n", &ar);
if (strcmp(ar.namewhat, "method") == 0) {
narg--; /* do not count `self' */
if (narg == 0) /* error is in the self argument itself? */
return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
ar.name, extramsg);
}
if (ar.name == NULL)
ar.name = "?";
return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
narg, ar.name, extramsg);
}
LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
const char *msg = lua_pushfstring(L, "%s expected, got %s",
tname, luaL_typename(L, narg));
return luaL_argerror(L, narg, msg);
}
static void tag_error (lua_State *L, int narg, int tag) {
luaL_typerror(L, narg, lua_typename(L, tag));
}
LUALIB_API void luaL_where (lua_State *L, int level) {
lua_Debug ar;
if (lua_getstack(L, level, &ar)) { /* check function at level */
lua_getinfo(L, "Sl", &ar); /* get info about it */
if (ar.currentline > 0) { /* is there info? */
lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
return;
}
}
lua_pushliteral(L, ""); /* else, no information available... */
}
LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
va_list argp;
va_start(argp, fmt);
luaL_where(L, 1);
lua_pushvfstring(L, fmt, argp);
va_end(argp);
lua_concat(L, 2);
return lua_error(L);
}
/* }====================================================== */
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
const char *const lst[]) {
const char *name = (def) ? luaL_optstring(L, narg, def) :
luaL_checkstring(L, narg);
int i;
for (i=0; lst[i]; i++)
if (strcmp(lst[i], name) == 0)
return i;
return luaL_argerror(L, narg,
lua_pushfstring(L, "invalid option " LUA_QS, name));
}
LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
if (!lua_isnil(L, -1)) /* name already in use? */
return 0; /* leave previous value on top, but return 0 */
lua_pop(L, 1);
lua_newtable(L); /* create metatable */
lua_pushvalue(L, -1);
lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
return 1;
}
LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
void *p = lua_touserdata(L, ud);
if (p != NULL) { /* value is a userdata? */
if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
lua_pop(L, 2); /* remove both metatables */
return p;
}
}
}
luaL_typerror(L, ud, tname); /* else error */
return NULL; /* to avoid warnings */
}
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
if (!lua_checkstack(L, space))
luaL_error(L, "stack overflow (%s)", mes);
}
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
if (lua_type(L, narg) != t)
tag_error(L, narg, t);
}
LUALIB_API void luaL_checkany (lua_State *L, int narg) {
if (lua_type(L, narg) == LUA_TNONE)
luaL_argerror(L, narg, "value expected");
}
LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
const char *s = lua_tolstring(L, narg, len);
if (!s) tag_error(L, narg, LUA_TSTRING);
return s;
}
LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
const char *def, size_t *len) {
if (lua_isnoneornil(L, narg)) {
if (len)
*len = (def ? strlen(def) : 0);
return def;
}
else return luaL_checklstring(L, narg, len);
}
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
lua_Number d = lua_tonumber(L, narg);
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
tag_error(L, narg, LUA_TNUMBER);
return d;
}
LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {
return luaL_opt(L, luaL_checknumber, narg, def);
}
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
lua_Integer d = lua_tointeger(L, narg);
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
tag_error(L, narg, LUA_TNUMBER);
return d;
}
LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
lua_Integer def) {
return luaL_opt(L, luaL_checkinteger, narg, def);
}
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
if (!lua_getmetatable(L, obj)) /* no metatable? */
return 0;
lua_pushstring(L, event);
lua_rawget(L, -2);
if (lua_isnil(L, -1)) {
lua_pop(L, 2); /* remove metatable and metafield */
return 0;
}
else {
lua_remove(L, -2); /* remove only metatable */
return 1;
}
}
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
obj = abs_index(L, obj);
if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
return 0;
lua_pushvalue(L, obj);
lua_call(L, 1, 1);
return 1;
}
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
const luaL_Reg *l) {
luaI_openlib(L, libname, l, 0);
}
static int libsize (const luaL_Reg *l) {
int size = 0;
for (; l->name; l++) size++;
return size;
}
LUALIB_API void luaI_openlib (lua_State *L, const char *libname,
const luaL_Reg *l, int nup) {
if (libname) {
int size = libsize(l);
/* check whether lib already exists */
luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1);
lua_getfield(L, -1, libname); /* get _LOADED[libname] */
if (!lua_istable(L, -1)) { /* not found? */
lua_pop(L, 1); /* remove previous result */
/* try global variable (and create one if it does not exist) */
if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL)
luaL_error(L, "name conflict for module " LUA_QS, libname);
lua_pushvalue(L, -1);
lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */
}
lua_remove(L, -2); /* remove _LOADED table */
lua_insert(L, -(nup+1)); /* move library table to below upvalues */
}
for (; l->name; l++) {
int i;
for (i=0; i<nup; i++) /* copy upvalues to the top */
lua_pushvalue(L, -nup);
lua_pushcclosure(L, l->func, nup);
lua_setfield(L, -(nup+2), l->name);
}
lua_pop(L, nup); /* remove upvalues */
}
/*
** {======================================================
** getn-setn: size for arrays
** =======================================================
*/
#if defined(LUA_COMPAT_GETN)
static int checkint (lua_State *L, int topop) {
int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1;
lua_pop(L, topop);
return n;
}
static void getsizes (lua_State *L) {
lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES");
if (lua_isnil(L, -1)) { /* no `size' table? */
lua_pop(L, 1); /* remove nil */
lua_newtable(L); /* create it */
lua_pushvalue(L, -1); /* `size' will be its own metatable */
lua_setmetatable(L, -2);
lua_pushliteral(L, "kv");
lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */
lua_pushvalue(L, -1);
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */
}
}
LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
t = abs_index(L, t);
lua_pushliteral(L, "n");
lua_rawget(L, t);
if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */
lua_pushliteral(L, "n"); /* use it */
lua_pushinteger(L, n);
lua_rawset(L, t);
}
else { /* use `sizes' */
getsizes(L);
lua_pushvalue(L, t);
lua_pushinteger(L, n);
lua_rawset(L, -3); /* sizes[t] = n */
lua_pop(L, 1); /* remove `sizes' */
}
}
LUALIB_API int luaL_getn (lua_State *L, int t) {
int n;
t = abs_index(L, t);
lua_pushliteral(L, "n"); /* try t.n */
lua_rawget(L, t);
if ((n = checkint(L, 1)) >= 0) return n;
getsizes(L); /* else try sizes[t] */
lua_pushvalue(L, t);
lua_rawget(L, -2);
if ((n = checkint(L, 2)) >= 0) return n;
return (int)lua_objlen(L, t);
}
#endif
/* }====================================================== */
LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
const char *r) {
const char *wild;
size_t l = strlen(p);
luaL_Buffer b;
luaL_buffinit(L, &b);
while ((wild = strstr(s, p)) != NULL) {
luaL_addlstring(&b, s, wild - s); /* push prefix */
luaL_addstring(&b, r); /* push replacement in place of pattern */
s = wild + l; /* continue after `p' */
}
luaL_addstring(&b, s); /* push last suffix */
luaL_pushresult(&b);
return lua_tostring(L, -1);
}
LUALIB_API const char *luaL_findtable (lua_State *L, int idx,
const char *fname, int szhint) {
const char *e;
lua_pushvalue(L, idx);
do {
e = strchr(fname, '.');
if (e == NULL) e = fname + strlen(fname);
lua_pushlstring(L, fname, e - fname);
lua_rawget(L, -2);
if (lua_isnil(L, -1)) { /* no such field? */
lua_pop(L, 1); /* remove this nil */
lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
lua_pushlstring(L, fname, e - fname);
lua_pushvalue(L, -2);
lua_settable(L, -4); /* set new table into field */
}
else if (!lua_istable(L, -1)) { /* field has a non-table value? */
lua_pop(L, 2); /* remove table and value */
return fname; /* return problematic part of the name */
}
lua_remove(L, -2); /* remove previous table */
fname = e + 1;
} while (*e == '.');
return NULL;
}
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
#define bufflen(B) ((B)->p - (B)->buffer)
#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B)))
#define LIMIT (LUA_MINSTACK/2)
static int emptybuffer (luaL_Buffer *B) {
size_t l = bufflen(B);
if (l == 0) return 0; /* put nothing on stack */
else {
lua_pushlstring(B->L, B->buffer, l);
B->p = B->buffer;
B->lvl++;
return 1;
}
}
static void adjuststack (luaL_Buffer *B) {
if (B->lvl > 1) {
lua_State *L = B->L;
int toget = 1; /* number of levels to concat */
size_t toplen = lua_strlen(L, -1);
do {
size_t l = lua_strlen(L, -(toget+1));
if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
toplen += l;
toget++;
}
else break;
} while (toget < B->lvl);
lua_concat(L, toget);
B->lvl = B->lvl - toget + 1;
}
}
LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {
if (emptybuffer(B))
adjuststack(B);
return B->buffer;
}
LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
while (l--)
luaL_addchar(B, *s++);
}
LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
luaL_addlstring(B, s, strlen(s));
}
LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
emptybuffer(B);
lua_concat(B->L, B->lvl);
B->lvl = 1;
}
LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
lua_State *L = B->L;
size_t vl;
const char *s = lua_tolstring(L, -1, &vl);
if (vl <= bufffree(B)) { /* fit into buffer? */
memcpy(B->p, s, vl); /* put it there */
B->p += vl;
lua_pop(L, 1); /* remove from stack */
}
else {
if (emptybuffer(B))
lua_insert(L, -2); /* put buffer before new value */
B->lvl++; /* add new value into B stack */
adjuststack(B);
}
}
LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
B->L = L;
B->p = B->buffer;
B->lvl = 0;
}
/* }====================================================== */
LUALIB_API int luaL_ref (lua_State *L, int t) {
int ref;
t = abs_index(L, t);
if (lua_isnil(L, -1)) {
lua_pop(L, 1); /* remove from stack */
return LUA_REFNIL; /* `nil' has a unique fixed reference */
}
lua_rawgeti(L, t, FREELIST_REF); /* get first free element */
ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */
lua_pop(L, 1); /* remove it from stack */
if (ref != 0) { /* any free element? */
lua_rawgeti(L, t, ref); /* remove it from list */
lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */
}
else { /* no free elements */
ref = (int)lua_objlen(L, t);
ref++; /* create new reference */
}
lua_rawseti(L, t, ref);
return ref;
}
LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
if (ref >= 0) {
t = abs_index(L, t);
lua_rawgeti(L, t, FREELIST_REF);
lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */
lua_pushinteger(L, ref);
lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */
}
}
/*
** {======================================================
** Load functions
** =======================================================
*/
typedef struct LoadF {
int extraline;
FILE *f;
char buff[LUAL_BUFFERSIZE];
} LoadF;
static const char *getF (lua_State *L, void *ud, size_t *size) {
LoadF *lf = (LoadF *)ud;
(void)L;
if (lf->extraline) {
lf->extraline = 0;
*size = 1;
return "\n";
}
if (feof(lf->f)) return NULL;
*size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);
return (*size > 0) ? lf->buff : NULL;
}
static int errfile (lua_State *L, const char *what, int fnameindex) {
const char *serr = strerror(errno);
const char *filename = lua_tostring(L, fnameindex) + 1;
lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
lua_remove(L, fnameindex);
return LUA_ERRFILE;
}
LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
LoadF lf;
int status, readstatus;
int c;
int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */
lf.extraline = 0;
if (filename == NULL) {
lua_pushliteral(L, "=stdin");
lf.f = stdin;
}
else {
lua_pushfstring(L, "@%s", filename);
lf.f = fopen(filename, "r");
if (lf.f == NULL) return errfile(L, "open", fnameindex);
}
c = getc(lf.f);
if (c == '#') { /* Unix exec. file? */
lf.extraline = 1;
while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */
if (c == '\n') c = getc(lf.f);
}
if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
/* skip eventual `#!...' */
while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
lf.extraline = 0;
}
ungetc(c, lf.f);
status = lua_load(L, getF, &lf, lua_tostring(L, -1));
readstatus = ferror(lf.f);
if (filename) fclose(lf.f); /* close file (even in case of errors) */
if (readstatus) {
lua_settop(L, fnameindex); /* ignore results from `lua_load' */
return errfile(L, "read", fnameindex);
}
lua_remove(L, fnameindex);
return status;
}
typedef struct LoadS {
const char *s;
size_t size;
} LoadS;
static const char *getS (lua_State *L, void *ud, size_t *size) {
LoadS *ls = (LoadS *)ud;
(void)L;
if (ls->size == 0) return NULL;
*size = ls->size;
ls->size = 0;
return ls->s;
}
LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
const char *name) {
LoadS ls;
ls.s = buff;
ls.size = size;
return lua_load(L, getS, &ls, name);
}
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) {
return luaL_loadbuffer(L, s, strlen(s), s);
}
/* }====================================================== */
static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
(void)ud;
(void)osize;
if (nsize == 0) {
free(ptr);
return NULL;
}
else
return realloc(ptr, nsize);
}
static int panic (lua_State *L) {
(void)L; /* to avoid warnings */
fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n",
lua_tostring(L, -1));
return 0;
}
LUALIB_API lua_State *luaL_newstate (void) {
lua_State *L = lua_newstate(l_alloc, NULL);
if (L) lua_atpanic(L, &panic);
return L;
}

174
extern/lua-5.1.5/src/lauxlib.h vendored Normal file
View file

@ -0,0 +1,174 @@
/*
** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "lua.h"
#if defined(LUA_COMPAT_GETN)
LUALIB_API int (luaL_getn) (lua_State *L, int t);
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
#else
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif
#if defined(LUA_COMPAT_OPENLIB)
#define luaI_openlib luaL_openlib
#endif
/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
const luaL_Reg *l, int nup);
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
const luaL_Reg *l);
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
const char *name);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
const char *r);
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
const char *fname, int szhint);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_argcheck(L, cond,numarg,extramsg) \
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
typedef struct luaL_Buffer {
char *p; /* current position in buffer */
int lvl; /* number of strings in the stack (level) */
lua_State *L;
char buffer[LUAL_BUFFERSIZE];
} luaL_Buffer;
#define luaL_addchar(B,c) \
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
(*(B)->p++ = (char)(c)))
/* compatibility only */
#define luaL_putchar(B,c) luaL_addchar(B,c)
#define luaL_addsize(B,n) ((B)->p += (n))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
/* }====================================================== */
/* compatibility with ref system */
/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
#define luaL_reg luaL_Reg
#endif

Some files were not shown because too many files have changed in this diff Show more