diff --git a/methods/VMangos/MapMethods.h b/methods/VMangos/MapMethods.h index d88a00ced3..18a77ae9aa 100644 --- a/methods/VMangos/MapMethods.h +++ b/methods/VMangos/MapMethods.h @@ -17,19 +17,6 @@ namespace LuaMap { -#ifndef CLASSIC - /** - * Returns `true` if the [Map] is an arena [BattleGround], `false` otherwise. - * - * @return bool isArena - */ - int IsArena(Eluna* E, Map* map) - { - E->Push(map->IsBattleArena()); - return 1; - } -#endif - /** * Returns `true` if the [Map] is a non-arena [BattleGround], `false` otherwise. * @@ -63,19 +50,6 @@ namespace LuaMap return 1; } -#ifndef CLASSIC - /** - * Returns `true` if the [Map] is a heroic, `false` otherwise. - * - * @return bool isHeroic - */ - int IsHeroic(Eluna* E, Map* map) - { - E->Push(map->IsHeroic()); - return 1; - } -#endif - /** * Returns `true` if the [Map] is a raid, `false` otherwise. * diff --git a/methods/VMangos/PlayerMethods.h b/methods/VMangos/PlayerMethods.h index 98fab50fac..041a525a41 100644 --- a/methods/VMangos/PlayerMethods.h +++ b/methods/VMangos/PlayerMethods.h @@ -12,58 +12,6 @@ */ namespace LuaPlayer { -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Returns 'true' if the [Player] can Titan Grip, 'false' otherwise. - * - * @return bool canTitanGrip - */ - int CanTitanGrip(Eluna* E, Player* player) - { - E->Push(player->CanTitanGrip()); - return 1; - } - - /** - * Returns 'true' if the [Player] has a talent by ID in specified spec, 'false' otherwise. - * - * @param uint32 spellId : talent spellId to check - * @param uint8 spec : specified spec. 0 for primary, 1 for secondary. - * @return bool hasTalent - */ - int HasTalent(Eluna* E, Player* player) - { - uint32 spellId = E->CHECKVAL(2); -#ifdef MANGOS - uint8 maxSpecs = MAX_TALENT_SPEC_COUNT; -#else - uint8 maxSpecs = MAX_TALENT_SPECS; -#endif - uint8 spec = E->CHECKVAL(3); - if (spec >= maxSpecs) - return 1; - E->Push(player->HasTalent(spellId, spec)); - return 1; - } - - /** - * Returns 'true' if the [Player] has completed the specified achievement, 'false' otherwise. - * - * @param uint32 achievementId - * @return bool hasAchieved - */ - int HasAchieved(Eluna* E, Player* player) - { - uint32 achievementId = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - E->Push(player->HasAchieved(achievementId)); -#else - E->Push(player->GetAchievementMgr().HasAchievement(achievementId)); -#endif - return 1; - } -#endif - /** * Returns 'true' if the [Player] has an active [Quest] by specific ID, 'false' otherwise. * @@ -133,23 +81,6 @@ namespace LuaPlayer E->Push(player->HasQuestForGO(entry)); return 1; } - -#ifndef CLASSIC - /** - * Returns 'true' if the [Player] has a title by specific ID, 'false' otherwise. - * - * @param uint32 titleId - * @return bool hasTitle - */ - int HasTitle(Eluna* E, Player* player) - { - uint32 id = E->CHECKVAL(2); - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); - if (titleInfo) - E->Push(player->HasTitle(titleInfo)); - return 1; - } -#endif /** * Returns 'true' if the [Player] has the given amount of item entry specified, 'false' otherwise. @@ -259,20 +190,6 @@ namespace LuaPlayer return 1; } -#ifndef CLASSIC - /** - * Returns 'true' if the [Player] can fly, 'false' otherwise. - * - * @return bool canFly - */ - int CanFly(Eluna* E, Player* player) - { - E->Push(player->CanFly()); - return 1; - } -#endif - -#ifdef CLASSIC /** * Returns [Player] kills * @@ -308,7 +225,6 @@ namespace LuaPlayer E->Push(player->GetHonorMgr().GetStanding()); // TODO: Probably not exactly what we need. Not week-based(?) return 1; } -#endif /** * Returns 'true' if the [Player] is currently in water, 'false' otherwise. @@ -332,7 +248,6 @@ namespace LuaPlayer return 1; } -#ifdef CLASSIC /** * Updates the [Player]s weekly honor status */ @@ -359,20 +274,6 @@ namespace LuaPlayer player->GetHonorMgr().ClearHonorData(); // TODO: Probably not exactly what we need. Not week-based return 0; } -#endif - -#ifndef CLASSIC - /** - * Returns 'true' if the [Player] is currently flying, 'false' otherwise. - * - * @return bool isFlying - */ - int IsFlying(Eluna* E, Player* player) // enable for unit when mangos support it - { - E->Push(player->IsFlying()); - return 1; - } -#endif /** * Returns 'true' if the [Player] is in a [Group], 'false' otherwise. @@ -408,24 +309,6 @@ namespace LuaPlayer E->Push(player->IsGameMaster()); return 1; } - -#ifndef CLASSIC - /** - * Returns 'true' if the [Player] is in an arena team specified by type, 'false' otherwise. - * - * @param uint32 type - * @return bool isInArenaTeam - */ - int IsInArenaTeam(Eluna* E, Player* player) - { - uint32 type = E->CHECKVAL(2); - if (type < MAX_ARENA_SLOT && player->GetArenaTeamId(type)) - E->Push(true); - else - E->Push(false); - return 1; - } -#endif /** * Returns 'true' if the [Player] is immune to everything. @@ -624,19 +507,6 @@ namespace LuaPlayer return 1; } -#ifndef CLASSIC - /** - * Returns 'true' if the [Player] is currently in an arena, 'false' otherwise. - * - * @return bool inArena - */ - int InArena(Eluna* E, Player* player) - { - E->Push(player->InArena()); - return 1; - } -#endif - /** * Returns 'true' if the [Player] is currently in a [BattleGround], 'false' otherwise. * @@ -729,67 +599,6 @@ namespace LuaPlayer return 1; }*/ -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Returns the amount of available specs the [Player] currently has - * - * @return uint8 specCount - */ - int GetSpecsCount(Eluna* E, Player* player) - { - E->Push(player->GetSpecsCount()); - return 1; - } - - /** - * Returns the [Player]s active spec ID - * - * @return uint32 specId - */ - int GetActiveSpec(Eluna* E, Player* player) - { - E->Push(player->GetActiveSpec()); - return 1; - } -#endif - -#ifdef WOTLK - /** - * Returns the normal phase of the player instead of the actual phase possibly containing GM phase - * - * @return uint32 phasemask - */ - int GetPhaseMaskForSpawn(Eluna* E, Player* player) - { - E->Push(player->GetPhaseMaskForSpawn()); - return 1; - } -#endif - -#if defined(TBC) || defined (WOTLK) - /** - * Returns the [Player]s current amount of Arena Points - * - * @return uint32 arenaPoints - */ - int GetArenaPoints(Eluna* E, Player* player) - { - E->Push(player->GetArenaPoints()); - return 1; - } - - /** - * Returns the [Player]s current amount of Honor Points - * - * @return uint32 honorPoints - */ - int GetHonorPoints(Eluna* E, Player* player) - { - E->Push(player->GetHonorPoints()); - return 1; - } -#endif -#if defined(CLASSIC) || defined(TBC) || defined (WOTLK) /** * Returns the [Player]s current shield block value * @@ -800,7 +609,6 @@ namespace LuaPlayer E->Push(player->GetShieldBlockValue()); return 1; } -#endif /** * Returns the [Player]s cooldown delay by specified [Spell] ID @@ -827,19 +635,6 @@ namespace LuaPlayer return 1; } -#if defined TRINITY || AZEROTHCORE - /** - * Returns the faction ID the [Player] is currently flagged as champion for - * - * @return uint32 championingFaction - */ - int GetChampioningFaction(Eluna* E, Player* player) - { - E->Push(player->GetChampioningFaction()); - return 1; - } -#endif - /** * Returns [Player]s original sub group * @@ -1688,11 +1483,7 @@ namespace LuaPlayer uint16 currVal = E->CHECKVAL(4); uint16 maxVal = E->CHECKVAL(5); -#ifdef TRINITY - player->SetSkill(id, step, currVal, maxVal); -#else player->SetSkill(id, currVal, maxVal, step); -#endif return 0; } @@ -1722,9 +1513,6 @@ namespace LuaPlayer uint32 points = E->CHECKVAL(2); player->SetFreeTalentPoints(points); -#if (!defined(TBC) && !defined(CLASSIC)) - player->SendTalentsInfoData(false); -#endif return 0; } @@ -1882,33 +1670,6 @@ namespace LuaPlayer return 0; } -#if defined(TBC) || defined(WOTLK) - /** - * Sets the [Player]s Arena Points to the amount specified - * - * @param uint32 arenaPoints - */ - int SetArenaPoints(Eluna* E, Player* player) - { - uint32 arenaP = E->CHECKVAL(2); - player->SetArenaPoints(arenaP); - return 0; - } - - /** - * Sets the [Player]s Honor Points to the amount specified - * - * @param uint32 honorPoints - */ - int SetHonorPoints(Eluna* E, Player* player) - { - uint32 honorP = E->CHECKVAL(2); - player->SetHonorPoints(honorP); - return 0; - } -#endif - -#ifdef CLASSIC /** * Sets kills * @@ -1956,7 +1717,6 @@ namespace LuaPlayer player->GetHonorMgr().SetStanding(standingPos); // Not sure if this is correct, not mentioned explicitly as week-based. return 0; } -#endif /** * Sets the [Player]s amount of Lifetime Honorable Kills to the value specified @@ -2000,49 +1760,11 @@ namespace LuaPlayer uint32 areaId = E->CHECKVAL(6); WorldLocation loc(mapId, x, y, z); -#if defined TRINITY || AZEROTHCORE - player->SetHomebind(loc, areaId); -#else - player->SetHomebindToLocation(loc, areaId); -#endif - return 0; - } -#ifndef CLASSIC - /** - * Adds the specified title to the [Player]s list of known titles - * - * @param uint32 titleId - */ - int SetKnownTitle(Eluna* E, Player* player) - { - uint32 id = E->CHECKVAL(2); - CharTitlesEntry const* t = sCharTitlesStore.LookupEntry(id); - if (t) - player->SetTitle(t, false); - return 0; - } - - -#if defined(TRINITY) || defined(AZEROTHCORE) - /** - * Adds the specified achievement to the [Player]s - * - * @param uint32 achievementid - */ - int SetAchievement(Eluna* E, Player* player) - { - uint32 id = E->CHECKVAL(2); - AchievementEntry const* t = sAchievementStore.LookupEntry(id); - if (t) - player->CompletedAchievement(t); + player->SetHomebindToLocation(loc, areaId); return 0; } -#endif - -#endif -#if !defined TRINITY && !AZEROTHCORE /** * Toggle the [Player]s FFA flag * @@ -2051,14 +1773,10 @@ namespace LuaPlayer int SetFFA(Eluna* E, Player* player) { bool apply = E->CHECKVAL(2, true); -#ifdef CMANGOS - player->SetPvPFreeForAll(apply); -#else + player->SetFFAPvP(apply); -#endif return 0; } -#endif /*int SetMovement(Eluna* E, Player* player) { @@ -2067,38 +1785,6 @@ namespace LuaPlayer player->SetMovement((PlayerMovementType)pType); return 0; }*/ - -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Resets the [Player]s pets talent points - */ - int ResetPetTalents(Eluna* /*E*/, Player* player) - { -#ifndef TRINITY - Pet* pet = player->GetPet(); - Pet::resetTalentsForAllPetsOf(player, pet); - if (pet) - player->SendTalentsInfoData(true); -#else - player->ResetPetTalents(); - player->SendTalentsInfoData(true); -#endif - return 0; - } - - /** - * Reset the [Player]s completed achievements - */ - int ResetAchievements(Eluna* /*E*/, Player* player) - { -#if defined TRINITY || AZEROTHCORE - player->ResetAchievements(); -#else - player->GetAchievementMgr().Reset(); -#endif - return 0; - } -#endif /** * Shows the mailbox window to the player from specified guid. @@ -2109,54 +1795,18 @@ namespace LuaPlayer { ObjectGuid guid = E->CHECKVAL(2, player->GET_GUID()); -#if (defined(CLASSIC) || defined(TBC)) WorldPacket data(CMSG_GET_MAIL_LIST, 8); data << guid; player->GetSession()->HandleGetMailList(data); -#else - player->GetSession()->SendShowMailBox(guid); -#endif - return 0; - } - -#if defined(TBC) || defined(WOTLK) - /** - * Adds or detracts from the [Player]s current Arena Points - * - * @param int32 amount - */ - int ModifyArenaPoints(Eluna* E, Player* player) - { - int32 amount = E->CHECKVAL(2); - - player->ModifyArenaPoints(amount); - return 0; - } - - /** - * Adds or detracts from the [Player]s current Honor Points - * - * @param int32 amount - */ - int ModifyHonorPoints(Eluna* E, Player* player) - { - int32 amount = E->CHECKVAL(2); - - player->ModifyHonorPoints(amount); return 0; } -#endif /** * Saves the [Player] to the database */ int SaveToDB(Eluna* /*E*/, Player* player) { -#ifndef AZEROTHCORE player->SaveToDB(); -#else - player->SaveToDB(false, false); -#endif return 0; } @@ -2169,27 +1819,16 @@ namespace LuaPlayer { Unit* summoner = E->CHECKOBJ(2); -#ifdef TRINITY - player->SendSummonRequestFrom(summoner); -#else float x, y, z; summoner->GetPosition(x,y,z); -#ifndef CMANGOS player->SetSummonPoint(summoner->GetMapId(), x, y, z); -#else - player->SetSummonPoint(summoner->GetMapId(), x, y, z, summoner->GetMasterGuid()); -#endif WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4); data << summoner->GET_GUID(); data << uint32(summoner->GetZoneId()); data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); -#ifdef CMANGOS - player->GetSession()->SendPacket(data); -#else + player->GetSession()->SendPacket(&data); -#endif -#endif return 0; } @@ -2239,27 +1878,15 @@ namespace LuaPlayer { Unit* unit = E->CHECKOBJ(2); -#if defined(TRINITY) || defined(AZEROTHCORE) - AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction()); -#else AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit); -#endif if (!ahEntry) return 0; WorldPacket data(MSG_AUCTION_HELLO, 12); data << unit->GET_GUID(); -#ifdef TRINITY - data << uint32(ahEntry->ID); -#else data << uint32(ahEntry->houseId); -#endif data << uint8(1); -#ifdef CMANGOS - player->GetSession()->SendPacket(data); -#else player->GetSession()->SendPacket(&data); -#endif return 0; } @@ -2333,11 +1960,7 @@ namespace LuaPlayer { Creature* obj = E->CHECKOBJ(2); -#ifdef TRINITY - player->GetSession()->SendTrainerList(obj); -#else player->GetSession()->SendTrainerList(obj->GET_GUID()); -#endif return 0; } @@ -2350,12 +1973,7 @@ namespace LuaPlayer { Player* plr = E->CHECKOBJ(2); -#if defined TRINITY || AZEROTHCORE - if (Guild* guild = player->GetGuild()) - guild->HandleInviteMember(player->GetSession(), plr->GetName()); -#else player->GetSession()->SendGuildInvite(plr); -#endif return 0; } @@ -2382,11 +2000,7 @@ namespace LuaPlayer int LogoutPlayer(Eluna* E, Player* player) { bool save = E->CHECKVAL(2, true); -#ifndef CMANGOS player->GetSession()->LogoutPlayer(save); -#else - player->GetSession()->LogoutPlayer(); -#endif return 0; } @@ -2395,11 +2009,7 @@ namespace LuaPlayer */ int RemoveFromBattlegroundRaid(Eluna* /*E*/, Player* player) { -#if defined TRINITY || AZEROTHCORE - player->RemoveFromBattlegroundOrBattlefieldRaid(); -#else player->RemoveFromBattleGroundRaid(); -#endif return 0; } @@ -2414,18 +2024,7 @@ namespace LuaPlayer int UnbindInstance(Eluna* E, Player* player) { uint32 map = E->CHECKVAL(2); -#ifndef CLASSIC - uint32 difficulty = E->CHECKVAL(3, 0); - - if (difficulty < MAX_DIFFICULTY) -#ifndef AZEROTHCORE - player->UnbindInstance(map, (Difficulty)difficulty); -#else - sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), map, Difficulty(difficulty), true, player); -#endif//AZEROTHCORE -#else//CLASSIC player->UnbindInstance(map); -#endif return 0; } @@ -2434,7 +2033,6 @@ namespace LuaPlayer */ int UnbindAllInstances(Eluna* /*E*/, Player* player) { -#ifdef CLASSIC Player::BoundInstancesMap& binds = player->GetBoundInstances(); for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) { @@ -2443,36 +2041,6 @@ namespace LuaPlayer else ++itr; } -#elif defined AZEROTHCORE - for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) - { - const BoundInstancesMap& binds = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUID(), Difficulty(i)); - for (BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end();) - { - if (itr->first != player->GetMapId()) - { - sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), itr->first, Difficulty(i), true, player); - itr = binds.begin(); - } - else - { - ++itr; - } - } - } -#else - for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) - { - Player::BoundInstancesMap& binds = player->GetBoundInstances(Difficulty(i)); - for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) - { - if (itr->first != player->GetMapId()) - player->UnbindInstance(itr, Difficulty(i)); - else - ++itr; - } - } -#endif return 0; } @@ -2501,13 +2069,7 @@ namespace LuaPlayer bool takeCost = E->CHECKVAL(3, true); float discountMod = E->CHECKVAL(4, 1.0f); -#ifdef CLASSIC - player->DurabilityRepair(position, takeCost, discountMod); -#elif defined(TRINITY) player->DurabilityRepair(position, takeCost, discountMod); -#else - player->DurabilityRepair(position, takeCost, discountMod, false); -#endif return 0; } @@ -2524,11 +2086,7 @@ namespace LuaPlayer float discountMod = E->CHECKVAL(3, 1.0f); bool guildBank = E->CHECKVAL(4, false); -#ifdef CLASSIC player->DurabilityRepairAll(takeCost, discountMod); -#else - player->DurabilityRepairAll(takeCost, discountMod, guildBank); -#endif return 0; } @@ -2792,13 +2350,8 @@ namespace LuaPlayer // Add quest items for quests that require items for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x) { -#if defined TRINITY || AZEROTHCORE - uint32 id = quest->RequiredItemId[x]; - uint32 count = quest->RequiredItemCount[x]; -#else uint32 id = quest->ReqItemId[x]; uint32 count = quest->ReqItemCount[x]; -#endif if (!id || !count) continue; @@ -2817,20 +2370,6 @@ namespace LuaPlayer // All creature/GO slain/cast (not required, but otherwise it will display "Creature slain 0/10") for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { -#if defined TRINITY || AZEROTHCORE - int32 creature = quest->RequiredNpcOrGo[i]; - uint32 creatureCount = quest->RequiredNpcOrGoCount[i]; - - if (creature > 0) - { - if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature)) - for (uint16 z = 0; z < creatureCount; ++z) - player->KilledMonster(creatureInfo, ObjectGuid::Empty); - } - else if (creature < 0) - for (uint16 z = 0; z < creatureCount; ++z) - player->KillCreditGO(creature); -#else int32 creature = quest->ReqCreatureOrGOId[i]; uint32 creaturecount = quest->ReqCreatureOrGOCount[i]; @@ -2843,18 +2382,13 @@ namespace LuaPlayer { if (CreatureInfo const* cInfo = sObjectMgr.GetCreatureTemplate(creature)) for (uint16 z = 0; z < creaturecount; ++z) -#ifndef CMANGOS player->KilledMonster(cInfo, ObjectGuid()); -#else - player->KilledMonster(cInfo, nullptr); -#endif } else if (creature < 0) { for (uint16 z = 0; z < creaturecount; ++z) player->CastedCreatureOrGO(-creature, ObjectGuid(), 0); } -#endif } @@ -2868,36 +2402,11 @@ namespace LuaPlayer player->GetReputationMgr().SetReputation(factionEntry, repValue); } -#if defined TRINITY || AZEROTHCORE - // If the quest requires a SECOND reputation to complete - if (uint32 repFaction = quest->GetRepObjectiveFaction2()) - { - uint32 repValue2 = quest->GetRepObjectiveValue2(); - uint32 curRep = player->GetReputationMgr().GetReputation(repFaction); - if (curRep < repValue2) - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction)) - player->GetReputationMgr().SetReputation(factionEntry, repValue2); - } -#endif - // If the quest requires money int32 ReqOrRewMoney = quest->GetRewOrReqMoney(); if (ReqOrRewMoney < 0) player->ModifyMoney(-ReqOrRewMoney); -#ifdef TRINITY - if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled - { - // prepare Quest Tracker datas - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE); - stmt->setUInt32(0, quest->GetQuestId()); - stmt->setUInt32(1, player->GetGUID().GetCounter()); - - // add to Quest Tracker - CharacterDatabase.Execute(stmt); - } -#endif - player->CompleteQuest(entry); return 0; } @@ -2976,16 +2485,8 @@ namespace LuaPlayer { std::string text = E->CHECKVAL(2); uint32 lang = E->CHECKVAL(3); -#ifdef TRINITY - Player* receiver = E->CHECKOBJ(4); -#else ObjectGuid guid = E->CHECKVAL(4); -#endif -#if defined(TRINITY) || defined(AZEROTHCORE) - player->Whisper(text, (Language)lang, receiver); -#else player->Whisper(text, lang, guid); -#endif return 0; } @@ -3012,11 +2513,8 @@ namespace LuaPlayer { std::string text = E->CHECKVAL(2); uint32 lang = E->CHECKVAL(3); -#if defined(TRINITY) || defined(AZEROTHCORE) - player->Yell(text, (Language)lang); -#else + player->Yell(text.c_str(), lang); -#endif return 0; } @@ -3030,11 +2528,7 @@ namespace LuaPlayer { std::string text = E->CHECKVAL(2); uint32 lang = E->CHECKVAL(3); -#if defined(TRINITY) || defined(AZEROTHCORE) - player->Say(text, (Language)lang); -#else player->Say(text.c_str(), lang); -#endif return 0; } @@ -3049,11 +2543,7 @@ namespace LuaPlayer uint32 xp = E->CHECKVAL(2); Unit* victim = E->CHECKOBJ(3, false); -#ifndef CMANGOS player->GiveXP(xp, victim); -#else - player->GiveXP(xp, nullptr); -#endif return 0; } @@ -3139,9 +2629,6 @@ namespace LuaPlayer return 1; } player->ItemAddedQuestCheck(entry, 1); -#if (!defined(TBC) && !defined(CLASSIC)) - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, entry, 1); -#endif } else { @@ -3201,32 +2688,12 @@ namespace LuaPlayer return 1; } -#ifndef CLASSIC - /** - * Removes a title by ID from the [Player]s list of known titles - * - * @param uint32 titleId - */ - int UnsetKnownTitle(Eluna* E, Player* player) - { - uint32 id = E->CHECKVAL(2); - CharTitlesEntry const* t = sCharTitlesStore.LookupEntry(id); - if (t) - player->SetTitle(t, true); - return 0; - } -#endif - /** * Advances all of the [Player]s weapon skills to the maximum amount available */ int AdvanceSkillsToMax(Eluna* /*E*/, Player* player) { -#ifdef TRINITY - player->UpdateWeaponsSkillsToMaxSkillsForLevel(); -#else player->UpdateSkillsToMaxSkillsForLevel(); -#endif return 0; } @@ -3246,19 +2713,11 @@ namespace LuaPlayer { if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(i)) { -#ifdef TRINITY - if (entry->CategoryID == SKILL_CATEGORY_LANGUAGES || entry->CategoryID == SKILL_CATEGORY_GENERIC) - continue; - - if (player->HasSkill(entry->ID)) - player->UpdateSkill(entry->ID, step); -#else if (entry->categoryId == SKILL_CATEGORY_LANGUAGES || entry->categoryId == SKILL_CATEGORY_GENERIC) continue; if (player->HasSkill(entry->id)) player->UpdateSkill(entry->id, step); -#endif } } @@ -3328,26 +2787,7 @@ namespace LuaPlayer uint32 itemId = E->CHECKVAL(2); uint32 itemCount = E->CHECKVAL(3, 1); -#if defined TRINITY || AZEROTHCORE - uint32 noSpaceForCount = 0; - ItemPosCountVec dest; - InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount); - if (msg != EQUIP_ERR_OK) - itemCount -= noSpaceForCount; - - if (itemCount == 0 || dest.empty()) - return 1; -#ifndef AZEROTHCORE - Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId)); -#else - Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); -#endif - if (item) - player->SendNewItem(item, itemCount, true, false); - E->Push(item); -#else E->Push(player->StoreNewItemInInventorySlot(itemId, itemCount)); -#endif return 1; } @@ -3422,19 +2862,7 @@ namespace LuaPlayer bool update = E->CHECKVAL(3, true); (void)update; // ensure that the variable is referenced in order to pass compiler checks -#ifdef TRINITY - player->GetSpellHistory()->ResetCooldowns([category](SpellHistory::CooldownStorageType::iterator itr) -> bool - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - return spellInfo && spellInfo->GetCategory() == category; - }, update); -#else -#ifndef AZEROTHCORE player->RemoveSpellCategoryCooldown(category, update); -#else - player->RemoveCategoryCooldown(category); -#endif -#endif return 0; } @@ -3443,13 +2871,7 @@ namespace LuaPlayer */ int ResetAllCooldowns(Eluna* /*E*/, Player* player) { -#ifdef TRINITY - player->GetSpellHistory()->ResetAllCooldowns(); -#elif CMANGOS - player->RemoveAllCooldowns(); -#else player->RemoveAllSpellCooldown(); -#endif return 0; } @@ -3502,17 +2924,10 @@ namespace LuaPlayer { WorldPacket* data = E->CHECKOBJ(2); bool selfOnly = E->CHECKVAL(3, true); -#ifdef CMANGOS - if (selfOnly) - player->GetSession()->SendPacket(*data); - else - player->SendMessageToSet(*data, true); -#else if (selfOnly) player->GetSession()->SendPacket(data); else player->SendMessageToSet(data, true); -#endif return 0; } @@ -3538,18 +2953,10 @@ namespace LuaPlayer data << uint8(channel); data << int32(LANG_ADDON); data << player->GET_GUID(); -#ifndef CLASSIC - data << uint32(0); - data << receiver->GET_GUID(); -#endif data << uint32(fullmsg.length() + 1); data << fullmsg; data << uint8(0); -#ifdef CMANGOS - receiver->GetSession()->SendPacket(data); -#else receiver->GetSession()->SendPacket(&data); -#endif return 0; } @@ -3558,11 +2965,7 @@ namespace LuaPlayer */ int KickPlayer(Eluna* /*E*/, Player* player) { -#ifdef TRINITY - player->GetSession()->KickPlayer("PlayerMethods::KickPlayer Kick the player"); -#else player->GetSession()->KickPlayer(); -#endif return 0; } @@ -3660,19 +3063,7 @@ namespace LuaPlayer bool _code = E->CHECKVAL(6, false); const char* _promptMsg = E->CHECKVAL(7, ""); uint32 _money = E->CHECKVAL(8, 0); -#if defined(TRINITY) - player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, GossipOptionIcon(_icon), msg, _sender, _intid, _promptMsg, _money, _code); -#elif defined(AZEROTHCORE) - player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money, _code); -#elif defined(CMANGOS) && !defined(CLASSIC) - player->GetPlayerMenu()->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code); -#elif defined(CMANGOS) && defined(CLASSIC) - player->GetPlayerMenu()->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _code); -#elif !defined(CLASSIC) && !defined(CMANGOS) - player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code); -#else player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _code); -#endif return 0; } @@ -3683,13 +3074,7 @@ namespace LuaPlayer */ int GossipComplete(Eluna* /*E*/, Player* player) { -#if defined TRINITY || AZEROTHCORE - player->PlayerTalkClass->SendCloseGossip(); -#elif CMANGOS - player->GetPlayerMenu()->CloseGossip(); -#else player->PlayerTalkClass->CloseGossip(); -#endif return 0; } @@ -3714,17 +3099,9 @@ namespace LuaPlayer if (sender->GetTypeId() == TYPEID_PLAYER) { uint32 menu_id = E->CHECKVAL(4); -#ifndef CMANGOS player->PlayerTalkClass->GetGossipMenu().SetMenuId(menu_id); -#else - player->GetPlayerMenu()->GetGossipMenu().SetMenuId(menu_id); -#endif } -#ifndef CMANGOS player->PlayerTalkClass->SendGossipMenu(npc_text, sender->GET_GUID()); -#else - player->GetPlayerMenu()->SendGossipMenu(npc_text, sender->GET_GUID()); -#endif return 0; } @@ -3738,11 +3115,7 @@ namespace LuaPlayer */ int GossipClearMenu(Eluna* /*E*/, Player* player) { -#ifndef CMANGOS player->PlayerTalkClass->ClearMenus(); -#else - player->GetPlayerMenu()->ClearMenus(); -#endif return 0; } @@ -3785,11 +3158,7 @@ namespace LuaPlayer packet << icon; packet << data; packet << iconText; -#ifdef CMANGOS - player->GetSession()->SendPacket(packet); -#else player->GetSession()->SendPacket(&packet); -#endif return 0; } @@ -3830,11 +3199,7 @@ namespace LuaPlayer if (!quest) return 0; -#ifndef CMANGOS player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept); -#else - player->GetPlayerMenu()->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept); -#endif return 0; } @@ -3877,11 +3242,7 @@ namespace LuaPlayer // Get correct existing group if any Group* group = player->GetGroup(); -#ifndef CMANGOS if (group && group->isBGGroup()) -#else - if (group && group->IsBattleGroup()) -#endif group = player->GetOriginalGroup(); bool success = false; @@ -3900,27 +3261,9 @@ namespace LuaPlayer if (success) { -#if defined(CLASSIC) || defined(TBC) WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size data << player->GetName(); -#ifdef CMANGOS - invited->GetSession()->SendPacket(data); -#else - invited->GetSession()->SendPacket(&data); -#endif -#else - WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size - data << uint8(1); // invited/already in group flag - data << player->GetName(); // max len 48 - data << uint32(0); // unk - data << uint8(0); // count - data << uint32(0); // unk -#ifdef CMANGOS - invited->GetSession()->SendPacket(data); -#else invited->GetSession()->SendPacket(&data); -#endif -#endif } E->Push(success); @@ -3957,24 +3300,13 @@ namespace LuaPlayer if (!group->IsCreated()) { group->RemoveInvite(player); -#if defined TRINITY || AZEROTHCORE - group->Create(player); - sGroupMgr->AddGroup(group); -#else if (!group->Create(group->GetLeaderGuid(), group->GetLeaderName())) return 0; sObjectMgr.AddGroup(group); -#endif } -#if defined TRINITY || AZEROTHCORE - if (!group->AddMember(invited)) - return 0; - group->BroadcastGroupUpdate(); -#else if (!group->AddMember(invited->GetObjectGuid(), invited->GetName())) return 0; -#endif E->Push(group); return 1; } @@ -3992,21 +3324,6 @@ namespace LuaPlayer return 0; } -#if !defined(CLASSIC) && !defined(TBC) - /** - * Starts a movie for the [Player] - * - * @param uint32 MovieId : entry of a movie - */ - int SendMovieStart(Eluna* E, Player* player) - { - uint32 MovieId = E->CHECKVAL(2); - - player->SendMovieStart(MovieId); - return 0; - } -#endif - /*int BindToInstance(Eluna* E, Player* player) { player->BindToInstance(); @@ -4153,22 +3470,9 @@ namespace LuaPlayer { "GetGossipTextId", &LuaPlayer::GetGossipTextId }, { "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus }, { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, -#if defined(CLASSIC) { "GetHonorStoredKills", &LuaPlayer::GetHonorStoredKills }, { "GetRankPoints", &LuaPlayer::GetRankPoints }, { "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos }, -#endif -#if defined(TBC) || defined (WOTLK) - { "GetArenaPoints", &LuaPlayer::GetArenaPoints }, - { "GetHonorPoints", &LuaPlayer::GetHonorPoints }, -#endif -#ifdef WOTLK - { "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn }, -#endif -#if (!defined(TBC) && !defined(CLASSIC)) - { "GetActiveSpec", &LuaPlayer::GetActiveSpec }, - { "GetSpecsCount", &LuaPlayer::GetSpecsCount }, -#endif // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, @@ -4196,19 +3500,9 @@ namespace LuaPlayer { "SetPlayerLock", &LuaPlayer::SetPlayerLock }, { "SetGender", &LuaPlayer::SetGender }, { "SetSheath", &LuaPlayer::SetSheath }, -#if defined(CLASSIC) { "SetHonorStoredKills", &LuaPlayer::SetHonorStoredKills }, { "SetRankPoints", &LuaPlayer::SetRankPoints }, { "SetHonorLastWeekStandingPos", &LuaPlayer::SetHonorLastWeekStandingPos }, -#endif -#ifndef CLASSIC - { "SetKnownTitle", &LuaPlayer::SetKnownTitle }, - { "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle }, -#endif -#if defined(TBC) || defined(WOTLK) - { "SetArenaPoints", &LuaPlayer::SetArenaPoints }, - { "SetHonorPoints", &LuaPlayer::SetHonorPoints }, -#endif // Boolean { "IsInGroup", &LuaPlayer::IsInGroup }, @@ -4254,19 +3548,6 @@ namespace LuaPlayer { "HasSpellCooldown", &LuaPlayer::HasSpellCooldown }, { "IsInWater", &LuaPlayer::IsInWater }, { "IsMoving", &LuaPlayer::IsMoving }, -#ifndef CLASSIC - { "HasTitle", &LuaPlayer::HasTitle }, - { "IsInArenaTeam", &LuaPlayer::IsInArenaTeam }, - { "InArena", &LuaPlayer::InArena }, - { "CanFly", &LuaPlayer::CanFly }, - { "IsFlying", &LuaPlayer::IsFlying }, -#endif -#if (!defined(TBC) && !defined(CLASSIC)) - { "HasAchieved", &LuaPlayer::HasAchieved }, - { "HasTalent", &LuaPlayer::HasTalent }, - { "CanTitanGrip", &LuaPlayer::CanTitanGrip }, -#endif - // Gossip { "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem }, @@ -4347,23 +3628,34 @@ namespace LuaPlayer { "GroupInvite", &LuaPlayer::GroupInvite, METHOD_REG_WORLD }, // World state method only in multistate { "GroupCreate", &LuaPlayer::GroupCreate, METHOD_REG_WORLD }, // World state method only in multistate { "SendCinematicStart", &LuaPlayer::SendCinematicStart }, -#if defined(CLASSIC) { "UpdateHonor", &LuaPlayer::UpdateHonor }, { "ResetHonor", &LuaPlayer::ResetHonor }, { "ClearHonorInfo", &LuaPlayer::ClearHonorInfo }, -#endif -#ifndef CLASSIC - { "RemoveArenaSpellCooldowns", &LuaPlayer::RemoveArenaSpellCooldowns }, -#endif -#if (!defined(TBC) && !defined(CLASSIC)) - { "ResetPetTalents", &LuaPlayer::ResetPetTalents }, - { "ResetAchievements", &LuaPlayer::ResetAchievements }, - { "SendMovieStart", &LuaPlayer::SendMovieStart }, -#endif -#if defined(TBC) || defined(WOTLK) - { "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints }, - { "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints }, -#endif + + // Not used in VMaNGOS + { "GetArenaPoints", METHOD_REG_NONE }, + { "GetHonorPoints", METHOD_REG_NONE }, + { "GetPhaseMaskForSpawn", METHOD_REG_NONE }, + { "GetActiveSpec", METHOD_REG_NONE }, + { "GetSpecsCount", METHOD_REG_NONE }, + { "RemoveArenaSpellCooldowns", METHOD_REG_NONE }, + { "ResetPetTalents", METHOD_REG_NONE }, + { "ResetAchievements", METHOD_REG_NONE }, + { "SendMovieStart", METHOD_REG_NONE }, + { "ModifyHonorPoints", METHOD_REG_NONE }, + { "ModifyArenaPoints", METHOD_REG_NONE }, + { "HasTitle", METHOD_REG_NONE }, + { "IsInArenaTeam", METHOD_REG_NONE }, + { "InArena", METHOD_REG_NONE }, + { "CanFly", METHOD_REG_NONE }, + { "IsFlying", METHOD_REG_NONE }, + { "HasAchieved", METHOD_REG_NONE }, + { "HasTalent", METHOD_REG_NONE }, + { "CanTitanGrip", METHOD_REG_NONE }, + { "SetKnownTitle", METHOD_REG_NONE }, + { "UnsetKnownTitle", METHOD_REG_NONE }, + { "SetArenaPoints", METHOD_REG_NONE }, + { "SetHonorPoints", METHOD_REG_NONE }, // Not implemented methods { "GetChampioningFaction", METHOD_REG_NONE }, // not implemented diff --git a/methods/VMangos/QuestMethods.h b/methods/VMangos/QuestMethods.h index c55d9d9afe..85c79df309 100644 --- a/methods/VMangos/QuestMethods.h +++ b/methods/VMangos/QuestMethods.h @@ -52,26 +52,10 @@ namespace LuaQuest int HasFlag(Eluna* E, Quest* quest) { uint32 flag = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - E->Push(quest->HasFlag(flag)); -#else - E->Push(quest->HasQuestFlag((QuestFlags)flag)); -#endif - return 1; - } -#ifndef CLASSIC - /** - * Returns 'true' if the [Quest] is a daily quest, false otherwise. - * - * @return bool isDaily - */ - int IsDaily(Eluna* E, Quest* quest) - { - E->Push(quest->IsDaily()); + E->Push(quest->HasQuestFlag((QuestFlags)flag)); return 1; } -#endif /** * Returns 'true' if the [Quest] is repeatable, false otherwise. @@ -157,11 +141,7 @@ namespace LuaQuest */ int GetFlags(Eluna* E, Quest* quest) { -#if defined TRINITY || AZEROTHCORE - E->Push(quest->GetFlags()); -#else E->Push(quest->GetQuestFlags()); -#endif return 1; } @@ -199,12 +179,10 @@ namespace LuaQuest // Boolean { "HasFlag", &LuaQuest::HasFlag }, { "IsRepeatable", &LuaQuest::IsRepeatable }, -#ifndef CLASSIC - { "IsDaily", &LuaQuest::IsDaily }, -#endif // Not implemented methods - { "GetMaxLevel", METHOD_REG_NONE } // not implemented + { "GetMaxLevel", METHOD_REG_NONE }, // not implemented + { "IsDaily",METHOD_REG_NONE } // not in VMaNGOS }; }; #endif diff --git a/methods/VMangos/SpellMethods.h b/methods/VMangos/SpellMethods.h index 1178816103..7657e9171f 100644 --- a/methods/VMangos/SpellMethods.h +++ b/methods/VMangos/SpellMethods.h @@ -76,11 +76,7 @@ namespace LuaSpell */ int GetDuration(Eluna* E, Spell* spell) { -#if defined TRINITY || AZEROTHCORE || defined VMANGOS E->Push(spell->GetSpellInfo()->GetDuration()); -#else - E->Push(GetSpellDuration(spell->m_spellInfo)); -#endif return 1; } @@ -93,17 +89,10 @@ namespace LuaSpell */ int GetTargetDest(Eluna* E, Spell* spell) { -#if defined TRINITY || AZEROTHCORE - if (!spell->m_targets.HasDst()) - return 3; - float x, y, z; - spell->m_targets.GetDstPos()->GetPosition(x, y, z); -#else if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) return 3; float x, y, z; spell->m_targets.getDestination(x, y, z); -#endif E->Push(x); E->Push(y); E->Push(z); @@ -124,18 +113,6 @@ namespace LuaSpell */ int GetTarget(Eluna* E, Spell* spell) { -#if defined TRINITY || AZEROTHCORE - if (GameObject* target = spell->m_targets.GetGOTarget()) - E->Push(target); - else if (Item* target = spell->m_targets.GetItemTarget()) - E->Push(target); - else if (Corpse* target = spell->m_targets.GetCorpseTarget()) - E->Push(target); - else if (Unit* target = spell->m_targets.GetUnitTarget()) - E->Push(target); - else if (WorldObject* target = spell->m_targets.GetObjectTarget()) - E->Push(target); -#else if (GameObject* target = spell->m_targets.getGOTarget()) E->Push(target); else if (Item* target = spell->m_targets.getItemTarget()) @@ -144,7 +121,6 @@ namespace LuaSpell E->Push(target); else if (Unit* target = spell->m_targets.getUnitTarget()) E->Push(target); -#endif return 1; } diff --git a/methods/VMangos/UnitMethods.h b/methods/VMangos/UnitMethods.h index feffa1f650..90a56abdb5 100644 --- a/methods/VMangos/UnitMethods.h +++ b/methods/VMangos/UnitMethods.h @@ -127,11 +127,7 @@ namespace LuaUnit */ int IsGuildMaster(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isGuildMaster()); -#else E->Push(unit->IsGuildMaster()); -#endif return 1; } @@ -142,11 +138,7 @@ namespace LuaUnit */ int IsInnkeeper(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isInnkeeper()); -#else E->Push(unit->IsInnkeeper()); -#endif return 1; } @@ -157,11 +149,7 @@ namespace LuaUnit */ int IsTrainer(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isTrainer()); -#else E->Push(unit->IsTrainer()); -#endif return 1; } @@ -172,11 +160,7 @@ namespace LuaUnit */ int IsGossip(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isGossip()); -#else E->Push(unit->IsGossip()); -#endif return 1; } @@ -187,11 +171,7 @@ namespace LuaUnit */ int IsTaxi(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isTaxi()); -#else E->Push(unit->IsTaxi()); -#endif return 1; } @@ -202,11 +182,7 @@ namespace LuaUnit */ int IsSpiritHealer(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isSpiritHealer()); -#else E->Push(unit->IsSpiritHealer()); -#endif return 1; } @@ -217,11 +193,7 @@ namespace LuaUnit */ int IsSpiritGuide(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isSpiritGuide()); -#else E->Push(unit->IsSpiritGuide()); -#endif return 1; } @@ -232,11 +204,7 @@ namespace LuaUnit */ int IsTabardDesigner(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isTabardDesigner()); -#else E->Push(unit->IsTabardDesigner()); -#endif return 1; } @@ -247,11 +215,7 @@ namespace LuaUnit */ int IsServiceProvider(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isServiceProvider()); -#else E->Push(unit->IsServiceProvider()); -#endif return 1; } @@ -262,11 +226,7 @@ namespace LuaUnit */ int IsSpiritService(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isSpiritService()); -#else E->Push(unit->IsSpiritService()); -#endif return 1; } @@ -310,11 +270,7 @@ namespace LuaUnit */ int IsBanker(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isBanker()); -#else E->Push(unit->IsBanker()); -#endif return 1; } @@ -325,11 +281,7 @@ namespace LuaUnit */ int IsVendor(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isVendor()); -#else E->Push(unit->IsVendor()); -#endif return 1; } @@ -340,11 +292,7 @@ namespace LuaUnit */ int IsBattleMaster(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isBattleMaster()); -#else E->Push(unit->IsBattleMaster()); -#endif return 1; } @@ -366,11 +314,7 @@ namespace LuaUnit */ int IsArmorer(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isArmorer()); -#else E->Push(unit->IsArmorer()); -#endif return 1; } @@ -396,23 +340,6 @@ namespace LuaUnit return 1; } -#ifndef CLASSIC - /** - * Returns true if the [Unit] is on a [Vehicle]. - * - * @return bool isOnVehicle - */ - int IsOnVehicle(Eluna* E, Unit* unit) - { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetVehicle()); -#else - E->Push(unit->IsBoarded()); -#endif - return 1; - } -#endif - /** * Returns true if the [Unit] is in combat. * @@ -464,11 +391,7 @@ namespace LuaUnit */ int IsQuestGiver(Eluna* E, Unit* unit) { -#ifdef CMANGOS - E->Push(unit->isQuestGiver()); -#else E->Push(unit->IsQuestGiver()); -#endif return 1; } @@ -517,11 +440,7 @@ namespace LuaUnit */ int IsCasting(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->HasUnitState(UNIT_STATE_CASTING)); -#else E->Push(unit->IsNonMeleeSpellCasted(false)); -#endif return 1; } @@ -574,11 +493,7 @@ namespace LuaUnit */ int GetOwnerGUID(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetOwnerGUID()); -#else E->Push(unit->GetOwnerGuid()); -#endif return 1; } @@ -589,11 +504,7 @@ namespace LuaUnit */ int GetMountId(Eluna* E, Unit* unit) { -#ifdef TRINITY - E->Push(unit->GetMountDisplayId()); -#else E->Push(unit->GetMountID()); -#endif return 1; } @@ -604,11 +515,7 @@ namespace LuaUnit */ int GetCreatorGUID(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetCreatorGUID()); -#else E->Push(unit->GetCreatorGuid()); -#endif return 1; } @@ -619,11 +526,7 @@ namespace LuaUnit */ int GetCharmerGUID(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetCharmerGUID()); -#else E->Push(unit->GetCharmerGuid()); -#endif return 1; } @@ -634,13 +537,7 @@ namespace LuaUnit */ int GetCharmGUID(Eluna* E, Unit* unit) { -#if defined AZEROTHCORE - E->Push(unit->GetCharmGUID()); -#elif defined TRINITY - E->Push(unit->GetCharmedGUID()); -#else E->Push(unit->GetCharmGuid()); -#endif return 1; } @@ -651,11 +548,7 @@ namespace LuaUnit */ int GetPetGUID(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetPetGUID()); -#else E->Push(unit->GetPetGuid()); -#endif return 1; } @@ -666,11 +559,7 @@ namespace LuaUnit */ int GetControllerGUID(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetCharmerOrOwnerGUID()); -#else E->Push(unit->GetCharmerOrOwnerGuid()); -#endif return 1; } @@ -681,11 +570,7 @@ namespace LuaUnit */ int GetControllerGUIDS(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetCharmerOrOwnerOrOwnGUID()); -#else E->Push(unit->GetCharmerOrOwnerOrOwnGuid()); -#endif return 1; } @@ -816,16 +701,8 @@ namespace LuaUnit Powers PowerSelectorHelper(Eluna* E, Unit* unit, int powerType = -1) { -#ifdef TRINITY - if (powerType == -1) - return unit->GetPowerType(); -#elif AZEROTHCORE - if (powerType == -1) - return unit->getPowerType(); -#else if (powerType == -1) return unit->GetPowerType(); -#endif if (powerType < 0 || powerType >= int(MAX_POWERS)) luaL_argerror(E->L, 2, "valid Powers expected"); @@ -916,11 +793,8 @@ namespace LuaUnit int type = E->CHECKVAL(2, -1); Powers power = PowerSelectorHelper(E, unit, type); -#if (!defined(TRINITY) && defined(WOTLK)) - float percent = ((float)unit->GetPower(power) / (float)unit->GetMaxPower(power)) * 100.0f; -#else float percent = ((float)unit->GetPower(power) / (float)unit->GetMaxPower(power)) * 100.0f; -#endif + E->Push(percent); return 1; } @@ -946,13 +820,7 @@ namespace LuaUnit */ int GetPowerType(Eluna* E, Unit* unit) { -#ifdef TRINITY - E->Push(unit->GetPowerType()); -#elif AZEROTHCORE - E->Push(unit->getPowerType()); -#else E->Push(unit->GetPowerType()); -#endif return 1; } @@ -974,11 +842,7 @@ namespace LuaUnit */ int GetHealthPct(Eluna* E, Unit* unit) { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetHealthPct()); -#else E->Push(unit->GetHealthPercent()); -#endif return 1; } @@ -1099,11 +963,7 @@ namespace LuaUnit if (!entry) return 1; -#ifdef TRINITY - E->Push(entry->Name[locale]); -#else E->Push(entry->name[locale]); -#endif return 1; } @@ -1138,11 +998,7 @@ namespace LuaUnit if (!entry) return 1; -#ifdef TRINITY - E->Push(entry->Name[locale]); -#else E->Push(entry->name[locale]); -#endif return 1; } @@ -1166,11 +1022,8 @@ namespace LuaUnit int GetAura(Eluna* E, Unit* unit) { uint32 spellID = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetAura(spellID)); -#else + E->Push(unit->GetAura(spellID, EFFECT_INDEX_0)); -#endif return 1; } @@ -1185,23 +1038,10 @@ namespace LuaUnit float range = E->CHECKVAL(2, SIZE_OF_GRIDS); std::list list; -#ifdef TRINITY - Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range); - Trinity::UnitListSearcher searcher(unit, list, checker); - Cell::VisitAllObjects(unit, searcher, range); -#elif AZEROTHCORE - Acore::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range); - Acore::UnitListSearcher searcher(unit, list, checker); - Cell::VisitAllObjects(unit, searcher, range); -#elif CMANGOS - MaNGOS::AnyFriendlyUnitInObjectRangeCheck checker(unit, range); - MaNGOS::UnitListSearcher searcher(list, checker); - Cell::VisitGridObjects(unit, searcher, range); -#else MaNGOS::AnyFriendlyUnitInObjectRangeCheck checker(unit, range); MaNGOS::UnitListSearcher searcher(list, checker); Cell::VisitGridObjects(unit, searcher, range); -#endif + ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); list.remove_if(guidCheck); @@ -1250,46 +1090,6 @@ namespace LuaUnit return 1; } -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Returns [Unit]'s [Vehicle] methods - * - * @return [Vehicle] vehicle - */ - int GetVehicleKit(Eluna* E, Unit* unit) - { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetVehicleKit()); -#else - E->Push(unit->GetVehicleInfo()); -#endif - return 1; - } - - /* - int GetVehicle(Eluna* E, Unit* unit) - { - E->Push(unit->GetVehicle()); - return 1; - } - */ - - /** - * Returns the Critter Guid - * - * @return ObjectGuid critterGuid - */ - int GetCritterGUID(Eluna* E, Unit* unit) - { -#if defined TRINITY || AZEROTHCORE - E->Push(unit->GetCritterGUID()); -#else - E->Push(unit->GetCritterGuid()); -#endif - return 1; - } -#endif - /** * Returns the [Unit]'s speed of given [UnitMoveType]. * @@ -1317,11 +1117,7 @@ namespace LuaUnit if (type >= MAX_MOVE_TYPE) return luaL_argerror(E->L, 2, "valid UnitMoveType expected"); -#ifndef TRINITY E->Push(unit->GetSpeedRate((UnitMoveType)type)); -#else - E->Push(unit->GetSpeed((UnitMoveType)type)); -#endif return 1; } @@ -1372,11 +1168,7 @@ namespace LuaUnit { ObjectGuid guid = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - unit->SetOwnerGUID(guid); -#else unit->SetOwnerGuid(guid); -#endif return 0; } @@ -1638,13 +1430,7 @@ namespace LuaUnit if (type >= int(MAX_POWERS)) return luaL_argerror(E->L, 2, "valid Powers expected"); -#ifdef TRINITY unit->SetPowerType((Powers)type); -#elif AZEROTHCORE - unit->setPowerType((Powers)type); -#else - unit->SetPowerType((Powers)type); -#endif return 0; } @@ -1704,11 +1490,8 @@ namespace LuaUnit int SetCreatorGUID(Eluna* E, Unit* unit) { ObjectGuid guid = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - unit->SetCreatorGUID(guid); -#else + unit->SetCreatorGuid(guid); -#endif return 0; } @@ -1720,11 +1503,9 @@ namespace LuaUnit int SetPetGUID(Eluna* E, Unit* unit) { ObjectGuid guid = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - unit->SetPetGUID(guid); -#else + unit->SetPetGuid(guid); -#endif + return 0; } @@ -1748,11 +1529,8 @@ namespace LuaUnit int SetStandState(Eluna* E, Unit* unit) { uint8 state = E->CHECKVAL(2); -#ifdef TRINITY - unit->SetStandState(UnitStandStateType(state)); -#else + unit->SetStandState(state); -#endif return 0; } @@ -1768,91 +1546,6 @@ namespace LuaUnit return 0; } -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Sets the [Unit]'s FFA flag on or off. - * - * @param bool apply = true - */ - int SetFFA(Eluna* E, Unit* unit) - { - bool apply = E->CHECKVAL(2, true); - -#ifdef TRINITY - if (apply) - { - unit->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - for (Unit::ControlList::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr) - (*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - } - else - { - unit->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - for (Unit::ControlList::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr) - (*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - } -#elif AZEROTHCORE - if (apply) - { - unit->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - for (Unit::ControlSet::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr) - (*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - } - else - { - unit->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - for (Unit::ControlSet::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr) - (*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - } -#elif CMANGOS - unit->SetPvPFreeForAll(apply); -#else - unit->SetFFAPvP(apply); -#endif - return 0; - } - - /** - * Sets the [Unit]'s sanctuary flag on or off. - * - * @param bool apply = true - */ - int SetSanctuary(Eluna* E, Unit* unit) - { - bool apply = E->CHECKVAL(2, true); - - if (apply) - { -#ifndef CMANGOS - unit->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); -#else - unit->SetPvPSanctuary(true); -#endif - unit->CombatStop(); - unit->CombatStopWithPets(); - } - else -#ifndef CMANGOS - unit->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); -#else - unit->SetPvPSanctuary(false); -#endif - - return 0; - } - - int SetCritterGUID(Eluna* E, Unit* unit) - { - ObjectGuid guid = E->CHECKVAL(2); -#if defined TRINITY || AZEROTHCORE - unit->SetCritterGUID(guid); -#else - unit->SetCritterGuid(guid); -#endif - return 0; - } -#endif - /*int SetStunned(Eluna* E, Unit* unit) { bool apply = E->CHECKVAL(2, true); @@ -1880,11 +1573,8 @@ namespace LuaUnit int SetConfused(Eluna* E, Unit* unit) { bool apply = E->CHECKVAL(2, true); -#if defined TRINITY || AZEROTHCORE - unit->SetControlled(apply, UNIT_STATE_CONFUSED); -#else + unit->SetConfused(apply); -#endif return 0; } @@ -1896,13 +1586,8 @@ namespace LuaUnit int SetFeared(Eluna* E, Unit* unit) { bool apply = E->CHECKVAL(2, true); -#if defined TRINITY || AZEROTHCORE - unit->SetControlled(apply, UNIT_STATE_FLEEING); -#elif defined CMANGOS - unit->SetFleeing(apply); -#else + unit->SetFeared(apply); -#endif return 0; } @@ -1925,15 +1610,7 @@ namespace LuaUnit */ int ClearThreatList(Eluna* /*E*/, Unit* unit) { -#ifdef TRINITY - unit->GetThreatManager().ClearAllThreat(); -#elif AZEROTHCORE - unit->getThreatMgr().clearReferences(); -#elif CMANGOS - unit->getThreatManager().clearReferences(); -#else unit->GetThreatManager().clearReferences(); -#endif return 0; } @@ -1957,13 +1634,8 @@ namespace LuaUnit { if (unit->IsMounted()) { -#if defined TRINITY || AZEROTHCORE - unit->Dismount(); - unit->RemoveAurasByType(SPELL_AURA_MOUNTED); -#else unit->Unmount(); unit->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); -#endif } return 0; @@ -1976,12 +1648,7 @@ namespace LuaUnit */ int PerformEmote(Eluna* E, Unit* unit) { -#ifdef TRINITY - Emote emote = static_cast(E->CHECKVAL(2)); - unit->HandleEmoteCommand(emote); -#else unit->HandleEmoteCommand(E->CHECKVAL(2)); -#endif return 0; } @@ -2041,16 +1708,9 @@ namespace LuaUnit return luaL_argerror(E->L, 3, "valid Language expected"); WorldPacket data; -#if defined TRINITY || AZEROTHCORE - ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), unit, target, msg); -#else + ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), 0, unit->GET_GUID(), unit->GetName(), target->GET_GUID(), target->GetName()); -#endif -#ifdef CMANGOS - target->GetSession()->SendPacket(data); -#else target->GetSession()->SendPacket(&data); -#endif return 0; } @@ -2077,13 +1737,8 @@ namespace LuaUnit */ int MoveExpire(Eluna* E, Unit* unit) { -#ifdef TRINITY - (void) L; // ensure that the variable is referenced in order to pass compiler checks - unit->GetMotionMaster()->Clear(); -#else bool reset = E->CHECKVAL(2, true); unit->GetMotionMaster()->MovementExpired(reset); -#endif return 0; } @@ -2094,13 +1749,8 @@ namespace LuaUnit */ int MoveClear(Eluna* E, Unit* unit) { -#ifdef TRINITY - (void) L; // ensure that the variable is referenced in order to pass compiler checks - unit->GetMotionMaster()->Clear(); -#else bool reset = E->CHECKVAL(2, true); unit->GetMotionMaster()->Clear(reset); -#endif return 0; } @@ -2207,43 +1857,10 @@ namespace LuaUnit float y = E->CHECKVAL(4); float z = E->CHECKVAL(5); bool genPath = E->CHECKVAL(6, true); -#ifndef CMANGOS - unit->GetMotionMaster()->MovePoint(id, x, y, z, genPath); -#else - unit->GetMotionMaster()->MovePoint(id, x, y, z, FORCED_MOVEMENT_NONE, genPath); -#endif - return 0; - } -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Makes the [Unit] jump to the coordinates - * - * @param float x - * @param float y - * @param float z - * @param float zSpeed : start velocity - * @param float maxHeight : maximum height - * @param uint32 id = 0 : unique movement Id - */ - int MoveJump(Eluna* E, Unit* unit) - { - float x = E->CHECKVAL(2); - float y = E->CHECKVAL(3); - float z = E->CHECKVAL(4); - float zSpeed = E->CHECKVAL(5); - float maxHeight = E->CHECKVAL(6); - uint32 id = E->CHECKVAL(7, 0); - -#if (defined(CMANGOS) || defined(MANGOS)) && defined(WOTLK) - unit->GetMotionMaster()->MoveJump(x, y, z, zSpeed, maxHeight, id); -#else - Position pos(x, y, z); - unit->GetMotionMaster()->MoveJump(pos, zSpeed, maxHeight, id); -#endif + unit->GetMotionMaster()->MovePoint(id, x, y, z, genPath); return 0; } -#endif /** * The [Unit] will whisper the message to a [Player] @@ -2261,11 +1878,7 @@ namespace LuaUnit Player* receiver = E->CHECKOBJ(4); bool bossWhisper = E->CHECKVAL(5, false); if (std::string(msg).length() > 0) -#if defined(TRINITY) || defined(AZEROTHCORE) - unit->Whisper(msg, (Language)lang, receiver, bossWhisper); -#else unit->MonsterWhisper(msg, receiver, bossWhisper); -#endif return 0; } @@ -2282,11 +1895,7 @@ namespace LuaUnit Unit* receiver = E->CHECKOBJ(3, false); bool bossEmote = E->CHECKVAL(4, false); if (std::string(msg).length() > 0) -#if defined(TRINITY) || defined(AZEROTHCORE) - unit->TextEmote(msg, receiver, bossEmote); -#else unit->MonsterTextEmote(msg, receiver, bossEmote); -#endif return 0; } @@ -2301,11 +1910,7 @@ namespace LuaUnit const char* msg = E->CHECKVAL(2); uint32 language = E->CHECKVAL(3); if (std::string(msg).length() > 0) -#if defined(TRINITY) || defined(AZEROTHCORE) - unit->Say(msg, (Language)language, unit); -#else unit->MonsterSay(msg, language, unit); -#endif return 0; } @@ -2320,11 +1925,7 @@ namespace LuaUnit const char* msg = E->CHECKVAL(2); uint32 language = E->CHECKVAL(3); if (std::string(msg).length() > 0) -#if defined(TRINITY) || defined(AZEROTHCORE) - unit->Yell(msg, (Language)language, unit); -#else unit->MonsterYell(msg, language, unit); -#endif return 0; } @@ -2349,21 +1950,12 @@ namespace LuaUnit Unit* target = E->CHECKOBJ(2, false); uint32 spell = E->CHECKVAL(3); bool triggered = E->CHECKVAL(4, false); -#ifdef CMANGOS - SpellEntry const* spellEntry = GetSpellStore()->LookupEntry(spell); -#endif -#ifdef MANGOS - SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell); -#endif + SpellEntry const* spellEntry = sSpellMgr.GetSpellEntry(spell); if (!spellEntry) return 0; -#ifdef CMANGOS - unit->CastSpell(target, spell, triggered ? TRIGGERED_OLD_TRIGGERED : 0); -#else unit->CastSpell(target, spell, triggered); -#endif return 0; } @@ -2394,24 +1986,7 @@ namespace LuaUnit Item* castItem = E->CHECKOBJ(8, false); ObjectGuid originalCaster = E->CHECKVAL(9, ObjectGuid()); -#ifdef TRINITY - CastSpellExtraArgs args; - if (has_bp0) - args.AddSpellMod(SPELLVALUE_BASE_POINT0, bp0); - if (has_bp1) - args.AddSpellMod(SPELLVALUE_BASE_POINT1, bp1); - if (has_bp2) - args.AddSpellMod(SPELLVALUE_BASE_POINT2, bp2); - if (triggered) - args.TriggerFlags = TRIGGERED_FULL_MASK; - if (castItem) - args.SetCastItem(castItem); - if (originalCaster) - args.SetOriginalCaster(originalCaster); - unit->CastSpell(target, spell, args); -#else unit->CastCustomSpell(target, spell, has_bp0 ? bp0 : NULL, has_bp1 ? bp1 : NULL, has_bp2 ? bp2 : NULL, triggered, castItem, NULL, ObjectGuid(originalCaster)); -#endif return 0; } @@ -2524,9 +2099,6 @@ namespace LuaUnit if (!spellEntry) return 1; -#if defined TRINITY || AZEROTHCORE - E->Push(unit->AddAura(spell, target)); -#elif defined VMANGOS SpellAuraHolder* spellAuraHolder = unit->AddAura(spell, 0, target); Aura* aura = nullptr; if (spellAuraHolder) @@ -2538,35 +2110,6 @@ namespace LuaUnit aura = unit->GetAura(spell, SpellEffIndex(0)); } E->Push(aura); // TODO: 0 is magic number for "addAuraFlags" -#else - if (!IsSpellAppliesAura(spellEntry) && !IsSpellHaveEffect(spellEntry, SPELL_EFFECT_PERSISTENT_AREA_AURA)) - return 1; - - SpellAuraHolder* holder = CreateSpellAuraHolder(spellEntry, target, unit); - - for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) - { - uint8 eff = spellEntry->Effect[i]; -#ifndef CMANGOS - if (eff >= TOTAL_SPELL_EFFECTS) -#else - if (eff >= MAX_SPELL_EFFECTS) -#endif - continue; - if (IsAreaAuraEffect(eff) || - eff == SPELL_EFFECT_APPLY_AURA || - eff == SPELL_EFFECT_PERSISTENT_AREA_AURA) - { -#ifndef CMANGOS - Aura* aur = CreateAura(spellEntry, SpellEffIndex(i), NULL, holder, target); -#else - Aura* aur = CreateAura(spellEntry, SpellEffIndex(i), NULL, NULL, holder, target); -#endif - holder->AddAura(aur, SpellEffIndex(i)); - } - } - E->Push(target->AddSpellAuraHolder(holder)); -#endif return 1; } @@ -2593,17 +2136,6 @@ namespace LuaUnit return 0; } -#if !defined(CLASSIC) - /** - * Removes all positive visible [Aura]'s from the [Unit]. - */ - int RemoveArenaAuras(Eluna* /*E*/, Unit* unit) - { - unit->RemoveArenaAuras(); - return 0; - } -#endif - /** * Adds the given unit state for the [Unit]. * @@ -2692,94 +2224,9 @@ namespace LuaUnit SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); -#if defined TRINITY || AZEROTHCORE - if (Unit::IsDamageReducedByArmor(schoolmask)) - damage = Unit::CalcArmorReducedDamage(unit, target, damage, NULL, BASE_ATTACK); -#else if (schoolmask & SPELL_SCHOOL_MASK_NORMAL) -#ifndef CMANGOS damage = unit->CalcArmorReducedDamage(target, damage); -#else - damage = unit->CalcArmorReducedDamage(unit, target, damage); -#endif -#endif - -#ifdef TRINITY - // melee damage by specific school - if (!spell) - { - DamageInfo dmgInfo(unit, target, damage, nullptr, schoolmask, SPELL_DIRECT_DAMAGE, BASE_ATTACK); - unit->CalcAbsorbResist(dmgInfo); - - if (!dmgInfo.GetDamage()) - damage = 0; - else - damage = dmgInfo.GetDamage(); - - uint32 absorb = dmgInfo.GetAbsorb(); - uint32 resist = dmgInfo.GetResist(); - unit->DealDamageMods(target, damage, &absorb); -#ifdef TRINITY - Unit::DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); -#else - unit->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); -#endif - unit->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); - return 0; - } - - if (!spell) - return 0; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); - if (!spellInfo) - return 0; - - SpellNonMeleeDamage dmgInfo(unit, target, spell, spellInfo->GetSchoolMask()); -#ifdef TRINITY - Unit::DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb); -#else - damage = unit->SpellDamageBonusDone(target, spellInfo, damage, SPELL_DIRECT_DAMAGE; - damage = target->SpellDamageBonusTaken(unit, spellInfo, damage, SPELL_DIRECT_DAMAGE); - unit->CalculateSpellDamageTaken(&dmgInfo, damage, spellInfo); - unit->DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb); -#endif - - unit->SendSpellNonMeleeDamageLog(&dmgInfo); - unit->DealSpellDamage(&dmgInfo, true); - return 0; -#elif AZEROTHCORE - if (!spell) - { - DamageInfo dmgInfo(unit, target, damage, nullptr, schoolmask, SPELL_DIRECT_DAMAGE); - unit->CalcAbsorbResist(dmgInfo); - - if (!dmgInfo.GetDamage()) - damage = 0; - else - damage = dmgInfo.GetDamage(); - - uint32 absorb = dmgInfo.GetAbsorb(); - uint32 resist = dmgInfo.GetResist(); - unit->DealDamageMods(target, damage, &absorb); - Unit::DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); - unit->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0); - return 0; - } - - if (!spell) - return 0; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); - if (!spellInfo) - return 0; - SpellNonMeleeDamage dmgInfo(unit, target, spellInfo, spellInfo->GetSchoolMask()); - Unit::DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb); - unit->SendSpellNonMeleeDamageLog(&dmgInfo); - unit->DealSpellDamage(&dmgInfo, true); - return 0; -#else // melee damage by specific school if (!spell) { @@ -2801,7 +2248,6 @@ namespace LuaUnit // non-melee damage unit->SendSpellNonMeleeDamageLog(target, spell, damage, SPELL_SCHOOL_MASK_NONE, 0, 0, false, 0); return 0; -#endif } /** @@ -2819,17 +2265,9 @@ namespace LuaUnit uint32 amount = E->CHECKVAL(4); bool critical = E->CHECKVAL(5, false); -#if defined TRINITY || AZEROTHCORE - if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) - { - HealInfo healInfo(unit, target, amount, info, info->GetSchoolMask()); - unit->HealBySpell(healInfo, critical); - } -#else SpellEntry const* spellEntry = sSpellMgr.GetSpellEntry(spell); if (spellEntry) unit->DealHeal(target, amount, spellEntry, critical); -#endif return 0; } @@ -2844,13 +2282,7 @@ namespace LuaUnit Unit* target = E->CHECKOBJ(2); bool durLoss = E->CHECKVAL(3, true); -#if defined TRINITY || AZEROTHCORE - Unit::Kill(unit, target, durLoss); -#elif defined CMANGOS - unit->DealDamage(unit, target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss); -#else unit->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss); -#endif return 0; } @@ -2882,19 +2314,8 @@ namespace LuaUnit float threat = E->CHECKVAL(3, true); uint32 spell = E->CHECKVAL(4, 0); -#ifdef TRINITY - unit->GetThreatManager().AddThreat(victim, threat, spell ? sSpellMgr->GetSpellInfo(spell) : NULL, true, true); -#elif AZEROTHCORE - uint32 schoolMask = E->CHECKVAL(5, 0); - if (schoolMask > SPELL_SCHOOL_MASK_ALL) - { - return luaL_argerror(E->L, 4, "valid SpellSchoolMask expected"); - } - unit->AddThreat(victim, threat, (SpellSchoolMask)schoolMask, spell ? sSpellMgr->GetSpellInfo(spell) : NULL); -#else SpellEntry const* spellEntry = sSpellMgr.GetSpellEntry(spell); unit->AddThreat(victim, threat, false, spellEntry ? GetSchoolMask(spellEntry->School) : SPELL_SCHOOL_MASK_NONE, spellEntry); -#endif return 0; } @@ -3015,10 +2436,6 @@ namespace LuaUnit { "GetStat", &LuaUnit::GetStat }, { "GetBaseSpellPower", &LuaUnit::GetBaseSpellPower }, { "GetMovementType", &LuaUnit::GetMovementType }, -#if (!defined(TBC) && !defined(CLASSIC)) - { "GetVehicleKit", &LuaUnit::GetVehicleKit }, - { "GetCritterGUID", &LuaUnit::GetCritterGUID }, -#endif // Setters { "SetFaction", &LuaUnit::SetFaction }, @@ -3047,11 +2464,6 @@ namespace LuaUnit { "SetStandState", &LuaUnit::SetStandState }, { "SetInCombatWith", &LuaUnit::SetInCombatWith }, { "ModifyPower", &LuaUnit::ModifyPower }, -#if (!defined(TBC) && !defined(CLASSIC)) - { "SetFFA", &LuaUnit::SetFFA }, - { "SetSanctuary", &LuaUnit::SetSanctuary }, - { "SetCritterGUID", &LuaUnit::SetCritterGUID }, -#endif // Boolean { "IsAlive", &LuaUnit::IsAlive }, @@ -3092,9 +2504,6 @@ namespace LuaUnit { "HasAura", &LuaUnit::HasAura }, { "IsCasting", &LuaUnit::IsCasting }, { "IsStandState", &LuaUnit::IsStandState }, -#if !defined(CLASSIC) - { "IsOnVehicle", &LuaUnit::IsOnVehicle }, -#endif // Other { "AddAura", &LuaUnit::AddAura }, @@ -3137,12 +2546,16 @@ namespace LuaUnit { "DealDamage", &LuaUnit::DealDamage }, { "DealHeal", &LuaUnit::DealHeal }, { "AddThreat", &LuaUnit::AddThreat }, -#if !defined(CLASSIC) - { "RemoveArenaAuras", &LuaUnit::RemoveArenaAuras }, -#endif -#if (!defined(TBC) && !defined(CLASSIC)) - { "MoveJump", &LuaUnit::MoveJump }, -#endif + + // Not used in VMaNGOS + { "GetVehicleKit", METHOD_REG_NONE }, + { "GetCritterGUID", METHOD_REG_NONE }, + { "MoveJump", METHOD_REG_NONE }, + { "RemoveArenaAuras", METHOD_REG_NONE }, + { "IsOnVehicle", METHOD_REG_NONE }, + { "SetFFA", METHOD_REG_NONE }, + { "SetSanctuary", METHOD_REG_NONE }, + { "SetCritterGUID", METHOD_REG_NONE }, // Not implemented mehtods { "GetVehicle", METHOD_REG_NONE }, // not implemented diff --git a/methods/VMangos/VehicleMethods.h b/methods/VMangos/VehicleMethods.h index 9751c06496..dec025ddf1 100644 --- a/methods/VMangos/VehicleMethods.h +++ b/methods/VMangos/VehicleMethods.h @@ -6,8 +6,7 @@ #ifndef VEHICLEMETHODS_H #define VEHICLEMETHODS_H -#ifndef CLASSIC -#ifndef TBC +#if ELUNA_EXPANSION >= WOTLK /*** * Inherits all methods from: none @@ -121,6 +120,5 @@ namespace LuaVehicle }; } -#endif // CLASSIC -#endif // TBC +#endif // Expansion WotLK or higher #endif // VEHICLEMETHODS_H diff --git a/methods/VMangos/WorldObjectMethods.h b/methods/VMangos/WorldObjectMethods.h index 1617c9d453..91dbdee2f8 100644 --- a/methods/VMangos/WorldObjectMethods.h +++ b/methods/VMangos/WorldObjectMethods.h @@ -34,33 +34,6 @@ namespace LuaWorldObject return 1; } -#if (!defined(TBC) && !defined(CLASSIC)) - /** - * Returns the current phase of the [WorldObject] - * - * @return uint32 phase - */ - int GetPhaseMask(Eluna* E, WorldObject* obj) - { - E->Push(obj->GetPhaseMask()); - return 1; - } - - /** - * Sets the [WorldObject]'s phase mask. - * - * @param uint32 phaseMask - * @param bool update = true : update visibility to nearby objects - */ - int SetPhaseMask(Eluna* E, WorldObject* obj) - { - uint32 phaseMask = E->CHECKVAL(2); - bool update = E->CHECKVAL(3, true); - obj->SetPhaseMask(phaseMask, update); - return 0; - } -#endif - /** * Returns the current instance ID of the [WorldObject] * @@ -207,16 +180,8 @@ namespace LuaWorldObject GameObject* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); -#ifdef TRINITY - Trinity::GameObjectLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE - Acore::GameObjectLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::GameObjectLastSearcher searcher(target, checker); Cell::VisitGridObjects(obj, searcher, range); -#endif E->Push(target); return 1; @@ -241,18 +206,9 @@ namespace LuaWorldObject Creature* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead); -#ifdef TRINITY - Trinity::CreatureLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE - Acore::CreatureLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::CreatureLastSearcher searcher(target, checker); Cell::VisitGridObjects(obj, searcher, range); -#endif - E->Push(target); return 1; } @@ -274,16 +230,8 @@ namespace LuaWorldObject std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); -#ifdef TRINITY - Trinity::PlayerListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE - Acore::PlayerListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::PlayerListSearcher searcher(list, checker); Cell::VisitWorldObjects(obj, searcher, range); -#endif lua_createtable(E->L, list.size(), 0); int tbl = lua_gettop(E->L); @@ -318,16 +266,8 @@ namespace LuaWorldObject std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead); -#ifdef TRINITY - Trinity::CreatureListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif defined AZEROTHCORE - Acore::CreatureListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::CreatureListSearcher searcher(list, checker); Cell::VisitGridObjects(obj, searcher, range); -#endif lua_createtable(E->L, list.size(), 0); int tbl = lua_gettop(E->L); @@ -360,16 +300,8 @@ namespace LuaWorldObject std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); -#ifdef TRINITY - Trinity::GameObjectListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE - Acore::GameObjectListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::GameObjectListSearcher searcher(list, checker); Cell::VisitGridObjects(obj, searcher, range); -#endif lua_createtable(E->L, list.size(), 0); int tbl = lua_gettop(E->L); @@ -410,16 +342,8 @@ namespace LuaWorldObject ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead); WorldObject* target = NULL; -#ifdef TRINITY - Trinity::WorldObjectLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE - Acore::WorldObjectLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::WorldObjectLastSearcher searcher(target, checker); Cell::VisitAllObjects(obj, searcher, range); -#endif E->Push(target); return 1; @@ -450,16 +374,8 @@ namespace LuaWorldObject ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead); std::list list; -#ifdef TRINITY - Trinity::WorldObjectListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE - Acore::WorldObjectListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#else MaNGOS::WorldObjectListSearcher searcher(list, checker); Cell::VisitAllObjects(obj, searcher, range); -#endif lua_createtable(E->L, list.size(), 0); int tbl = lua_gettop(E->L); @@ -649,16 +565,7 @@ namespace LuaWorldObject int GetAngle(Eluna* E, WorldObject* obj) { WorldObject* target = E->CHECKOBJ(2, false); -#if defined TRINITY && !AZEROTHCORE - if (target) - E->Push(obj->GetAbsoluteAngle(target)); - else - { - float x = E->CHECKVAL(2); - float y = E->CHECKVAL(3); - E->Push(obj->GetAbsoluteAngle(x, y)); - } -#else + if (target) E->Push(obj->GetAngle(target)); else @@ -667,7 +574,6 @@ namespace LuaWorldObject float y = E->CHECKVAL(3); E->Push(obj->GetAngle(x, y)); } -#endif return 1; } @@ -679,11 +585,8 @@ namespace LuaWorldObject int SendPacket(Eluna* E, WorldObject* obj) { WorldPacket* data = E->CHECKOBJ(2); -#ifdef CMANGOS - obj->SendMessageToSet(*data, true); -#else + obj->SendMessageToSet(data, true); -#endif return 0; } @@ -706,14 +609,8 @@ namespace LuaWorldObject float z = E->CHECKVAL(5); float o = E->CHECKVAL(6); uint32 respawnDelay = E->CHECKVAL(7, 30); -#ifdef TRINITY - QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); - E->Push(obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay))); -#elif AZEROTHCORE - E->Push(obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay)); -#else + E->Push(obj->SummonGameObject(entry, x, y, z, o, respawnDelay)); -#endif return 1; } @@ -784,11 +681,7 @@ namespace LuaWorldObject return luaL_argerror(E->L, 7, "valid SpawnType expected"); } -#ifdef TRINITY - E->Push(obj->SummonCreature(entry, x, y, z, o, type, Milliseconds(despawnTimer))); -#else E->Push(obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); -#endif return 1; } @@ -1173,10 +1066,6 @@ namespace LuaWorldObject // Getters { "GetName", &LuaWorldObject::GetName }, { "GetMap", &LuaWorldObject::GetMap }, -#if (!defined(TBC) && !defined(CLASSIC)) - { "GetPhaseMask", &LuaWorldObject::GetPhaseMask }, - { "SetPhaseMask", &LuaWorldObject::SetPhaseMask }, -#endif { "GetInstanceId", &LuaWorldObject::GetInstanceId }, { "GetAreaId", &LuaWorldObject::GetAreaId }, { "GetZoneId", &LuaWorldObject::GetZoneId }, @@ -1223,7 +1112,11 @@ namespace LuaWorldObject { "RemoveEvents", &LuaWorldObject::RemoveEvents }, { "PlayMusic", &LuaWorldObject::PlayMusic }, { "PlayDirectSound", &LuaWorldObject::PlayDirectSound }, - { "PlayDistanceSound", &LuaWorldObject::PlayDistanceSound } + { "PlayDistanceSound", &LuaWorldObject::PlayDistanceSound }, + + // Not in VMaNGOS + { "GetPhaseMask", METHOD_REG_NONE }, + { "SetPhaseMask", METHOD_REG_NONE } }; }; #endif