Parse enhancement stats of equipment items.
This commit is contained in:
parent
694a82701e
commit
2cf48c53f9
@ -46,7 +46,6 @@ INCLUDE_DATA
|
|||||||
INCLUDE_GFX
|
INCLUDE_GFX
|
||||||
|
|
||||||
void sig::Animation::InitializeAnimations(){
|
void sig::Animation::InitializeAnimations(){
|
||||||
|
|
||||||
auto CreateStillAnimation=[&](std::string imgName,vf2d size,AnimationData data={}){
|
auto CreateStillAnimation=[&](std::string imgName,vf2d size,AnimationData data={}){
|
||||||
Animate2D::FrameSequence anim(data.frameDuration,data.style);
|
Animate2D::FrameSequence anim(data.frameDuration,data.style);
|
||||||
anim.AddFrame({&GFX[imgName],{{0,0},size}});
|
anim.AddFrame({&GFX[imgName],{{0,0},size}});
|
||||||
|
@ -84,6 +84,16 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
characterMenuWindow->AddComponent("Equip Selection Bottom Outline",equipSelectionBottomOutline);
|
characterMenuWindow->AddComponent("Equip Selection Bottom Outline",equipSelectionBottomOutline);
|
||||||
characterMenuWindow->AddComponent("Equip Selection Select Button",equipSelectionSelectButton);
|
characterMenuWindow->AddComponent("Equip Selection Select Button",equipSelectionSelectButton);
|
||||||
|
|
||||||
|
const std::array<ItemAttribute,7>displayAttrs{
|
||||||
|
ItemAttribute::health,
|
||||||
|
ItemAttribute::attack,
|
||||||
|
ItemAttribute::defense,
|
||||||
|
ItemAttribute::moveSpdPct,
|
||||||
|
ItemAttribute::cdrPct,
|
||||||
|
ItemAttribute::critPct,
|
||||||
|
ItemAttribute::critDmgPct,
|
||||||
|
};
|
||||||
|
|
||||||
int equipSlot=1;
|
int equipSlot=1;
|
||||||
for(int i=0;i<8;i++){
|
for(int i=0;i<8;i++){
|
||||||
float x=31+(i%2)*33;
|
float x=31+(i%2)*33;
|
||||||
@ -98,7 +108,7 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
EquipSlot slot=EquipSlot(equipSlot);
|
EquipSlot slot=EquipSlot(equipSlot);
|
||||||
|
|
||||||
MenuItemItemButton*equipmentSlot=NEW MenuItemItemButton(CHARACTER_MENU,{{x,y+36},{24,24}},Item::BLANK,MenuType::ENUM_END,
|
MenuItemItemButton*equipmentSlot=NEW MenuItemItemButton(CHARACTER_MENU,{{x,y+36},{24,24}},Item::BLANK,MenuType::ENUM_END,
|
||||||
[](MenuFuncData data){
|
[&](MenuFuncData data){
|
||||||
EquipSlot slot=EquipSlot(data.component->I(Attribute::EQUIP_TYPE));
|
EquipSlot slot=EquipSlot(data.component->I(Attribute::EQUIP_TYPE));
|
||||||
|
|
||||||
std::vector<Item>&equips=Inventory::get("Equipment");
|
std::vector<Item>&equips=Inventory::get("Equipment");
|
||||||
@ -142,15 +152,6 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
MenuComponent*statDisplayOutline=NEW MenuComponent(CHARACTER_MENU,{{245,36},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
MenuComponent*statDisplayOutline=NEW MenuComponent(CHARACTER_MENU,{{245,36},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
||||||
const std::array<ItemAttribute,7>displayAttrs{
|
|
||||||
ItemAttribute::health,
|
|
||||||
ItemAttribute::attack,
|
|
||||||
ItemAttribute::defense,
|
|
||||||
ItemAttribute::moveSpdPct,
|
|
||||||
ItemAttribute::cdrPct,
|
|
||||||
ItemAttribute::critPct,
|
|
||||||
ItemAttribute::critDmgPct,
|
|
||||||
};
|
|
||||||
|
|
||||||
characterMenuWindow->AddComponent("Stat Display Outline",statDisplayOutline);
|
characterMenuWindow->AddComponent("Stat Display Outline",statDisplayOutline);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
}
|
@ -79,6 +79,7 @@ struct EnhancementInfo{
|
|||||||
private:
|
private:
|
||||||
std::vector<Stats>enhancementStats;
|
std::vector<Stats>enhancementStats;
|
||||||
public:
|
public:
|
||||||
|
void SetAttribute(int enhanceLevel,ItemAttribute attribute,int value);
|
||||||
const Stats&operator[](int level)const;
|
const Stats&operator[](int level)const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 3457
|
#define VERSION_BUILD 3458
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user