diff --git a/Crawler/AttributableStat.h b/Crawler/AttributableStat.h index 30d1b94d..2b56b91a 100644 --- a/Crawler/AttributableStat.h +++ b/Crawler/AttributableStat.h @@ -104,8 +104,8 @@ public: inline int&get(ItemAttribute a){ return attributes[a]; } - inline const int get_readOnly(ItemAttribute a)const{ - return attributes.at(a); + inline const int get_readOnly(ItemAttribute a){ + return attributes[a]; } inline static AttributeData GetDisplayInfo(ItemAttribute a){ return data[a]; diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index dc7b695c..545c56d5 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -123,6 +123,9 @@ Crawler::Crawler() std::string ITEM_CONFIG = CONFIG_PATH + "item_config"_S; utils::datafile::Read(DATA,ITEM_CONFIG); + std::string ITEM_SET_CONFIG = CONFIG_PATH + "item_set_config"_S; + utils::datafile::Read(DATA,ITEM_SET_CONFIG); + for(auto&key:DATA.GetProperty("ItemConfiguration").GetKeys()){ std::string config = DATA["ItemConfiguration"][key.first].GetString(); utils::datafile::Read(DATA,CONFIG_PATH + "item_directory"_S + config); diff --git a/Crawler/Item.cpp b/Crawler/Item.cpp index 8f4d05a0..73b901f8 100644 --- a/Crawler/Item.cpp +++ b/Crawler/Item.cpp @@ -80,6 +80,8 @@ void ItemInfo::InitializeItems(){ ItemAttributable::stringToAttribute[ItemAttributable::GetDisplayInfo(attr).name]=attr; } + InitializeSets(); + for(auto&key:DATA["ItemCategory"].GetKeys()){ ITEM_CATEGORIES[key.first]; Inventory::sortedInv[key.first]; @@ -93,6 +95,7 @@ void ItemInfo::InitializeItems(){ img.Load(imgPath); std::string scriptName="",description="",category=""; + std::string setName=""; float castTime=0; std::vector slot; float cooldownTime="Item.Item Cooldown Time"_F; @@ -123,6 +126,9 @@ void ItemInfo::InitializeItems(){ for(int i=0;i0){ for(std::string&s:slot){ if(!nameToEquipSlot.count(s))ERR("WARNING! Tried to add item "<=9)ERR("Piece count is invalid! Expecting a value (1-8) but got "<sets; std::arraysetBonuses; public: //Specify the piece count(1-8) for a set bonus to be applied. - void AddSetBonus(int pieceCount,const Stats&bonuses); + static void AddSetBonus(std::string setName,int pieceCount,Stats&bonuses); //Gets a set bonus based on number of pieces (1-8) const Stats&operator[](int setPieces)const; }; @@ -101,7 +102,6 @@ private: //The amount in the current item stack. uint32_t amt; uint8_t enhancementLevel; - std::string set; ItemInfo*it; public: Item(); @@ -113,7 +113,6 @@ public: EquipSlot GetEquipSlot(); Decal*Decal(); ItemScript&OnUseAction(); - const ItemSet&GetItemSet()const; float CastTime(); float CooldownTime(); bool IsBlank(); @@ -178,6 +177,7 @@ class ItemInfo{ EquipSlot slot; EnhancementInfo enhancement; Decal*img; + std::string set; //Returns true if the item can be used, false otherwise std::string useFunc=""; //Custom properties for this specific item's script. @@ -186,6 +186,7 @@ class ItemInfo{ private: static void InitializeScripts(); + static void InitializeSets(); static std::mapnameToEquipSlot; public: static void InitializeItems(); @@ -201,6 +202,9 @@ public: float CastTime(); float CooldownTime(); EquipSlot Slot(); + bool HasItemSet(); + //NOTE: Not every item has a set! Verify with HasItemSet() first! + const ItemSet&ItemSet()const; }; class ItemOverlay{ diff --git a/Crawler/Version.h b/Crawler/Version.h index 6c107c70..90beab66 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 3460 +#define VERSION_BUILD 3470 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/configuration.txt b/Crawler/assets/config/configuration.txt index 67677666..4314058c 100644 --- a/Crawler/assets/config/configuration.txt +++ b/Crawler/assets/config/configuration.txt @@ -42,6 +42,9 @@ class_list = Warrior, Thief, Ranger, Trapper, Wizard, Witch # Items Config item_config = items/items.txt +# Item Set Config +item_set_config = items/ItemSets.txt + # Path to items configuration item_directory = items/