mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 00:03:50 +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
62
include/ui/chat/chat_markup_renderer.hpp
Normal file
62
include/ui/chat/chat_markup_renderer.hpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#pragma once
|
||||
|
||||
#include "ui/chat/chat_markup_parser.hpp"
|
||||
#include "ui/ui_services.hpp"
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace game { class GameHandler; }
|
||||
namespace pipeline { class AssetManager; }
|
||||
namespace ui {
|
||||
|
||||
class InventoryScreen;
|
||||
class SpellbookScreen;
|
||||
class QuestLogScreen;
|
||||
|
||||
/**
|
||||
* Context needed by the renderer to display links, tooltips, and icons.
|
||||
*/
|
||||
struct MarkupRenderContext {
|
||||
game::GameHandler* gameHandler = nullptr;
|
||||
InventoryScreen* inventory = nullptr;
|
||||
SpellbookScreen* spellbook = nullptr;
|
||||
QuestLogScreen* questLog = nullptr;
|
||||
pipeline::AssetManager* assetMgr = nullptr;
|
||||
// Spell icon callback — same as ChatPanel::getSpellIcon
|
||||
std::function<VkDescriptorSet(uint32_t, pipeline::AssetManager*)> getSpellIcon;
|
||||
// Chat input buffer for shift-click link insertion
|
||||
char* chatInputBuffer = nullptr;
|
||||
size_t chatInputBufSize = 0;
|
||||
bool* moveCursorToEnd = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders parsed ChatSegments via ImGui.
|
||||
*
|
||||
* Extracted from ChatPanel::render() inline lambdas (Phase 2.2 of chat_panel_ref.md).
|
||||
* Handles: colored text, item/spell/quest/achievement link tooltips+icons,
|
||||
* URL click-to-open, shift-click link insertion.
|
||||
*/
|
||||
class ChatMarkupRenderer {
|
||||
public:
|
||||
/** Render a list of segments with ImGui. baseColor is the message-type color. */
|
||||
void render(const std::vector<ChatSegment>& segments,
|
||||
const ImVec4& baseColor,
|
||||
const MarkupRenderContext& ctx) const;
|
||||
|
||||
/**
|
||||
* Render a full item tooltip for the given item entry.
|
||||
* Extracted from the renderItemLinkTooltip inline lambda.
|
||||
*/
|
||||
static void renderItemTooltip(uint32_t itemEntry,
|
||||
game::GameHandler& gameHandler,
|
||||
InventoryScreen& inventoryScreen,
|
||||
pipeline::AssetManager* assetMgr);
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue