Skip to content

Commit

Permalink
Remove CATA specific code for TC methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Jul 20, 2024
1 parent c67e4a7 commit a13ce82
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 381 deletions.
3 changes: 0 additions & 3 deletions ElunaUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
#if (defined TRINITY || CMANGOS || VMANGOS) && !defined CATA
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
return false;
#elif defined CATA && defined TRINITY
if ((i_obj_fact->IsHostileTo(target->GetFactionTemplateEntry())) != (i_hostile == 1))
return false;
#elif defined CATA && defined CMANGOS
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
return false;
Expand Down
4 changes: 0 additions & 4 deletions methods/TrinityCore/BattleGroundMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ namespace LuaBattleGround
*/
int GetEndTime(Eluna* E, BattleGround* bg)
{
#if defined CATA
E->Push(bg->GetRemainingTime());
#else
E->Push(bg->GetEndTime());
#endif
return 1;
}

Expand Down
12 changes: 0 additions & 12 deletions methods/TrinityCore/CreatureMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ namespace LuaCreature
*/
int IsRegeneratingHealth(Eluna* E, Creature* creature)
{
#if defined CATA
E->Push(creature->isRegeneratingHealth());
#else
E->Push(creature->CanRegenerateHealth());
#endif
return 1;
}

Expand Down Expand Up @@ -904,7 +900,6 @@ namespace LuaCreature
return 1;
}

#if !defined CATA
/**
* Returns the [Creature]'s shield block value.
*
Expand All @@ -915,7 +910,6 @@ namespace LuaCreature
E->Push(creature->GetShieldBlockValue());
return 1;
}
#endif

/**
* Returns the loot mode for the [Creature].
Expand Down Expand Up @@ -1440,9 +1434,7 @@ namespace LuaCreature
{ "GetNPCFlags", &LuaCreature::GetNPCFlags },
{ "GetExtraFlags", &LuaCreature::GetExtraFlags },
{ "GetRank", &LuaCreature::GetRank },
#if !defined CATA
{ "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue },
#endif
{ "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow },
{ "GetCreatureFamily", &LuaCreature::GetCreatureFamily },
{ "GetThreat", &LuaCreature::GetThreat },
Expand Down Expand Up @@ -1519,10 +1511,6 @@ namespace LuaCreature
{ "ClearFixate", &LuaCreature::ClearFixate },
{ "RemoveFromWorld", &LuaCreature::RemoveFromWorld },

#if defined CATA //Not implemented in TCPP
{ "GetShieldBlockValue", nullptr },
#endif

{ NULL, NULL, METHOD_REG_NONE }
};
};
Expand Down
6 changes: 0 additions & 6 deletions methods/TrinityCore/GameObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,7 @@ namespace LuaGameObject
else if (state == 1)
go->SetGoState(GO_STATE_READY);
else if (state == 2)
{
#if !defined CATA
go->SetGoState(GO_STATE_DESTROYED);
#else
go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
#endif
}

return 0;
}
Expand Down
69 changes: 3 additions & 66 deletions methods/TrinityCore/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ namespace LuaGlobalFunctions
*/
int GetCoreExpansion(Eluna* E)
{
#ifdef WOTLK
E->Push(2);
#elif CATA
E->Push(3);
#endif
return 1;
}

Expand Down Expand Up @@ -457,20 +453,12 @@ namespace LuaGlobalFunctions
if (!temp)
return luaL_argerror(E->L, 1, "valid ItemEntry expected");

#if defined CATA
std::string name = temp->ExtendedData->Display->Str[locale];
#else
std::string name = temp->Name1;
#endif
if (ItemLocale const* il = eObjectMgr->GetItemLocale(entry))
ObjectMgr::GetLocaleString(il->Name, static_cast<LocaleConstant>(locale), name);

