diff --git a/apps/openmw/mwlua/types/book.cpp b/apps/openmw/mwlua/types/book.cpp index a8c9563a43..597c1a07a0 100644 --- a/apps/openmw/mwlua/types/book.cpp +++ b/apps/openmw/mwlua/types/book.cpp @@ -16,35 +16,10 @@ namespace MWLua { void addBookBindings(sol::table book, const Context& context) { - book["SKILL"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs({ - {"Acrobatics", ESM::Skill::Acrobatics}, - {"Alchemy", ESM::Skill::Alchemy}, - {"Alteration", ESM::Skill::Alteration}, - {"Armorer", ESM::Skill::Armorer}, - {"Athletics", ESM::Skill::Athletics}, - {"Axe", ESM::Skill::Axe}, - {"Block", ESM::Skill::Block}, - {"BluntWeapon", ESM::Skill::BluntWeapon}, - {"Conjuration", ESM::Skill::Conjuration}, - {"Destruction", ESM::Skill::Destruction}, - {"Enchant", ESM::Skill::Enchant}, - {"HandToHand", ESM::Skill::HandToHand}, - {"HeavyArmor", ESM::Skill::HeavyArmor}, - {"Illusion", ESM::Skill::Illusion}, - {"LightArmor", ESM::Skill::LightArmor}, - {"LongBlade", ESM::Skill::LongBlade}, - {"Marksman", ESM::Skill::Marksman}, - {"MediumArmor", ESM::Skill::MediumArmor}, - {"Mercantile", ESM::Skill::Mercantile}, - {"Mysticism", ESM::Skill::Mysticism}, - {"Restoration", ESM::Skill::Restoration}, - {"Security", ESM::Skill::Security}, - {"ShortBlade", ESM::Skill::ShortBlade}, - {"Sneak", ESM::Skill::Sneak}, - {"Spear", ESM::Skill::Spear}, - {"Speechcraft", ESM::Skill::Speechcraft}, - {"Unarmored", ESM::Skill::Unarmored}, - })); + sol::table skill(context.mLua->sol(), sol::create); + book["SKILL"] = LuaUtil::makeStrictReadOnly(skill); + for (int id = ESM::Skill::Block; id < ESM::Skill::Length; ++id) + skill[(ESM::Skill::sSkillNames[id])] = id; const MWWorld::Store* store = &MWBase::Environment::get().getWorld()->getStore().get(); book["record"] = sol::overload( diff --git a/apps/openmw/mwlua/types/weapon.cpp b/apps/openmw/mwlua/types/weapon.cpp index 87ae984cf9..594e447f00 100644 --- a/apps/openmw/mwlua/types/weapon.cpp +++ b/apps/openmw/mwlua/types/weapon.cpp @@ -55,7 +55,7 @@ namespace MWLua record["health"] = sol::readonly_property([](const ESM::Weapon& rec) -> int { return rec.mData.mHealth; }); record["speed"] = sol::readonly_property([](const ESM::Weapon& rec) -> float { return rec.mData.mSpeed; }); record["reach"] = sol::readonly_property([](const ESM::Weapon& rec) -> float { return rec.mData.mReach; }); - record["enchant"] = sol::readonly_property([](const ESM::Weapon& rec) -> float { return rec.mData.mEnchant * 0.1f; }); + record["enchantCapacity"] = sol::readonly_property([](const ESM::Weapon& rec) -> float { return rec.mData.mEnchant * 0.1f; }); record["chopMinDamage"] = sol::readonly_property([](const ESM::Weapon& rec) -> int { return rec.mData.mChop[0]; }); record["chopMaxDamage"] = sol::readonly_property([](const ESM::Weapon& rec) -> int { return rec.mData.mChop[1]; }); record["slashMinDamage"] = sol::readonly_property([](const ESM::Weapon& rec) -> int { return rec.mData.mSlash[0]; }); diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 6a58eea7bf..d7a917711b 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -582,7 +582,7 @@ -- @field #string text The text content of the book -- @field #number weight -- @field #number value --- @field #number skill See @{#Book.SKILL} +-- @field #number skill See @{#Book.SKILL} The skill that this book teaches -- @field #boolean isScroll -- @field #number enchantCapacity @@ -724,7 +724,7 @@ -- @field #number health -- @field #number speed -- @field #number reach --- @field #number enchant +-- @field #number enchantCapacity -- @field #number chopMinDamage -- @field #number chopMaxDamage -- @field #number slashMinDamage