1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

update book.cpp and weapon.cpp

This commit is contained in:
kuyondo 2022-05-20 00:39:19 +08:00
parent a26898d8ed
commit 8a1a838ffa
3 changed files with 7 additions and 32 deletions

View File

@ -16,35 +16,10 @@ namespace MWLua
{
void addBookBindings(sol::table book, const Context& context)
{
book["SKILL"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs<std::string_view, int>({
{"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<ESM::Book>* store = &MWBase::Environment::get().getWorld()->getStore().get<ESM::Book>();
book["record"] = sol::overload(

View File

@ -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]; });

View File

@ -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