Kelsidavis-WoWee/include/ui/chat/cast_sequence_tracker.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

37 lines
932 B
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <string>
#include <unordered_map>
namespace wowee {
namespace ui {
/**
* /castsequence persistent state — shared across all macros using the same spell list.
*
* Extracted from chat_panel_commands.cpp static global (Phase 1.5 of chat_panel_ref.md).
* Keyed by the normalized (lowercase, comma-joined) spell sequence string.
*/
class CastSequenceTracker {
public:
struct State {
size_t index = 0;
float lastPressSec = 0.0f;
uint64_t lastTargetGuid = 0;
bool lastInCombat = false;
};
/** Get (or create) the state for a given sequence key. */
State& get(const std::string& seqKey) { return states_[seqKey]; }
/** Reset all tracked sequences. */
void clear() { states_.clear(); }
private:
std::unordered_map<std::string, State> states_;
};
} // namespace ui
} // namespace wowee