mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 22:09:42 +00:00
Redo specialization field
This commit is contained in:
parent
ea3eeb6bad
commit
c311caef9a
4 changed files with 8 additions and 15 deletions
|
@ -71,8 +71,9 @@ namespace MWLua
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
||||||
classT["specialization"] = sol::readonly_property(
|
classT["specialization"] = sol::readonly_property([](const ESM::Class& rec) -> std::string_view {
|
||||||
[](const ESM::Class& rec) -> std::string_view { return getSpecialization(rec.mData.mSpecialization); });
|
return ESM::Class::indexToLuaId[rec.mData.mSpecialization];
|
||||||
|
});
|
||||||
classT["isPlayable"]
|
classT["isPlayable"]
|
||||||
= sol::readonly_property([](const ESM::Class& rec) -> bool { return rec.mData.mIsPlayable; });
|
= sol::readonly_property([](const ESM::Class& rec) -> bool { return rec.mData.mIsPlayable; });
|
||||||
return LuaUtil::makeReadOnly(classes);
|
return LuaUtil::makeReadOnly(classes);
|
||||||
|
|
|
@ -60,16 +60,6 @@ namespace
|
||||||
|
|
||||||
namespace MWLua
|
namespace MWLua
|
||||||
{
|
{
|
||||||
std::string_view getSpecialization(int32_t val)
|
|
||||||
{
|
|
||||||
if (val == ESM::Class::Stealth)
|
|
||||||
return "stealth";
|
|
||||||
else if (val == ESM::Class::Magic)
|
|
||||||
return "magic";
|
|
||||||
else
|
|
||||||
return "combat";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void addStatUpdateAction(MWLua::LuaManager* manager, const SelfObject& obj)
|
static void addStatUpdateAction(MWLua::LuaManager* manager, const SelfObject& obj)
|
||||||
{
|
{
|
||||||
if (!obj.mStatsCache.empty())
|
if (!obj.mStatsCache.empty())
|
||||||
|
@ -456,8 +446,9 @@ namespace MWLua
|
||||||
skillT["name"] = sol::readonly_property([](const ESM::Skill& rec) -> std::string_view { return rec.mName; });
|
skillT["name"] = sol::readonly_property([](const ESM::Skill& rec) -> std::string_view { return rec.mName; });
|
||||||
skillT["description"]
|
skillT["description"]
|
||||||
= sol::readonly_property([](const ESM::Skill& rec) -> std::string_view { return rec.mDescription; });
|
= sol::readonly_property([](const ESM::Skill& rec) -> std::string_view { return rec.mDescription; });
|
||||||
skillT["specialization"] = sol::readonly_property(
|
skillT["specialization"] = sol::readonly_property([](const ESM::Skill& rec) -> std::string_view {
|
||||||
[](const ESM::Skill& rec) -> std::string_view { return getSpecialization(rec.mData.mSpecialization); });
|
return ESM::Class::indexToLuaId[rec.mData.mSpecialization];
|
||||||
|
});
|
||||||
skillT["icon"] = sol::readonly_property([vfs](const ESM::Skill& rec) -> std::string {
|
skillT["icon"] = sol::readonly_property([vfs](const ESM::Skill& rec) -> std::string {
|
||||||
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace ESM
|
||||||
{
|
{
|
||||||
const std::string_view Class::sGmstSpecializationIds[3]
|
const std::string_view Class::sGmstSpecializationIds[3]
|
||||||
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
||||||
|
const std::string_view Class::indexToLuaId[3] = { "combat", "magic", "stealth" };
|
||||||
|
|
||||||
int32_t& Class::CLDTstruct::getSkill(int index, bool major)
|
int32_t& Class::CLDTstruct::getSkill(int index, bool major)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace ESM
|
||||||
Magic = 1,
|
Magic = 1,
|
||||||
Stealth = 2
|
Stealth = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::string_view sGmstSpecializationIds[3];
|
static const std::string_view sGmstSpecializationIds[3];
|
||||||
|
static const std::string_view indexToLuaId[3];
|
||||||
|
|
||||||
struct CLDTstruct
|
struct CLDTstruct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue