From 414217b7467ccb32de99fcee5ca3d7b2f651fc96 Mon Sep 17 00:00:00 2001 From: celguar Date: Tue, 26 Mar 2024 20:59:02 +0300 Subject: [PATCH] Fix merge --- src/game/BattleGround/BattleGround.cpp | 9 --- src/game/Entities/CharacterHandler.cpp | 2 +- src/game/Entities/Object.cpp | 1 - src/game/Entities/Player.cpp | 59 ------------------- src/game/Entities/Player.h | 1 - src/game/Entities/Unit.cpp | 2 +- src/game/LFG/LFGQueue.h | 2 +- src/game/Loot/LootMgr.cpp | 2 +- src/game/Maps/Map.cpp | 4 +- src/game/Maps/Map.h | 8 --- src/game/MotionGenerators/MovementHandler.cpp | 8 --- src/game/MotionGenerators/PathFinder.cpp | 21 ------- src/game/MotionGenerators/PathFinder.h | 2 - src/game/Server/DBCfmt.h | 3 - src/game/Server/WorldSession.cpp | 14 +---- src/game/Server/WorldSession.h | 4 -- src/game/Spells/UnitAuraProcHandler.cpp | 2 +- src/game/World/World.cpp | 1 + 18 files changed, 8 insertions(+), 137 deletions(-) diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp index 08f419f00b..84e4b0ad28 100644 --- a/src/game/BattleGround/BattleGround.cpp +++ b/src/game/BattleGround/BattleGround.cpp @@ -1523,15 +1523,6 @@ void BattleGround::OnObjectDBLoad(GameObject* obj) } } -uint32 BattleGround::GetSingleGameObjectGuid(uint8 event1, uint8 event2) -{ - auto itr = m_eventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin(); - if (itr != m_eventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end()) - return *itr; - - return ObjectGuid(); -} - /** Function that checks if event handles doors diff --git a/src/game/Entities/CharacterHandler.cpp b/src/game/Entities/CharacterHandler.cpp index 4a44745677..a66a2cfce8 100644 --- a/src/game/Entities/CharacterHandler.cpp +++ b/src/game/Entities/CharacterHandler.cpp @@ -1026,7 +1026,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) uint8 msg = pCurrChar->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, 1, &noSpaceForCount); if (msg != EQUIP_ERR_OK) { - ostringstream body; + std::ostringstream body; body << "Hello, " << pCurrChar->GetName() << ",\n\n"; body << "Welcome to the World of Warcraft!\n\n"; body << "As special thanks for purchasing the World of Warcraft Collector's Edition we send you a gift: a little companion to join you on your quest for adventure and glory.\n\n"; diff --git a/src/game/Entities/Object.cpp b/src/game/Entities/Object.cpp index 38f05f421e..02ddd4ac0f 100644 --- a/src/game/Entities/Object.cpp +++ b/src/game/Entities/Object.cpp @@ -2492,7 +2492,6 @@ struct WorldObjectChangeAccumulator { #endif if (owner != &i_object && owner->HasAtClient(&i_object)) -#endif i_object.BuildUpdateDataForPlayer(owner, i_updateDatas); #ifdef ENABLE_PLAYERBOTS } diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index c347646d47..b563618e5d 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -1686,43 +1686,6 @@ void Player::Heartbeat() SendUpdateToOutOfRangeGroupMembers(); } -#ifdef ENABLE_PLAYERBOTS -void Player::CreatePlayerbotAI() -{ - assert(!m_playerbotAI); - m_playerbotAI = std::make_unique(this); -} - -void Player::RemovePlayerbotAI() -{ - m_playerbotAI = nullptr; -} - -void Player::CreatePlayerbotMgr() -{ - assert(!m_playerbotMgr); - m_playerbotMgr = std::make_unique(this); -} - -void Player::RemovePlayerbotMgr() -{ - m_playerbotMgr = nullptr; -} - -void Player::UpdateAI(const uint32 diff, bool minimal) -{ - if (m_playerbotAI) - { - m_playerbotAI->UpdateAI(diff); - } - - if (m_playerbotMgr) - { - m_playerbotMgr->UpdateAI(diff); - } -} -#endif - void Player::SetDeathState(DeathState s) { uint32 ressSpellId = 0; @@ -8355,25 +8318,6 @@ Item* Player::GetItemByGuid(ObjectGuid guid) const return nullptr; } -Item* Player::GetItemByEntry(uint32 item) const -{ - for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) - if (pItem->GetEntry() == item) - { - return pItem; - } - - for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i)) - if (Item* itemPtr = pBag->GetItemByEntry(item)) - { - return itemPtr; - } - - return NULL; -} - Item* Player::GetItemByPos(uint16 pos) const { uint8 bag = pos >> 8; @@ -12869,7 +12813,6 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, { #endif if (!handled && pQuest->GetQuestCompleteScript() != 0) -#endif GetMap()->ScriptsStart(SCRIPT_TYPE_QUEST_END, pQuest->GetQuestCompleteScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); #ifdef ENABLE_PLAYERBOTS } @@ -19910,8 +19853,6 @@ void Player::learnClassLevelSpells(bool includeHighLevelQuestRewards) { CastSpell(this, tSpell->spell, TRIGGERED_OLD_TRIGGERED); } - else - CastSpell(this, tSpell->spell, TRIGGERED_OLD_TRIGGERED); } } } diff --git a/src/game/Entities/Player.h b/src/game/Entities/Player.h index ae322ea8b3..31a24e4c84 100644 --- a/src/game/Entities/Player.h +++ b/src/game/Entities/Player.h @@ -1105,7 +1105,6 @@ class Player : public Unit Item* GetItemByEntry(uint32 item) const; // only for special cases Item* GetItemByPos(uint16 pos) const; Item* GetItemByPos(uint8 bag, uint8 slot) const; - Item* GetItemByEntry(uint32 item) const; Item* GetWeaponForAttack(WeaponAttackType attackType) const { return GetWeaponForAttack(attackType, false, false); } Item* GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bool useable) const; diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index f5880ae0f3..b74830bba9 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -2675,7 +2675,7 @@ void Unit::DoExtraAttacks(Unit* pVictim) swingError = SWING_ERROR_BAD_FACING; else if (!pVictim->IsAlive()) swingError = SWING_ERROR_TARGET_NOT_ALIVE; - else if (!CanAttackInCombat(pVictim)) + else if (!CanAttackInCombat(pVictim, false, false)) swingError = SWING_ERROR_CANT_ATTACK_TARGET; if (swingError) diff --git a/src/game/LFG/LFGQueue.h b/src/game/LFG/LFGQueue.h index 454811d54c..efc6924ced 100644 --- a/src/game/LFG/LFGQueue.h +++ b/src/game/LFG/LFGQueue.h @@ -93,7 +93,7 @@ class LFGQueue void LoadMeetingStones(); MeetingStoneSet GetDungeonsForPlayer(Player* player); - void TeleportGroupToStone(Group* grp, uint32 areaId); + void TeleportGroupToStone(uint32 groupId, uint32 areaId); #endif private: diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 9363aee76a..1c118158d9 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -990,7 +990,7 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* lootOwner, b m_lootItems.reserve(MAX_NR_LOOT_ITEMS); - tab->Process(*this, lootOwner, store, store.IsRatesAllowed()); // Processing is done there, callback via Loot::AddItem() + tab->Process(*this, lootOwner, store.IsRatesAllowed()); // Processing is done there, callback via Loot::AddItem() #ifdef ENABLE_MODULES } #endif diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 272d0a1ce1..38c661b5c0 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -1030,7 +1030,6 @@ void Map::Update(const uint32& t_diff) } } } -#endif // Reset the has real players flag and check for it again const bool hadRealPlayers = hasRealPlayers; @@ -1089,7 +1088,7 @@ void Map::Update(const uint32& t_diff) { shouldUpdateBot = true; } - }*/ + } } // Save the active characters for later logs @@ -1161,7 +1160,6 @@ void Map::Update(const uint32& t_diff) } const bool shouldUpdateObjects = urand(0, (uint32)(objectUpdateChance * 100)) < 100; -#endif // non-player active objects bool updateObj = urand(0, (HasRealPlayers() ? avgDiff : (avgDiff * 3))) < 10; diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index cb839b51c7..42faad4cd8 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -167,10 +167,6 @@ class Map : public GridRefManager void DoUpdate(uint32 maxDiff, uint32 minimumTimeSinceLastUpdate = 0); virtual void Update(const uint32&); -#ifdef ENABLE_PLAYERBOTS - bool HasRealPlayers() { return hasRealPlayers; } -#endif - void MessageBroadcast(Player const*, WorldPacket const&, bool to_self); void MessageBroadcast(WorldObject const*, WorldPacket const&); void ThreatMessageBroadcast(WorldObject const*, std::string const&, bool newClient = false); @@ -412,10 +408,6 @@ class Map : public GridRefManager // debug std::set m_objRemoveList; // this will eventually eat up too much memory - only used for debugging VisibleNotifier::Notify() customlog leak - - bool HasActiveAreas(ContinentArea areaId = MAP_NO_AREA) { if (areaId == MAP_NO_AREA) { return !m_activeAreas.empty(); } else { return !(find(m_activeAreas.begin(), m_activeAreas.end(), areaId) == m_activeAreas.end()); } } - bool HasActiveZones() { return !m_activeZones.empty(); } - bool HasActiveZone(uint32 zoneId) { return find(m_activeZones.begin(), m_activeZones.end(), zoneId) != m_activeZones.end(); } #ifdef ENABLE_PLAYERBOTS bool HasRealPlayers() { return hasRealPlayers; } diff --git a/src/game/MotionGenerators/MovementHandler.cpp b/src/game/MotionGenerators/MovementHandler.cpp index def2776897..18de3f5dd2 100644 --- a/src/game/MotionGenerators/MovementHandler.cpp +++ b/src/game/MotionGenerators/MovementHandler.cpp @@ -363,14 +363,6 @@ void WorldSession::HandleMoveTeleportAckOpcode(WorldPacket& recv_data) // honorless target if (plMover->pvpInfo.inPvPEnforcedArea) plMover->CastSpell(plMover, 2479, TRIGGERED_OLD_TRIGGERED); - -#ifdef ENABLE_PLAYERBOTS - // reset moving for bot if any - if (plMover->GetPlayerbotAI() && !plMover->GetMotionMaster()->empty()) - { - if (MovementGenerator* movgen = plMover->GetMotionMaster()->top()) - movgen->Reset(*plMover); - } #endif m_anticheat->Teleport({ dest.coord_x, dest.coord_y, dest.coord_z, dest.orientation }); diff --git a/src/game/MotionGenerators/PathFinder.cpp b/src/game/MotionGenerators/PathFinder.cpp index a47cd91d71..73c589cc72 100644 --- a/src/game/MotionGenerators/PathFinder.cpp +++ b/src/game/MotionGenerators/PathFinder.cpp @@ -32,27 +32,6 @@ #include ////////////////// PathFinder ////////////////// -PathFinder::PathFinder() : - m_polyLength(0), m_type(PATHFIND_BLANK), - m_useStraightPath(false), m_forceDestination(false), m_straightLine(false), m_pointPathLimit(MAX_POINT_PATH_LENGTH), // TODO: Fix legitimate long paths - m_sourceUnit(nullptr), m_navMesh(nullptr), m_navMeshQuery(nullptr), m_cachedPoints(m_pointPathLimit* VERTEX_SIZE), m_pathPolyRefs(m_pointPathLimit), m_smoothPathPolyRefs(m_pointPathLimit), m_defaultMapId(0) -{ - //MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager(); - //m_defaultNavMeshQuery = mmap->GetNavMeshQuery(mapId, instanceId); - - //createFilter(); -} - -PathFinder::PathFinder(uint32 mapId, uint32 instanceId) : - m_polyLength(0), m_type(PATHFIND_BLANK), - m_useStraightPath(false), m_forceDestination(false), m_straightLine(false), m_pointPathLimit(MAX_POINT_PATH_LENGTH), // TODO: Fix legitimate long paths - m_sourceUnit(nullptr), m_navMesh(nullptr), m_navMeshQuery(nullptr), m_cachedPoints(m_pointPathLimit* VERTEX_SIZE), m_pathPolyRefs(m_pointPathLimit), m_smoothPathPolyRefs(m_pointPathLimit), m_defaultMapId(mapId) -{ - MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager(); - m_defaultNavMeshQuery = mmap->GetNavMeshQuery(mapId, instanceId); - - createFilter(); -} PathFinder::PathFinder(const Unit* owner, bool ignoreNormalization) : m_type(PATHFIND_BLANK), m_useStraightPath(false), m_forceDestination(false), m_straightLine(false), m_pointPathLimit(MAX_POINT_PATH_LENGTH), // TODO: Fix legitimate long paths diff --git a/src/game/MotionGenerators/PathFinder.h b/src/game/MotionGenerators/PathFinder.h index 205b32f3fc..5e7de2211a 100644 --- a/src/game/MotionGenerators/PathFinder.h +++ b/src/game/MotionGenerators/PathFinder.h @@ -72,8 +72,6 @@ enum PathType class PathFinder { public: - PathFinder(); - PathFinder(uint32 mapId, uint32 instanceId = 0); PathFinder(Unit const* owner, bool ignoreNormalization = false); ~PathFinder(); diff --git a/src/game/Server/DBCfmt.h b/src/game/Server/DBCfmt.h index 66d1066828..ae059222ef 100644 --- a/src/game/Server/DBCfmt.h +++ b/src/game/Server/DBCfmt.h @@ -40,9 +40,6 @@ const char CreatureTypefmt[] = "nxxxxxxxxxx"; const char DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; const char DurabilityQualityfmt[] = "nf"; const char EmotesEntryfmt[] = "nxxiiix"; -#ifdef ENABLE_PLAYERBOTS -char const EmotesTextSoundEntryfmt[] = "niiii"; -#endif const char EmotesTextEntryfmt[] = "nxixxxxxxxxxxxxxxxx"; #ifdef ENABLE_PLAYERBOTS diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp index d44a36a448..20c8c60d79 100644 --- a/src/game/Server/WorldSession.cpp +++ b/src/game/Server/WorldSession.cpp @@ -216,7 +216,7 @@ void WorldSession::SendPacket(WorldPacket const& packet, bool forcedSend /*= fal } #endif - if (!m_Socket || (m_sessionState != WORLD_SESSION_STATE_READY && !forcedSend)) + if (!m_socket || (m_sessionState != WORLD_SESSION_STATE_READY && !forcedSend)) { //sLog.outDebug("Refused to send %s to %s", packet.GetOpcodeName(), _player ? _player->GetName() : "UKNOWN"); return; @@ -774,11 +774,6 @@ void WorldSession::LogoutPlayer() uint32 guid = _player->GetGUIDLow(); #endif -#ifdef ENABLE_PLAYERBOTS - // Remember player GUID for update SQL below - uint32 guid = _player->GetGUIDLow(); -#endif - //Start Solocraft Function CharacterDatabase.PExecute("DELETE FROM custom_solocraft_character_stats WHERE GUID = %u", _player->GetGUIDLow()); //End Solocraft Function @@ -1350,10 +1345,3 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recv_data) { m_anticheat->WardenPacket(recv_data); } - -#ifdef ENABLE_PLAYERBOTS -void WorldSession::SetNoAnticheat() -{ - m_anticheat.reset(new NullSessionAnticheat(this)); -} -#endif diff --git a/src/game/Server/WorldSession.h b/src/game/Server/WorldSession.h index d9add49a31..30b9e33948 100644 --- a/src/game/Server/WorldSession.h +++ b/src/game/Server/WorldSession.h @@ -256,10 +256,6 @@ class WorldSession void SetNoAnticheat(); #endif -#ifdef ENABLE_PLAYERBOTS - void SetNoAnticheat(); -#endif - /// Session in auth.queue currently void SetInQueue(bool state) { m_inQueue = state; } diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index 2261b6b286..3ef7007202 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -1119,7 +1119,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data) if (damagePoint >= 0) { // currently uses same spell damage fetch as flametongue - need to verify whether SP is supposed to be applied pre-triggered spell bonuses or post - int32 bonusDamage = SpellDamageBonusDone(pVictim, GetSpellSchoolMask(dummySpell), dummySpell, damagePoint, SPELL_DIRECT_DAMAGE); + pVictim->SpellBaseDamageBonusTaken(GetSpellSchoolMask(dummySpell)); + int32 bonusDamage = SpellDamageBonusDone(pVictim, GetSpellSchoolMask(dummySpell), dummySpell, EFFECT_INDEX_0, damagePoint, SPELL_DIRECT_DAMAGE); + pVictim->SpellBaseDamageBonusTaken(GetSpellSchoolMask(dummySpell)); //if (Aura* aura = GetAura(43743, EFFECT_INDEX_0)) // Improved Seal of Righteousness // bonusDamage += aura->GetAmount(); damagePoint += bonusDamage * coeff * CalculateLevelPenalty(dummySpell); diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index ed121b5012..357b248497 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -110,6 +110,7 @@ uint32 World::m_relocation_ai_notify_delay = 1000u; uint32 World::m_currentMSTime = 0; TimePoint World::m_currentTime = TimePoint(); uint32 World::m_currentDiff = 0; +#ifdef ENABLE_PLAYERBOTS uint32 World::m_currentDiffSum = 0; uint32 World::m_currentDiffSumIndex = 0; uint32 World::m_averageDiff = 0;