aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-08-30 19:16:09 -0500
committerSubv <s.v.h21@hotmail.com>2012-08-30 19:16:09 -0500
commit554e88dd63c244f740d385d8a45d4e4405e951ba (patch)
treeabcd721b4f6e7e8a9189455386a3d3b0b9eac0e4 /src/server
parent532ddfcd402390a9caf3ac5863bba2f0db9d0efc (diff)
parente3d9768a50a3b2b700d65e0cc96e697a5c9d22dc (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Diffstat (limited to 'src/server')
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp4
-rw-r--r--src/server/collision/Maps/MapTree.cpp4
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp5
-rwxr-xr-xsrc/server/collision/Models/ModelInstance.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h15
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.h8
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp7
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.cpp13
-rwxr-xr-xsrc/server/game/Chat/Chat.h6
-rwxr-xr-xsrc/server/game/Combat/UnitEvents.h4
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp1
-rwxr-xr-xsrc/server/game/Entities/Corpse/Corpse.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp1
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h1
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp3
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp2
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp2
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp25
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h2
-rwxr-xr-xsrc/server/game/Entities/Player/SocialMgr.h16
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp5
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h29
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp89
-rwxr-xr-xsrc/server/game/Grids/NGrid.h3
-rwxr-xr-xsrc/server/game/Handlers/AddonHandler.cpp41
-rwxr-xr-xsrc/server/game/Maps/Map.cpp2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.cpp4
-rwxr-xr-xsrc/server/game/Reputation/ReputationMgr.h2
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.h2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp4
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp3
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp3
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h2
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp25
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/silverpine_forest.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/wetlands.cpp10
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp6
-rw-r--r--src/server/scripts/Kalimdor/silithus.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp5
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp7
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp214
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp2
-rwxr-xr-xsrc/server/scripts/World/achievement_scripts.cpp5
-rwxr-xr-xsrc/server/shared/Cryptography/BigNumber.cpp2
-rwxr-xr-xsrc/server/shared/Cryptography/BigNumber.h2
-rwxr-xr-xsrc/server/shared/DataStores/DBCFileLoader.cpp4
-rwxr-xr-xsrc/server/shared/DataStores/DBCFileLoader.h4
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.cpp2
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp4
-rwxr-xr-xsrc/server/shared/Utilities/ServiceWin32.cpp6
-rwxr-xr-xsrc/server/shared/Utilities/Util.cpp2
-rwxr-xr-xsrc/server/worldserver/TCSoap/TCSoap.h2
61 files changed, 348 insertions, 332 deletions
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 2ad80c7f62d..d55d2cf02b3 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -196,7 +196,7 @@ const AuthHandler table[] =
Patcher PatchesCache;
// Constructor - set the N and g values for SRP6
-AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket)
+AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket), pPatch(NULL)
{
N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
g.SetDword(7);
@@ -946,7 +946,7 @@ bool AuthSocket::_HandleXferResume()
{
sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume");
// Check packet length and patch existence
- if (socket().recv_len() < 9 || !pPatch)
+ if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)");
return false;
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index 6489ddd7a4f..f35e36d92fd 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -124,8 +124,8 @@ namespace VMAP
return intersectionCallBack.result;
}
- StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath):
- iMapID(mapID), iTreeValues(0), iBasePath(basePath)
+ StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath)
+ : iMapID(mapID), iTreeValues(0), iBasePath(basePath), iIsTiled(false)
{
if (iBasePath.length() > 0 && iBasePath[iBasePath.length()-1] != '/' && iBasePath[iBasePath.length()-1] != '\\')
{
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index 207b652a4d6..8458ffdd5d3 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -54,11 +54,8 @@ namespace VMAP
//=================================================================
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName)
+ : iSrcDir(pSrcDirName), iDestDir(pDestDirName), iCurrentUniqueNameId(0), iFilterMethod(NULL)
{
- iCurrentUniqueNameId = 0;
- iFilterMethod = NULL;
- iSrcDir = pSrcDirName;
- iDestDir = pDestDirName;
//mkdir(iDestDir);
//init();
}
diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h
index 3c46967980f..2abd83ba377 100755
--- a/src/server/collision/Models/ModelInstance.h
+++ b/src/server/collision/Models/ModelInstance.h
@@ -63,7 +63,7 @@ namespace VMAP
class ModelInstance: public ModelSpawn
{
public:
- ModelInstance(): iModel(0) {}
+ ModelInstance(): iModel(0), iInvScale(0.0f) {}
ModelInstance(const ModelSpawn &spawn, WorldModel* model);
void setUnloaded() { iModel = 0; }
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 6e5a34e8c33..69ecb1ef581 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -79,6 +79,7 @@ SmartScript::SmartScript()
{
go = NULL;
me = NULL;
+ trigger = NULL;
mEventPhase = 0;
mPathId = 0;
mTargetStorage = new ObjectListMap();
@@ -92,6 +93,7 @@ SmartScript::SmartScript()
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
+ mScriptType = SMART_SCRIPT_TYPE_CREATURE;
}
SmartScript::~SmartScript()
@@ -1117,10 +1119,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SUMMON_CREATURE:
{
- float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
+ float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
(*itr)->GetPosition(x, y, z, o);
@@ -1149,10 +1151,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!GetBaseObject())
break;
- float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
+ float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (!IsUnit(*itr))
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 3b69408354e..ef5c7511124 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -913,7 +913,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return true;
}
-bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
+/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused
{
bool error = false;
uint32 entry = 0;
@@ -938,4 +938,4 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
return false;
}
return true;
-}
+}*/
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 05965d8ffa0..f1747734a29 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1215,16 +1215,9 @@ enum SmartCastFlags
// one line in DB is one event
struct SmartScriptHolder
{
- SmartScriptHolder()
- {
- timer = 0;
- active = false;
- runOnce = false;
- link = 0;
- entryOrGuid = 0;
- event_id = 0;
- enableTimed = false;
- }
+ SmartScriptHolder() : timer(0), active(false), runOnce(false), link(0), entryOrGuid(0),
+ event_id(0), enableTimed(false), source_type(SMART_SCRIPT_TYPE_CREATURE) {}
+
int32 entryOrGuid;
SmartScriptType source_type;
uint32 event_id;
@@ -1436,7 +1429,7 @@ class SmartAIMgr
return true;
}
- bool IsTextValid(SmartScriptHolder const& e, uint32 id);
+ //bool IsTextValid(SmartScriptHolder const& e, uint32 id);
};
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h
index 38338b3980f..fd227b258c5 100755
--- a/src/server/game/Addons/AddonMgr.h
+++ b/src/server/game/Addons/AddonMgr.h
@@ -25,13 +25,7 @@
struct AddonInfo
{
AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
- {
- Name = name;
- Enabled = enabled;
- CRC = crc;
- State = state;
- UsePublicKeyOrCRC = crcOrPubKey;
- }
+ : Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {}
std::string Name;
uint8 Enabled;
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 7f701f541a1..ffc5e48290b 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -155,13 +155,13 @@ bool Battlefield::Update(uint32 diff)
if (m_uiKickDontAcceptTimer <= diff)
{
for (int team = 0; team < 2; team++)
- for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
+ for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
if ((*itr).second <= time(NULL))
KickPlayerFromBattlefield((*itr).first);
InvitePlayersInZoneToWar();
for (int team = 0; team < 2; team++)
- for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
+ for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); ++itr)
if ((*itr).second <= time(NULL))
KickPlayerFromBattlefield((*itr).first);
@@ -862,7 +862,8 @@ BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_
{
m_team = TEAM_NEUTRAL;
m_value = 0;
- m_maxValue = 0;
+ m_minValue = 0.0f;
+ m_maxValue = 0.0f;
m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
m_capturePointEntry = 0;
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index 97e7bb5bef2..09783176094 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -1084,10 +1084,12 @@ WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, Tea
{
m_Bf = battlefield;
m_team = teamInControl;
+ m_Workshop = NULL;
}
void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
{
+ ASSERT(m_Workshop);
m_Workshop->GiveControlTo(m_team, false);
}
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 61b15bdd182..e88c501398e 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -24,16 +24,9 @@
#include "ArenaTeamMgr.h"
ArenaTeam::ArenaTeam()
+ : TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
+ BorderStyle(0), BorderColor(0)
{
- TeamId = 0;
- Type = 0;
- TeamName = "";
- CaptainGuid = 0;
- BackgroundColor = 0;
- EmblemStyle = 0;
- EmblemColor = 0;
- BorderStyle = 0;
- BorderColor = 0;
Stats.WeekGames = 0;
Stats.SeasonGames = 0;
Stats.Rank = 0;
@@ -343,7 +336,7 @@ void ArenaTeam::Disband(WorldSession* session)
// Broadcast update
if (session)
{
- BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName().c_str(), GetName(), "");
+ BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
if (Player* player = session->GetPlayer())
sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 269ebdd1d2f..d4701b10ce1 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -47,8 +47,8 @@ class ChatHandler
{
public:
WorldSession* GetSession() { return m_session; }
- explicit ChatHandler(WorldSession* session) : m_session(session) {}
- explicit ChatHandler(Player* player) : m_session(player->GetSession()) {}
+ explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
+ explicit ChatHandler(Player* player) : m_session(player->GetSession()), sentErrorMessage(false) {}
virtual ~ChatHandler() {}
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit* speaker);
@@ -126,7 +126,7 @@ class ChatHandler
bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
protected:
- explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
+ explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h
index de60491de89..07d8b20af52 100755
--- a/src/server/game/Combat/UnitEvents.h
+++ b/src/server/game/Combat/UnitEvents.h
@@ -123,8 +123,8 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
private:
ThreatContainer* iThreatContainer;
public:
- ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {}
- ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {}
+ ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(NULL) {}
+ ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(NULL) {}
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 7bb28556514..e24547f1a31 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -867,7 +867,6 @@ void ConditionMgr::LoadConditions(bool isReload)
valid = true;
++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting
- break;
}
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
valid = addToSpellImplicitTargetConditions(cond);
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 60c0b7ad394..9359581e3a0 100755
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -26,8 +26,7 @@
#include "GossipDef.h"
#include "World.h"
-Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
-, m_type(type)
+Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
{
m_objectType |= TYPEMASK_CORPSE;
m_objectTypeId = TYPEID_CORPSE;
@@ -39,6 +38,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
m_time = time(NULL);
lootForBody = false;
+ lootRecipient = NULL;
}
Corpse::~Corpse()
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 866437d828c..afa4b62d8b0 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -380,6 +380,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
SetAttackTime(RANGED_ATTACK, cInfo->rangeattacktime);
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
+ SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index c8ebf1aa13b..4dd080f8b15 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -111,6 +111,7 @@ struct CreatureTemplate
uint32 rangeattacktime;
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
uint32 unit_flags; // enum UnitFlags mask values
+ uint32 unit_flags2; // enum UnitFlags2 mask values
uint32 dynamicflags;
uint32 family; // enum CreatureFamily values (optional)
uint32 trainer_type;
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index b229f00fcd7..751107ac011 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1418,7 +1418,8 @@ void GameObject::Use(Unit* user)
// full amount unique participants including original summoner
if (GetUniqueUseCount() == info->summoningRitual.reqParticipants)
{
- spellCaster = m_ritualOwner ? m_ritualOwner : spellCaster;
+ if (m_ritualOwner)
+ spellCaster = m_ritualOwner;
spellId = info->summoningRitual.spellId;
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index c032647d924..58cc1d027a3 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -1019,7 +1019,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
if (count > pProto->GetMaxStackSize())
count = pProto->GetMaxStackSize();
- ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");
+ ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
Item* pItem = NewItemOrBag(pProto);
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 2e4ad07f86d..fe5d32b9b95 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1764,10 +1764,10 @@ bool WorldObject::canSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
return true;
- bool corpseCheck = false;
bool corpseVisibility = false;
if (distanceCheck)
{
+ bool corpseCheck = false;
if (Player const* thisPlayer = ToPlayer())
{
if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 && // Cheap way to check for ghost state
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 8660b040037..936788f484e 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -7262,8 +7262,6 @@ void Player::SetArenaPoints(uint32 value)
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
- PreparedStatement* stmt = NULL;
-
int32 newValue = int32(GetHonorPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7271,7 +7269,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -7280,8 +7278,6 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
- PreparedStatement* stmt = NULL;
-
int32 newValue = int32(GetArenaPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7289,7 +7285,7 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -15681,7 +15677,6 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
{
uint32 srcItemId = quest->GetSrcItemId();
ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
- bool destroyItem = true;
if (srcItemId > 0)
{
@@ -15701,6 +15696,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
return false;
}
+ bool destroyItem = true;
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
destroyItem = false;
@@ -17119,7 +17115,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt64Value(PLAYER_FARSIGHT, 0);
SetCreatorGUID(0);
- RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
// reset some aura modifiers before aura apply
SetUInt32Value(PLAYER_TRACK_CREATURES, 0);
@@ -17516,8 +17512,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
uint32 zoneId = GetZoneId();
- std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
- std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags
+ std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
+ std::map<uint32, Item*> invalidBagMap; // fast guid lookup for bags
std::list<Item*> problematicItems;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -17576,7 +17572,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
item->SetSlot(NULL_SLOT);
// Item is in the bag, find the bag
- std::map<uint64, Bag*>::iterator itr = bagMap.find(bagGuid);
+ std::map<uint32, Bag*>::iterator itr = bagMap.find(bagGuid);
if (itr != bagMap.end())
{
ItemPosCountVec dest;
@@ -17586,8 +17582,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
- std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid);
- if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end())
+ std::map<uint32, Item*>::iterator itr = invalidBagMap.find(bagGuid);
+ if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
err = EQUIP_ERR_INT_BAG_ERROR;
}
else
@@ -17637,7 +17633,6 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
{
- PreparedStatement* stmt = NULL;
Item* item = NULL;
uint32 itemGuid = fields[13].GetUInt32();
uint32 itemEntry = fields[14].GetUInt32();
@@ -17647,6 +17642,8 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
item = NewItemOrBag(proto);
if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
{
+ PreparedStatement* stmt = NULL;
+
// Do not allow to have item limited to another map/zone in alive state
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
{
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 358eebb7548..1758b915ebf 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -114,7 +114,7 @@ struct PlayerTalent
// Spell modifier (used for modify other spells)
struct SpellModifier
{
- SpellModifier(Aura* _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {}
+ SpellModifier(Aura* _ownerAura = NULL) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {}
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h
index 3c7d13070fa..99a40d6110f 100755
--- a/src/server/game/Entities/Player/SocialMgr.h
+++ b/src/server/game/Entities/Player/SocialMgr.h
@@ -54,24 +54,12 @@ struct FriendInfo
uint8 Class;
std::string Note;
- FriendInfo()
+ FriendInfo() : Status(FRIEND_STATUS_OFFLINE), Flags(0), Area(0), Level(0), Class(0), Note()
{
- Status = FRIEND_STATUS_OFFLINE;
- Flags = 0;
- Area = 0;
- Level = 0;
- Class = 0;
- Note = "";
}
- FriendInfo(uint8 flags, const std::string& note)
+ FriendInfo(uint8 flags, const std::string& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note)
{
- Status = FRIEND_STATUS_OFFLINE;
- Flags = flags;
- Area = 0;
- Level = 0;
- Class = 0;
- Note = note;
}
};
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index b9396122bb1..d9798571de5 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -159,7 +159,7 @@ m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(fa
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL),
i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(this),
m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
-m_HostileRefManager(this)
+m_HostileRefManager(this), m_TempSpeed(0.0f), m_AutoRepeatFirstCast(false)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
@@ -13903,7 +13903,8 @@ void Unit::DeleteCharmInfo()
CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
- m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false)
+ m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false),
+ m_stayX(0.0f), m_stayY(0.0f), m_stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 6770ad94c23..5c29537db40 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -619,17 +619,24 @@ enum UnitFlags
// Value masks for UNIT_FIELD_FLAGS_2
enum UnitFlags2
{
- UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
- UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
- UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
- UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
- UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
- UNIT_FLAG2_FORCE_MOVE = 0x00000040,
- UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
- UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
- UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
- UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
- UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
+ UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
+ UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
+ UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
+ UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
+ UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
+ UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
+ UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
+ UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
+ UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
+ UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
+ UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
+ UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
+ UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
+ UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
+ UNIT_FLAG2_DISABLE_TURN = 0x00008000,
+ UNIT_FLAG2_UNK2 = 0x00010000,
+ UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
+ UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
};
/// Non Player Character flags
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 08a76008fde..3d58d5f4ce9 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -369,17 +369,17 @@ void ObjectMgr::LoadCreatureTemplates()
QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
// 9 10 11 12 13 14 15 16 17 18 19 20 21
"modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, "
- // 22 23 24 25 26 27 28 29 30 31 32
- "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, "
- // 33 34 35 36 37 38 39 40 41 42
+ // 22 23 24 25 26 27 28 29 30 31 32 33
+ "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, "
+ // 34 35 36 37 38 39 40 41 42 43
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
- // 43 44 45 46 47 48 49 50 51 52 53
+ // 44 45 46 47 48 49 50 51 52 53 54
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
- // 54 55 56 57 58 59 60 61 62 63 64 65 66
+ // 55 56 57 58 59 60 61 62 63 64 65 66 67
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
- // 67 68 69 70 71 72 73 74 75 76 77
+ // 68 69 70 71 72 73 74 75 76 77 78
"InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, "
- // 78 79 80 81 82 83
+ // 79 80 81 82 83 84
" questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
"FROM creature_template;");
@@ -435,49 +435,50 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.rangeattacktime = fields[30].GetUInt32();
creatureTemplate.unit_class = uint32(fields[31].GetUInt8());
creatureTemplate.unit_flags = fields[32].GetUInt32();
- creatureTemplate.dynamicflags = fields[33].GetUInt32();
- creatureTemplate.family = uint32(fields[34].GetUInt8());
- creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
- creatureTemplate.trainer_spell = fields[36].GetUInt32();
- creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
- creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
- creatureTemplate.minrangedmg = fields[39].GetFloat();
- creatureTemplate.maxrangedmg = fields[40].GetFloat();
- creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
- creatureTemplate.type = uint32(fields[42].GetUInt8());
- creatureTemplate.type_flags = fields[43].GetUInt32();
- creatureTemplate.lootid = fields[44].GetUInt32();
- creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
- creatureTemplate.SkinLootId = fields[46].GetUInt32();
+ creatureTemplate.unit_flags2 = fields[33].GetUInt32();
+ creatureTemplate.dynamicflags = fields[34].GetUInt32();
+ creatureTemplate.family = uint32(fields[35].GetUInt8());
+ creatureTemplate.trainer_type = uint32(fields[36].GetUInt8());
+ creatureTemplate.trainer_spell = fields[37].GetUInt32();
+ creatureTemplate.trainer_class = uint32(fields[38].GetUInt8());
+ creatureTemplate.trainer_race = uint32(fields[39].GetUInt8());
+ creatureTemplate.minrangedmg = fields[40].GetFloat();
+ creatureTemplate.maxrangedmg = fields[41].GetFloat();
+ creatureTemplate.rangedattackpower = uint32(fields[42].GetUInt16());
+ creatureTemplate.type = uint32(fields[43].GetUInt8());
+ creatureTemplate.type_flags = fields[44].GetUInt32();
+ creatureTemplate.lootid = fields[45].GetUInt32();
+ creatureTemplate.pickpocketLootId = fields[46].GetUInt32();
+ creatureTemplate.SkinLootId = fields[47].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
+ creatureTemplate.resistance[i] = fields[48 + i -1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
- creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
-
- creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
- creatureTemplate.VehicleId = fields[62].GetUInt32();
- creatureTemplate.mingold = fields[63].GetUInt32();
- creatureTemplate.maxgold = fields[64].GetUInt32();
- creatureTemplate.AIName = fields[65].GetString();
- creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
- creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
- creatureTemplate.HoverHeight = fields[68].GetFloat();
- creatureTemplate.ModHealth = fields[69].GetFloat();
- creatureTemplate.ModMana = fields[70].GetFloat();
- creatureTemplate.ModArmor = fields[71].GetFloat();
- creatureTemplate.RacialLeader = fields[72].GetBool();
+ creatureTemplate.spells[i] = fields[54 + i].GetUInt32();
+
+ creatureTemplate.PetSpellDataId = fields[62].GetUInt32();
+ creatureTemplate.VehicleId = fields[63].GetUInt32();
+ creatureTemplate.mingold = fields[64].GetUInt32();
+ creatureTemplate.maxgold = fields[65].GetUInt32();
+ creatureTemplate.AIName = fields[66].GetString();
+ creatureTemplate.MovementType = uint32(fields[67].GetUInt8());
+ creatureTemplate.InhabitType = uint32(fields[68].GetUInt8());
+ creatureTemplate.HoverHeight = fields[69].GetFloat();
+ creatureTemplate.ModHealth = fields[70].GetFloat();
+ creatureTemplate.ModMana = fields[71].GetFloat();
+ creatureTemplate.ModArmor = fields[72].GetFloat();
+ creatureTemplate.RacialLeader = fields[73].GetBool();
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
- creatureTemplate.questItems[i] = fields[73 + i].GetUInt32();
+ creatureTemplate.questItems[i] = fields[74 + i].GetUInt32();
- creatureTemplate.movementId = fields[79].GetUInt32();
- creatureTemplate.RegenHealth = fields[80].GetBool();
- creatureTemplate.equipmentId = fields[81].GetUInt32();
- creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32();
- creatureTemplate.flags_extra = fields[83].GetUInt32();
- creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
+ creatureTemplate.movementId = fields[80].GetUInt32();
+ creatureTemplate.RegenHealth = fields[81].GetBool();
+ creatureTemplate.equipmentId = fields[82].GetUInt32();
+ creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32();
+ creatureTemplate.flags_extra = fields[84].GetUInt32();
+ creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString());
++count;
}
@@ -7901,8 +7902,6 @@ void ObjectMgr::LoadTrainerSpell()
// For reload case
_cacheTrainerSpellStore.clear();
- std::set<uint32> skip_trainers;
-
QueryResult result = WorldDatabase.Query("SELECT b.entry, a.spell, a.spellcost, a.reqskill, a.reqskillvalue, a.reqlevel FROM npc_trainer AS a "
"INNER JOIN npc_trainer AS b ON a.entry = -(b.spell) "
"UNION SELECT * FROM npc_trainer WHERE spell > 0");
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h
index b5701a7a590..6bf558a4d5e 100755
--- a/src/server/game/Grids/NGrid.h
+++ b/src/server/game/Grids/NGrid.h
@@ -79,9 +79,8 @@ class NGrid
public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> GridType;
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true)
- : i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false)
+ : i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false), i_GridInfo(GridInfo(expiry, unload))
{
- i_GridInfo = GridInfo(expiry, unload);
}
GridType& GetGridType(const uint32 x, const uint32 y)
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index f86dacbc55e..c3ffeace3fb 100755
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
@@ -37,26 +37,6 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint32 CurrentPosition;
uint32 TempValue;
- unsigned char tdata[256] =
- {
- 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
- 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
- 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
- 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
- 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
- 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
- 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
- 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
- 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
- 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
- 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
- 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
- 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
- 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
- 0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
- 0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
- };
-
// broken addon packet, can't be received from real client
if (Source->rpos() + 4 > Source->size())
return false;
@@ -110,7 +90,28 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
*Target << uint8(unk);
if (unk)
+ {
+ unsigned char tdata[256] =
+ {
+ 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
+ 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
+ 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
+ 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
+ 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
+ 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
+ 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
+ 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
+ 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
+ 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
+ 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
+ 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
+ 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
+ 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
+ 0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
+ 0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
+ };
Target->append(tdata, sizeof(tdata));
+ }
*Target << uint32(0);
}
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index c960d8123fe..684977f9563 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -2706,7 +2706,7 @@ uint32 InstanceMap::GetMaxResetDelay() const
/* ******* Battleground Instance Maps ******* */
BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
- : Map(id, expiry, InstanceId, spawnMode, _parent)
+ : Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(NULL)
{
//lets initialize visibility distance for BG/Arenas
BattlegroundMap::InitVisibilityDistance();
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index e04f7b6fcbc..acb1a57a9ba 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -205,10 +205,6 @@ bool TimedFleeingMovementGenerator::Update(Unit* owner, const uint32& time_diff)
if (i_totalFleeTime.Passed())
return false;
- i_totalFleeTime.Update(time_diff);
- if (i_totalFleeTime.Passed())
- return false;
-
// This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
// This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
return MovementGeneratorMedium< Creature, FleeingMovementGenerator<Creature> >::Update(owner, time_diff);
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 4db35d5bc79..5a4d5734929 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -29,8 +29,8 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
-OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
-m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0), m_maxSpeed(0),
+OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp) :
+m_capturePointGUID(0), m_capturePoint(NULL), m_minValue(0.0f), m_maxValue(0.0f), m_maxSpeed(0),
m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
{
diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h
index a073845ea73..f950cbb82c2 100755
--- a/src/server/game/Reputation/ReputationMgr.h
+++ b/src/server/game/Reputation/ReputationMgr.h
@@ -65,7 +65,7 @@ class ReputationMgr
{
public: // constructors and global modifiers
explicit ReputationMgr(Player* owner) : _player(owner),
- _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0) {}
+ _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0), _sendFactionIncreased(false) {}
~ReputationMgr() {}
void SaveToDB(SQLTransaction& trans);
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index d5b9dff4a89..bd993a24193 100755
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -1390,7 +1390,7 @@ inline std::string GetOpcodeNameForLogging(uint16 opcode)
{
std::ostringstream ss;
ss << '[' << LookupOpcodeName(opcode) << " 0x" << std::hex << std::uppercase << opcode << std::nouppercase << " (" << std::dec << opcode << ")]";
- return ss.str().c_str();
+ return ss.str();
}
#endif
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b83e44d6a73..bca26bd7391 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2958,13 +2958,13 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mod
Unit* target = aurApp->GetTarget();
if (apply)
- target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(GetAuraType()))
return;
- target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
}
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 90ac5ed5a3f..19741ea7854 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -87,7 +87,7 @@ SpellDestination::SpellDestination(WorldObject const& wObj)
}
-SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
+SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
{
m_objectTarget = NULL;
m_itemTarget = NULL;
@@ -96,7 +96,6 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
- m_strTarget = "";
m_targetMask = 0;
}
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a5e24ff1cec..119e828680d 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -312,10 +312,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
return;
- bool apply_direct_bonus = true;
-
if (unitTarget && unitTarget->isAlive())
{
+ bool apply_direct_bonus = true;
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index dcf3c38fe4f..9c5619ef5f6 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -441,7 +441,7 @@ class PetAura
typedef UNORDERED_MAP<uint32, uint32> PetAuraMap;
public:
- PetAura()
+ PetAura() : removeOnChangePet(false), damage(0)
{
auras.clear();
}
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 99ec263b8f9..e3cd185e4a3 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -642,19 +642,13 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
- // wpCreature
- Creature* wpCreature = NULL;
-
if (wpGuid != 0)
- {
- wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- if (wpCreature)
+ if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
wpCreature->AddObjectToRemoveList();
}
- }
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
@@ -681,15 +675,12 @@ public:
Player* chr = handler->GetSession()->GetPlayer();
Map* map = chr->GetMap();
{
- // wpCreature
- Creature* wpCreature = NULL;
// What to do:
// Move the visual spawnpoint
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
- wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- if (wpCreature)
+ if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
index 204fbe5223b..25c3f2e41e3 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
@@ -243,11 +243,9 @@ public:
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit;
if ((*i) && (*i)->getSource())
{
- unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
//Cast affliction
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 06c1243645c..533a1aac2f0 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -201,12 +201,11 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- Temp->DisappearAndDie();
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ temp->DisappearAndDie();
}
}
}
@@ -215,14 +214,13 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
{
- Temp->AI()->AttackStart(me->getVictim());
- DoZoneInCombat(Temp);
+ temp->AI()->AttackStart(me->getVictim());
+ DoZoneInCombat(temp);
} else
EnterEvadeMode();
}
@@ -250,13 +248,12 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Unit::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- if (!Temp->getVictim())
- Temp->AI()->AttackStart(me->getVictim());
+ Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ if (!temp->getVictim())
+ temp->AI()->AttackStart(me->getVictim());
}
}
CheckAdds_Timer = 5000;
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index d4c037d45c3..b405f9eba85 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -240,7 +240,6 @@ public:
return;
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
- Creature* summon = NULL;
if (!pArchmage || !pArchmage->isAlive())
return;
@@ -252,7 +251,8 @@ public:
switch (uiPhase)
{
case 1:
- summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
+ {
+ Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
summon->SetReactState(REACT_DEFENSIVE);
summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true);
@@ -260,13 +260,16 @@ public:
uiTimer = 2000;
uiPhase = 2;
break;
+ }
case 2:
+ {
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
uiPhase = 0;
break;
+ }
}
} else uiTimer -= uiDiff;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 1009d3e0a0a..8fb3dd55077 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -315,14 +315,12 @@ class boss_zuljin : public CreatureScript
{
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Temp = NULL;
if (SpiritGUID[i])
{
- Temp = Unit::GetUnit(*me, SpiritGUID[i]);
- if (Temp)
+ if (Unit* temp = Unit::GetUnit(*me, SpiritGUID[i]))
{
- Temp->SetVisible(false);
- Temp->setDeathState(DEAD);
+ temp->SetVisible(false);
+ temp->setDeathState(DEAD);
}
}
SpiritGUID[i] = 0;
diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
index 870cb29c28d..c52e69787d4 100644
--- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
@@ -230,13 +230,11 @@ public:
{
if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
{
- Player* player = NULL;
Unit* target = NULL;
if (PlayerGUID)
{
- player = Unit::GetPlayer(*me, PlayerGUID);
- if (player)
- target = RAND((Unit*)me, (Unit*)player);
+ if (Unit* player = Unit::GetPlayer(*me, PlayerGUID)->ToUnit())
+ target = RAND((Unit*)me, player);
} else
target = me;
diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp
index fac8fb51c2d..34e6e7c9ddf 100644
--- a/src/server/scripts/EasternKingdoms/wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/wetlands.cpp
@@ -60,12 +60,12 @@ public:
{
npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) { }
- bool m_bFriendSummoned;
+ bool IsFriendSummoned;
void Reset()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- m_bFriendSummoned = false;
+ IsFriendSummoned = false;
}
void WaypointReached(uint32 waypointId)
@@ -83,14 +83,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- Player* player = GetPlayerForEscort();
-
- if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && player)
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && !IsFriendSummoned && GetPlayerForEscort())
{
for (uint8 i = 0; i < 3; ++i)
DoCast(me, SPELL_CALL_FRIENDS, true);
- m_bFriendSummoned = true;
+ IsFriendSummoned = true;
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index 5b6dc784113..ee7ef383603 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -222,11 +222,9 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
if (msg == EQUIP_ERR_OK)
- {
- Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
- if (item && player)
+ if (Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true))
player->SendNewItem(item, 1, true, false, true);
- }
+
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
}
return true;
diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp
index 639de3dc3b2..bad278f51c7 100644
--- a/src/server/scripts/Kalimdor/silithus.cpp
+++ b/src/server/scripts/Kalimdor/silithus.cpp
@@ -537,7 +537,6 @@ public:
if (!Fandral || !Arygos || !Caelestrasz || !Merithra)
return;
- Unit* mob = NULL;
AnimationTimer = EventAnim[AnimationCount].Timer;
if (eventEnd == false)
{
@@ -720,6 +719,7 @@ public:
case 51:
{
uint32 entries[4] = { 15423, 15424, 15414, 15422 };
+ Unit* mob = NULL;
for (uint8 i = 0; i < 4; ++i)
{
mob = player->FindNearestCreature(entries[i], 50, me);
@@ -844,9 +844,6 @@ public:
void UpdateAI(const uint32 diff)
{
- Unit* target = NULL;
- //Player* player = me->GetPlayer(PlayerGUID);
-
if (!Timers)
{
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers
@@ -890,6 +887,7 @@ public:
}
if (!hasTarget)
{
+ Unit* target = NULL;
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414)
target = me->FindNearestCreature(15423, 20, true);
if (me->GetEntry() == 15423)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 2ea234775c0..d335d36e112 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -314,15 +314,14 @@ class boss_gothik : public CreatureScript
bool CheckGroupSplitted()
{
- bool checklife = false;
- bool checkdead = false;
-
Map* map = me->GetMap();
if (map && map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
{
+ bool checklife = false;
+ bool checkdead = false;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource() && i->getSource()->isAlive() &&
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index 1b2fe61e87c..ec25a8f9f60 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -248,11 +248,9 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
- Unit* unit = NULL;
if (TargetGUID[i])
{
- unit = Unit::GetUnit(*me, TargetGUID[i]);
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, TargetGUID[i]))
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 710f5c82fab..673d4bcc96f 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -299,12 +299,11 @@ public:
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Member = NULL;
if (Council[i])
{
- Member = Unit::GetUnit(*me, Council[i]);
- if (Member && Member->isAlive())
- CAST_CRE(Member)->AI()->AttackStart(target);
+ Unit* member = Unit::GetUnit(*me, Council[i]);
+ if (member && member->isAlive())
+ CAST_CRE(member)->AI()->AttackStart(target);
}
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 5eebb69d7a5..5153010c0cc 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -950,14 +950,14 @@ class spell_generic_clone : public SpellScriptLoader
enum CloneWeaponSpells
{
- SPELL_COPY_WEAPON = 41055,
- SPELL_COPY_WEAPON_2 = 63416,
- SPELL_COPY_WEAPON_3 = 69891,
+ SPELL_COPY_WEAPON_AURA = 41054,
+ SPELL_COPY_WEAPON_2_AURA = 63418,
+ SPELL_COPY_WEAPON_3_AURA = 69893,
- SPELL_COPY_OFFHAND = 45206,
- SPELL_COPY_OFFHAND_2 = 69892,
+ SPELL_COPY_OFFHAND_AURA = 45205,
+ SPELL_COPY_OFFHAND_2_AURA = 69896,
- SPELL_COPY_RANGED = 57593
+ SPELL_COPY_RANGED_AURA = 57594
};
class spell_generic_clone_weapon : public SpellScriptLoader
@@ -969,80 +969,147 @@ class spell_generic_clone_weapon : public SpellScriptLoader
{
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
- bool Validate(SpellInfo const* /*spellEntry*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)
- || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
- return false;
- return true;
- }
-
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
+
if (Unit* target = GetHitUnit())
{
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
- target->CastSpell(caster, spellId, true);
+ caster->CastSpell(target, spellId, true);
+ }
+ }
- if (target->GetTypeId() == TYPEID_PLAYER)
- return;
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_generic_clone_weapon_SpellScript();
+ }
+};
+
+class spell_gen_clone_weapon_aura : public SpellScriptLoader
+{
+ public:
+ spell_gen_clone_weapon_aura() : SpellScriptLoader("spell_gen_clone_weapon_aura") { }
+
+ class spell_gen_clone_weapon_auraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_clone_weapon_auraScript);
+
+ uint32 prevItem;
+
+ bool Validate(SpellInfo const* /*spellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA)
+ || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ Unit* target = GetTarget();
- switch (GetSpellInfo()->Id)
+ if (!caster)
+ return;
+
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_COPY_WEAPON_AURA:
+ case SPELL_COPY_WEAPON_2_AURA:
+ case SPELL_COPY_WEAPON_3_AURA:
{
- case SPELL_COPY_WEAPON:
- case SPELL_COPY_WEAPON_2:
- case SPELL_COPY_WEAPON_3:
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID);
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
- break;
+ if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
}
- case SPELL_COPY_OFFHAND:
- case SPELL_COPY_OFFHAND_2:
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
+ break;
+ }
+ case SPELL_COPY_OFFHAND_AURA:
+ case SPELL_COPY_OFFHAND_2_AURA:
+ {
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 1;
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
- break;
+ if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
}
- case SPELL_COPY_RANGED:
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
+ break;
+ }
+ case SPELL_COPY_RANGED_AURA:
+ {
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 2;
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
- break;
+ if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
}
- default:
- break;
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_COPY_WEAPON_AURA:
+ case SPELL_COPY_WEAPON_2_AURA:
+ case SPELL_COPY_WEAPON_3_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, prevItem);
+ break;
+ }
+ case SPELL_COPY_OFFHAND_AURA:
+ case SPELL_COPY_OFFHAND_2_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, prevItem);
+ break;
}
+ case SPELL_COPY_RANGED_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, prevItem);
+ break;
+ }
+ default:
+ break;
}
}
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffectApply += AuraEffectApplyFn(spell_gen_clone_weapon_auraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_clone_weapon_auraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
+
};
- SpellScript* GetSpellScript() const
+ AuraScript* GetAuraScript() const
{
- return new spell_generic_clone_weapon_SpellScript();
+ return new spell_gen_clone_weapon_auraScript();
}
};
@@ -1844,16 +1911,18 @@ class spell_gen_break_shield: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- Aura* aura = itr->second->GetBase();
- SpellInfo const* auraInfo = aura->GetSpellInfo();
- if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ if (Aura* aura = itr->second->GetBase())
{
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- // Remove dummys from rider (Necessary for updating visual shields)
- if (Unit* rider = target->GetCharmer())
- if (Aura* defend = rider->GetAura(aura->GetId()))
- defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- break;
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ {
+ aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ // Remove dummys from rider (Necessary for updating visual shields)
+ if (Unit* rider = target->GetCharmer())
+ if (Aura* defend = rider->GetAura(aura->GetId()))
+ defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ break;
+ }
}
}
break;
@@ -1972,16 +2041,18 @@ class spell_gen_mounted_charge: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- Aura* aura = itr->second->GetBase();
- SpellInfo const* auraInfo = aura->GetSpellInfo();
- if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ if (Aura* aura = itr->second->GetBase())
{
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- // Remove dummys from rider (Necessary for updating visual shields)
- if (Unit* rider = target->GetCharmer())
- if (Aura* defend = rider->GetAura(aura->GetId()))
- defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- break;
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ {
+ aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ // Remove dummys from rider (Necessary for updating visual shields)
+ if (Unit* rider = target->GetCharmer())
+ if (Aura* defend = rider->GetAura(aura->GetId()))
+ defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ break;
+ }
}
}
break;
@@ -3189,6 +3260,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_profession_research();
new spell_generic_clone();
new spell_generic_clone_weapon();
+ new spell_gen_clone_weapon_aura();
new spell_gen_seaforium_blast();
new spell_gen_turkey_marker();
new spell_gen_lifeblood();
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 3cb2300cadf..cbf45910495 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -1291,7 +1291,7 @@ class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoad
class spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript);
-
+
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetHitCreature())
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 60572ee3e6a..a6f4f7f64f9 100755
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -278,6 +278,9 @@ class achievement_tilted : public AchievementCriteriaScript
bool OnCheck(Player* player, Unit* /*target*/)
{
+ if (!player)
+ return false;
+
bool checkArea = player->GetAreaId() == AREA_ARGENT_TOURNAMENT_FIELDS ||
player->GetAreaId() == AREA_RING_OF_ASPIRANTS ||
player->GetAreaId() == AREA_RING_OF_ARGENT_VALIANTS ||
@@ -285,7 +288,7 @@ class achievement_tilted : public AchievementCriteriaScript
player->GetAreaId() == AREA_RING_OF_HORDE_VALIANTS ||
player->GetAreaId() == AREA_RING_OF_CHAMPIONS;
- return player && checkArea && player->duel && player->duel->isMounted;
+ return checkArea && player->duel && player->duel->isMounted;
}
};
diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp
index 364ee76ec75..146b2c37ad3 100755
--- a/src/server/shared/Cryptography/BigNumber.cpp
+++ b/src/server/shared/Cryptography/BigNumber.cpp
@@ -75,7 +75,7 @@ void BigNumber::SetRand(int numbits)
BN_rand(_bn, numbits, 0, 1);
}
-BigNumber BigNumber::operator=(const BigNumber &bn)
+BigNumber& BigNumber::operator=(const BigNumber &bn)
{
if (this == &bn)
return *this;
diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h
index 6646245a6a0..a27d74fb5c7 100755
--- a/src/server/shared/Cryptography/BigNumber.h
+++ b/src/server/shared/Cryptography/BigNumber.h
@@ -39,7 +39,7 @@ class BigNumber
void SetRand(int numbits);
- BigNumber operator=(const BigNumber &bn);
+ BigNumber& operator=(const BigNumber &bn);
BigNumber operator+=(const BigNumber &bn);
BigNumber operator+(const BigNumber &bn)
diff --git a/src/server/shared/DataStores/DBCFileLoader.cpp b/src/server/shared/DataStores/DBCFileLoader.cpp
index f909c8566bb..85b61c4f143 100755
--- a/src/server/shared/DataStores/DBCFileLoader.cpp
+++ b/src/server/shared/DataStores/DBCFileLoader.cpp
@@ -23,10 +23,8 @@
#include "DBCFileLoader.h"
#include "Errors.h"
-DBCFileLoader::DBCFileLoader()
+DBCFileLoader::DBCFileLoader() : stringTable(NULL), data(NULL), fieldsOffset(NULL)
{
- data = NULL;
- fieldsOffset = NULL;
}
bool DBCFileLoader::Load(const char* filename, const char* fmt)
diff --git a/src/server/shared/DataStores/DBCFileLoader.h b/src/server/shared/DataStores/DBCFileLoader.h
index a43807a3b59..eb8317fbefd 100755
--- a/src/server/shared/DataStores/DBCFileLoader.h
+++ b/src/server/shared/DataStores/DBCFileLoader.h
@@ -32,8 +32,8 @@ enum
FT_BYTE='b', //uint8
FT_SORT='d', //sorted by this field, field is not included
FT_IND='n', //the same, but parsed to data
- FT_LOGIC='l', //Logical (boolean)
- FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
+ FT_LOGIC='l', //Logical (boolean)
+ FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
};
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index 872d9ec415c..c491852b1bd 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
- PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 6e17a32c78b..0b2bbb3122a 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -103,7 +103,7 @@ void Log::CreateAppenderFromConfig(const char* name)
LogLevel level = LogLevel(atoi(*iter));
if (level > LOG_LEVEL_FATAL)
{
- fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %u for appender %s\n", level, name);
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name);
return;
}
@@ -158,7 +158,7 @@ void Log::CreateAppenderFromConfig(const char* name)
break;
}
default:
- fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %u for appender %s\n", type, name);
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name);
break;
}
}
diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp
index c6e9d385be3..91a78af1adc 100755
--- a/src/server/shared/Utilities/ServiceWin32.cpp
+++ b/src/server/shared/Utilities/ServiceWin32.cpp
@@ -52,8 +52,6 @@ typedef WINADVAPI BOOL (WINAPI *CSD_T)(SC_HANDLE, DWORD, LPCVOID);
bool WinServiceInstall()
{
- CSD_T ChangeService_Config2;
- HMODULE advapi32;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
if (serviceControlManager)
@@ -79,7 +77,7 @@ bool WinServiceInstall()
0); // no password
if (service)
{
- advapi32 = GetModuleHandle("ADVAPI32.DLL");
+ HMODULE advapi32 = GetModuleHandle("ADVAPI32.DLL");
if (!advapi32)
{
CloseServiceHandle(service);
@@ -87,7 +85,7 @@ bool WinServiceInstall()
return false;
}
- ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
+ CSD_T ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
if (!ChangeService_Config2)
{
CloseServiceHandle(service);
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 7bedf9690ca..9917bbb5309 100755
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -217,7 +217,7 @@ uint32 CreatePIDFile(const std::string& filename)
pid_t pid = getpid();
#endif
- fprintf(pid_file, "%d", pid );
+ fprintf(pid_file, "%u", pid );
fclose(pid_file);
return (uint32)pid;
diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h
index 285adaaaf4b..51ffb3a91c8 100755
--- a/src/server/worldserver/TCSoap/TCSoap.h
+++ b/src/server/worldserver/TCSoap/TCSoap.h
@@ -51,7 +51,7 @@ class SOAPCommand
{
public:
SOAPCommand():
- pendingCommands(0, USYNC_THREAD, "pendingCommands")
+ pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false)
{
}