Chore: Remove unused #if statement (TrinityCore, Mangos, AzerothCore, TBC, Classic, Mists, Cata) (#217)

This commit is contained in:
iThorgrim
2025-01-21 17:37:39 +01:00
committed by GitHub
parent 16173cb751
commit 2e89531b05
35 changed files with 60 additions and 2504 deletions

View File

@@ -22,11 +22,7 @@ namespace LuaGameObject
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, go->hasQuest(questId));
#else
Eluna::Push(L, go->HasQuest(questId));
#endif
return 1;
}
@@ -145,11 +141,7 @@ namespace LuaGameObject
*/
int GetLootRecipientGroup(lua_State* L, GameObject* go)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, go->GetLootRecipientGroup());
#else
Eluna::Push(L, go->GetGroupLootRecipient());
#endif
return 1;
}
@@ -160,12 +152,7 @@ namespace LuaGameObject
*/
int GetDBTableGUIDLow(lua_State* L, GameObject* go)
{
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, go->GetSpawnId());
#else
// on mangos based this is same as lowguid
Eluna::Push(L, go->GetGUIDLow());
#endif
return 1;
}
@@ -192,13 +179,7 @@ namespace LuaGameObject
else if (state == 1)
go->SetGoState(GO_STATE_READY);
else if (state == 2)
{
#ifdef TRINITY
go->SetGoState(GO_STATE_DESTROYED);
#else
go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
#endif
}
return 0;
}
@@ -249,20 +230,15 @@ 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<uint32>(L, ++i);
uint32 amount = Eluna::CHECKVAL<uint32>(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);
@@ -275,25 +251,15 @@ namespace LuaGameObject
}
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;
}
}
#if defined TRINITY || AZEROTHCORE
CharacterDatabase.CommitTransaction(trans);
#endif
return addedItems;
}
@@ -320,11 +286,7 @@ namespace LuaGameObject
bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
// cs_gobject.cpp copy paste
#if defined TRINITY || AZEROTHCORE
ObjectGuid ownerGuid = go->GetOwnerGUID();
#else
ObjectGuid ownerGuid = go->GetOwnerGuid();
#endif
if (ownerGuid)
{
Unit* owner = eObjectAccessor()GetUnit(*go, ownerGuid);
@@ -335,13 +297,7 @@ namespace LuaGameObject
}
if (deldb)
{
#ifdef TRINITY
GameObject::DeleteFromDB(go->GetSpawnId());
#else
go->DeleteFromDB();
#endif
}
go->SetRespawnTime(0);
go->Delete();