#pragma once #include "objects/object.hpp" #include "building/building_data.hpp" #include "resource/resource.hpp" class Inventory; class Messages; enum class EquipmentSlot { HEAD, CAPE, CHEST, HAND_LEFT, HAND_RIGHT, LEGS, NONE, LAST }; // also add Item::stats if adding to ItemType! enum class ItemType : uint32_t { NONE, HAND, BUILDING_TOOL, SWORD_WOOD, SWORD_STONE, WOODAXE_STONE, BONE_BREASTPLATE, PICKAXE_STONE, CULTIVATOR, LAST }; struct ItemStats { ItemType type; std::string title; std::initializer_list cost; int base_damage; int base_armor; int base_health; float base_speed; int dmg_per_level; int armor_per_level; int health_per_level; int max_level; float crafting_duration; EquipmentSlot equipement_slot; size_t research_level; BuildingType research_station; }; struct ItemCrafting { ItemType type = ItemType::NONE; ItemStats stats = {}; float duration = 0; float duration_max = 0; bool is_crafting = false; }; namespace Item { extern ItemCrafting crafting_item; extern std::vector stats; const ItemStats& get(ItemType t); bool is_Weapon(ItemType&); int get_Damage(ItemType t, int lvl); int get_Health(ItemType t, int lvl); std::vector get_ResearchedItems(const std::vector& researched); bool craft_ItemStart(Inventory*, ItemType item, ItemCrafting& = Item::crafting_item); bool craft_Item(Inventory*, ItemCrafting&, Messages*); void craft_Stop(ItemCrafting& = Item::crafting_item); std::string to_String(ItemType); }