std::ostringstream oss;
#if defined CATA
oss << "|c" << std::hex << ItemQualityColors[temp->ExtendedData->Quality] << std::dec <<
#else
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
#endif
"|Hitem:" << entry << ":0:" <<
"0:0:0:0:" <<
"0:0:0:0|h[" << name << "]|h|r";
Expand Down Expand Up @@ -1304,11 +1292,7 @@ namespace LuaGlobalFunctions
{
const char* command = E->CHECKVAL<const char*>(1);
// ignores output of the command
#if defined CATA
eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, nullptr, [](void*, bool) {}));
#else
eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view) {}, [](void*, bool) {}));
#endif
return 0;
}

Expand Down Expand Up @@ -1748,22 +1732,14 @@ namespace LuaGlobalFunctions
if (save)
{
Creature* creature = new Creature();
#if defined CATA
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, entry, pos))
#else
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, pos))
#endif
{
delete creature;
E->Push();
return 1;
}

#if defined CATA
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#else
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
#endif

uint32 db_guid = creature->GetSpawnId();

Expand All @@ -1785,13 +1761,7 @@ namespace LuaGlobalFunctions
}
else
{
#if defined CATA
SummonCreatureExtraArgs extraArgs;
extraArgs.SummonDuration = durorresptime;
TempSummon* creature = map->SummonCreature(entry, pos, extraArgs);
#else
TempSummon* creature = map->SummonCreature(entry, pos, NULL, durorresptime);
#endif
if (!creature)
{
E->Push();
Expand Down Expand Up @@ -1827,11 +1797,8 @@ namespace LuaGlobalFunctions
GameObject* object = new GameObject;
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
#if defined CATA
if (!object->Create(guidLow, objectInfo->entry, map, Position(x, y, z, o), rot, 0, GO_STATE_READY))
#else

if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY))
#endif
{
delete object;
E->Push();
Expand All @@ -1844,11 +1811,7 @@ namespace LuaGlobalFunctions
if (save)
{
// fill the gameobject data and save to the db
#if defined CATA
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#else
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
#endif
guidLow = object->GetSpawnId();

// delete the old object and do a clean load from DB with a fresh new GameObject instance.
Expand Down Expand Up @@ -1910,22 +1873,11 @@ namespace LuaGlobalFunctions
uint32 incrtime = E->CHECKVAL<uint32>(4);
uint32 extendedcost = E->CHECKVAL<uint32>(5);

#if defined CATA
VendorItem vItem;
vItem.item = item;
vItem.maxcount = maxcount;
vItem.incrtime = incrtime;
vItem.ExtendedCost = extendedcost;

if (!eObjectMgr->IsVendorItemValid(entry, vItem))
return 0;
eObjectMgr->AddVendorItem(entry, vItem);
#else
if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost))
return 0;

eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
#endif

return 0;
}

Expand All @@ -1942,11 +1894,7 @@ namespace LuaGlobalFunctions
if (!eObjectMgr->GetCreatureTemplate(entry))
return luaL_argerror(E->L, 1, "valid CreatureEntry expected");

#if defined CATA
eObjectMgr->RemoveVendorItem(entry, item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, item);
#endif

return 0;
}
Expand All @@ -1966,12 +1914,8 @@ namespace LuaGlobalFunctions

auto const itemlist = items->m_items;
for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr)
#if defined CATA
eObjectMgr->RemoveVendorItem(entry, itr->item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, itr->item);

#endif
return 0;
}

Expand All @@ -1984,11 +1928,7 @@ namespace LuaGlobalFunctions
{
Player* player = E->CHECKOBJ<Player>(1);

#if !defined CATA
player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player");
#else
player->GetSession()->KickPlayer();
#endif
return 0;
}

Expand Down Expand Up @@ -2136,11 +2076,8 @@ namespace LuaGlobalFunctions
luaL_error(E->L, "Item entry %d does not exist", entry);
continue;
}
#if defined CATA
if (amount < 1 || (item_proto->ExtendedData->MaxCount > 0 && amount > uint32(item_proto->ExtendedData->MaxCount)))
#else

if (amount < 1 || (item_proto->MaxCount > 0 && amount > uint32(item_proto->MaxCount)))
#endif
{
luaL_error(E->L, "Item entry %d has invalid amount %d", entry, amount);
continue;
Expand Down
13 changes: 0 additions & 13 deletions methods/TrinityCore/GroupMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ namespace LuaGroup
return 1;
}

#if !defined CATA
/**
* Returns the [Group] members' flags
*
Expand All @@ -278,7 +277,6 @@ namespace LuaGroup
E->Push(group->GetMemberFlags(guid));
return 1;
}
#endif

/**
* Sets the leader of this [Group]
Expand Down Expand Up @@ -424,7 +422,6 @@ namespace LuaGroup
return 0;
}

#if !defined CATA
/**
* Sets or removes a flag for a [Group] member
*
Expand Down Expand Up @@ -452,7 +449,6 @@ namespace LuaGroup
group->SetGroupMemberFlag(target, apply, flag);
return 0;
}
#endif

ElunaRegister<Group> GroupMethods[] =
{
Expand All @@ -463,17 +459,13 @@ namespace LuaGroup
{ "GetMemberGroup", &LuaGroup::GetMemberGroup },
{ "GetMemberGUID", &LuaGroup::GetMemberGUID },
{ "GetMembersCount", &LuaGroup::GetMembersCount },
#if !defined CATA
{ "GetMemberFlags", &LuaGroup::GetMemberFlags },
#endif

// Setters
{ "SetLeader", &LuaGroup::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetMembersGroup", &LuaGroup::SetMembersGroup, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetTargetIcon", &LuaGroup::SetTargetIcon, METHOD_REG_WORLD }, // World state method only in multistate
#if !defined CATA
{ "SetMemberFlag", &LuaGroup::SetMemberFlag, METHOD_REG_WORLD }, // World state method only in multistate
#endif

// Boolean
{ "IsLeader", &LuaGroup::IsLeader },
Expand All @@ -495,11 +487,6 @@ namespace LuaGroup
{ "ConvertToLFG", &LuaGroup::ConvertToLFG, METHOD_REG_WORLD }, // World state method only in multistate
{ "ConvertToRaid", &LuaGroup::ConvertToRaid, METHOD_REG_WORLD }, // World state method only in multistate

#if defined CATA //Not implemented in TCPP
{ "GetMemberFlags", nullptr, METHOD_REG_NONE },
{ "SetMemberFlag", nullptr, METHOD_REG_NONE },
#endif

{ NULL, NULL, METHOD_REG_NONE }
};
};
Expand Down
8 changes: 0 additions & 8 deletions methods/TrinityCore/GuildMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ namespace LuaGuild
return 1;
}

#if !defined CATA
/**
* Sets the leader of this [Guild]
*
Expand All @@ -139,7 +138,6 @@ namespace LuaGuild
guild->HandleSetLeader(player->GetSession(), player->GetName());
return 0;
}
#endif

/**
* Sets the information of the bank tab specified
Expand Down Expand Up @@ -274,9 +272,7 @@ namespace LuaGuild
// Setters
{ "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate
{ "SetMemberRank", &LuaGuild::SetMemberRank, METHOD_REG_WORLD }, // World state method only in multistate
#if !defined CATA
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
#endif

// Other
{ "SendPacket", &LuaGuild::SendPacket },
Expand All @@ -285,10 +281,6 @@ namespace LuaGuild
{ "AddMember", &LuaGuild::AddMember, METHOD_REG_WORLD }, // World state method only in multistate
{ "DeleteMember", &LuaGuild::DeleteMember, METHOD_REG_WORLD }, // World state method only in multistate

#if defined CATA //Not implemented in TCPP
{ "SetLeader", nullptr, METHOD_REG_NONE },
#endif

{ NULL, NULL, METHOD_REG_NONE }
};
};
Expand Down
Loading

0 comments on commit a13ce82

Please sign in to comment.