|
|
@ -91,6 +91,7 @@ void ItemInfo::InitializeItems(){ |
|
|
|
float castTime=0; |
|
|
|
float castTime=0; |
|
|
|
std::vector<std::string> slot; |
|
|
|
std::vector<std::string> slot; |
|
|
|
float cooldownTime="Item.Item Cooldown Time"_F; |
|
|
|
float cooldownTime="Item.Item Cooldown Time"_F; |
|
|
|
|
|
|
|
bool hasStatValues=false; |
|
|
|
for(auto&itemKey:data[key.first].GetKeys()){ |
|
|
|
for(auto&itemKey:data[key.first].GetKeys()){ |
|
|
|
std::string keyName=itemKey.first; |
|
|
|
std::string keyName=itemKey.first; |
|
|
|
if(keyName=="Description"){ |
|
|
|
if(keyName=="Description"){ |
|
|
@ -112,17 +113,34 @@ void ItemInfo::InitializeItems(){ |
|
|
|
for(auto&val:data[key.first][keyName].GetValues()){ |
|
|
|
for(auto&val:data[key.first][keyName].GetValues()){ |
|
|
|
slot.push_back(val); |
|
|
|
slot.push_back(val); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else |
|
|
|
|
|
|
|
if(keyName.starts_with("StatValues")){ |
|
|
|
|
|
|
|
hasStatValues=true; |
|
|
|
}else{ //THis is a custom override modifier for a script. NO-OP
|
|
|
|
}else{ //THis is a custom override modifier for a script. NO-OP
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemInfo&it=ITEM_DATA[key.first]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(hasStatValues){ |
|
|
|
|
|
|
|
EnhancementInfo enhancementStats; |
|
|
|
|
|
|
|
for(int i=0;i<=10;i++){ |
|
|
|
|
|
|
|
datafile&dat=data[key.first]["StatValues["+std::to_string(i)+"]"]; |
|
|
|
|
|
|
|
int armor=dat.GetValueCount()>0?dat.GetInt(0):0; |
|
|
|
|
|
|
|
int health=dat.GetValueCount()>1?dat.GetInt(1):0; |
|
|
|
|
|
|
|
int attack=dat.GetValueCount()>2?dat.GetInt(2):0; |
|
|
|
|
|
|
|
enhancementStats.SetAttribute(i,ItemAttribute::defense,armor); |
|
|
|
|
|
|
|
enhancementStats.SetAttribute(i,ItemAttribute::health,health); |
|
|
|
|
|
|
|
enhancementStats.SetAttribute(i,ItemAttribute::attack,attack); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
it.enhancement=enhancementStats; |
|
|
|
|
|
|
|
} |
|
|
|
if(scriptName!=""){ |
|
|
|
if(scriptName!=""){ |
|
|
|
if(!ITEM_SCRIPTS.count(scriptName)){ |
|
|
|
if(!ITEM_SCRIPTS.count(scriptName)){ |
|
|
|
ERR("Could not load script "<<scriptName<<" for Item "<<key.first<<"!") |
|
|
|
ERR("Could not load script "<<scriptName<<" for Item "<<key.first<<"!") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ItemInfo&it=ITEM_DATA[key.first]; |
|
|
|
|
|
|
|
it.name=key.first; |
|
|
|
it.name=key.first; |
|
|
|
it.description=description; |
|
|
|
it.description=description; |
|
|
|
it.category=category; |
|
|
|
it.category=category; |
|
|
@ -486,3 +504,10 @@ EquipSlot Item::GetEquipSlot(){ |
|
|
|
EquipSlot ItemInfo::Slot(){ |
|
|
|
EquipSlot ItemInfo::Slot(){ |
|
|
|
return slot; |
|
|
|
return slot; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EnhancementInfo::SetAttribute(int enhanceLevel,ItemAttribute attribute,int value){ |
|
|
|
|
|
|
|
while(enhancementStats.size()<=enhanceLevel){ |
|
|
|
|
|
|
|
enhancementStats.push_back({}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
enhancementStats[enhanceLevel].A(attribute)=value; |
|
|
|
|
|
|
|
} |