mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
- NPC default scale changed from 1.0 to 3.0 so creatures are visible from typical editing altitude (WoW creature models are very small at scale 1.0) - Properties/Info panel uses ImGuiCond_Always for position so it stays pinned to the right edge when the window is resized (was getting lost off-screen before)
97 lines
2.3 KiB
C++
97 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <cstdint>
|
|
|
|
namespace wowee {
|
|
namespace editor {
|
|
|
|
enum class CreatureBehavior {
|
|
Stationary,
|
|
Patrol,
|
|
Wander,
|
|
Scripted
|
|
};
|
|
|
|
struct PatrolPoint {
|
|
glm::vec3 position;
|
|
float waitTimeMs = 2000.0f;
|
|
};
|
|
|
|
struct CreatureSpawn {
|
|
uint32_t id = 0;
|
|
std::string name = "Creature";
|
|
std::string modelPath;
|
|
uint32_t displayId = 0;
|
|
|
|
// Position
|
|
glm::vec3 position{0};
|
|
float orientation = 0.0f; // degrees
|
|
|
|
// Stats
|
|
uint32_t level = 1;
|
|
uint32_t health = 100;
|
|
uint32_t mana = 0;
|
|
uint32_t minDamage = 5;
|
|
uint32_t maxDamage = 10;
|
|
uint32_t armor = 0;
|
|
uint32_t faction = 0; // 0 = neutral
|
|
|
|
// Display
|
|
float scale = 3.0f;
|
|
|
|
// Behavior
|
|
CreatureBehavior behavior = CreatureBehavior::Stationary;
|
|
float wanderRadius = 10.0f;
|
|
float aggroRadius = 20.0f;
|
|
float leashRadius = 40.0f;
|
|
uint32_t respawnTimeMs = 300000;
|
|
std::vector<PatrolPoint> patrolPath;
|
|
|
|
// Flags
|
|
bool hostile = false;
|
|
bool questgiver = false;
|
|
bool vendor = false;
|
|
bool flightmaster = false;
|
|
bool innkeeper = false;
|
|
|
|
bool selected = false;
|
|
};
|
|
|
|
class NpcSpawner {
|
|
public:
|
|
void placeCreature(const CreatureSpawn& spawn);
|
|
void removeCreature(int index);
|
|
|
|
int selectAt(const glm::vec3& worldPos, float maxDist = 30.0f);
|
|
void clearSelection();
|
|
CreatureSpawn* getSelected();
|
|
int getSelectedIndex() const { return selectedIdx_; }
|
|
|
|
const std::vector<CreatureSpawn>& getSpawns() const { return spawns_; }
|
|
std::vector<CreatureSpawn>& getSpawns() { return spawns_; }
|
|
size_t spawnCount() const { return spawns_.size(); }
|
|
|
|
// Serialize to/from JSON
|
|
bool saveToFile(const std::string& path) const;
|
|
bool loadFromFile(const std::string& path);
|
|
|
|
// Template creature for placement
|
|
CreatureSpawn& getTemplate() { return template_; }
|
|
|
|
// Scatter: place multiple copies in a radius around a point
|
|
void scatter(const CreatureSpawn& base, const glm::vec3& center,
|
|
float radius, int count);
|
|
|
|
private:
|
|
uint32_t nextId();
|
|
std::vector<CreatureSpawn> spawns_;
|
|
int selectedIdx_ = -1;
|
|
uint32_t idCounter_ = 1;
|
|
CreatureSpawn template_;
|
|
};
|
|
|
|
} // namespace editor
|
|
} // namespace wowee
|