Implemented ability to craft weapons/armor. Sorting all equipment by tier / type. Fixed bug with not properly setting available chapter for crafting on items with multiple enhancement levels. Fixed bugs related to adding crafting to weapons / armor (side effects applied directly to consumable items), fix stage loot/monster loot displays not properly updating when collecting items. Made old items properly convert to newer item names when being read in (constructor for the IT data type is no longer an enum and instead does the conversion automatically). This type now has implicit conversion from a std::string so is still a highly flexible typing like before. Release build 6677.
if(Inventory::GetItemCount(item.lock()->ActualName())==0){//We don't own this item, so we need to give the player this item and refresh the blacksmith's inventory.
if(Inventory::GetItemCount(item.lock()->ActualName())==0){//We don't own this item, so we need to give the player this item and refresh the blacksmith's inventory.
Component<RequiredMaterialsList>(CRAFT_ITEM,"Required Materials List")->SetItem(item);//Update the item refs in the enhancement level screen to now display the correct item.
Inventory::UpdateBlacksmithInventoryLists();
Inventory::UpdateBlacksmithInventoryLists();
}else{//Since we already own this equipment, just enhance it.
}else{//Since we already own this equipment, just enhance it.
if(it.Category()=="Accessories"&&it.IsArmor())ERR(std::format("WARNING! {} is in the Accessories Category, but is considered Armor!",it.Name()))
if(it.Category()=="Accessories"&&it.IsArmor())ERR(std::format("WARNING! {} is in the Accessories Category, but is considered Armor!",it.Name()))
if(it.Category()=="Accessories"&&!it.IsAccessory())ERR(std::format("WARNING! {} is in the Accessories Category, but not considered an Accessory!",it.Name()))
if(it.Category()=="Accessories"&&!it.IsAccessory())ERR(std::format("WARNING! {} is in the Accessories Category, but not considered an Accessory!",it.Name()))
#pragma endregion
#pragma endregion
#pragma region Equipment Sort Rules Verification Tests
if(category=="Equipment"){
if(std::find_if(ItemSortRules::primarySort.begin(),ItemSortRules::primarySort.end(),[&](conststd::string&sort){returnkey.find(sort)!=std::string::npos;})==ItemSortRules::primarySort.end())ERR(std::format("WARNING! Item {} does not have valid equipment sorting primary rule! Check items.txt config key: 'Equipment Sort Order Primary'!",key))
if(std::find_if(ItemSortRules::secondarySort.begin(),ItemSortRules::secondarySort.end(),[&](conststd::string&sort){returnkey.find(sort)!=std::string::npos;})==ItemSortRules::secondarySort.end())ERR(std::format("WARNING! Item {} does not have valid equipment sorting secondary rule! Check items.txt config key: 'Equipment Sort Order Secondary'!",key))
if(GetEnhancementInfo().size()>2){//If the item has exactly 2 enhancement levels, then it's an item that can only simply be crafted. Therefore, don't do the max enhancement level check.
if(GetEnhancementInfo().size()>2){//If the item has exactly 2 enhancement levels, then it's an item that can only simply be crafted. Therefore, don't do the max enhancement level check.
if(EnhancementLevel()>="Item.Item Max Enhancement Level"_I)returnfalse;
if(EnhancementLevel()>="Item.Item Max Enhancement Level"_I)returnfalse;
if(Inventory::GetItemCount(itemRef.lock()->ActualName())==0){//If we don't have the item, use the initial crafting list instead.
if(itemRef.lock()->IsEquippable()&&Inventory::GetItemCount(itemRef.lock()->ActualName())==0)enhancementIndex=0;//If we don't have the item, use the initial crafting list instead. But only for equipment!