From 78984d8a959648ae378a1cd1b2b7769414ba5ac9 Mon Sep 17 00:00:00 2001 From: 55Honey <71938210+55Honey@users.noreply.github.com> Date: Sun, 5 Jun 2022 20:53:07 +0200 Subject: [PATCH] remove extra code --- src/LuaEngine/GameObjectMethods.h | 43 +++---------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/src/LuaEngine/GameObjectMethods.h b/src/LuaEngine/GameObjectMethods.h index f51e26a..3e63747 100644 --- a/src/LuaEngine/GameObjectMethods.h +++ b/src/LuaEngine/GameObjectMethods.h @@ -240,7 +240,6 @@ namespace LuaGameObject * * @param uint32 entry : The entry of the [Item] * @param uint32 amount = 1 : amount of the [Item] to add to the loot - * @return uint32 itemGUIDlow : low GUID of the [Item] */ int AddLoot(lua_State* L, GameObject* go) @@ -248,52 +247,16 @@ namespace LuaGameObject int i = 1; int argAmount = lua_gettop(L); -#if defined TRINITY || defined AZEROTHCORE - CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); -#endif uint8 addedItems = 0; while (i + 2 <= argAmount) { uint32 entry = Eluna::CHECKVAL(L, ++i); uint32 amount = Eluna::CHECKVAL(L, ++i); -#if defined TRINITY || AZEROTHCORE - ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); -#else - ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry); -#endif - if (!item_proto) - { - luaL_error(L, "Item entry %d does not exist", entry); - continue; - } - if (amount < 1 || (item_proto->MaxCount > 0 && amount > uint32(item_proto->MaxCount))) - { - luaL_error(L, "Item entry %d has invalid amount %d", entry, amount); - continue; - } - if (Item* item = Item::CreateItem(entry, amount)) - { -#if defined TRINITY || AZEROTHCORE - item->SaveToDB(trans); -#else - item->SaveToDB(); -#endif - LootStoreItem storeItem(item->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, item->GetCount(), item->GetCount()); - go->loot.AddItem(storeItem); -#if defined TRINITY || AZEROTHCORE - Eluna::Push(L, item->GetGUID().GetCounter()); -#else - Eluna::Push(L, item->GetGUIDLow()); -#endif - ++addedItems; - } + LootStoreItem storeItem(entry, 0, 100, 0, LOOT_MODE_DEFAULT, 0, amount, amount); + go->loot.AddItem(storeItem); + ++addedItems; } - -#if defined TRINITY || AZEROTHCORE - CharacterDatabase.CommitTransaction(trans); -#endif - return addedItems; }