Files
WoWee/include/ui/talent_screen.hpp
Kelsi ba79374689 Implement complete talent system with dual spec support
Network Protocol:
- Add SMSG_TALENTS_INFO (0x4C0) packet parsing for talent data
- Add CMSG_LEARN_TALENT (0x251) to request learning talents
- Add MSG_TALENT_WIPE_CONFIRM (0x2AB) opcode for spec switching
- Parse talent spec, unspent points, and learned talent ranks

DBC Parsing:
- Load Talent.dbc: talent grid positions, ranks, prerequisites, spell IDs
- Load TalentTab.dbc: talent tree definitions with correct field indices
- Fix localized string field handling (17 fields per string)
- Load Spell.dbc and SpellIcon.dbc for talent icons and tooltips
- Class mask filtering using bitwise operations (1 << (class - 1))

UI Implementation:
- Complete talent tree UI with tabbed interface for specs
- Display talent icons from spell data with proper tinting/borders
- Enhanced tooltips: spell name, rank, current/next descriptions, prereqs
- Visual states: green (maxed), yellow (partial), white (available), gray (locked)
- Tier unlock system (5 points per tier requirement)
- Rank overlay on icons with shadow text
- Click to learn talents with validation

Dual Spec Support:
- Store unspent points and learned talents per spec (0 and 1)
- Track active spec and display its talents
- Spec switching UI with buttons for Spec 1/Spec 2
- Handle both SMSG_TALENTS_INFO packets from server at login
- Display unspent points for both specs in header
- Independent talent trees for each specialization
2026-02-10 02:00:13 -08:00

44 lines
1.3 KiB
C++

#pragma once
#include "game/game_handler.hpp"
#include <imgui.h>
#include <GL/glew.h>
#include <unordered_map>
#include <string>
namespace wowee {
namespace pipeline { class AssetManager; }
namespace ui {
class TalentScreen {
public:
void render(game::GameHandler& gameHandler);
bool isOpen() const { return open; }
void toggle() { open = !open; }
void setOpen(bool o) { open = o; }
private:
void renderTalentTrees(game::GameHandler& gameHandler);
void renderTalentTree(game::GameHandler& gameHandler, uint32_t tabId);
void renderTalent(game::GameHandler& gameHandler, const game::GameHandler::TalentEntry& talent);
void loadSpellDBC(pipeline::AssetManager* assetManager);
void loadSpellIconDBC(pipeline::AssetManager* assetManager);
GLuint getSpellIcon(uint32_t iconId, pipeline::AssetManager* assetManager);
bool open = false;
bool nKeyWasDown = false;
// DBC caches
bool spellDbcLoaded = false;
bool iconDbcLoaded = false;
std::unordered_map<uint32_t, uint32_t> spellIconIds; // spellId -> iconId
std::unordered_map<uint32_t, std::string> spellIconPaths; // iconId -> path
std::unordered_map<uint32_t, GLuint> spellIconCache; // iconId -> texture
std::unordered_map<uint32_t, std::string> spellTooltips; // spellId -> description
};
} // namespace ui
} // namespace wowee