Skip to content

Commit

Permalink
ScriptExtenals: Implemented "npc_clearinventory"
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Jan 11, 2017
1 parent 9f18d8f commit 066290b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 10 additions & 0 deletions src/logic/scriptExternals/Externals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions src/logic/scriptExternals/Stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 066290b

Please sign in to comment.