From 1320261ebacb06017c029fb6bd69787734612d29 Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Sun, 20 Aug 2023 14:55:23 -0500 Subject: [PATCH] Add baseGold to NPC and creature records --- apps/openmw/mwlua/types/creature.cpp | 1 + apps/openmw/mwlua/types/npc.cpp | 1 + files/lua_api/openmw/types.lua | 2 ++ 3 files changed, 4 insertions(+) diff --git a/apps/openmw/mwlua/types/creature.cpp b/apps/openmw/mwlua/types/creature.cpp index b42f433ede..08c0dd021c 100644 --- a/apps/openmw/mwlua/types/creature.cpp +++ b/apps/openmw/mwlua/types/creature.cpp @@ -47,5 +47,6 @@ namespace MWLua [](const ESM::Creature& rec) -> std::string { return rec.mOriginal.serializeText(); }); record["soulValue"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mSoul; }); record["type"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mType; }); + record["baseGold"] = sol::readonly_property([](const ESM::Creature& rec) -> int { return rec.mData.mGold; }); } } diff --git a/apps/openmw/mwlua/types/npc.cpp b/apps/openmw/mwlua/types/npc.cpp index eb8dd32445..06bcab243b 100644 --- a/apps/openmw/mwlua/types/npc.cpp +++ b/apps/openmw/mwlua/types/npc.cpp @@ -44,6 +44,7 @@ namespace MWLua record["head"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mHead.serializeText(); }); record["isMale"] = sol::readonly_property([](const ESM::NPC& rec) -> bool { return rec.isMale(); }); + record["baseGold"] = sol::readonly_property([](const ESM::NPC& rec) -> int { return rec.mNpdt.mGold; }); // This function is game-specific, in future we should replace it with something more universal. npc["isWerewolf"] = [](const Object& o) { diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index cd28f9bd12..f867c0ba21 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -688,6 +688,7 @@ -- @field #string mwscript -- @field #number soulValue The soul value of the creature record -- @field #number type The @{#Creature.TYPE} of the creature +-- @field #number baseGold The base barter gold of the creature --- @{#NPC} functions @@ -727,6 +728,7 @@ -- @field #string mwscript MWScript that is attached to this NPC -- @field #string hair Path to the hair body part model -- @field #string head Path to the head body part model +-- @field #number baseGold The base barter gold of the NPC -- @field #bool isMale The gender setting of the NPC