Kelsidavis-WoWee/include/ui/chat/i_game_state.hpp
Pavel Okhlopkov 42f1bb98ea refactor(chat): decompose into modular architecture, add GM commands, fix protocol
- Extract ChatPanel monolith into 15+ focused modules under ui/chat/
  (ChatInput, ChatTabManager, ChatTabCompleter, ChatMarkupParser,
  ChatMarkupRenderer, ChatCommandRegistry, ChatBubbleManager,
  ChatSettings, MacroEvaluator, GameStateAdapter, InputModifierAdapter)
- Split 2700-line chat_panel_commands.cpp into 11 command modules
- Add GM command handling: 190-command data table, dot-prefix interception,
  tab-completion, /gmhelp with category filter
- Fix ChatType enum to match WoW wire protocol (SAY=0x01 not 0x00);
  values 0x00-0x1B shared across Vanilla/TBC/WotLK
- Fix BG_SYSTEM_* values from 82-84 (UB in bitmask shifts) to 0x24-0x26
- Fix infinite Enter key loop after teleport (disable TOGGLE_CHAT repeat,
  add 2-frame input cooldown)
- Add tests: chat_markup_parser, chat_tab_completer, gm_commands,
  macro_evaluator

Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
2026-04-12 14:59:56 +03:00

63 lines
2.1 KiB
C++

// IGameState — abstract interface for game state queries used by macro evaluation.
// Allows unit testing with mock state. Phase 4.1 of chat_panel_ref.md.
#pragma once
#include <cstdint>
#include <string>
namespace wowee {
namespace ui {
/**
* Read-only view of game state for macro conditional evaluation.
*
* All entity/aura queries are flattened to simple types so callers
* don't need to depend on game::Entity, game::Unit, etc.
*/
class IGameState {
public:
virtual ~IGameState() = default;
// --- GUIDs ---
virtual uint64_t getPlayerGuid() const = 0;
virtual uint64_t getTargetGuid() const = 0;
virtual uint64_t getFocusGuid() const = 0;
virtual uint64_t getPetGuid() const = 0;
virtual uint64_t getMouseoverGuid() const = 0;
// --- Player state booleans ---
virtual bool isInCombat() const = 0;
virtual bool isMounted() const = 0;
virtual bool isSwimming() const = 0;
virtual bool isFlying() const = 0;
virtual bool isCasting() const = 0;
virtual bool isChanneling() const = 0;
virtual bool isStealthed() const = 0;
virtual bool hasPet() const = 0;
virtual bool isInGroup() const = 0;
virtual bool isInRaid() const = 0;
virtual bool isIndoors() const = 0;
// --- Numeric state ---
virtual uint8_t getActiveTalentSpec() const = 0; // 0-based index
virtual uint32_t getVehicleId() const = 0;
virtual uint32_t getCurrentCastSpellId() const = 0;
// --- Spell/aura queries ---
virtual std::string getSpellName(uint32_t spellId) const = 0;
/** Check if target (or player if guid==playerGuid) has a buff/debuff by name. */
virtual bool hasAuraByName(uint64_t targetGuid, const std::string& spellName,
bool wantDebuff) const = 0;
/** Check if player has a form/stance aura (permanent aura, maxDurationMs == -1). */
virtual bool hasFormAura() const = 0;
// --- Entity queries (flattened, no Entity* exposure) ---
virtual bool entityExists(uint64_t guid) const = 0;
virtual bool entityIsDead(uint64_t guid) const = 0;
virtual bool entityIsHostile(uint64_t guid) const = 0;
};
} // namespace ui
} // namespace wowee