diff --git a/source/WorldServer/LuaInterface.cpp b/source/WorldServer/LuaInterface.cpp index 111bdcd..2fcd6a7 100644 --- a/source/WorldServer/LuaInterface.cpp +++ b/source/WorldServer/LuaInterface.cpp @@ -584,9 +584,6 @@ std::string LuaInterface::AddSpawnPointers(LuaSpell* spell, bool first_cast, boo lua_pop(spell->state, 1); return string(""); } - else { - lua_getglobal(spell->state, functionCalled.c_str()); - } if(passLuaSpell) SetSpellValue(spell->state, spell); @@ -858,7 +855,6 @@ void LuaInterface::RemoveSpell(LuaSpell* spell, bool call_remove_function, bool lua_pop(spell->state, 1); } else { - lua_getglobal(spell->state, "remove"); LUASpawnWrapper* spawn_wrapper = new LUASpawnWrapper(); spawn_wrapper->spawn = spell->caster; AddUserDataPtr(spawn_wrapper, spawn_wrapper->spawn); diff --git a/source/WorldServer/SpellProcess.cpp b/source/WorldServer/SpellProcess.cpp index 3ee9ca0..b6702b3 100644 --- a/source/WorldServer/SpellProcess.cpp +++ b/source/WorldServer/SpellProcess.cpp @@ -582,28 +582,30 @@ bool SpellProcess::ProcessSpell(LuaSpell* spell, bool first_cast, const char* fu std::string SpellProcess::ApplyLuaFunction(LuaSpell* spell, bool first_cast, const char* function, SpellScriptTimer* timer, Spawn* altTarget) { std::string functionCall = lua_interface->AddSpawnPointers(spell, first_cast, false, function, timer, false, altTarget); - vector* data = spell->spell->GetLUAData(); - for(int32 i=0;isize();i++){ - switch(data->at(i)->type){ - case 0:{ - lua_interface->SetSInt32Value(spell->state, data->at(i)->int_value); - break; - } - case 1:{ - lua_interface->SetFloatValue(spell->state, data->at(i)->float_value); - break; - } - case 2:{ - lua_interface->SetBooleanValue(spell->state, data->at(i)->bool_value); - break; - } - case 3:{ - lua_interface->SetStringValue(spell->state, data->at(i)->string_value.c_str()); - break; - } - default:{ - LogWrite(SPELL__ERROR, 0, "Spell", "Error: Unknown LUA Type '%i' in SpellProcess::ProcessSpell for Spell '%s'", (int)data->at(i)->type, spell->spell->GetName()); - return string(""); + if(functionCall.length() > 0) { + vector* data = spell->spell->GetLUAData(); + for(int32 i=0;isize();i++){ + switch(data->at(i)->type){ + case 0:{ + lua_interface->SetSInt32Value(spell->state, data->at(i)->int_value); + break; + } + case 1:{ + lua_interface->SetFloatValue(spell->state, data->at(i)->float_value); + break; + } + case 2:{ + lua_interface->SetBooleanValue(spell->state, data->at(i)->bool_value); + break; + } + case 3:{ + lua_interface->SetStringValue(spell->state, data->at(i)->string_value.c_str()); + break; + } + default:{ + LogWrite(SPELL__ERROR, 0, "Spell", "Error: Unknown LUA Type '%i' in SpellProcess::ProcessSpell for Spell '%s'", (int)data->at(i)->type, spell->spell->GetName()); + return string(""); + } } } }