From b9856137911968e8253c9d205ca4deeaed625c5b Mon Sep 17 00:00:00 2001 From: Emagi Date: Sun, 19 Jan 2025 09:59:42 -0500 Subject: [PATCH] RemoveSpellBonus should only remove the target if specified, otherwise it can remove the entire target set/group accidentally --- source/WorldServer/LuaFunctions.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/WorldServer/LuaFunctions.cpp b/source/WorldServer/LuaFunctions.cpp index dd24080..fdcc78b 100644 --- a/source/WorldServer/LuaFunctions.cpp +++ b/source/WorldServer/LuaFunctions.cpp @@ -2578,7 +2578,12 @@ int EQ2Emu_lua_RemoveSpellBonus(lua_State* state) { Spawn* spawn = lua_interface->GetSpawn(state); LuaSpell* luaspell = lua_interface->GetCurrentSpell(state); lua_interface->ResetFunctionStack(state); - if (luaspell && luaspell->spell) { + if (spawn && spawn->IsEntity()) { + ((Entity*)spawn)->RemoveSpellBonus(luaspell); + if (spawn->IsPlayer()) + ((Player*)spawn)->SetCharSheetChanged(true); + } + else if (luaspell && luaspell->spell) { ZoneServer* zone = nullptr; if (luaspell->caster != nullptr) zone = luaspell->caster->GetZone(); @@ -2602,11 +2607,6 @@ int EQ2Emu_lua_RemoveSpellBonus(lua_State* state) { LogWrite(LUA__ERROR, 0, "LUA", "Error removing spell bonus buff %s called by %s, zone is not available.", luaspell->spell ? luaspell->spell->GetName() : "NotSet", spawn ? spawn->GetName() : "N/A"); } } - else if (spawn && spawn->IsEntity()) { - ((Entity*)spawn)->RemoveSpellBonus(luaspell); - if (spawn->IsPlayer()) - ((Player*)spawn)->SetCharSheetChanged(true); - } return 0; }