From 1c61c95f4a905554434bd74d774a213c1041e632 Mon Sep 17 00:00:00 2001 From: Emagi Date: Fri, 8 Aug 2025 19:46:36 -0400 Subject: [PATCH] Fixed if we do not call obtained (potential of removing item) we skip the item_deleted task because the item could not have been deleted (and there is no lua data to validate it anyway since the runitemscript failed) --- source/WorldServer/client.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index c0fb38f..e4808db 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -8152,10 +8152,12 @@ bool Client::AddItem(Item* item, bool* item_deleted, AddItemType type) { */ } CheckPlayerQuestsItemUpdate(item); + bool skipItemDeleted = true; if (item->GetItemScript() && lua_interface) - lua_interface->RunItemScript(item->GetItemScript(), "obtained", item, player); + if(lua_interface->RunItemScript(item->GetItemScript(), "obtained", item, player)) + skipItemDeleted = false; // we called "obtained" properly, check ptr to make sure it is valid - if(!lua_interface->IsLuaUserDataValid(item) && item_deleted) + if(!skipItemDeleted && !lua_interface->IsLuaUserDataValid(item) && item_deleted) *item_deleted = true; } else {