Skip to content

Commit

Permalink
More define fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Niam5 committed Aug 28, 2024
1 parent 42685ed commit 0e407ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 43 deletions.
56 changes: 24 additions & 32 deletions methods/CMangos/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,7 @@ namespace LuaGlobalFunctions
*/
int GetCoreExpansion(Eluna* E)
{
#if ELUNA_EXPANSION == CLASSIC
E->Push(0);
#elif ELUNA_EXPANSION == TBC
E->Push(1);
#elif ELUNA_EXPANSION == WOTLK
E->Push(2);
#elif ELUNA_EXPANSION == CATA
E->Push(3);
#endif
E->Push(ELUNA_EXPANSION);
return 1;
}

Expand Down Expand Up @@ -460,7 +452,7 @@ namespace LuaGlobalFunctions
std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << entry << ":0:" <<
#if ELUNA_EXPANSION > CLASSIC
#if ELUNA_EXPANSION > EXP_CLASSIC
"0:0:0:0:" <<
#endif
"0:0:0:0|h[" << name << "]|h|r";
Expand Down Expand Up @@ -1678,7 +1670,7 @@ namespace LuaGlobalFunctions
float o = E->CHECKVAL<float>(8);
bool save = E->CHECKVAL<bool>(9, false);
uint32 durorresptime = E->CHECKVAL<uint32>(10, 0);
#if ELUNA_EXPANSION >= WOTLK
#if ELUNA_EXPANSION >= EXP_WOTLK
uint32 phase = E->CHECKVAL<uint32>(11, PHASEMASK_NORMAL);
if (!phase)
{
Expand All @@ -1705,7 +1697,7 @@ namespace LuaGlobalFunctions
return 1;
}

#if ELUNA_EXPANSION <= TBC
#if ELUNA_EXPANSION <= EXP_TBC
CreatureCreatePos pos(map, x, y, z, o);
#else
CreatureCreatePos pos(map, x, y, z, o, phase);
Expand All @@ -1718,7 +1710,7 @@ namespace LuaGlobalFunctions
E->Push();
return 1;
}
#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
if (!pCreature->Create(lowguid, lowguid, pos, cinfo))
#else
if (!pCreature->Create(lowguid, pos, cinfo))
Expand All @@ -1729,9 +1721,9 @@ namespace LuaGlobalFunctions
return 1;
}

#if ELUNA_EXPANSION == TBC
#if ELUNA_EXPANSION == EXP_TBC
pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#elif ELUNA_EXPANSION == CLASSIC
#elif ELUNA_EXPANSION == EXP_CLASSIC
pCreature->SaveToDB(map->GetId());
#else
pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
Expand All @@ -1740,7 +1732,7 @@ namespace LuaGlobalFunctions
uint32 db_guid = pCreature->GetGUIDLow();

// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
pCreature->LoadFromDB(db_guid, map, db_guid, 0);
#else
pCreature->LoadFromDB(db_guid, map);
Expand All @@ -1764,12 +1756,12 @@ namespace LuaGlobalFunctions

TemporarySpawn* pCreature = new TemporarySpawn(ObjectGuid(uint64(0)));

#if ELUNA_EXPANSION <= TBC
#if ELUNA_EXPANSION <= EXP_TBC
CreatureCreatePos pos(map, x, y, z, o);
#else
CreatureCreatePos pos(map, x, y, z, o, phase);
#endif
#if ELUNA_EXPANSION == CATA
#if ELUNA_EXPANSION == EXP_CATA
if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo))
#else
if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo))
Expand Down Expand Up @@ -1820,9 +1812,9 @@ namespace LuaGlobalFunctions
}

GameObject* pGameObj = new GameObject;
#if ELUNA_EXPANSION <= TBC
#if ELUNA_EXPANSION <= EXP_TBC
if (!pGameObj->Create(db_lowGUID, db_lowGUID, gInfo->id, map, x, y, z, o))
#elif ELUNA_EXPANSION == CATA
#elif ELUNA_EXPANSION == EXP_CATA
if (!pGameObj->Create(db_lowGUID, gInfo->id, map, phase, x, y, z, o))
#else
if (!pGameObj->Create(db_lowGUID, db_lowGUID, gInfo->id, map, phase, x, y, z, o))
Expand All @@ -1837,16 +1829,16 @@ namespace LuaGlobalFunctions
pGameObj->SetRespawnTime(durorresptime);

