71 lines
1.6 KiB
C++
71 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
|
|
#include <tinyxml2.h>
|
|
|
|
#include "constants.h"
|
|
|
|
namespace cursebreaker {
|
|
|
|
struct CraftingItemEntry
|
|
{
|
|
uint16_t itemId{};
|
|
uint16_t amount{};
|
|
};
|
|
|
|
// Struct for item crafting requirements
|
|
struct ItemCrafting
|
|
{
|
|
WorkbenchType workbench;
|
|
SkillType craftingskill;
|
|
std::vector<CraftingItemEntry> craftingitems;
|
|
std::string checks;
|
|
|
|
ItemCrafting() = default;
|
|
};
|
|
|
|
// Main item struct
|
|
struct Item {
|
|
uint16_t id = 0;
|
|
uint16_t price = 0;
|
|
uint16_t abilityid = 0;
|
|
uint16_t learnabilityid = 0;
|
|
|
|
SkillType skill = SkillType::none;
|
|
ItemCategory category = ItemCategory::none;
|
|
ItemType slot = ItemType::resource;
|
|
Tool tool = Tool::none;
|
|
GenstatType generation = GenstatType::none;
|
|
uint8_t level = 0;
|
|
uint8_t foodlevel = 0;
|
|
uint8_t foodamount = 0;
|
|
uint8_t foodfrequency = 0;
|
|
uint8_t foodtime = 0;
|
|
uint8_t maxstack = 0;
|
|
uint8_t book = 0;
|
|
|
|
bool stackable : 1;
|
|
bool twohanded : 1;
|
|
bool undroppable : 1;
|
|
bool hidemilestone : 1;
|
|
|
|
std::string name;
|
|
std::string description;
|
|
std::string comment;
|
|
|
|
std::vector<StatValue> stats;
|
|
std::vector<ItemCrafting> craftings;
|
|
|
|
Item() = default;
|
|
};
|
|
|
|
// Items configuration functions
|
|
bool loadItemsFromXML(const std::string& filepath, std::unordered_map<uint16_t, Item>& items);
|
|
const Item* getItemById(uint16_t id, const std::unordered_map<uint16_t, Item>& items);
|
|
const std::unordered_map<uint16_t, Item>& getAllItems(const std::unordered_map<uint16_t, Item>& items);
|
|
|
|
} // namespace cursebreaker
|