|
|
|
@ -31,7 +31,6 @@ namespace MWLua
|
|
|
|
|
sol::table classes(context.mLua->sol(), sol::create);
|
|
|
|
|
addRecordFunctionBinding<ESM::Class>(classes, context);
|
|
|
|
|
|
|
|
|
|
// class record
|
|
|
|
|
auto classT = lua.new_usertype<ESM::Class>("ESM3_Class");
|
|
|
|
|
classT[sol::meta_function::to_string]
|
|
|
|
|
= [](const ESM::Class& rec) -> std::string { return "ESM3_Class[" + rec.mId.toDebugString() + "]"; };
|
|
|
|
@ -40,16 +39,6 @@ namespace MWLua
|
|
|
|
|
classT["description"]
|
|
|
|
|
= sol::readonly_property([](const ESM::Class& rec) -> std::string_view { return rec.mDescription; });
|
|
|
|
|
|
|
|
|
|
classT["majorSkills"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table {
|
|
|
|
|
sol::table res(lua, sol::create);
|
|
|
|
|
auto skills = rec.mData.mSkills;
|
|
|
|
|
for (size_t i = 0; i < skills.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
ESM::RefId skillId = ESM::Skill::indexToRefId(skills[i][1]);
|
|
|
|
|
res[i + 1] = skillId.serializeText();
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
});
|
|
|
|
|
classT["attributes"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table {
|
|
|
|
|
sol::table res(lua, sol::create);
|
|
|
|
|
auto attribute = rec.mData.mAttribute;
|
|
|
|
@ -60,6 +49,16 @@ namespace MWLua
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
});
|
|
|
|
|
classT["majorSkills"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table {
|
|
|
|
|
sol::table res(lua, sol::create);
|
|
|
|
|
auto skills = rec.mData.mSkills;
|
|
|
|
|
for (size_t i = 0; i < skills.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
ESM::RefId skillId = ESM::Skill::indexToRefId(skills[i][1]);
|
|
|
|
|
res[i + 1] = skillId.serializeText();
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
});
|
|
|
|
|
classT["minorSkills"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table {
|
|
|
|
|
sol::table res(lua, sol::create);
|
|
|
|
|
auto skills = rec.mData.mSkills;
|
|
|
|
|