// fill the gameobject data and save to the db
#if ELUNA_EXPANSION == TBC
#if ELUNA_EXPANSION == EXP_TBC
pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#elif ELUNA_EXPANSION == CLASSIC
#elif ELUNA_EXPANSION == EXP_CLASSIC
pGameObj->SaveToDB(map->GetId());
#else
pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
#endif

// this will generate a new guid if the object is in an instance
#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
if (!pGameObj->LoadFromDB(db_lowGUID, map, db_lowGUID, 0))
#else
if (!pGameObj->LoadFromDB(db_lowGUID, map))
Expand All @@ -1869,9 +1861,9 @@ namespace LuaGlobalFunctions
else
{
GameObject* pGameObj = new GameObject;
#if ELUNA_EXPANSION <= TBC
#if ELUNA_EXPANSION <= EXP_TBC
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, x, y, z, o))
#elif ELUNA_EXPANSION == WOTLK
#elif ELUNA_EXPANSION == EXP_WOTLK
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, phase, x, y, z, o))
#else
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, phase, x, y, z, o))
Expand Down Expand Up @@ -1910,7 +1902,7 @@ namespace LuaGlobalFunctions
if (opcode >= NUM_MSG_TYPES)
return luaL_argerror(E->L, 1, "valid opcode expected");

#if ELUNA_EXPANSION == CLASSIC
#if ELUNA_EXPANSION == EXP_CLASSIC
E->Push(new WorldPacket((Opcodes)opcode, size));
#else
E->Push(new WorldPacket((OpcodesList)opcode, size));
Expand All @@ -1935,15 +1927,15 @@ namespace LuaGlobalFunctions
uint32 incrtime = E->CHECKVAL<uint32>(4);
uint32 extendedcost = E->CHECKVAL<uint32>(5);

#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, maxcount, incrtime, extendedcost, 0))
#else
if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, VENDOR_ITEM_TYPE_ITEM, maxcount, incrtime, extendedcost, 0))
#endif
return 0;
#if ELUNA_EXPANSION == CATA
#if ELUNA_EXPANSION == EXP_CATA
eObjectMgr->AddVendorItem(entry, item, VENDOR_ITEM_TYPE_ITEM, maxcount, incrtime, extendedcost);
#elif ELUNA_EXPANSION > CLASSIC
#elif ELUNA_EXPANSION > EXP_CLASSIC
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
#else
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime);
Expand All @@ -1964,7 +1956,7 @@ namespace LuaGlobalFunctions
if (!eObjectMgr->GetCreatureTemplate(entry))
return luaL_argerror(E->L, 1, "valid CreatureEntry expected");

#if ELUNA_EXPANSION == CATA
#if ELUNA_EXPANSION == EXP_CATA
eObjectMgr->RemoveVendorItem(entry, item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, item);
Expand All @@ -1987,7 +1979,7 @@ namespace LuaGlobalFunctions

auto const itemlist = items->m_items;
for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr)
#if ELUNA_EXPANSION == CATA
#if ELUNA_EXPANSION == EXP_CATA
eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, (*itr)->item);
Expand Down Expand Up @@ -2370,7 +2362,7 @@ namespace LuaGlobalFunctions

sTaxiNodesStore.InsertEntry(nodeEntry, nodeId++);

#if ELUNA_EXPANSION == CATA
#if ELUNA_EXPANSION == EXP_CATA
sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry);
#else
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
Expand Down
11 changes: 0 additions & 11 deletions methods/VMangos/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -3010,17 +3010,6 @@ namespace LuaPlayer
return 0;
}

#if !defined(CLASSIC)
/**
* Remove cooldowns on spells that have less than 10 minutes of cooldown from the [Player], similarly to when you enter an arena.
*/
int RemoveArenaSpellCooldowns(Eluna* /*E*/, Player* player)
{
player->RemoveArenaSpellCooldowns();
return 0;
}
#endif

/**
* Resurrects the [Player].
*
Expand Down

0 comments on commit 0e407ed

Please sign in to comment.