mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 21:13:51 +00:00
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>
This commit is contained in:
parent
09c4a9a04a
commit
42f1bb98ea
54 changed files with 7363 additions and 3856 deletions
35
src/ui/chat/chat_tab_completer.cpp
Normal file
35
src/ui/chat/chat_tab_completer.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// ChatTabCompleter — cycling tab-completion state machine.
|
||||
// Extracted from ChatPanel tab-completion logic (Phase 5.1).
|
||||
#include "ui/chat/chat_tab_completer.hpp"
|
||||
|
||||
namespace wowee { namespace ui {
|
||||
|
||||
void ChatTabCompleter::startCompletion(const std::string& prefix,
|
||||
std::vector<std::string> candidates) {
|
||||
prefix_ = prefix;
|
||||
matches_ = std::move(candidates);
|
||||
matchIdx_ = matches_.empty() ? -1 : 0;
|
||||
}
|
||||
|
||||
bool ChatTabCompleter::next() {
|
||||
if (matches_.empty()) return false;
|
||||
++matchIdx_;
|
||||
if (matchIdx_ >= static_cast<int>(matches_.size()))
|
||||
matchIdx_ = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ChatTabCompleter::getCurrentMatch() const {
|
||||
if (matchIdx_ < 0 || matchIdx_ >= static_cast<int>(matches_.size()))
|
||||
return "";
|
||||
return matches_[matchIdx_];
|
||||
}
|
||||
|
||||
void ChatTabCompleter::reset() {
|
||||
prefix_.clear();
|
||||
matches_.clear();
|
||||
matchIdx_ = -1;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue