mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 17:13:52 +00:00
- 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>
54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "game/world_packets.hpp"
|
|
#include <imgui.h>
|
|
#include <cstdint>
|
|
#include <deque>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace wowee {
|
|
namespace ui {
|
|
|
|
/**
|
|
* Chat tab definitions, unread tracking, type colors, and type names.
|
|
*
|
|
* Extracted from ChatPanel (Phase 1.3 of chat_panel_ref.md).
|
|
* Owns the tab configuration, unread badge counts, and message filtering.
|
|
*/
|
|
class ChatTabManager {
|
|
public:
|
|
ChatTabManager();
|
|
|
|
// ---- Tab access ----
|
|
int getTabCount() const { return static_cast<int>(tabs_.size()); }
|
|
const std::string& getTabName(int idx) const { return tabs_[idx].name; }
|
|
uint64_t getTabTypeMask(int idx) const { return tabs_[idx].typeMask; }
|
|
|
|
// ---- Unread tracking ----
|
|
int getUnreadCount(int idx) const;
|
|
void clearUnread(int idx);
|
|
/** Scan new messages since last call and increment unread counters for non-active tabs. */
|
|
void updateUnread(const std::deque<game::MessageChatData>& history, int activeTab);
|
|
|
|
// ---- Message filtering ----
|
|
bool shouldShowMessage(const game::MessageChatData& msg, int tabIndex) const;
|
|
|
|
// ---- Chat type helpers (static, no state needed) ----
|
|
static const char* getChatTypeName(game::ChatType type);
|
|
static ImVec4 getChatTypeColor(game::ChatType type);
|
|
|
|
private:
|
|
struct ChatTab {
|
|
std::string name;
|
|
uint64_t typeMask;
|
|
};
|
|
std::vector<ChatTab> tabs_;
|
|
std::vector<int> unread_;
|
|
size_t seenCount_ = 0;
|
|
|
|
void initTabs();
|
|
};
|
|
|
|
} // namespace ui
|
|
} // namespace wowee
|