mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
refactor(Core): code cleanup (part 3) (#6380)
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "Duration.h"
|
||||
#include <mysqld_error.h>
|
||||
#include <errmsg.h>
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseWorker.h"
|
||||
#include "SQLOperation.h"
|
||||
#include "MySQLConnection.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Xinef
|
||||
*/
|
||||
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: http://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Xinef
|
||||
*/
|
||||
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: http://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#ifndef _PETITIONMGR_H
|
||||
#define _PETITIONMGR_H
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
//add here most rarely modified headers to speed up debug build compilation
|
||||
|
||||
#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "CellImpl.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Map.h"
|
||||
|
||||
@@ -1936,10 +1936,10 @@ public:
|
||||
{
|
||||
// Try to find an existing script.
|
||||
bool existing = false;
|
||||
for (ScriptMapIterator it = ScriptPointerList.begin(); it != ScriptPointerList.end(); ++it)
|
||||
for (auto iterator = ScriptPointerList.begin(); iterator != ScriptPointerList.end(); ++iterator)
|
||||
{
|
||||
// If the script names match...
|
||||
if (it->second->GetName() == script->GetName())
|
||||
if (iterator->second->GetName() == script->GetName())
|
||||
{
|
||||
// ... It exists.
|
||||
existing = true;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "Errors.h"
|
||||
#include <utf8.h>
|
||||
#include <sstream>
|
||||
#include <array>
|
||||
|
||||
WorldPackets::InvalidStringValueException::InvalidStringValueException(std::string const& value) :
|
||||
ByteBufferInvalidValueException("string", value.c_str()) { }
|
||||
|
||||
@@ -1430,7 +1430,7 @@ void OpcodeTable::Initialize()
|
||||
|
||||
#undef DEFINE_HANDLER
|
||||
#undef DEFINE_SERVER_OPCODE_HANDLER
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::string GetOpcodeNameForLoggingImpl(T id)
|
||||
|
||||
@@ -86,7 +86,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
|
||||
return true;
|
||||
|
||||
//lets process all packets for non-in-the-world player
|
||||
return (player->IsInWorld() == false);
|
||||
return !player->IsInWorld();
|
||||
}
|
||||
|
||||
/// WorldSession constructor
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "BigNumber.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "Common.h"
|
||||
#include "CryptoHash.h"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
* \author Derex <derex101@gmail.com>
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
@@ -23,7 +22,6 @@
|
||||
#include <ace/os_include/arpa/os_inet.h>
|
||||
#include <ace/os_include/netinet/os_tcp.h>
|
||||
#include <ace/os_include/sys/os_socket.h>
|
||||
#include <ace/os_include/sys/os_types.h>
|
||||
#include <ace/Reactor_Impl.h>
|
||||
#include <ace/Reactor.h>
|
||||
#include <ace/TP_Reactor.h>
|
||||
|
||||
@@ -379,7 +379,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* cast
|
||||
|
||||
m_amount = CalculateAmount(caster);
|
||||
m_casterLevel = caster ? caster->getLevel() : 0;
|
||||
m_applyResilience = caster ? caster->CanApplyResilience() : false;
|
||||
m_applyResilience = caster && caster->CanApplyResilience();
|
||||
m_auraGroup = sSpellMgr->GetSpellGroup(GetId());
|
||||
|
||||
CalculateSpellMod();
|
||||
@@ -5222,9 +5222,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
{
|
||||
if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601)
|
||||
{
|
||||
Unit* caster = GetBase()->GetCaster();
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
caster->ToPlayer()->KilledMonsterCredit(25987);
|
||||
auto caster2 = GetBase()->GetCaster();
|
||||
if (caster2 && caster2->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
caster2->ToPlayer()->KilledMonsterCredit(25987);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -6567,15 +6569,17 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
|
||||
// xinef: caster is available, checked earlier
|
||||
if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
|
||||
{
|
||||
uint32 damage = GetSpellInfo()->ManaPerSecond;
|
||||
if ((int32)damage > gain && gain > 0)
|
||||
damage = gain;
|
||||
uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
|
||||
if ((int32)manaPerSecond > gain && gain > 0)
|
||||
{
|
||||
manaPerSecond = gain;
|
||||
}
|
||||
|
||||
uint32 absorb = 0;
|
||||
Unit::DealDamageMods(caster, damage, &absorb);
|
||||
uint32 absorb2 = 0;
|
||||
Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
|
||||
|
||||
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
|
||||
Unit::DealDamage(caster, caster, damage, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
|
||||
Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
|
||||
}
|
||||
|
||||
uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
|
||||
|
||||
@@ -2599,7 +2599,7 @@ UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
|
||||
LoadScripts();
|
||||
_InitEffects(effMask, caster, baseAmount);
|
||||
GetUnitOwner()->_AddAura(this, caster);
|
||||
};
|
||||
}
|
||||
|
||||
void UnitAura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* aurApp)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ class AuraEffect;
|
||||
class Aura;
|
||||
class DynamicObject;
|
||||
class AuraScript;
|
||||
class ProcInfo;
|
||||
|
||||
class AuraApplication
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundEY.h"
|
||||
#include "BattlegroundIC.h"
|
||||
@@ -14,22 +13,17 @@
|
||||
#include "CellImpl.h"
|
||||
#include "Common.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "Formulas.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "MMapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -39,7 +33,6 @@
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SkillExtraItems.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Spell.h"
|
||||
@@ -54,7 +47,6 @@
|
||||
#include "UpdateMask.h"
|
||||
#include "Util.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
|
||||
@@ -1849,7 +1849,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
||||
him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem
|
||||
cannot be solved from within the check in other way since target type cannot be called for the spell currently
|
||||
Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */
|
||||
if (!caster->IsVehicle() && !(caster->GetCharmerOrOwner() == target))
|
||||
if (!caster->IsVehicle() && caster->GetCharmerOrOwner() != target)
|
||||
{
|
||||
if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PlayerDump.h"
|
||||
#include "UpdateFields.h"
|
||||
#include "World.h"
|
||||
|
||||
#define DUMP_TABLE_COUNT 27
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
Warden::Warden() : _session(nullptr), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
|
||||
@@ -281,7 +280,7 @@ bool Warden::ProcessLuaCheckResponse(std::string const& msg)
|
||||
{
|
||||
static constexpr char WARDEN_TOKEN[] = "_TW\t";
|
||||
// if msg starts with WARDEN_TOKEN
|
||||
if (!(msg.rfind(WARDEN_TOKEN, 0) == 0))
|
||||
if (msg.rfind(WARDEN_TOKEN, 0) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "Util.h"
|
||||
#include "Warden.h"
|
||||
#include "WardenCheckMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
WardenCheckMgr::WardenCheckMgr()
|
||||
@@ -128,9 +126,9 @@ void WardenCheckMgr::LoadWardenChecks()
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string str = fmt::sprintf("%04u", id);
|
||||
ASSERT(str.size() == 4);
|
||||
std::copy(str.begin(), str.end(), wardenCheck.IdStr.begin());
|
||||
std::string str2 = Acore::StringFormat("%04u", id);
|
||||
ASSERT(str2.size() == 4);
|
||||
std::copy(str2.begin(), str2.end(), wardenCheck.IdStr.begin());
|
||||
|
||||
CheckIdPool[WARDEN_CHECK_LUA_TYPE].push_back(id);
|
||||
break;
|
||||
|
||||
@@ -5,15 +5,12 @@
|
||||
*/
|
||||
|
||||
#include "ByteBuffer.h"
|
||||
#include "Common.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "SessionKeyGenerator.h"
|
||||
#include "Util.h"
|
||||
#include "WardenMac.h"
|
||||
#include "WardenModuleMac.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include <openssl/md5.h>
|
||||
|
||||
@@ -4,13 +4,10 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "Common.h"
|
||||
#include "CryptoRandom.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "HMAC.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "SessionKeyGenerator.h"
|
||||
|
||||
@@ -8,15 +8,12 @@
|
||||
\ingroup world
|
||||
*/
|
||||
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "Weather.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
/// Create the Weather object
|
||||
Weather::Weather(uint32 zone, WeatherData const* weatherChances)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "CalendarMgr.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Channel.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include "CharacterDatabaseCleaner.h"
|
||||
@@ -63,7 +62,6 @@
|
||||
#include "SkillExtraItems.h"
|
||||
#include "SmartAI.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "TicketMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "TransportMgr.h"
|
||||
|
||||
@@ -4,13 +4,10 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCDatabaseLoader.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
#include "StringFormat.h"
|
||||
#include <sstream>
|
||||
|
||||
DBCDatabaseLoader::DBCDatabaseLoader(char const* tableName, char const* dbcFormatString, std::vector<char*>& stringPool)
|
||||
: _sqlTableName(tableName),
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "RealmSocket.h"
|
||||
#include <ace/INET_Addr.h>
|
||||
#include <ace/OS_NS_string.h>
|
||||
#include <ace/SString.h>
|
||||
|
||||
RealmSocket::Session::Session() = default;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "ByteBuffer.h"
|
||||
#include "Errors.h"
|
||||
#include "MessageBuffer.h"
|
||||
#include "Common.h"
|
||||
#include "Log.h"
|
||||
#include "Util.h"
|
||||
#include <utf8.h>
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
|
||||
ByteBuffer& operator>>(bool& value)
|
||||
{
|
||||
value = read<char>() > 0 ? true : false;
|
||||
value = read<char>() > 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "Log.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
#define SECRET_FLAG_FOR(key, val, server) server ## _ ## key = (val ## ull << (16*SERVER_PROCESS_ ## server))
|
||||
#define SECRET_FLAG(key, val) SECRET_FLAG_ ## key = val, SECRET_FLAG_FOR(key, val, AUTHSERVER), SECRET_FLAG_FOR(key, val, WORLDSERVER)
|
||||
@@ -137,7 +136,7 @@ void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std
|
||||
}
|
||||
|
||||
// attempt to transition us to the new key, if possible
|
||||
Optional<std::string> error = AttemptTransition(Secrets(i), currentValue, oldSecret, !!oldDigest);
|
||||
Optional<std::string> error = AttemptTransition(Secrets(i), currentValue, oldSecret, static_cast<bool>(oldDigest));
|
||||
if (error)
|
||||
{
|
||||
LOG_MESSAGE_BODY("server.loading", errorLevel, "Your value of '%s' changed, but we cannot transition your database to the new value:\n%s", info.configKey, error->c_str());
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "AppenderDB.h"
|
||||
#include "Banner.h"
|
||||
#include "Common.h"
|
||||
#include "Configuration/Config.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseWorkerPool.h"
|
||||
#include "GitRevision.h"
|
||||
#include "IoContext.h"
|
||||
#include "Log.h"
|
||||
|
||||
Reference in New Issue
Block a user