|
|
|
@ -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<std::string> slot; |
|
|
|
|
float cooldownTime="Item.Item Cooldown Time"_F; |
|
|
|
@ -123,6 +126,9 @@ void ItemInfo::InitializeItems(){ |
|
|
|
|
for(int i=0;i<data[key.first]["StatValues"].GetValueCount();i++){ |
|
|
|
|
statValueList.push_back(ItemAttributable::GetAttributeFromString(data[key.first]["StatValues"].GetString(i))); |
|
|
|
|
} |
|
|
|
|
}else |
|
|
|
|
if(keyName=="PartofSet"){ |
|
|
|
|
setName=data[key.first][keyName].GetString(); |
|
|
|
|
}else{ //THis is a custom override modifier for a script. NO-OP
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -153,6 +159,7 @@ void ItemInfo::InitializeItems(){ |
|
|
|
|
it.castTime=castTime; |
|
|
|
|
it.cooldownTime=cooldownTime; |
|
|
|
|
it.slot=EquipSlot::NONE; |
|
|
|
|
it.set=setName; |
|
|
|
|
if(slot.size()>0){ |
|
|
|
|
for(std::string&s:slot){ |
|
|
|
|
if(!nameToEquipSlot.count(s))ERR("WARNING! Tried to add item "<<it.name<<" to slot "<<s<<" which doesn't exist!"); |
|
|
|
@ -468,7 +475,11 @@ const Stats&EnhancementInfo::operator[](int level)const{ |
|
|
|
|
return enhancementStats[level]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const ItemSet&Item::GetItemSet()const{ |
|
|
|
|
bool ItemInfo::HasItemSet(){ |
|
|
|
|
return ItemSet::sets.count(set); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const ItemSet&ItemInfo::ItemSet()const{ |
|
|
|
|
return ItemSet::sets[set]; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -477,10 +488,10 @@ const Stats&ItemSet::operator[](int setPieces)const{ |
|
|
|
|
return setBonuses[setPieces]; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
void ItemSet::AddSetBonus(int pieceCount,const Stats&bonuses){ |
|
|
|
|
void ItemSet::AddSetBonus(std::string setName,int pieceCount,Stats&bonuses){ |
|
|
|
|
if(pieceCount<=0||pieceCount>=9)ERR("Piece count is invalid! Expecting a value (1-8) but got "<<pieceCount); |
|
|
|
|
for(int i=pieceCount-1;i<setBonuses.size();i++){ |
|
|
|
|
setBonuses[i]+=bonuses; |
|
|
|
|
for(int i=pieceCount-1;i<sets[setName].setBonuses.size();i++){ |
|
|
|
|
sets[setName].setBonuses[i]+=bonuses; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -516,4 +527,23 @@ void EnhancementInfo::SetAttribute(int enhanceLevel,ItemAttribute attribute,int |
|
|
|
|
enhancementStats.push_back({}); |
|
|
|
|
} |
|
|
|
|
enhancementStats[enhanceLevel].A(attribute)=value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ItemInfo::InitializeSets(){ |
|
|
|
|
for(auto&key:DATA["ItemSet"].GetKeys()){ |
|
|
|
|
std::string setName=key.first; |
|
|
|
|
datafile&setInfo=DATA["ItemSet"][setName]; |
|
|
|
|
|
|
|
|
|
for(int pieceCount=1;pieceCount<=8;pieceCount++){ |
|
|
|
|
if(setInfo.HasProperty(std::to_string(pieceCount))){ |
|
|
|
|
datafile&statInfo=setInfo[std::to_string(pieceCount)]; |
|
|
|
|
Stats bonuses; |
|
|
|
|
for(auto&key:statInfo.GetKeys()){ |
|
|
|
|
ItemAttribute attr=bonuses.GetAttributeFromString(key.first); |
|
|
|
|
bonuses.A(attr)=statInfo[key.first].GetInt(0); |
|
|
|
|
} |
|
|
|
|
ItemSet::AddSetBonus(setName,pieceCount,bonuses); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |