Skip to content

Commit

Permalink
Fix CMaNGOS defines in line with new scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Niam5 committed Aug 8, 2024
1 parent e89b721 commit f53e91d
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 168 deletions.
6 changes: 3 additions & 3 deletions methods/CMangos/AuraMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace LuaAura
{
int32 duration = E->CHECKVAL<int32>(2);
aura->GetHolder()->SetAuraDuration(duration);
#if (defined(TBC) || defined(CLASSIC))
#if ELUNA_EXPANSION < WOTLK
aura->GetHolder()->UpdateAuraDuration();
#else
aura->GetHolder()->SendAuraUpdate(false);
Expand All @@ -143,7 +143,7 @@ namespace LuaAura
{
int32 duration = E->CHECKVAL<int32>(2);
aura->GetHolder()->SetAuraMaxDuration(duration);
#if (defined(TBC) || defined(CLASSIC))
#if ELUNA_EXPANSION < WOTLK
aura->GetHolder()->UpdateAuraDuration();
#else
aura->GetHolder()->SendAuraUpdate(false);
Expand All @@ -162,7 +162,7 @@ namespace LuaAura
int SetStackAmount(Eluna* E, Aura* aura)
{
uint8 amount = E->CHECKVAL<uint8>(2);
#ifndef CATA
#if ELUNA_EXPANSION < CATA
aura->GetHolder()->SetStackAmount(amount, aura->GetTarget());
#else
aura->GetHolder()->SetStackAmount(amount);
Expand Down
2 changes: 1 addition & 1 deletion methods/CMangos/BattleGroundMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace LuaBattleGround
*/
int GetInstanceId(Eluna* E, BattleGround* bg)
{
#ifndef CATA
#if ELUNA_EXPANSION < CATA
E->Push(bg->GetInstanceId());
#else
E->Push(bg->GetInstanceID());
Expand Down
18 changes: 9 additions & 9 deletions methods/CMangos/CreatureMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace LuaCreature
return 1;
}

#ifndef CATA
#if ELUNA_EXPANSION < CATA
/**
* Returns `true` if the [Creature] is set to not give reputation when killed,
* and returns `false` otherwise.
Expand Down Expand Up @@ -66,7 +66,7 @@ namespace LuaCreature
{
bool mustBeDead = E->CHECKVAL<bool>(2, false);

#ifndef CATA
#if ELUNA_EXPANSION < CATA
E->Push(creature->IsTargetableForAttack(mustBeDead));
#else
E->Push(creature->isTargetableForAttack(mustBeDead));
Expand Down Expand Up @@ -715,7 +715,7 @@ namespace LuaCreature
return 1;
}

#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
#if ELUNA_EXPANSION < CATA
/**
* Returns the [Creature]'s shield block value.
*
Expand Down Expand Up @@ -827,7 +827,7 @@ namespace LuaCreature
return 0;
}

#ifndef CATA
#if ELUNA_EXPANSION < CATA
/**
* Sets whether the [Creature] gives reputation or not.
*
Expand Down Expand Up @@ -1056,7 +1056,7 @@ namespace LuaCreature
uint32 entry = E->CHECKVAL<uint32>(2);
uint32 dataGuidLow = E->CHECKVAL<uint32>(3, 0);

#ifndef CATA
#if ELUNA_EXPANSION < CATA
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
#else
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
Expand Down Expand Up @@ -1160,7 +1160,7 @@ namespace LuaCreature
SpellEntry const* spellEntry = GetSpellStore()->LookupEntry<SpellEntry>(spell);
creature->AddThreat(victim, threat, false, (SpellSchoolMask)schoolMask, spellEntry);

#ifdef CLASSIC
#if ELUNA_EXPANSION == CLASSIC
creature->AddThreat(victim, threat, false, spellEntry ? GetSchoolMask(spellEntry->School) : SPELL_SCHOOL_MASK_NONE, spellEntry);
#else
creature->AddThreat(victim, threat, false, spellEntry ? static_cast<SpellSchoolMask>(spellEntry->SchoolMask) : SPELL_SCHOOL_MASK_NONE, spellEntry);
Expand Down Expand Up @@ -1219,7 +1219,7 @@ namespace LuaCreature
{ "GetRank", &LuaCreature::GetRank },
{ "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow },
{ "GetCreatureFamily", &LuaCreature::GetCreatureFamily },
#ifndef CATA
#if ELUNA_EXPANSION < CATA
{ "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue },
#else
{ "GetShieldBlockValue", METHOD_REG_NONE },
Expand All @@ -1240,7 +1240,7 @@ namespace LuaCreature
{ "SetWalk", &LuaCreature::SetWalk },
{ "SetHomePosition", &LuaCreature::SetHomePosition },
{ "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots },
#ifndef CATA
#if ELUNA_EXPANSION < CATA
{ "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain },
#else
{ "SetDisableReputationGain", METHOD_REG_NONE },
Expand Down Expand Up @@ -1268,7 +1268,7 @@ namespace LuaCreature
{ "HasQuest", &LuaCreature::HasQuest },
{ "HasSpellCooldown", &LuaCreature::HasSpellCooldown },
{ "CanFly", &LuaCreature::CanFly },
#ifndef CATA
#if ELUNA_EXPANSION < CATA
{ "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled },
#else
{ "IsReputationGainDisabled", METHOD_REG_NONE },
Expand Down
54 changes: 27 additions & 27 deletions methods/CMangos/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ namespace LuaGlobalFunctions
*/
int GetCoreExpansion(Eluna* E)
{
#ifdef CLASSIC
#if ELUNA_EXPANSION == CLASSIC
E->Push(0);
#elif defined(TBC)
#elif ELUNA_EXPANSION == TBC
E->Push(1);
#elif defined(WOTLK)
#elif ELUNA_EXPANSION == WOTLK
E->Push(2);
#elif defined(CATA)
#elif ELUNA_EXPANSION == CATA
E->Push(3);
#endif
return 1;
Expand Down Expand Up @@ -460,7 +460,7 @@ namespace LuaGlobalFunctions
std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << entry << ":0:" <<
#ifndef CLASSIC
#if ELUNA_EXPANSION > CLASSIC
"0:0:0:0:" <<
#endif
"0:0:0:0|h[" << name << "]|h|r";
Expand Down Expand Up @@ -1678,7 +1678,7 @@ namespace LuaGlobalFunctions
float o = E->CHECKVAL<float>(8);
bool save = E->CHECKVAL<bool>(9, false);
uint32 durorresptime = E->CHECKVAL<uint32>(10, 0);
#if (!defined(TBC) && !defined(CLASSIC))
#if ELUNA_EXPANSION >= WOTLK
uint32 phase = E->CHECKVAL<uint32>(11, PHASEMASK_NORMAL);
if (!phase)
{
Expand All @@ -1705,7 +1705,7 @@ namespace LuaGlobalFunctions
return 1;
}

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

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

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

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

#if (defined(TBC) || defined(CLASSIC))
#if ELUNA_EXPANSION <= TBC
CreatureCreatePos pos(map, x, y, z, o);
#else
CreatureCreatePos pos(map, x, y, z, o, phase);
#endif
#ifdef CATA
#if ELUNA_EXPANSION == 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 +1820,9 @@ namespace LuaGlobalFunctions
}

GameObject* pGameObj = new GameObject;
#if (defined(TBC) || defined(CLASSIC))
#if ELUNA_EXPANSION <= TBC
if (!pGameObj->Create(db_lowGUID, db_lowGUID, gInfo->id, map, x, y, z, o))
#elif defined CATA
#elif ELUNA_EXPANSION == 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 +1837,16 @@ namespace LuaGlobalFunctions
pGameObj->SetRespawnTime(durorresptime);

// fill the gameobject data and save to the db
#ifdef TBC
#if ELUNA_EXPANSION == TBC
pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#elif defined(CLASSIC)
#elif ELUNA_EXPANSION == 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
#ifndef CATA
#if ELUNA_EXPANSION < CATA
if (!pGameObj->LoadFromDB(db_lowGUID, map, db_lowGUID, 0))
#else
if (!pGameObj->LoadFromDB(db_lowGUID, map))
Expand All @@ -1869,9 +1869,9 @@ namespace LuaGlobalFunctions
else
{
GameObject* pGameObj = new GameObject;
#if (defined(TBC) || defined(CLASSIC))
#if ELUNA_EXPANSION <= TBC
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, x, y, z, o))
#elif !defined CATA
#elif ELUNA_EXPANSION == 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 +1910,7 @@ namespace LuaGlobalFunctions
if (opcode >= NUM_MSG_TYPES)
return luaL_argerror(E->L, 1, "valid opcode expected");

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

#ifndef CATA
#if ELUNA_EXPANSION < 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;
#ifdef CATA
#if ELUNA_EXPANSION == CATA
eObjectMgr->AddVendorItem(entry, item, VENDOR_ITEM_TYPE_ITEM, maxcount, incrtime, extendedcost);
#elif !defined CLASSIC
#elif ELUNA_EXPANSION > CLASSIC
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
#else
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime);
Expand All @@ -1964,7 +1964,7 @@ namespace LuaGlobalFunctions
if (!eObjectMgr->GetCreatureTemplate(entry))
return luaL_argerror(E->L, 1, "valid CreatureEntry expected");

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

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

sTaxiNodesStore.InsertEntry(nodeEntry, nodeId++);

#ifdef CATA
#if ELUNA_EXPANSION == CATA
sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry);
#else
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
Expand Down
8 changes: 4 additions & 4 deletions methods/CMangos/GroupMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace LuaGroup
return 1;
}

#if !(defined(CLASSIC) || defined(TBC))
#if ELUNA_EXPANSION >= WOTLK
/**
* Returns 'true' if the [Group] is a LFG group
*
Expand Down Expand Up @@ -200,7 +200,7 @@ namespace LuaGroup
*/
int GetGUID(Eluna* E, Group* group)
{
#ifdef CLASSIC
#if ELUNA_EXPANSION == CLASSIC
E->Push(group->GetId());
#else
E->Push(group->GET_GUID());
Expand Down Expand Up @@ -361,7 +361,7 @@ namespace LuaGroup
if (icon >= TARGETICONCOUNT)
return luaL_argerror(E->L, 2, "valid target icon expected");

#if (defined(CLASSIC) || defined(TBC))
#if ELUNA_EXPANSION <= TBC
group->SetTargetIcon(icon, target);
#else
group->SetTargetIcon(icon, setter, target);
Expand Down Expand Up @@ -402,7 +402,7 @@ namespace LuaGroup
{ "IsAssistant", &LuaGroup::IsAssistant },
{ "SameSubGroup", &LuaGroup::SameSubGroup },
{ "HasFreeSlotSubGroup", &LuaGroup::HasFreeSlotSubGroup },
#if defined WOTLK
#if ELUNA_EXPANSION == WOTLK
{ "IsLFGGroup", &LuaGroup::IsLFGGroup },
#else
{ "IsLFGGroup", METHOD_REG_NONE },
Expand Down
8 changes: 4 additions & 4 deletions methods/CMangos/GuildMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace LuaGuild
return 1;
}

#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
#if ELUNA_EXPANSION <= WOTLK
/**
* Sets the leader of this [Guild]
*
Expand All @@ -136,7 +136,7 @@ namespace LuaGuild
}
#endif

#ifndef CLASSIC
#if ELUNA_EXPANSION >= TBC
/**
* Sets the information of the bank tab specified
*
Expand Down Expand Up @@ -252,13 +252,13 @@ namespace LuaGuild
{ "GetMemberCount", &LuaGuild::GetMemberCount },

// Setters
#if defined(TBC) || defined(WOTLK)
#if ELUNA_EXPANSION >= TBC
{ "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate
#else
{ "SetBankTabText", METHOD_REG_NONE },
#endif
{ "SetMemberRank", &LuaGuild::SetMemberRank, METHOD_REG_WORLD }, // World state method only in multistate
#ifndef CATA
#if ELUNA_EXPANSION < CATA
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
#else
{ "SetLeader", METHOD_REG_NONE },
Expand Down
Loading

0 comments on commit f53e91d

Please sign in to comment.