Character Info Window layouts setup

This commit is contained in:
2023-12-01 22:55:33 -06:00
parent 298b0c4ca7
commit a659bf7924
12 changed files with 157 additions and 26 deletions
+32 -1
View File
@@ -45,7 +45,7 @@ enum class ItemAttribute{
/*////////////////////////////////////////////*/
/*//////*/ENUM_START,/*///////////////////////*/
/*////////////////////////////////////////////*/
//////////////
defense,
health,
attack,
@@ -56,18 +56,49 @@ enum class ItemAttribute{
healthPct, //Percentage of health boost
healthPctRecoveryPer6sec, //Percentage of health recovered every 6 seconds.
/////////NOTE: When adding a new item stat, provide its display name in the map below.
/*////////////////////////////////////////////*/
/*//////*/ENUM_END/*//////////////////////////*/
/*////////////////////////////////////////////*/
};
namespace DisplayType{
enum DisplayType{
DISPLAY_AS_NUMBER=0,
DISPLAY_AS_PERCENT=1,
};
}
struct AttributeData{
std::string name;
DisplayType::DisplayType displayAsPercent;
};
class ItemAttributable{
std::map<ItemAttribute,int>attributes;
private:
inline static std::map<ItemAttribute,AttributeData>data{
{ItemAttribute::defense,{"Defense",DisplayType::DISPLAY_AS_NUMBER}},
{ItemAttribute::health,{"Health",DisplayType::DISPLAY_AS_NUMBER}},
{ItemAttribute::attack,{"Attack",DisplayType::DISPLAY_AS_NUMBER}},
{ItemAttribute::moveSpdPct,{"Move Spd",DisplayType::DISPLAY_AS_PERCENT}},
{ItemAttribute::cdrPct,{"CDR",DisplayType::DISPLAY_AS_PERCENT}},
{ItemAttribute::critPct,{"Crit Rate",DisplayType::DISPLAY_AS_PERCENT}},
{ItemAttribute::critDmgPct,{"Crit Dmg",DisplayType::DISPLAY_AS_PERCENT}},
{ItemAttribute::healthPct,{"Health %",DisplayType::DISPLAY_AS_PERCENT}}, //Percentage of health boost
{ItemAttribute::healthPctRecoveryPer6sec,{"HP Recovery",DisplayType::DISPLAY_AS_NUMBER}} //Percentage of health recovered every 6 seconds.}
};
public:
//Returns a copy of all the attributes to be passed to a new instance easily / to sync values between both.
inline void copyTo(ItemAttributable&target){
target.attributes=attributes;
}
inline int&get(ItemAttribute a){
return attributes[a];
}
inline const int get_readOnly(ItemAttribute a)const{
return attributes.at(a);
}
inline static AttributeData GetDisplayInfo(ItemAttribute a){
return data[a];
}
};