Use created character data and DB start items/spells

This commit is contained in:
Kelsi 2026-02-05 14:35:12 -08:00
parent 776a617f61
commit 33226fa953
4 changed files with 509 additions and 102 deletions

View file

@ -2,6 +2,7 @@
#include "core/window.hpp"
#include "core/input.hpp"
#include "game/character.hpp"
#include <memory>
#include <string>
#include <vector>
@ -76,6 +77,8 @@ private:
void setupUICallbacks();
void spawnPlayerCharacter();
void spawnNpcs();
std::string getPlayerModelPath() const;
static const char* mapIdToName(uint32_t mapId);
static Application* instance;
@ -96,6 +99,14 @@ private:
bool spawnSnapToGround = true;
float lastFrameTime = 0.0f;
float movementHeartbeatTimer = 0.0f;
game::Race spRace_ = game::Race::HUMAN;
game::Gender spGender_ = game::Gender::MALE;
game::Class spClass_ = game::Class::WARRIOR;
uint32_t spMapId_ = 0;
uint32_t spZoneId_ = 0;
glm::vec3 spSpawnCanonical_ = glm::vec3(62.0f, -9464.0f, 200.0f);
float spYawDeg_ = 0.0f;
float spPitchDeg_ = -5.0f;
// Weapon model ID counter (starting high to avoid collision with character model IDs)
uint32_t nextWeaponModelId_ = 1000;

View file

@ -112,6 +112,10 @@ public:
* @param characterGuid GUID of character to log in with
*/
void selectCharacter(uint64_t characterGuid);
void setActiveCharacterGuid(uint64_t guid) { activeCharacterGuid_ = guid; }
uint64_t getActiveCharacterGuid() const { return activeCharacterGuid_; }
const Character* getActiveCharacter() const;
const Character* getFirstCharacter() const;
/**
* Get current player movement info
@ -167,6 +171,9 @@ public:
// Money (copper)
uint64_t getMoneyCopper() const { return playerMoneyCopper_; }
// Single-player: mark character list ready for selection UI
void setSinglePlayerCharListReady();
// Inventory
Inventory& getInventory() { return inventory; }
const Inventory& getInventory() const { return inventory; }
@ -216,6 +223,7 @@ public:
void setSinglePlayerMode(bool sp) { singlePlayerMode_ = sp; }
bool isSinglePlayerMode() const { return singlePlayerMode_; }
void simulateMotd(const std::vector<std::string>& lines);
void applySinglePlayerStartData(Race race, Class cls);
// NPC death callback (single-player)
using NpcDeathCallback = std::function<void(uint64_t guid)>;
@ -296,6 +304,16 @@ public:
*/
void update(float deltaTime);
struct SinglePlayerCreateInfo {
uint32_t mapId = 0;
uint32_t zoneId = 0;
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
float orientation = 0.0f;
};
bool getSinglePlayerCreateInfo(Race race, Class cls, SinglePlayerCreateInfo& out) const;
private:
/**
* Handle incoming packet from world server
@ -503,6 +521,8 @@ private:
bool pendingGroupInvite = false;
std::string pendingInviterName;
uint64_t activeCharacterGuid_ = 0;
// ---- Phase 5: Loot ----
bool lootWindowOpen = false;
LootResponseData currentLoot;