From c20f97faa556d4f10be556e719af1c13e0964a75 Mon Sep 17 00:00:00 2001 From: Emagi Date: Tue, 24 Sep 2024 07:33:54 -0400 Subject: [PATCH] Fixed RemoveProc to work without Spawn argument --- source/WorldServer/LuaFunctions.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/source/WorldServer/LuaFunctions.cpp b/source/WorldServer/LuaFunctions.cpp index f055d55..ef49870 100644 --- a/source/WorldServer/LuaFunctions.cpp +++ b/source/WorldServer/LuaFunctions.cpp @@ -8682,18 +8682,6 @@ int EQ2Emu_lua_RemoveProc(lua_State* state) { Item* item = lua_interface->GetItem(state, 2); LuaSpell* spell = 0; - if (!spawn) { - lua_interface->LogError("%s: LUA RemoveProc command error: spawn is not valid", lua_interface->GetScriptName(state)); - lua_interface->ResetFunctionStack(state); - return 0; - } - - if (!spawn->IsEntity()) { - lua_interface->LogError("%s: LUA RemoveProc command error: spawn is not a valid entity", lua_interface->GetScriptName(state)); - lua_interface->ResetFunctionStack(state); - return 0; - } - if (!item) spell = lua_interface->GetCurrentSpell(state); @@ -8717,9 +8705,17 @@ int EQ2Emu_lua_RemoveProc(lua_State* state) { spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__); spell->caster->RemoveProc(item, spell); } - else + else if (!spawn) { + lua_interface->LogError("%s: LUA RemoveProc command error: spawn is not valid", lua_interface->GetScriptName(state)); + return 0; + } + else if (!spawn->IsEntity()) { + lua_interface->LogError("%s: LUA RemoveProc command error: spawn is not a valid entity", lua_interface->GetScriptName(state)); + return 0; + } + else { ((Entity*)spawn)->RemoveProc(item, spell); - + } return 0; }