From a13ce82e9d5d11a3cb8f91ae726e3c4059803767 Mon Sep 17 00:00:00 2001 From: Foereaper Date: Sat, 20 Jul 2024 04:04:33 +0200 Subject: [PATCH] Remove CATA specific code for TC methods --- ElunaUtility.cpp | 3 - methods/TrinityCore/BattleGroundMethods.h | 4 - methods/TrinityCore/CreatureMethods.h | 12 --- methods/TrinityCore/GameObjectMethods.h | 6 -- methods/TrinityCore/GlobalMethods.h | 69 +------------ methods/TrinityCore/GroupMethods.h | 13 --- methods/TrinityCore/GuildMethods.h | 8 -- methods/TrinityCore/ItemMethods.h | 108 +------------------- methods/TrinityCore/MapMethods.h | 10 -- methods/TrinityCore/PlayerMethods.h | 115 +--------------------- methods/TrinityCore/QuestMethods.h | 4 - methods/TrinityCore/UnitMethods.h | 4 - methods/TrinityCore/VehicleMethods.h | 4 - methods/TrinityCore/WorldObjectMethods.h | 28 +----- 14 files changed, 7 insertions(+), 381 deletions(-) diff --git a/ElunaUtility.cpp b/ElunaUtility.cpp index 8b44c29668..1d0bc3a5e2 100644 --- a/ElunaUtility.cpp +++ b/ElunaUtility.cpp @@ -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; diff --git a/methods/TrinityCore/BattleGroundMethods.h b/methods/TrinityCore/BattleGroundMethods.h index d6d39eb35f..830a33b17a 100644 --- a/methods/TrinityCore/BattleGroundMethods.h +++ b/methods/TrinityCore/BattleGroundMethods.h @@ -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; } diff --git a/methods/TrinityCore/CreatureMethods.h b/methods/TrinityCore/CreatureMethods.h index fd20af3d5e..e25c1328f3 100644 --- a/methods/TrinityCore/CreatureMethods.h +++ b/methods/TrinityCore/CreatureMethods.h @@ -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; } @@ -904,7 +900,6 @@ namespace LuaCreature return 1; } -#if !defined CATA /** * Returns the [Creature]'s shield block value. * @@ -915,7 +910,6 @@ namespace LuaCreature E->Push(creature->GetShieldBlockValue()); return 1; } -#endif /** * Returns the loot mode for the [Creature]. @@ -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 }, @@ -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 } }; }; diff --git a/methods/TrinityCore/GameObjectMethods.h b/methods/TrinityCore/GameObjectMethods.h index 230b36d507..1838abf8e9 100644 --- a/methods/TrinityCore/GameObjectMethods.h +++ b/methods/TrinityCore/GameObjectMethods.h @@ -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; } diff --git a/methods/TrinityCore/GlobalMethods.h b/methods/TrinityCore/GlobalMethods.h index db5cce03ba..528a5145d2 100644 --- a/methods/TrinityCore/GlobalMethods.h +++ b/methods/TrinityCore/GlobalMethods.h @@ -78,11 +78,7 @@ namespace LuaGlobalFunctions */ int GetCoreExpansion(Eluna* E) { -#ifdef WOTLK E->Push(2); -#elif CATA - E->Push(3); -#endif return 1; } @@ -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(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"; @@ -1304,11 +1292,7 @@ namespace LuaGlobalFunctions { const char* command = E->CHECKVAL(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; } @@ -1748,22 +1732,14 @@ namespace LuaGlobalFunctions if (save) { Creature* creature = new Creature(); -#if defined CATA - if (!creature->Create(map->GenerateLowGuid(), map, entry, pos)) -#else if (!creature->Create(map->GenerateLowGuid(), 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(); @@ -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(); @@ -1827,11 +1797,8 @@ namespace LuaGlobalFunctions GameObject* object = new GameObject; uint32 guidLow = map->GenerateLowGuid(); 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(); @@ -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. @@ -1910,22 +1873,11 @@ namespace LuaGlobalFunctions uint32 incrtime = E->CHECKVAL(4); uint32 extendedcost = E->CHECKVAL(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; } @@ -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; } @@ -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; } @@ -1984,11 +1928,7 @@ namespace LuaGlobalFunctions { Player* player = E->CHECKOBJ(1); -#if !defined CATA player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player"); -#else - player->GetSession()->KickPlayer(); -#endif return 0; } @@ -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; diff --git a/methods/TrinityCore/GroupMethods.h b/methods/TrinityCore/GroupMethods.h index 1aa85b9606..1bd46773a0 100644 --- a/methods/TrinityCore/GroupMethods.h +++ b/methods/TrinityCore/GroupMethods.h @@ -256,7 +256,6 @@ namespace LuaGroup return 1; } -#if !defined CATA /** * Returns the [Group] members' flags * @@ -278,7 +277,6 @@ namespace LuaGroup E->Push(group->GetMemberFlags(guid)); return 1; } -#endif /** * Sets the leader of this [Group] @@ -424,7 +422,6 @@ namespace LuaGroup return 0; } -#if !defined CATA /** * Sets or removes a flag for a [Group] member * @@ -452,7 +449,6 @@ namespace LuaGroup group->SetGroupMemberFlag(target, apply, flag); return 0; } -#endif ElunaRegister GroupMethods[] = { @@ -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 }, @@ -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 } }; }; diff --git a/methods/TrinityCore/GuildMethods.h b/methods/TrinityCore/GuildMethods.h index 9691f85b34..4cc6acc63b 100644 --- a/methods/TrinityCore/GuildMethods.h +++ b/methods/TrinityCore/GuildMethods.h @@ -124,7 +124,6 @@ namespace LuaGuild return 1; } -#if !defined CATA /** * Sets the leader of this [Guild] * @@ -139,7 +138,6 @@ namespace LuaGuild guild->HandleSetLeader(player->GetSession(), player->GetName()); return 0; } -#endif /** * Sets the information of the bank tab specified @@ -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 }, @@ -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 } }; }; diff --git a/methods/TrinityCore/ItemMethods.h b/methods/TrinityCore/ItemMethods.h index 16564eaa41..fdd8f0a162 100644 --- a/methods/TrinityCore/ItemMethods.h +++ b/methods/TrinityCore/ItemMethods.h @@ -185,7 +185,6 @@ namespace LuaItem return 1; } -#if !defined CATA /** * Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise * @@ -207,7 +206,6 @@ namespace LuaItem E->Push(item->IsArmorVellum()); return 1; } -#endif /** * Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise @@ -220,7 +218,6 @@ namespace LuaItem return 1; } -#if !defined CATA /** * Returns 'true' if the refund period has expired for this [Item], 'false' otherwise * @@ -231,7 +228,6 @@ namespace LuaItem E->Push(item->IsRefundExpired()); return 1; } -#endif /** * Returns the chat link of the [Item] @@ -261,22 +257,14 @@ namespace LuaItem return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); const ItemTemplate* temp = item->GetTemplate(); -#if defined CATA - std::string name = temp->ExtendedData->Display1->Str[locale]; - if (ItemLocale const* il = eObjectMgr->GetItemLocale(temp->BasicData->ID)) -#else + std::string name = temp->Name1; if (ItemLocale const* il = eObjectMgr->GetItemLocale(temp->ItemId)) -#endif ObjectMgr::GetLocaleString(il->Name, static_cast(locale), name); if (int32 itemRandPropId = item->GetItemRandomPropertyId()) { -#if defined CATA - char* const* suffix = NULL; -#else std::array const* suffix = NULL; -#endif if (itemRandPropId < 0) { const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId()); @@ -292,22 +280,13 @@ namespace LuaItem if (suffix) { name += ' '; -#if defined CATA - name += (*suffix)[(name != temp->ExtendedData->Display->Str[locale]) ? locale : uint8(DEFAULT_LOCALE)]; -#else name += (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; -#endif } } std::ostringstream oss; -#if defined CATA - oss << "|c" << std::hex << ItemQualityColors[temp->ExtendedData->Quality] << std::dec << - "|Hitem:" << temp->BasicData->ID << ":" << -#else oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << "|Hitem:" << temp->ItemId << ":" << -#endif item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" << @@ -415,11 +394,7 @@ namespace LuaItem if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(E->L, 2, "valid SpellIndex expected"); -#if defined CATA - E->Push(item->GetTemplate()->ExtendedData->SpellID[index]); -#else E->Push(item->GetTemplate()->Spells[index].SpellId); -#endif return 1; } @@ -435,11 +410,7 @@ namespace LuaItem if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(E->L, 2, "valid SpellIndex expected"); -#if defined CATA - E->Push(item->GetTemplate()->ExtendedData->SpellTrigger[index]); -#else E->Push(item->GetTemplate()->Spells[index].SpellTrigger); -#endif return 1; } @@ -450,11 +421,7 @@ namespace LuaItem */ int GetClass(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetClass()); -#else E->Push(item->GetTemplate()->Class); -#endif return 1; } @@ -465,11 +432,7 @@ namespace LuaItem */ int GetSubClass(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetSubClass()); -#else E->Push(item->GetTemplate()->SubClass); -#endif return 1; } @@ -491,11 +454,7 @@ namespace LuaItem */ int GetName(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetDefaultLocaleName()); -#else E->Push(item->GetTemplate()->Name1); -#endif return 1; } @@ -506,11 +465,7 @@ namespace LuaItem */ int GetDisplayId(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetDisplayID()); -#else E->Push(item->GetTemplate()->DisplayInfoID); -#endif return 1; } @@ -521,11 +476,7 @@ namespace LuaItem */ int GetQuality(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetQuality()); -#else E->Push(item->GetTemplate()->Quality); -#endif return 1; } @@ -569,11 +520,7 @@ namespace LuaItem */ int GetBuyCount(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetBuyCount()); -#else E->Push(item->GetTemplate()->BuyCount); -#endif return 1; } @@ -584,11 +531,7 @@ namespace LuaItem */ int GetBuyPrice(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetBuyPrice()); -#else E->Push(item->GetTemplate()->BuyPrice); -#endif return 1; } @@ -599,11 +542,7 @@ namespace LuaItem */ int GetSellPrice(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetSellPrice()); -#else E->Push(item->GetTemplate()->SellPrice); -#endif return 1; } @@ -614,11 +553,7 @@ namespace LuaItem */ int GetInventoryType(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetInventoryType()); -#else E->Push(item->GetTemplate()->InventoryType); -#endif return 1; } @@ -629,11 +564,7 @@ namespace LuaItem */ int GetAllowableClass(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetAllowableClass()); -#else E->Push(item->GetTemplate()->AllowableClass); -#endif return 1; } @@ -644,11 +575,7 @@ namespace LuaItem */ int GetAllowableRace(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetAllowableRace()); -#else E->Push(item->GetTemplate()->AllowableRace); -#endif return 1; } @@ -659,11 +586,7 @@ namespace LuaItem */ int GetItemLevel(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetBaseItemLevel()); -#else E->Push(item->GetTemplate()->ItemLevel); -#endif return 1; } @@ -674,15 +597,10 @@ namespace LuaItem */ int GetRequiredLevel(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetRequiredLevel()); -#else E->Push(item->GetTemplate()->RequiredLevel); -#endif return 1; } -#ifdef WOTLK /** * Returns the amount of stat values on this [Item] * @@ -693,7 +611,6 @@ namespace LuaItem E->Push(item->GetTemplate()->StatsCount); return 1; } -#endif /** * Returns the random property ID of this [Item] @@ -702,11 +619,7 @@ namespace LuaItem */ int GetRandomProperty(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetRandomProperty()); -#else E->Push(item->GetTemplate()->RandomProperty); -#endif return 1; } @@ -717,11 +630,7 @@ namespace LuaItem */ int GetRandomSuffix(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetRandomSuffix()); -#else E->Push(item->GetTemplate()->RandomSuffix); -#endif return 1; } @@ -732,11 +641,7 @@ namespace LuaItem */ int GetItemSet(Eluna* E, Item* item) { -#if defined CATA - E->Push(item->GetTemplate()->GetItemSet()); -#else E->Push(item->GetTemplate()->ItemSet); -#endif return 1; } @@ -900,9 +805,7 @@ namespace LuaItem { "GetAllowableRace", &LuaItem::GetAllowableRace }, { "GetItemLevel", &LuaItem::GetItemLevel }, { "GetRequiredLevel", &LuaItem::GetRequiredLevel }, -#if !defined CATA { "GetStatsCount", &LuaItem::GetStatsCount }, -#endif { "GetRandomProperty", &LuaItem::GetRandomProperty }, { "GetRandomSuffix", &LuaItem::GetRandomSuffix }, { "GetItemSet", &LuaItem::GetItemSet }, @@ -929,11 +832,9 @@ namespace LuaItem { "IsEquipped", &LuaItem::IsEquipped }, { "HasQuest", &LuaItem::HasQuest }, { "IsPotion", &LuaItem::IsPotion }, -#if !defined CATA { "IsWeaponVellum", &LuaItem::IsWeaponVellum }, { "IsArmorVellum", &LuaItem::IsArmorVellum }, { "IsRefundExpired", &LuaItem::IsRefundExpired }, -#endif { "IsConjuredConsumable", &LuaItem::IsConjuredConsumable }, { "SetEnchantment", &LuaItem::SetEnchantment }, { "ClearEnchantment", &LuaItem::ClearEnchantment }, @@ -941,13 +842,6 @@ namespace LuaItem // Other { "SaveToDB", &LuaItem::SaveToDB }, -#if defined CATA //Not implemented in TCPP - { "GetStatsCount", nullptr, METHOD_REG_NONE }, - { "IsWeaponVellum", nullptr, METHOD_REG_NONE }, - { "IsArmorVellum", nullptr, METHOD_REG_NONE }, - { "IsRefundExpired", nullptr, METHOD_REG_NONE }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/MapMethods.h b/methods/TrinityCore/MapMethods.h index cc0329926a..50601014f4 100644 --- a/methods/TrinityCore/MapMethods.h +++ b/methods/TrinityCore/MapMethods.h @@ -108,14 +108,9 @@ namespace LuaMap { float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); -#if defined CATA - PhaseShift phase; - float z = map->GetHeight(phase, x, y, MAX_HEIGHT); -#else uint32 phasemask = E->CHECKVAL(4, 1); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); -#endif if (z != INVALID_HEIGHT) E->Push(z); return 1; @@ -181,14 +176,9 @@ namespace LuaMap float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); float z = E->CHECKVAL(4); -#if defined CATA - PhaseShift phase; - E->Push(map->GetAreaId(phase, x, y, z)); -#else float phasemask = E->CHECKVAL(5, PHASEMASK_NORMAL); E->Push(map->GetAreaId(phasemask, x, y, z)); -#endif return 1; } diff --git a/methods/TrinityCore/PlayerMethods.h b/methods/TrinityCore/PlayerMethods.h index 98df35f7d7..120314e65b 100644 --- a/methods/TrinityCore/PlayerMethods.h +++ b/methods/TrinityCore/PlayerMethods.h @@ -239,11 +239,7 @@ namespace LuaPlayer */ int CanSpeak(Eluna* E, Player* player) { -#if !defined CATA E->Push(player->GetSession()->CanSpeak()); -#else - E->Push(player->CanSpeak()); -#endif return 1; } @@ -378,7 +374,6 @@ namespace LuaPlayer return 1; } -#if !defined CATA /** * Returns 'true' if the [Player] satisfies all requirements to complete the repeatable quest entry. * @@ -416,7 +411,6 @@ namespace LuaPlayer return 1; } -#endif /** * Returns 'true' if the [Player] is a part of the Horde faction, 'false' otherwise. @@ -668,12 +662,7 @@ namespace LuaPlayer int IsNeverVisible(Eluna* E, Player* player) { - // Possibly add a bool var here -#if defined CATA - E->Push(player->IsNeverVisible()); -#else E->Push(player->IsNeverVisible(true)); -#endif return 1; } @@ -720,7 +709,6 @@ namespace LuaPlayer return 1; } -#if !defined CATA /** * Returns the normal phase of the player instead of the actual phase possibly containing GM phase * @@ -764,7 +752,6 @@ namespace LuaPlayer E->Push(player->GetShieldBlockValue()); return 1; } -#endif /** * Returns the [Player]s cooldown delay by specified [Spell] ID @@ -1066,11 +1053,7 @@ namespace LuaPlayer */ int GetGuildRank(Eluna* E, Player* player) // TODO: Move to Guild Methods { -#if defined CATA - E->Push(player->GetGuildRank()); -#else E->Push(player->GetRank()); -#endif return 1; } @@ -1553,7 +1536,6 @@ namespace LuaPlayer return 1; } -#if !defined CATA /** * Returns the amount of mails in the [Player]s mailbox * @@ -1586,7 +1568,6 @@ namespace LuaPlayer E->Push(player->GetXPForNextLevel()); return 1; } -#endif /** * Locks the player controls and disallows all movement and casting. @@ -1695,11 +1676,7 @@ namespace LuaPlayer if (!player->GetGuildId()) return 0; -#if defined CATA - player->SetGuildRank(rank); -#else player->SetRank(rank); -#endif return 0; } @@ -1872,7 +1849,6 @@ namespace LuaPlayer return 0; } -#if !defined CATA /** * Sets the [Player]s Arena Points to the amount specified * @@ -1896,7 +1872,6 @@ namespace LuaPlayer player->SetHonorPoints(honorP); return 0; } -#endif /** * Sets the [Player]s amount of Lifetime Honorable Kills to the value specified @@ -1986,20 +1961,12 @@ namespace LuaPlayer bool apply = E->CHECKVAL(2, true); if(apply) -#if defined CATA - player->SetByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, UNIT_BYTE2_FLAG_FFA_PVP); - else - player->RemoveByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, UNIT_BYTE2_FLAG_FFA_PVP); -#else player->SetPvpFlag(UNIT_BYTE2_FLAG_FFA_PVP); else player->RemovePvpFlag(UNIT_BYTE2_FLAG_FFA_PVP); -#endif return 0; } - -#if !defined CATA int SetMovement(Eluna* E, Player* player) { int32 pType = E->CHECKVAL(2); @@ -2007,7 +1974,6 @@ namespace LuaPlayer player->SetMovement((PlayerMovementType)pType); return 0; } -#endif /** * Resets the [Player]s pets talent points @@ -2041,7 +2007,6 @@ namespace LuaPlayer return 0; } -#if !defined CATA /** * Adds or detracts from the [Player]s current Arena Points * @@ -2067,7 +2032,6 @@ namespace LuaPlayer player->ModifyHonorPoints(amount); return 0; } -#endif /** * Saves the [Player] to the database @@ -2099,17 +2063,10 @@ namespace LuaPlayer int Mute(Eluna* E, Player* player) { uint32 muteseconds = E->CHECKVAL(2); - /*const char* reason = luaL_checkstring(E, 2);*/ // Mangos does not have a reason field in database. time_t muteTime = time(NULL) + muteseconds; player->GetSession()->m_muteTime = muteTime; -#if defined CATA - std::ostringstream oss; - oss << "UPDATE account SET mutetime = " << muteTime << " WHERE id = " << player->GetSession()->GetAccountId(); - LoginDatabase.PExecute("%s", oss.str().c_str()); -#else LoginDatabase.PExecute("UPDATE account SET mutetime = {} WHERE id = {}", muteTime, player->GetSession()->GetAccountId()); -#endif return 0; } @@ -2215,11 +2172,7 @@ namespace LuaPlayer { Creature* obj = E->CHECKOBJ(2); -#if defined CATA - player->GetSession()->SendTrainerList(obj, NULL); -#else player->GetSession()->SendTrainerList(obj); -#endif return 0; } @@ -2464,11 +2417,7 @@ namespace LuaPlayer */ int ResetTalentsCost(Eluna* E, Player* player) { -#if defined CATA - E->Push(player->GetNextResetTalentsCost()); -#else E->Push(player->ResetTalentsCost()); -#endif return 1; } @@ -2715,13 +2664,6 @@ namespace LuaPlayer return 0; // check item starting quest (it can work incorrectly if added without item in inventory) -#if defined CATA - ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore(); - ItemTemplateContainer::const_iterator result = std::find_if(itc->begin(), itc->end(), [quest](ItemTemplateContainer::value_type const& value) - { - return value.second.ExtendedData->StartQuest == quest->GetQuestId(); - }); -#else ItemTemplateContainer const& itc = sObjectMgr->GetItemTemplateStore(); auto itr = std::find_if(std::begin(itc), std::end(itc), [quest](ItemTemplateContainer::value_type const& value) { @@ -2730,7 +2672,7 @@ namespace LuaPlayer if (itr != std::end(itc)) return 0; -#endif + // ok, normal (creature/GO starting) quest if (player->CanAddQuest(quest, true)) player->AddQuestAndCheckCompletion(quest, NULL); @@ -3008,7 +2950,6 @@ namespace LuaPlayer return 0; } -#if !defined CATA /** * Advances all of the [Player]s weapon skills to the maximum amount available */ @@ -3017,7 +2958,6 @@ namespace LuaPlayer player->UpdateWeaponsSkillsToMaxSkillsForLevel(); return 0; } -#endif /** * Advances all of the [Player]s skills to the amount specified @@ -3081,21 +3021,11 @@ namespace LuaPlayer float z = E->CHECKVAL(5); float o = E->CHECKVAL(6); -#if defined CATA - if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->m_taxi.ClearTaxiDestinations(); - } - else - player->SaveRecallPosition(); -#else if (player->IsInFlight()) player->FinishTaxiFlight(); else player->SaveRecallPosition(); -#endif E->Push(player->TeleportTo(mapId, x, y, z, o)); return 1; } @@ -3308,11 +3238,7 @@ namespace LuaPlayer */ int KickPlayer(Eluna* /*E*/, Player* player) { -#if defined CATA - player->GetSession()->KickPlayer(); -#else player->GetSession()->KickPlayer("PlayerMethods::KickPlayer Kick the player"); -#endif return 0; } @@ -3549,12 +3475,7 @@ namespace LuaPlayer if (!quest) return 0; -#if defined CATA - player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept, true); -#else player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept); - -#endif return 0; } @@ -3800,10 +3721,8 @@ namespace LuaPlayer { "GetGuild", &LuaPlayer::GetGuild }, { "GetAccountId", &LuaPlayer::GetAccountId }, { "GetAccountName", &LuaPlayer::GetAccountName }, -#if !defined CATA { "GetArenaPoints", &LuaPlayer::GetArenaPoints }, { "GetHonorPoints", &LuaPlayer::GetHonorPoints }, -#endif { "GetLifetimeKills", &LuaPlayer::GetLifetimeKills }, { "GetPlayerIP", &LuaPlayer::GetPlayerIP }, { "GetLevelPlayedTime", &LuaPlayer::GetLevelPlayedTime }, @@ -3817,9 +3736,7 @@ namespace LuaPlayer { "GetQuestLevel", &LuaPlayer::GetQuestLevel }, { "GetChatTag", &LuaPlayer::GetChatTag }, { "GetRestBonus", &LuaPlayer::GetRestBonus }, -#if !defined CATA { "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn }, -#endif { "GetReqKillOrCastCurrentCount", &LuaPlayer::GetReqKillOrCastCurrentCount }, { "GetQuestStatus", &LuaPlayer::GetQuestStatus }, { "GetInGameTime", &LuaPlayer::GetInGameTime }, @@ -3859,17 +3776,13 @@ namespace LuaPlayer { "GetCorpse", &LuaPlayer::GetCorpse }, { "GetGossipTextId", &LuaPlayer::GetGossipTextId }, { "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus }, -#if !defined CATA { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, { "GetMailCount", &LuaPlayer::GetMailCount }, { "GetXP", &LuaPlayer::GetXP }, { "GetXPForNextLevel", &LuaPlayer::GetXPForNextLevel }, -#endif // Setters -#if !defined CATA { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, -#endif { "AdvanceSkill", &LuaPlayer::AdvanceSkill }, { "AdvanceAllSkills", &LuaPlayer::AdvanceAllSkills }, { "AddLifetimeKills", &LuaPlayer::AddLifetimeKills }, @@ -3877,10 +3790,8 @@ namespace LuaPlayer { "SetKnownTitle", &LuaPlayer::SetKnownTitle }, { "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle }, { "SetBindPoint", &LuaPlayer::SetBindPoint }, -#if !defined CATA { "SetArenaPoints", &LuaPlayer::SetArenaPoints }, { "SetHonorPoints", &LuaPlayer::SetHonorPoints }, -#endif { "SetLifetimeKills", &LuaPlayer::SetLifetimeKills }, { "SetGameMaster", &LuaPlayer::SetGameMaster }, { "SetGMChat", &LuaPlayer::SetGMChat }, @@ -3893,9 +3804,7 @@ namespace LuaPlayer { "SetReputation", &LuaPlayer::SetReputation }, { "SetFreeTalentPoints", &LuaPlayer::SetFreeTalentPoints }, { "SetGuildRank", &LuaPlayer::SetGuildRank }, -#if !defined CATA { "SetMovement", &LuaPlayer::SetMovement }, -#endif { "SetSkill", &LuaPlayer::SetSkill }, { "SetFactionForRace", &LuaPlayer::SetFactionForRace }, { "SetDrunkValue", &LuaPlayer::SetDrunkValue }, @@ -3966,10 +3875,8 @@ namespace LuaPlayer { "CanFly", &LuaPlayer::CanFly }, { "IsMoving", &LuaPlayer::IsMoving }, { "IsFlying", &LuaPlayer::IsFlying }, -#if !defined CATA { "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest }, { "CanRewardQuest", &LuaPlayer::CanRewardQuest }, -#endif // Gossip { "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem }, @@ -4030,10 +3937,8 @@ namespace LuaPlayer { "DurabilityPointLossForEquipSlot", &LuaPlayer::DurabilityPointLossForEquipSlot }, { "DurabilityRepairAll", &LuaPlayer::DurabilityRepairAll }, { "DurabilityRepair", &LuaPlayer::DurabilityRepair }, -#if !defined CATA { "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints }, { "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints }, -#endif { "LeaveBattleground", &LuaPlayer::LeaveBattleground }, { "BindToInstance", &LuaPlayer::BindToInstance }, { "UnbindInstance", &LuaPlayer::UnbindInstance }, @@ -4083,24 +3988,6 @@ namespace LuaPlayer { "ClearHonorInfo", nullptr, METHOD_REG_NONE }, // classic only { "GainSpellComboPoints", nullptr, METHOD_REG_NONE }, // not implemented -#if defined CATA //Not implmented in TCPP - { "GetArenaPoints", nullptr, METHOD_REG_NONE }, - { "GetHonorPoints", nullptr, METHOD_REG_NONE }, - { "GetPhaseMaskForSpawn", nullptr, METHOD_REG_NONE }, - { "GetShieldBlockValue", nullptr, METHOD_REG_NONE }, - { "GetMailCount", nullptr, METHOD_REG_NONE }, - { "GetXP", nullptr, METHOD_REG_NONE }, - { "GetXPForNextLevel", nullptr, METHOD_REG_NONE }, - { "AdvanceSkillsToMax", nullptr, METHOD_REG_NONE }, - { "SetArenaPoints", nullptr, METHOD_REG_NONE }, - { "SetHonorPoints", nullptr, METHOD_REG_NONE }, - { "SetMovement", nullptr, METHOD_REG_NONE }, - { "CanCompleteRepeatableQuest", nullptr, METHOD_REG_NONE }, - { "CanRewardQuest", nullptr, METHOD_REG_NONE }, - { "ModifyHonorPoints", nullptr, METHOD_REG_NONE }, - { "ModifyArenaPoints", nullptr, METHOD_REG_NONE }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/QuestMethods.h b/methods/TrinityCore/QuestMethods.h index 933f2d7b90..38a05a2991 100644 --- a/methods/TrinityCore/QuestMethods.h +++ b/methods/TrinityCore/QuestMethods.h @@ -165,11 +165,7 @@ namespace LuaQuest */ int GetType(Eluna* E, Quest* quest) { -#if defined CATA - E->Push(quest->GetQuestType()); -#else E->Push(quest->GetType()); -#endif return 1; } diff --git a/methods/TrinityCore/UnitMethods.h b/methods/TrinityCore/UnitMethods.h index 902b9dbe76..14a54edc0b 100644 --- a/methods/TrinityCore/UnitMethods.h +++ b/methods/TrinityCore/UnitMethods.h @@ -1550,11 +1550,7 @@ namespace LuaUnit int SetNativeDisplayId(Eluna* E, Unit* unit) { uint32 model = E->CHECKVAL(2); -#if defined CATA - unit->SetDisplayId(model, true); -#else unit->SetNativeDisplayId(model); -#endif return 0; } diff --git a/methods/TrinityCore/VehicleMethods.h b/methods/TrinityCore/VehicleMethods.h index cd4fe93d56..cf27fedf9a 100644 --- a/methods/TrinityCore/VehicleMethods.h +++ b/methods/TrinityCore/VehicleMethods.h @@ -72,11 +72,7 @@ namespace LuaVehicle Unit* passenger = E->CHECKOBJ(2); int8 seatId = E->CHECKVAL(3); -#if defined CATA - vehicle->AddVehiclePassenger(passenger, seatId); -#else vehicle->AddPassenger(passenger, seatId); -#endif return 0; } diff --git a/methods/TrinityCore/WorldObjectMethods.h b/methods/TrinityCore/WorldObjectMethods.h index 4b7710379c..d7274a73a5 100644 --- a/methods/TrinityCore/WorldObjectMethods.h +++ b/methods/TrinityCore/WorldObjectMethods.h @@ -43,12 +43,7 @@ namespace LuaWorldObject */ int GetPhaseMask(Eluna* E, WorldObject* obj) { -#if defined CATA - EventMap event; - E->Push(event.GetPhaseMask()); -#else E->Push(obj->GetPhaseMask()); -#endif return 1; } @@ -61,13 +56,9 @@ namespace LuaWorldObject int SetPhaseMask(Eluna* E, WorldObject* obj) { uint32 phaseMask = E->CHECKVAL(2); -#if defined CATA - EventMap event; - event.SetPhase(phaseMask); -#else bool update = E->CHECKVAL(3, true); + obj->SetPhaseMask(phaseMask, update); -#endif return 0; } @@ -604,20 +595,12 @@ namespace LuaWorldObject WorldObject* target = E->CHECKOBJ(2, false); if (target) -#if defined CATA - E->Push(obj->GetAngle(target)); -#else E->Push(obj->GetAbsoluteAngle(target)); -#endif else { float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); -#if defined CATA - E->Push(obj->GetAngle(x, y)); -#else E->Push(obj->GetAbsoluteAngle(x, y)); -#endif } return 1; @@ -657,11 +640,8 @@ namespace LuaWorldObject uint32 respawnDelay = E->CHECKVAL(7, 30); QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); -#if defined CATA - E->Push(obj->SummonGameObject(entry, x, y, z, o, rot, respawnDelay)); -#else + E->Push(obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay))); -#endif return 1; } @@ -732,11 +712,7 @@ namespace LuaWorldObject return luaL_argerror(E->L, 7, "valid SpawnType expected"); } -#if defined CATA - E->Push(obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); -#else E->Push(obj->SummonCreature(entry, x, y, z, o, type, Milliseconds(despawnTimer))); -#endif return 1; }