Files
cursebreaker-parser/include/configs/npcs.h
2025-12-24 16:51:01 +09:00

43 lines
901 B
C++

#pragma once
#include <string>
#include <vector>
#include <unordered_map>
#include <tinyxml2.h>
#include "constants.h"
namespace cursebreaker {
struct NPCStat
{
StatType type{};
uint16_t value{};
};
struct NPC
{
uint16_t id{};
uint16_t level{};
uint16_t health{};
uint16_t mana{};
uint16_t experience{};
uint16_t lootTableId{};
std::string name;
std::string description;
std::string faction;
std::vector<NPCStat> stats;
std::vector<uint16_t> lootItems; // alternative simple loot
NPC() = default;
};
// NPCs configuration functions
bool loadNPCsFromXML(const std::string& filepath, std::unordered_map<uint16_t, NPC>& npcs);
const NPC* getNPCById(uint16_t id, const std::unordered_map<uint16_t, NPC>& npcs);
const std::unordered_map<uint16_t, NPC>& getAllNPCs(const std::unordered_map<uint16_t, NPC>& npcs);
} // namespace cursebreaker