refactor(Core): code cleanup (part 2) (#6374)

This commit is contained in:
Francesco Borzì
2021-06-16 20:40:42 +02:00
committed by GitHub
parent 8f7ad83010
commit 466cdb68d6
80 changed files with 198 additions and 209 deletions
@@ -7,8 +7,6 @@
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
#include "BattlegroundMgr.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "AccountMgr.h"
#include "AsyncAuctionListing.h"
#include "AuctionHouseMgr.h"
#include "Chat.h"
@@ -9,14 +9,10 @@
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "Common.h"
#include "DisableMgr.h"
#include "Group.h"
#include "Language.h"
#include "Log.h"
#include "Object.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "ScriptMgr.h"
@@ -5,7 +5,6 @@
*/
#include "AccountMgr.h"
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
#include "AuctionHouseMgr.h"
#include "Battleground.h"
@@ -18,7 +17,6 @@
#include "Guild.h"
#include "GuildMgr.h"
#include "Language.h"
#include "LFGMgr.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-1
View File
@@ -9,7 +9,6 @@
#include "ChannelMgr.h"
#include "Chat.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Guild.h"
@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "CreatureAI.h"
#include "Log.h"
#include "ObjectAccessor.h"
@@ -12,7 +11,6 @@
#include "Opcodes.h"
#include "Player.h"
#include "Vehicle.h"
#include "VehicleDefines.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-2
View File
@@ -4,8 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
#include "UpdateData.h"
@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "DatabaseEnv.h"
#include "Group.h"
#include "GroupMgr.h"
@@ -4,8 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "GossipDef.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
-3
View File
@@ -4,12 +4,10 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "Corpse.h"
#include "Creature.h"
#include "GameObject.h"
#include "Group.h"
#include "Log.h"
#include "LootItemStorage.h"
#include "LootMgr.h"
#include "Object.h"
@@ -17,7 +15,6 @@
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
+6 -7
View File
@@ -8,8 +8,6 @@
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "BigNumber.h"
#include "CellImpl.h"
#include "Chat.h"
#include "Common.h"
#include "CreatureAI.h"
@@ -36,7 +34,6 @@
#include "Spell.h"
#include "UpdateData.h"
#include "Vehicle.h"
#include "WhoListCache.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
@@ -461,12 +458,14 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/)
if (GetPlayer()->CanFreeMove())
{
if (GetPlayer()->getStandState() == UNIT_STAND_STATE_STAND)
{
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
}
WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8 + 4)); // guess size
data << GetPlayer()->GetPackGUID();
data << (uint32)2;
SendPacket(&data);
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, (8 + 4)); // guess size
data2 << GetPlayer()->GetPackGUID();
data2 << (uint32)2;
SendPacket(&data2);
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
+1 -3
View File
@@ -9,11 +9,9 @@
#include "BattlegroundMgr.h"
#include "CellImpl.h"
#include "Chat.h"
#include "Common.h"
#include "Corpse.h"
#include "GameGraveyard.h"
#include "InstanceSaveMgr.h"
#include "Language.h"
#include "Log.h"
#include "MathUtil.h"
#include "MapManager.h"
@@ -69,7 +67,7 @@ void WorldSession::HandleMoveWorldportAck()
}
// reset instance validity, except if going to an instance inside an instance
if (GetPlayer()->m_InstanceValid == false && !mInstance)
if (!GetPlayer()->m_InstanceValid && !mInstance)
{
GetPlayer()->m_InstanceValid = true;
// pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map!
-4
View File
@@ -6,14 +6,10 @@
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "Common.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "DatabaseEnv.h"
#include "GameGraveyard.h"
#include "GossipDef.h"
#include "Language.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
+24 -8
View File
@@ -849,7 +849,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint16 spe
}
else if (haspositiveeffect)
{
bool tempspellIsPositive = true;
bool tmpSpellIsPositive = true;
pet->ClearUnitState(UNIT_STATE_FOLLOW);
// This is true if pet has no target or has target but targets differs.
Unit* victim = pet->GetVictim();
@@ -880,7 +880,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint16 spe
pet->SendPetAIReaction(guid1);
}
pet->ToPet()->CastWhenWillAvailable(spellid, unit_target, victim, tempspellIsPositive);
pet->ToPet()->CastWhenWillAvailable(spellid, unit_target, victim, tmpSpellIsPositive);
}
}
}
@@ -1103,21 +1103,37 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
if (act_state == ACT_ENABLED)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet())
{
((Pet*)pet)->ToggleAutocast(spellInfo, true);
}
else
for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true);
{
for (auto iterator = GetPlayer()->m_Controlled.begin(); iterator != GetPlayer()->m_Controlled.end(); ++iterator)
{
if ((*iterator)->GetEntry() == pet->GetEntry())
{
(*iterator)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true);
}
}
}
}
//sign for no/turn off autocast
else if (act_state == ACT_DISABLED)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet())
{
((Pet*)pet)->ToggleAutocast(spellInfo, false);
}
else
for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false);
{
for (auto iterator = GetPlayer()->m_Controlled.begin(); iterator != GetPlayer()->m_Controlled.end(); ++iterator)
{
if ((*iterator)->GetEntry() == pet->GetEntry())
{
(*iterator)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false);
}
}
}
}
}
@@ -6,8 +6,6 @@
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
#include "Common.h"
#include "GossipDef.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Language.h"
@@ -5,8 +5,6 @@
*/
#include "Common.h"
#include "DatabaseEnv.h"
#include "Language.h"
#include "Log.h"
#include "MapManager.h"
#include "NPCHandler.h"
@@ -14,7 +12,6 @@
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "UpdateMask.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
@@ -6,9 +6,7 @@
#include "Battleground.h"
#include "BattlegroundAV.h"
#include "Common.h"
#include "GameObjectAI.h"
#include "GossipDef.h"
#include "Group.h"
#include "Language.h"
#include "Log.h"
@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
@@ -4,14 +4,10 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "UpdateMask.h"
#include "WorldPacket.h"
#include "WorldSession.h"
@@ -4,8 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "CreatureAI.h"
#include "DBCStores.h"
#include "GameObjectAI.h"
#include "Log.h"
@@ -15,7 +13,6 @@
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
-3
View File
@@ -4,9 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
@@ -5,9 +5,7 @@
*/
#include "Chat.h"
#include "Common.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "TicketMgr.h"
@@ -4,8 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "AccountMgr.h"
#include "Common.h"
#include "Item.h"
#include "Language.h"
#include "Log.h"
@@ -4,8 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Common.h"
#include "Log.h"
#include "Opcodes.h"
#include "WorldPacket.h"
#include "WorldSession.h"