From 066290b3171a6772d6a31b50faa43960ef208da3 Mon Sep 17 00:00:00 2001 From: Alexandr Akulich Date: Thu, 12 Jan 2017 03:17:48 +0500 Subject: [PATCH] ScriptExtenals: Implemented "npc_clearinventory" --- src/logic/scriptExternals/Externals.cpp | 10 ++++++++++ src/logic/scriptExternals/Stubs.cpp | 7 ------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/logic/scriptExternals/Externals.cpp b/src/logic/scriptExternals/Externals.cpp index 6e75f8bf..bc1dca93 100644 --- a/src/logic/scriptExternals/Externals.cpp +++ b/src/logic/scriptExternals/Externals.cpp @@ -997,6 +997,16 @@ void ::Logic::ScriptExternals::registerEngineExternals(World::WorldInstance& wor toNpc.playerController->getInventory().addItem(itemInstance); }); + vm->registerExternalFunction("npc_clearinventory", [=](Daedalus::DaedalusVM& vm) { + uint32_t npcId = vm.popVar(); if(verbose) LogInfo() << "npc_clearinventory " << npcId; + + VobTypes::NpcVobInformation npc = getNPCByInstance(npcId); + + if(!npc.isValid()) + return; + npc.playerController->getInventory().clear(); + }); + vm->registerExternalFunction("snd_play", [=](Daedalus::DaedalusVM& vm) { if(verbose) LogInfo() << "snd_play"; std::string s0 = vm.popString(); if(verbose) LogInfo() << "s0: " << s0; diff --git a/src/logic/scriptExternals/Stubs.cpp b/src/logic/scriptExternals/Stubs.cpp index 4e03f5ae..a5564842 100644 --- a/src/logic/scriptExternals/Stubs.cpp +++ b/src/logic/scriptExternals/Stubs.cpp @@ -1781,13 +1781,6 @@ void ::Logic::ScriptExternals::registerStubs(Daedalus::DaedalusVM& vm, bool verb }); - vm.registerExternalFunction("npc_clearinventory", [=](Daedalus::DaedalusVM& vm) { - if(verbose) LogInfo() << "npc_clearinventory"; - uint32_t arr_n0; - int32_t n0 = vm.popVar(arr_n0); if(verbose) LogInfo() << "n0: " << n0; - - }); - vm.registerExternalFunction("npc_createspell", [=](Daedalus::DaedalusVM& vm) { if(verbose) LogInfo() << "npc_createspell"; int spellnr = vm.popDataValue(); if(verbose) LogInfo() << "spellnr: " << spellnr;