2026-02-04 11:31:08 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "game/game_handler.hpp"
|
2026-02-06 16:04:25 -08:00
|
|
|
#include <GL/glew.h>
|
2026-02-04 11:31:08 -08:00
|
|
|
#include <imgui.h>
|
|
|
|
|
#include <string>
|
2026-02-06 16:04:25 -08:00
|
|
|
#include <vector>
|
2026-02-04 11:31:08 -08:00
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
|
namespace wowee {
|
|
|
|
|
|
|
|
|
|
namespace pipeline { class AssetManager; }
|
|
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
2026-02-06 16:04:25 -08:00
|
|
|
struct SpellInfo {
|
|
|
|
|
uint32_t spellId = 0;
|
|
|
|
|
std::string name;
|
|
|
|
|
std::string rank;
|
|
|
|
|
uint32_t iconId = 0; // SpellIconID
|
|
|
|
|
uint32_t attributes = 0; // Spell attributes (field 75)
|
|
|
|
|
bool isPassive() const { return (attributes & 0x40) != 0; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class SpellTab { GENERAL, ACTIVE, PASSIVE };
|
|
|
|
|
|
2026-02-04 11:31:08 -08:00
|
|
|
class SpellbookScreen {
|
|
|
|
|
public:
|
|
|
|
|
void render(game::GameHandler& gameHandler, pipeline::AssetManager* assetManager);
|
|
|
|
|
bool isOpen() const { return open; }
|
|
|
|
|
void toggle() { open = !open; }
|
|
|
|
|
void setOpen(bool o) { open = o; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool open = false;
|
|
|
|
|
bool pKeyWasDown = false;
|
|
|
|
|
|
2026-02-06 16:04:25 -08:00
|
|
|
// Spell data (loaded from Spell.dbc)
|
2026-02-04 11:31:08 -08:00
|
|
|
bool dbcLoaded = false;
|
|
|
|
|
bool dbcLoadAttempted = false;
|
2026-02-06 16:04:25 -08:00
|
|
|
std::unordered_map<uint32_t, SpellInfo> spellData;
|
|
|
|
|
|
|
|
|
|
// Icon data (loaded from SpellIcon.dbc)
|
|
|
|
|
bool iconDbLoaded = false;
|
|
|
|
|
std::unordered_map<uint32_t, std::string> spellIconPaths; // SpellIconID -> path
|
|
|
|
|
std::unordered_map<uint32_t, GLuint> spellIconCache; // SpellIconID -> GL texture
|
|
|
|
|
|
|
|
|
|
// Categorized spell lists (rebuilt when spell list changes)
|
|
|
|
|
std::vector<const SpellInfo*> generalSpells;
|
|
|
|
|
std::vector<const SpellInfo*> activeSpells;
|
|
|
|
|
std::vector<const SpellInfo*> passiveSpells;
|
|
|
|
|
size_t lastKnownSpellCount = 0;
|
|
|
|
|
|
|
|
|
|
// Tab state
|
|
|
|
|
SpellTab currentTab = SpellTab::GENERAL;
|
2026-02-04 11:31:08 -08:00
|
|
|
|
|
|
|
|
// Action bar assignment
|
2026-02-06 16:04:25 -08:00
|
|
|
int assigningSlot = -1;
|
2026-02-04 11:31:08 -08:00
|
|
|
|
|
|
|
|
void loadSpellDBC(pipeline::AssetManager* assetManager);
|
2026-02-06 16:04:25 -08:00
|
|
|
void loadSpellIconDBC(pipeline::AssetManager* assetManager);
|
|
|
|
|
void categorizeSpells(const std::vector<uint32_t>& knownSpells);
|
|
|
|
|
GLuint getSpellIcon(uint32_t iconId, pipeline::AssetManager* assetManager);
|
|
|
|
|
const SpellInfo* getSpellInfo(uint32_t spellId) const;
|
2026-02-04 11:31:08 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ui
|
|
|
|
|
} // namespace wowee
|