2010-09-24 13:28:14 +00:00
|
|
|
#include "attr.hpp"
|
2023-05-20 15:49:32 +00:00
|
|
|
#include <components/misc/strings/algorithm.hpp>
|
2023-05-25 10:49:27 +00:00
|
|
|
#include <stdexcept>
|
2010-09-24 13:28:14 +00:00
|
|
|
|
|
|
|
using namespace ESM;
|
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
const Attribute::AttributeID Attribute::sAttributeIds[Attribute::Length] = {
|
2010-09-24 13:28:14 +00:00
|
|
|
Attribute::Strength,
|
|
|
|
Attribute::Intelligence,
|
|
|
|
Attribute::Willpower,
|
|
|
|
Attribute::Agility,
|
|
|
|
Attribute::Speed,
|
|
|
|
Attribute::Endurance,
|
|
|
|
Attribute::Personality,
|
2022-09-12 16:35:54 +00:00
|
|
|
Attribute::Luck,
|
2010-09-24 13:28:14 +00:00
|
|
|
};
|
|
|
|
|
2013-08-09 12:14:58 +00:00
|
|
|
const std::string Attribute::sAttributeNames[Attribute::Length] = {
|
|
|
|
"Strength",
|
|
|
|
"Intelligence",
|
|
|
|
"Willpower",
|
|
|
|
"Agility",
|
|
|
|
"Speed",
|
|
|
|
"Endurance",
|
|
|
|
"Personality",
|
2022-09-12 16:35:54 +00:00
|
|
|
"Luck",
|
2013-08-09 12:14:58 +00:00
|
|
|
};
|
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
const std::string Attribute::sGmstAttributeIds[Attribute::Length] = {
|
2010-09-24 13:28:14 +00:00
|
|
|
"sAttributeStrength",
|
|
|
|
"sAttributeIntelligence",
|
|
|
|
"sAttributeWillpower",
|
|
|
|
"sAttributeAgility",
|
|
|
|
"sAttributeSpeed",
|
|
|
|
"sAttributeEndurance",
|
|
|
|
"sAttributePersonality",
|
2022-09-12 16:35:54 +00:00
|
|
|
"sAttributeLuck",
|
2010-09-24 13:28:14 +00:00
|
|
|
};
|
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
const std::string Attribute::sGmstAttributeDescIds[Attribute::Length] = {
|
2010-09-24 13:28:14 +00:00
|
|
|
"sStrDesc",
|
|
|
|
"sIntDesc",
|
|
|
|
"sWilDesc",
|
|
|
|
"sAgiDesc",
|
|
|
|
"sSpdDesc",
|
|
|
|
"sEndDesc",
|
|
|
|
"sPerDesc",
|
2022-09-12 16:35:54 +00:00
|
|
|
"sLucDesc",
|
2010-09-24 13:28:14 +00:00
|
|
|
};
|
2012-05-27 04:39:10 +00:00
|
|
|
|
2012-09-17 07:37:50 +00:00
|
|
|
const std::string Attribute::sAttributeIcons[Attribute::Length] = {
|
2012-05-27 04:39:10 +00:00
|
|
|
"icons\\k\\attribute_strength.dds",
|
|
|
|
"icons\\k\\attribute_int.dds",
|
|
|
|
"icons\\k\\attribute_wilpower.dds",
|
|
|
|
"icons\\k\\attribute_agility.dds",
|
|
|
|
"icons\\k\\attribute_speed.dds",
|
|
|
|
"icons\\k\\attribute_endurance.dds",
|
|
|
|
"icons\\k\\attribute_personality.dds",
|
2022-09-12 16:35:54 +00:00
|
|
|
"icons\\k\\attribute_luck.dds",
|
2012-05-27 04:39:10 +00:00
|
|
|
};
|
2023-05-20 15:49:32 +00:00
|
|
|
|
|
|
|
Attribute::AttributeID Attribute::stringToAttributeId(std::string_view attribute)
|
|
|
|
{
|
2023-05-21 11:01:11 +00:00
|
|
|
for (auto id : sAttributeIds)
|
|
|
|
if (Misc::StringUtils::ciEqual(sAttributeNames[id], attribute))
|
2023-05-20 15:49:32 +00:00
|
|
|
return id;
|
|
|
|
|
|
|
|
throw std::logic_error("No such attribute: " + std::string(attribute));
|
|
|
|
}
|