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

41 lines
979 B
C++

#pragma once
#include <string>
#include <vector>
#include <unordered_map>
#include <tinyxml2.h>
#include "constants.h"
namespace cursebreaker {
struct HarvestableLootEntry
{
uint16_t itemId{};
uint16_t amount{};
uint16_t chance{}; // percentage chance
};
struct Harvestable
{
uint16_t id{};
uint16_t level{};
uint16_t respawnTime{}; // in seconds or minutes, TBD
SkillType skill{};
std::string name;
std::string description;
std::vector<HarvestableLootEntry> loot;
Harvestable() = default;
};
// Harvestables configuration functions
bool loadHarvestablesFromXML(const std::string& filepath, std::unordered_map<uint16_t, Harvestable>& harvestables);
const Harvestable* getHarvestableById(uint16_t id, const std::unordered_map<uint16_t, Harvestable>& harvestables);
const std::unordered_map<uint16_t, Harvestable>& getAllHarvestables(const std::unordered_map<uint16_t, Harvestable>& harvestables);
} // namespace cursebreaker