Kelsidavis-WoWee/include/ui/chat/game_state_adapter.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 KiB
C++

// GameStateAdapter — wraps GameHandler + Renderer to implement IGameState.
// Phase 4.2 of chat_panel_ref.md.
#pragma once
#include "ui/chat/i_game_state.hpp"
namespace wowee {
namespace game { class GameHandler; }
namespace rendering { class Renderer; }
namespace ui {
/**
* Concrete adapter from GameHandler + Renderer → IGameState.
* Flatten complex entity/aura queries into the simple IGameState interface.
*/
class GameStateAdapter : public IGameState {
public:
GameStateAdapter(game::GameHandler& gameHandler, rendering::Renderer* renderer);
// --- GUIDs ---
uint64_t getPlayerGuid() const override;
uint64_t getTargetGuid() const override;
uint64_t getFocusGuid() const override;
uint64_t getPetGuid() const override;
uint64_t getMouseoverGuid() const override;
// --- Player state ---
bool isInCombat() const override;
bool isMounted() const override;
bool isSwimming() const override;
bool isFlying() const override;
bool isCasting() const override;
bool isChanneling() const override;
bool isStealthed() const override;
bool hasPet() const override;
bool isInGroup() const override;
bool isInRaid() const override;
bool isIndoors() const override;
// --- Numeric ---
uint8_t getActiveTalentSpec() const override;
uint32_t getVehicleId() const override;
uint32_t getCurrentCastSpellId() const override;
// --- Spell/aura ---
std::string getSpellName(uint32_t spellId) const override;
bool hasAuraByName(uint64_t targetGuid, const std::string& spellName,
bool wantDebuff) const override;
bool hasFormAura() const override;
// --- Entity queries ---
bool entityExists(uint64_t guid) const override;
bool entityIsDead(uint64_t guid) const override;
bool entityIsHostile(uint64_t guid) const override;
private:
game::GameHandler& gameHandler_;
rendering::Renderer* renderer_;
};
} // namespace ui
} // namespace wowee