mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 18:09:43 +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;
|
||||
});
|
||||
|
||||
classT["specialization"] = sol::readonly_property(
|
||||
[](const ESM::Class& rec) -> std::string_view { return getSpecialization(rec.mData.mSpecialization); });
|
||||
classT["specialization"] = sol::readonly_property([](const ESM::Class& rec) -> std::string_view {
|
||||
return ESM::Class::indexToLuaId[rec.mData.mSpecialization];
|
||||
});
|
||||
classT["isPlayable"]
|
||||
= sol::readonly_property([](const ESM::Class& rec) -> bool { return rec.mData.mIsPlayable; });
|
||||
return LuaUtil::makeReadOnly(classes);
|
||||
|
|
|
@ -60,16 +60,6 @@ namespace
|
|||
|
||||
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)
|
||||
{
|
||||
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["description"]
|
||||
= sol::readonly_property([](const ESM::Skill& rec) -> std::string_view { return rec.mDescription; });
|
||||
skillT["specialization"] = sol::readonly_property(
|
||||
[](const ESM::Skill& rec) -> std::string_view { return getSpecialization(rec.mData.mSpecialization); });
|
||||
skillT["specialization"] = sol::readonly_property([](const ESM::Skill& rec) -> std::string_view {
|
||||
return ESM::Class::indexToLuaId[rec.mData.mSpecialization];
|
||||
});
|
||||
skillT["icon"] = sol::readonly_property([vfs](const ESM::Skill& rec) -> std::string {
|
||||
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
||||
});
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace ESM
|
|||
{
|
||||
const std::string_view Class::sGmstSpecializationIds[3]
|
||||
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
||||
const std::string_view Class::indexToLuaId[3] = { "combat", "magic", "stealth" };
|
||||
|
||||
int32_t& Class::CLDTstruct::getSkill(int index, bool major)
|
||||
{
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace ESM
|
|||
Magic = 1,
|
||||
Stealth = 2
|
||||
};
|
||||
|
||||
static const std::string_view sGmstSpecializationIds[3];
|
||||
static const std::string_view indexToLuaId[3];
|
||||
|
||||
struct CLDTstruct
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue