aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.cpp4
-rwxr-xr-xsrc/server/authserver/Realms/RealmList.h2
-rwxr-xr-xsrc/server/game/AI/CoreAI/GuardAI.cpp6
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp12
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.h2
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp34
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp10
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp22
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp173
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.cpp2
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp10
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.cpp12
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp5
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.h12
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp24
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.h47
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.cpp3
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.h5
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.cpp5
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.cpp3
-rwxr-xr-xsrc/server/game/Chat/Commands/Level0.cpp26
-rwxr-xr-xsrc/server/game/Chat/Commands/Level1.cpp8
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp55
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.h2
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp4
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp2
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp2
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h6
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp4
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp8
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h4
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp18
-rwxr-xr-xsrc/server/game/Entities/Item/Item.h2
-rwxr-xr-xsrc/server/game/Entities/Item/ItemEnchantmentMgr.cpp9
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp6
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h8
-rwxr-xr-xsrc/server/game/Entities/Object/ObjectPosSelector.cpp2
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp2
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp82
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h4
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp8
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp67
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h6
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp61
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp232
-rw-r--r--src/server/game/Grids/Cells/CellImpl.h2
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiers.h7
-rwxr-xr-xsrc/server/game/Groups/Group.cpp28
-rw-r--r--src/server/game/Groups/GroupMgr.cpp6
-rwxr-xr-xsrc/server/game/Guilds/Guild.cpp16
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp84
-rwxr-xr-xsrc/server/game/Handlers/GroupHandler.cpp14
-rwxr-xr-xsrc/server/game/Handlers/GuildHandler.cpp8
-rwxr-xr-xsrc/server/game/Handlers/ItemHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/LFGHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/MailHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/NPCHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/PetitionsHandler.cpp6
-rwxr-xr-xsrc/server/game/Handlers/QueryHandler.cpp50
-rwxr-xr-xsrc/server/game/Handlers/TicketHandler.cpp10
-rwxr-xr-xsrc/server/game/Handlers/TradeHandler.cpp2
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp2
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp29
-rwxr-xr-xsrc/server/game/Maps/Map.h8
-rw-r--r--src/server/game/Maps/MapUpdater.cpp2
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h3
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp2
-rwxr-xr-xsrc/server/game/Movement/Waypoints/WaypointManager.cpp3
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.cpp4
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp2
-rwxr-xr-xsrc/server/game/Quests/QuestDef.cpp68
-rwxr-xr-xsrc/server/game/Reputation/ReputationMgr.cpp2
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp2
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp18
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp8
-rwxr-xr-xsrc/server/game/Skills/SkillDiscovery.cpp2
-rwxr-xr-xsrc/server/game/Skills/SkillExtraItems.cpp2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp10
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp74
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp60
-rwxr-xr-xsrc/server/game/Spells/Spell.h2
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp9
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp147
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h1
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.cpp43
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.h8
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp2
-rwxr-xr-xsrc/server/game/Weather/Weather.cpp2
-rwxr-xr-xsrc/server/game/Weather/WeatherMgr.cpp6
-rwxr-xr-xsrc/server/game/World/World.cpp55
-rwxr-xr-xsrc/server/game/World/World.h7
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/arathi_highlands.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ghostlands.cpp101
-rw-r--r--src/server/scripts/EasternKingdoms/hinterlands.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/silverpine_forest.cpp53
-rw-r--r--src/server/scripts/EasternKingdoms/western_plaguelands.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/westfall.cpp6
-rw-r--r--src/server/scripts/Examples/example_escort.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp2
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp9
-rw-r--r--src/server/scripts/Kalimdor/ashenvale.cpp50
-rw-r--r--src/server/scripts/Kalimdor/azuremyst_isle.cpp2
-rw-r--r--src/server/scripts/Kalimdor/desolace.cpp5
-rw-r--r--src/server/scripts/Kalimdor/dustwallow_marsh.cpp7
-rw-r--r--src/server/scripts/Kalimdor/feralas.cpp4
-rw-r--r--src/server/scripts/Kalimdor/stonetalon_mountains.cpp21
-rw-r--r--src/server/scripts/Kalimdor/tanaris.cpp11
-rw-r--r--src/server/scripts/Kalimdor/the_barrens.cpp5
-rw-r--r--src/server/scripts/Kalimdor/thousand_needles.cpp5
-rw-r--r--src/server/scripts/Kalimdor/ungoro_crater.cpp3
-rw-r--r--src/server/scripts/Kalimdor/winterspring.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp1
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp96
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp2
-rw-r--r--src/server/scripts/Northrend/borean_tundra.cpp3
-rw-r--r--src/server/scripts/Northrend/grizzly_hills.cpp1
-rw-r--r--src/server/scripts/Northrend/howling_fjord.cpp4
-rw-r--r--src/server/scripts/Northrend/sholazar_basin.cpp8
-rw-r--r--src/server/scripts/Northrend/storm_peaks.cpp15
-rw-r--r--src/server/scripts/Northrend/zuldrak.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp4
-rw-r--r--src/server/scripts/Outland/nagrand.cpp20
-rw-r--r--src/server/scripts/Outland/netherstorm.cpp9
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp1
-rw-r--r--src/server/scripts/Outland/shattrath_city.cpp6
-rw-r--r--src/server/scripts/Outland/terokkar_forest.cpp51
-rw-r--r--src/server/scripts/Outland/zangarmarsh.cpp1
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp2
-rw-r--r--src/server/scripts/Spells/spell_item.cpp8
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp18
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp2
-rwxr-xr-xsrc/server/shared/Database/DatabaseWorkerPool.h170
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp4
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.cpp4
-rwxr-xr-xsrc/server/shared/Database/QueryResult.h4
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp2
-rwxr-xr-xsrc/server/shared/Packets/ByteBuffer.h2
-rwxr-xr-xsrc/server/shared/Utilities/Util.cpp40
-rwxr-xr-xsrc/server/worldserver/Master.cpp18
-rw-r--r--src/server/worldserver/worldserver.conf.dist6
160 files changed, 1422 insertions, 1297 deletions
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp
index efcced51089..f856156825d 100755
--- a/src/server/authserver/Realms/RealmList.cpp
+++ b/src/server/authserver/Realms/RealmList.cpp
@@ -31,7 +31,7 @@ void RealmList::Initialize(uint32 updateInterval)
UpdateRealms(true);
}
-void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
+void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
{
// Create new if not exist or update existed
Realm& realm = m_realms[name];
@@ -82,7 +82,7 @@ void RealmList::UpdateRealms(bool init)
uint32 realmId = fields[0].GetUInt32();
const std::string& name = fields[1].GetString();
const std::string& address = fields[2].GetString();
- uint32 port = fields[3].GetUInt32();
+ uint16 port = fields[3].GetUInt16();
uint8 icon = fields[4].GetUInt8();
RealmFlags flag = RealmFlags(fields[5].GetUInt8());
uint8 timezone = fields[6].GetUInt8();
diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h
index 4d258953ae0..c8407b0fea1 100755
--- a/src/server/authserver/Realms/RealmList.h
+++ b/src/server/authserver/Realms/RealmList.h
@@ -71,7 +71,7 @@ public:
private:
void UpdateRealms(bool init=false);
- void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
+ void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
RealmMap m_realms;
uint32 m_UpdateInterval;
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index df29d485cba..252bcbabca5 100755
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -92,15 +92,15 @@ void GuardAI::EnterEvadeMode()
{
sLog->outStaticDebug("Creature stopped attacking because victim does not exist [guid=%u]", me->GetGUIDLow());
}
- else if (!victim ->isAlive())
+ else if (!victim->isAlive())
{
sLog->outStaticDebug("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow());
}
- else if (victim ->HasStealthAura())
+ else if (victim->HasStealthAura())
{
sLog->outStaticDebug("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow());
}
- else if (victim ->isInFlight())
+ else if (victim->isInFlight())
{
sLog->outStaticDebug("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow());
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index 11887611ae8..7a2b83273c9 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -95,7 +95,7 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
m_AttackDistance = 0.0f;
m_AttackAngle = 0.0f;
- m_InvinceabilityHpLevel = 0;
+ m_InvincibilityHpLevel = 0;
//Handle Spawned Events
if (!m_bEmptyList)
@@ -816,9 +816,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
if (action.invincibility_hp_level.is_percent)
- m_InvinceabilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level);
+ m_InvincibilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level);
else
- m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
+ m_InvincibilityHpLevel = action.invincibility_hp_level.hp_level;
break;
}
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
@@ -1350,12 +1350,12 @@ void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote)
void CreatureEventAI::DamageTaken(Unit* /*done_by*/, uint32& damage)
{
- if (m_InvinceabilityHpLevel > 0 && me->GetHealth() < m_InvinceabilityHpLevel+damage)
+ if (m_InvincibilityHpLevel > 0 && me->GetHealth() < m_InvincibilityHpLevel+damage)
{
- if (me->GetHealth() <= m_InvinceabilityHpLevel)
+ if (me->GetHealth() <= m_InvincibilityHpLevel)
damage = 0;
else
- damage = me->GetHealth() - m_InvinceabilityHpLevel;
+ damage = me->GetHealth() - m_InvincibilityHpLevel;
}
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index c4daf2563e0..3d2bcf888c8 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -641,6 +641,6 @@ class CreatureEventAI : public CreatureAI
bool m_MeleeEnabled; // If we allow melee auto attack
float m_AttackDistance; // Distance to attack from
float m_AttackAngle; // Angle of attack
- uint32 m_InvinceabilityHpLevel; // Minimal health level allowed at damage apply
+ uint32 m_InvincibilityHpLevel; // Minimal health level allowed at damage apply
};
#endif
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index add7b4db174..517e55af457 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -38,7 +38,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
// Load EventAI Text
sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
- // Gather Additional data from EventAI Texts
+ // Gather Additional data from EventAI Texts 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
if (!result)
@@ -56,10 +56,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
StringTextData temp;
int32 i = fields[0].GetInt32();
- temp.SoundId = fields[1].GetInt32();
- temp.Type = fields[2].GetInt32();
- temp.Language = fields[3].GetInt32();
- temp.Emote = fields[4].GetInt32();
+ temp.SoundId = fields[1].GetUInt32();
+ temp.Type = fields[2].GetUInt8();
+ temp.Language = fields[3].GetUInt8();
+ temp.Emote = fields[4].GetUInt16();
// range negative
if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
@@ -187,7 +187,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
temp.creature_id = fields[1].GetUInt32();
uint32 creature_id = temp.creature_id;
- uint32 e_type = fields[2].GetUInt32();
+ uint32 e_type = fields[2].GetUInt8();
//Report any errors in event
if (e_type >= EVENT_T_END)
{
@@ -196,13 +196,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
temp.event_type = EventAI_Type(e_type);
- temp.event_inverse_phase_mask = fields[3].GetUInt32();
- temp.event_chance = fields[4].GetUInt8();
- temp.event_flags = fields[5].GetUInt8();
- temp.raw.param1 = fields[6].GetUInt32();
- temp.raw.param2 = fields[7].GetUInt32();
- temp.raw.param3 = fields[8].GetUInt32();
- temp.raw.param4 = fields[9].GetUInt32();
+ temp.event_inverse_phase_mask = fields[3].GetInt32();
+ temp.event_chance = fields[4].GetUInt32();
+ temp.event_flags = fields[5].GetUInt32();
+ temp.raw.param1 = fields[6].GetInt32();
+ temp.raw.param2 = fields[7].GetInt32();
+ temp.raw.param3 = fields[8].GetInt32();
+ temp.raw.param4 = fields[9].GetInt32();
//Creature does not exist in database
if (!sObjectMgr->GetCreatureTemplate(temp.creature_id))
@@ -399,7 +399,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
for (uint32 j = 0; j < MAX_ACTIONS; j++)
{
- uint16 action_type = fields[10+(j*4)].GetUInt16();
+ uint16 action_type = fields[10+(j*4)].GetUInt8();
if (action_type >= ACTION_T_END)
{
sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
@@ -410,9 +410,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
CreatureEventAI_Action& action = temp.action[j];
action.type = EventAI_ActionType(action_type);
- action.raw.param1 = fields[11+(j*4)].GetUInt32();
- action.raw.param2 = fields[12+(j*4)].GetUInt32();
- action.raw.param3 = fields[13+(j*4)].GetUInt32();
+ action.raw.param1 = fields[11+(j*4)].GetInt32();
+ action.raw.param2 = fields[12+(j*4)].GetInt32();
+ action.raw.param3 = fields[13+(j*4)].GetInt32();
//Report any errors in actions
switch (action.type)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 4cf438da5a4..4eb7f8a7f50 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -68,12 +68,14 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mFollowCredit = 0;
mFollowArrivedEntry = 0;
mFollowCreditType = 0;
- mInvinceabilityHpLevel = 0;
+ mInvincibilityHpLevel = 0;
}
void SmartAI::UpdateDespawn(const uint32 diff)
{
- if (mDespawnState <= 1 || mDespawnState > 3) return;
+ if (mDespawnState <= 1 || mDespawnState > 3)
+ return;
+
if (mDespawnTime < diff)
{
if (mDespawnState == 2)
@@ -638,8 +640,8 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
- if ((me->GetHealth() - damage) <= mInvinceabilityHpLevel)
- damage -= mInvinceabilityHpLevel;
+ if ((me->GetHealth() - damage) <= mInvincibilityHpLevel)
+ damage = me->GetHealth() - mInvincibilityHpLevel;
}
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index c2501199f77..94e5e65cf8b 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -174,7 +174,7 @@ class SmartAI : public CreatureAI
void SetSwim(bool swim = true);
- void SetInvinceabilityHpLevel(uint32 level) { mInvinceabilityHpLevel = level; }
+ void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; }
void sGossipHello(Player* player);
void sGossipSelect(Player* player, uint32 sender, uint32 action);
@@ -223,7 +223,7 @@ class SmartAI : public CreatureAI
bool mCanAutoAttack;
bool mCanCombatMove;
bool mForcedPaused;
- uint32 mInvinceabilityHpLevel;
+ uint32 mInvincibilityHpLevel;
bool AssistPlayerInCombat(Unit* who);
@@ -245,7 +245,7 @@ public:
SmartScript* GetScript() { return &mScript; }
static int Permissible(const GameObject* g);
- bool GossipHello(Player* player) ;
+ bool GossipHello(Player* player);
bool GossipSelect(Player* player, uint32 sender, uint32 action);
bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/);
bool QuestAccept(Player* player, Quest const* quest);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 05a2910e7a7..b2c4fd29868 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1043,9 +1043,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
if (e.action.invincHP.percent)
- ai->SetInvinceabilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent));
+ ai->SetInvincibilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent));
else
- ai->SetInvinceabilityHpLevel(e.action.invincHP.minHP);
+ ai->SetInvincibilityHpLevel(e.action.invincHP.minHP);
break;
}
case SMART_ACTION_SET_DATA:
@@ -1954,7 +1954,8 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
}
case SMARTAI_TEMPLATE_CAGED_NPC_PART:
{
- if (!me) return;
+ if (!me)
+ return;
//store cage as id1
AddEvent(SMART_EVENT_DATA_SET, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_GAMEOBJECT, e.action.installTtemplate.param1, 10, 0, 0);
@@ -1976,7 +1977,8 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
}
case SMARTAI_TEMPLATE_CAGED_GO_PART:
{
- if (!go) return;
+ if (!go)
+ return;
//store hostage as id1
AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0);
//store invoker as id2
@@ -2839,8 +2841,12 @@ void SmartScript::InstallEvents()
bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3)
{
- if (c == 0) return true;
- if (!u || !u->ToPlayer()) return false;
+ if (c == 0)
+ return true;
+
+ if (!u || !u->ToPlayer())
+ return false;
+
Condition cond;
cond.ConditionType = ConditionTypes(uint32(c));
cond.ConditionValue1 = uint32(v1);
@@ -3007,7 +3013,9 @@ void SmartScript::OnMoveInLineOfSight(Unit* who)
{
ProcessEventsFor(SMART_EVENT_OOC_LOS, who);
- if (!me) return;
+ if (!me)
+ return;
+
if (me->getVictim())
return;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 776ffd78a9a..b0f1fcb8ede 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -198,7 +198,6 @@ void SmartAIMgr::LoadSmartAIFromDB()
temp.event.raw.param4 = fields[11].GetUInt32();
temp.action.type = (SMART_ACTION)fields[12].GetUInt8();
-
temp.action.raw.param1 = fields[13].GetUInt32();
temp.action.raw.param2 = fields[14].GetUInt32();
temp.action.raw.param3 = fields[15].GetUInt32();
@@ -338,8 +337,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)
{
e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script!
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false;
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))
+ return false;
}
else
{
@@ -357,8 +359,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_DAMAGED:
case SMART_EVENT_DAMAGED_TARGET:
case SMART_EVENT_RECEIVE_HEAL:
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false;
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))
+ return false;
break;
case SMART_EVENT_SPELLHIT:
case SMART_EVENT_SPELLHIT_TARGET:
@@ -376,11 +381,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
}
- if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax)) return false;
+ if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax))
+ return false;
break;
case SMART_EVENT_OOC_LOS:
case SMART_EVENT_IC_LOS:
- if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax)) return false;
+ if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax))
+ return false;
break;
case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
@@ -395,32 +402,48 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_EVENT_FRIENDLY_HEALTH:
- if (!NotNULL(e, e.event.friendlyHealt.radius)) return false;
- if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax)) return false;
+ if (!NotNULL(e, e.event.friendlyHealt.radius))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax))
+ return false;
break;
case SMART_EVENT_FRIENDLY_IS_CC:
- if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax))
+ return false;
break;
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
{
- if (!IsSpellValid(e, e.event.missingBuff.spell)) return false;
- if (!NotNULL(e, e.event.missingBuff.radius)) return false;
- if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax)) return false;
+ if (!IsSpellValid(e, e.event.missingBuff.spell))
+ return false;
+
+ if (!NotNULL(e, e.event.missingBuff.radius))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax))
+ return false;
break;
}
case SMART_EVENT_KILL:
- if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax)) return false;
- if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) return false;
+ if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax))
+ return false;
+
+ if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature))
+ return false;
break;
case SMART_EVENT_TARGET_CASTING:
case SMART_EVENT_PASSENGER_BOARDED:
case SMART_EVENT_PASSENGER_REMOVED:
- if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax))
+ return false;
break;
case SMART_EVENT_SUMMON_DESPAWNED:
case SMART_EVENT_SUMMONED_UNIT:
- if (e.event.summoned.creature && !IsCreatureValid(e, e.event.summoned.creature)) return false;
- if (!IsMinMaxValid(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax)) return false;
+ if (e.event.summoned.creature && !IsCreatureValid(e, e.event.summoned.creature))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax))
+ return false;
break;
case SMART_EVENT_ACCEPTED_QUEST:
case SMART_EVENT_REWARD_QUEST:
@@ -429,20 +452,27 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_EVENT_RECEIVE_EMOTE:
{
- if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote)) return false;
- if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax)) return false;
+ if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax))
+ return false;
break;
}
case SMART_EVENT_HAS_AURA:
case SMART_EVENT_TARGET_BUFFED:
{
- if (!IsSpellValid(e, e.event.aura.spell)) return false;
- if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax)) return false;
+ if (!IsSpellValid(e, e.event.aura.spell))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax))
+ return false;
break;
}
case SMART_EVENT_TRANSPORT_ADDCREATURE:
{
- if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) return false;
+ if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature))
+ return false;
break;
}
case SMART_EVENT_MOVEMENTINFORM:
@@ -456,12 +486,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
case SMART_EVENT_DATA_SET:
{
- if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) return false;
+ if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax))
+ return false;
break;
}
case SMART_EVENT_AREATRIGGER_ONTRIGGER:
{
- if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) return false;
+ if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id))
+ return false;
break;
}
case SMART_EVENT_TEXT_OVER:
@@ -477,8 +509,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_EVENT_DUMMY_EFFECT:
- if (!IsSpellValid(e, e.event.dummy.spell)) return false;
- if (e.event.dummy.effIndex > EFFECT_2) return false;
+ if (!IsSpellValid(e, e.event.dummy.spell))
+ return false;
+
+ if (e.event.dummy.effIndex > EFFECT_2)
+ return false;
break;
case SMART_EVENT_IS_BEHIND_TARGET:
if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax))
@@ -575,11 +610,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_ACTION_SET_EMOTE_STATE:
case SMART_ACTION_PLAY_EMOTE:
- if (!IsEmoteValid(e, e.action.emote.emote)) return false;
+ if (!IsEmoteValid(e, e.action.emote.emote))
+ return false;
break;
case SMART_ACTION_FAIL_QUEST:
case SMART_ACTION_ADD_QUEST:
- if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) return false;
+ if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest))
+ return false;
break;
case SMART_ACTION_ACTIVATE_TAXI:
{
@@ -591,17 +628,29 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_ACTION_RANDOM_EMOTE:
- if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1)) return false;
- if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2)) return false;
- if (e.action.randomEmote.emote3 && !IsEmoteValid(e, e.action.randomEmote.emote3)) return false;
- if (e.action.randomEmote.emote4 && !IsEmoteValid(e, e.action.randomEmote.emote4)) return false;
- if (e.action.randomEmote.emote5 && !IsEmoteValid(e, e.action.randomEmote.emote5)) return false;
- if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6)) return false;
+ if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1))
+ return false;
+
+ if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2))
+ return false;
+
+ if (e.action.randomEmote.emote3 && !IsEmoteValid(e, e.action.randomEmote.emote3))
+ return false;
+
+ if (e.action.randomEmote.emote4 && !IsEmoteValid(e, e.action.randomEmote.emote4))
+ return false;
+
+ if (e.action.randomEmote.emote5 && !IsEmoteValid(e, e.action.randomEmote.emote5))
+ return false;
+
+ if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6))
+ return false;
break;
case SMART_ACTION_ADD_AURA:
case SMART_ACTION_CAST:
case SMART_ACTION_INVOKER_CAST:
- if (!IsSpellValid(e, e.action.cast.spell)) return false;
+ if (!IsSpellValid(e, e.action.cast.spell))
+ return false;
break;
case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS:
case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
@@ -620,8 +669,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_SEND_CASTCREATUREORGO:
- if (!IsQuestValid(e, e.action.castCreatureOrGO.quest)) return false;
- if (!IsSpellValid(e, e.action.castCreatureOrGO.spell)) return false;
+ if (!IsQuestValid(e, e.action.castCreatureOrGO.quest))
+ return false;
+
+ if (!IsSpellValid(e, e.action.castCreatureOrGO.spell))
+ return false;
break;
@@ -645,11 +697,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_CALL_CASTEDCREATUREORGO:
- if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature)) return false;
- if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell)) return false;
+ if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature))
+ return false;
+
+ if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell))
+ return false;
break;
case SMART_ACTION_REMOVEAURASFROMSPELL:
- if (!IsSpellValid(e, e.action.removeAura.spell)) return false;
+ if (!IsSpellValid(e, e.action.removeAura.spell))
+ return false;
break;
case SMART_ACTION_RANDOM_PHASE:
{
@@ -673,11 +729,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
- if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax)) return false;
+ if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax))
+ return false;
break;
}
case SMART_ACTION_SUMMON_CREATURE:
- if (!IsCreatureValid(e, e.action.summonCreature.creature)) return false;
+ if (!IsCreatureValid(e, e.action.summonCreature.creature))
+ return false;
if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
@@ -685,10 +743,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_CALL_KILLEDMONSTER:
- if (!IsCreatureValid(e, e.action.killedMonster.creature)) return false;
+ if (!IsCreatureValid(e, e.action.killedMonster.creature))
+ return false;
break;
case SMART_ACTION_UPDATE_TEMPLATE:
- if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) return false;
+ if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature))
+ return false;
break;
case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
@@ -707,12 +767,16 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_ACTION_SUMMON_GO:
- if (!IsGameObjectValid(e, e.action.summonGO.entry)) return false;
+ if (!IsGameObjectValid(e, e.action.summonGO.entry))
+ return false;
break;
case SMART_ACTION_ADD_ITEM:
case SMART_ACTION_REMOVE_ITEM:
- if (!IsItemValid(e, e.action.item.entry)) return false;
- if (!NotNULL(e, e.action.item.count)) return false;
+ if (!IsItemValid(e, e.action.item.entry))
+ return false;
+
+ if (!NotNULL(e, e.action.item.count))
+ return false;
break;
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
@@ -729,7 +793,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_WP_STOP:
- if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) return false;
+ if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest))
+ return false;
break;
case SMART_ACTION_WP_START:
{
@@ -738,7 +803,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
}
- if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest)) return false;
+ if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
+ return false;
if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
{
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
@@ -748,8 +814,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
case SMART_ACTION_CREATE_TIMED_EVENT:
{
- if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max)) return false;
- if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max))
+ return false;
+
+ if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax))
+ return false;
break;
}
case SMART_ACTION_FOLLOW:
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 240609e3821..9963ade54f9 100755
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -235,7 +235,7 @@ uint32 GetCharactersCount(uint32 accountId)
stmt->setUInt32(0, accountId);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
- return (result) ? (*result)[0].GetUInt32() : 0;
+ return (result) ? (*result)[0].GetUInt64() : 0;
}
bool normalizeString(std::string& utf8String)
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 5a97f6fa18f..2a9f4212f46 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -1492,7 +1492,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if (!miscValue1)
{
uint32 points = 0;
- for (CompletedAchievementMap::iterator itr = m_completedAchievements.begin(); itr != m_completedAchievements.end(); ++itr)
+ for (CompletedAchievementMap::iterator itr = m_completedAchievements.begin(); itr != m_completedAchievements.end(); ++itr)
if (AchievementEntry const* pAchievement = sAchievementStore.LookupEntry(itr->first))
points += pAchievement->points;
SetCriteriaProgress(achievementCriteria, points, PROGRESS_SET);
@@ -2039,7 +2039,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
return;
SendAchievementEarned(achievement);
- CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
+ CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
ca.date = time(NULL);
ca.changed = true;
@@ -2070,7 +2070,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
// mail
if (reward->sender)
{
- Item* item = reward->itemId ? Item::CreateItem(reward->itemId, 1, GetPlayer ()) : NULL;
+ Item* item = reward->itemId ? Item::CreateItem(reward->itemId, 1, GetPlayer()) : NULL;
int loc_idx = GetPlayer()->GetSession()->GetSessionDbLocaleIndex();
@@ -2282,7 +2282,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
continue;
}
- uint32 dataType = fields[1].GetUInt32();
+ uint32 dataType = fields[1].GetUInt8();
const char* scriptName = fields[4].GetCString();
uint32 scriptId = 0;
if (strcmp(scriptName, "")) // not empty
@@ -2415,7 +2415,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
{
Field* fields = result->Fetch();
- uint32 achievementId = fields[0].GetUInt32();
+ uint16 achievementId = fields[0].GetUInt16();
const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievementId);
if (!achievement)
{
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 05fef44f676..8cf504fd685 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -721,7 +721,7 @@ int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int3
void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// Called for each participant of a match after losing
- for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == player->GetGUID())
{
@@ -747,7 +747,7 @@ void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32
void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// Called for offline player after ending rated arena match!
- for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == guid)
{
@@ -769,7 +769,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, i
void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
// called for each participant after winning a match
- for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == player->GetGUID())
{
@@ -804,7 +804,7 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
// To get points, a player has to participate in at least 30% of the matches
uint32 requiredGames = (uint32)ceil(Stats.WeekGames * 0.3f);
- for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
// The player participated in enough games, update his points
uint32 pointsToAdd = 0;
@@ -840,7 +840,7 @@ void ArenaTeam::SaveToDB()
stmt->setUInt32(6, GetId());
trans->Append(stmt);
- for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_MEMBER);
stmt->setUInt16(0, itr->PersonalRating);
@@ -869,7 +869,7 @@ void ArenaTeam::FinishWeek()
Stats.WeekWins = 0;
// Reset member stats
- for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
itr->WeekGames = 0;
itr->WeekWins = 0;
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 36da0e9a97e..f3c393eaa36 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -21,7 +21,6 @@
#include "ArenaTeamMgr.h"
#include "World.h"
#include "WorldPacket.h"
-
#include "ArenaTeam.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
@@ -66,7 +65,7 @@ namespace Trinity
private:
void do_helper(WorldPacket& data, char const* text)
{
- uint64 target_guid = _source ? _source ->GetGUID() : 0;
+ uint64 target_guid = _source ? _source->GetGUID() : 0;
data << uint8 (_msgtype);
data << uint32(LANG_UNIVERSAL);
@@ -259,9 +258,7 @@ void Battleground::Update(uint32 diff)
{
case STATUS_WAIT_JOIN:
if (GetPlayersSize())
- {
_ProcessJoin(diff);
- }
break;
case STATUS_IN_PROGRESS:
_ProcessOfflineQueue();
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 77b985b205f..e1b99cbdcb9 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -708,10 +708,10 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
CreateBattlegroundData data;
data.bgTypeId = BattlegroundTypeId(bgTypeID_);
data.IsArena = (bl->type == TYPE_ARENA);
- data.MinPlayersPerTeam = fields[1].GetUInt32();
- data.MaxPlayersPerTeam = fields[2].GetUInt32();
- data.LevelMin = fields[3].GetUInt32();
- data.LevelMax = fields[4].GetUInt32();
+ data.MinPlayersPerTeam = fields[1].GetUInt16();
+ data.MaxPlayersPerTeam = fields[2].GetUInt16();
+ data.LevelMin = fields[3].GetUInt8();
+ data.LevelMax = fields[4].GetUInt8();
//check values from DB
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
{
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index a5b00ed9db1..6f4264c0faf 100755
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -129,7 +129,7 @@ bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 de
// add group or player (grp == NULL) to bg queue with the given leader and bg specifications
GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, BattlegroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid)
{
- BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
+ BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
// create new ginfo
GroupQueueInfo* ginfo = new GroupQueueInfo;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 71f0ce29aec..52d2cdefd65 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -549,7 +549,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
bool BattlegroundAB::SetupBattleground()
{
- for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
+ for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 50020a580b1..2cac5df73a9 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -184,7 +184,8 @@ enum BG_AB_Objectives
#define AB_EVENT_START_BATTLE 9158 // Achievement: Let's Get This Done
// x, y, z, o
-const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
+const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] =
+{
{1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables
{977.0156f, 1046.616f, -44.80923f, -2.600541f}, // blacksmith
{806.1821f, 874.2723f, -55.99371f, -2.303835f}, // farm
@@ -193,7 +194,8 @@ const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
};
// x, y, z, o, rot0, rot1, rot2, rot3
-const float BG_AB_DoorPositions[2][8] = {
+const float BG_AB_DoorPositions[2][8] =
+{
{1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f},
{708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f}
};
@@ -206,7 +208,8 @@ const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30};
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899};
// x, y, z, o
-const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
+const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] =
+{
{1185.71f, 1185.24f, -56.36f, 2.56f}, // stables
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
{817.66f, 843.34f, -56.54f, 3.01f}, // farm
@@ -215,7 +218,8 @@ const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
};
// x, y, z, o
-const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = {
+const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] =
+{
{1200.03f, 1171.09f, -56.47f, 5.15f}, // stables
{1017.43f, 960.61f, -42.95f, 4.88f}, // blacksmith
{833.00f, 793.00f, -57.25f, 5.27f}, // farm
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 5ea9fc67fed..d2cbab2be54 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -1208,7 +1208,7 @@ bool BattlegroundAV::SetupBattleground()
}
//spawn node-objects
- for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i)
+ for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
{
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
{
@@ -1293,7 +1293,7 @@ bool BattlegroundAV::SetupBattleground()
return false;
}
}
- for (uint16 i= 0 ; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
+ for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
{
@@ -1324,30 +1324,39 @@ bool BattlegroundAV::SetupBattleground()
// Initial Nodes
for (i = 0; i < BG_AV_OBJECT_MAX; i++)
SpawnBGObject(i, RESPAWN_ONE_DAY);
- for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE ; i++){
+
+ for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE; i++)
+ {
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+3*i, RESPAWN_IMMEDIATELY);
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
- for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ; i++)
+
+ for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
- for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ; i++){
+
+ for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER; i++)
+ {
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
if (i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i), RESPAWN_IMMEDIATELY);
}
+
for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag
SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
}
+
for (i = BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER; i <= BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER; i+=2)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag
SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
}
+
//snowfall and the doors
for (i = BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; i <= BG_AV_OBJECT_DOOR_A; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
+
SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
//creatures
@@ -1472,7 +1481,7 @@ void BattlegroundAV::ResetBGSubclass()
{
for (uint8 j=0; j<9; j++)
m_Team_QuestStatus[i][j]=0;
- m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS;
+ m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS;
m_IsInformedNearVictory[i]=false;
m_CaptainAlive[i] = true;
m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
@@ -1493,7 +1502,6 @@ void BattlegroundAV::ResetBGSubclass()
for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
if (BgCreatures[i])
DelCreature(i);
-
}
bool BattlegroundAV::IsBothMinesControlledByTeam(uint32 team) const
@@ -1553,4 +1561,4 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(uint32 team) const
}
return false;
-} \ No newline at end of file
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index 82e231c63fa..f073b69a779 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -356,7 +356,9 @@ enum BG_AV_OBJECTS
AV_OPLACE_MAX = 149
};
-const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = {
+
+const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] =
+{
{638.592f, -32.422f, 46.0608f, -1.62316f }, //firstaid station
{669.007f, -294.078f, 30.2909f, 2.77507f }, //stormpike
{77.8013f, -404.7f, 46.7549f, -0.872665f }, //stone grave
@@ -527,7 +529,8 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = {
{-951.394f, -193.695f, 67.634f, 0.802851f}
};
-const float BG_AV_DoorPositons[2][4] = {
+const float BG_AV_DoorPositons[2][4] =
+{
{780.487f, -493.024f, 99.9553f, 3.0976f}, //alliance
{-1375.193f, -538.981f, 55.2824f, 0.72178f} //horde
};
@@ -623,7 +626,8 @@ enum BG_AV_CreaturePlace
};
//x, y, z, o
-const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = {
+const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] =
+{
//spiritguides
{643.000000f, 44.000000f, 69.740196f, -0.001854f},
{676.000000f, -374.000000f, 30.000000f, -0.001854f},
@@ -1039,7 +1043,8 @@ enum BG_AV_CreatureIds
//entry, team, minlevel, maxlevel
//TODO this array should be removed, the only needed things are the entrys (for spawning(?) and handlekillunit)
-const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = {
+const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] =
+{
{ 12050, 1216, 58, 58 }, //Stormpike Defender
{ 13326, 1216, 59, 59 }, //Seasoned Defender
{ 13331, 1216, 60, 60 }, //Veteran Defender
@@ -1099,7 +1104,9 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = {
};
//x, y, z, o, static_creature_info-id
-const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatures
+const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] =
+{
+ //static creatures
{-1235.31f, -340.777f, 60.5088f, 3.31613f, 0 }, //2225 - Zora Guthrek
{-1244.02f, -323.795f, 61.0485f, 5.21853f, 1 }, //3343 - Grelkor
{-1235.16f, -332.302f, 60.2985f, 2.96706f, 2 }, //3625 - Rarck
@@ -1226,7 +1233,8 @@ const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatur
};
-const uint32 BG_AV_StaticCreatureInfo[51][4] = {
+const uint32 BG_AV_StaticCreatureInfo[51][4] =
+{
{ 2225, 1215, 55, 55 }, //Zora Guthrek
{ 3343, 1215, 55, 55 }, //Grelkor
{ 3625, 1215, 55, 55 }, //Rarck
@@ -1293,16 +1301,17 @@ enum BG_AV_Graveyards
AV_GRAVE_MAIN_HORDE = 610
};
-const uint32 BG_AV_GraveyardIds[9]= {
- AV_GRAVE_STORM_AID,
- AV_GRAVE_STORM_GRAVE,
- AV_GRAVE_STONE_GRAVE,
- AV_GRAVE_SNOWFALL,
- AV_GRAVE_ICE_GRAVE,
- AV_GRAVE_FROSTWOLF,
- AV_GRAVE_FROST_HUT,
- AV_GRAVE_MAIN_ALLIANCE,
- AV_GRAVE_MAIN_HORDE
+const uint32 BG_AV_GraveyardIds[9]=
+{
+ AV_GRAVE_STORM_AID,
+ AV_GRAVE_STORM_GRAVE,
+ AV_GRAVE_STONE_GRAVE,
+ AV_GRAVE_SNOWFALL,
+ AV_GRAVE_ICE_GRAVE,
+ AV_GRAVE_FROSTWOLF,
+ AV_GRAVE_FROST_HUT,
+ AV_GRAVE_MAIN_ALLIANCE,
+ AV_GRAVE_MAIN_HORDE
};
enum BG_AV_BUFF
@@ -1434,13 +1443,15 @@ enum BG_AV_WorldStates
};
//alliance_control neutral_control horde_control
-const uint32 BG_AV_MineWorldStates[2][3] = {
+const uint32 BG_AV_MineWorldStates[2][3] =
+{
{1358, 1360, 1359},
{1355, 1357, 1356}
};
//alliance_control alliance_assault h_control h_assault
-const uint32 BG_AV_NodeWorldStates[16][4] = {
+const uint32 BG_AV_NodeWorldStates[16][4] =
+{
//Stormpike first aid station
{1325, 1326, 1327, 1328},
//Stormpike Graveyard
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 344dc79fe79..8269a04a383 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -29,7 +29,8 @@
#include "Util.h"
// these variables aren't used outside of this file, so declare them only here
-uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
+uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] =
+{
260, // normal honor
160 // holiday
};
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index 026fbccc320..534a40484ce 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -258,7 +258,8 @@ struct BattlegroundEYPointIconsStruct
};
// x, y, z, o
-const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = {
+const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] =
+{
{2044.28f, 1729.68f, 1189.96f, 0.017453f}, // FEL_REAVER center
{2048.83f, 1393.65f, 1194.49f, 0.20944f}, // BLOOD_ELF center
{2286.56f, 1402.36f, 1197.11f, 3.72381f}, // DRAENEI_RUINS center
@@ -326,7 +327,7 @@ const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
class BattlegroundEYScore : public BattlegroundScore
{
public:
- BattlegroundEYScore () : FlagCaptures(0) {};
+ BattlegroundEYScore() : FlagCaptures(0) {};
virtual ~BattlegroundEYScore() {};
uint32 FlagCaptures;
};
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index e5ec15bf60d..f3d0f5520f0 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -47,7 +47,7 @@ BattlegroundIC::BattlegroundIC()
resourceTimer = IC_RESOURCE_TIME;
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
- nodePoint[i] = nodePointInitial[i];
+ nodePoint[i] = nodePointInitial[i];
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
@@ -359,7 +359,7 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
data << uint32(uws) << uint32(1);
}
- for (uint8 i = 0 ; i < MAX_NODE_TYPES ; i++)
+ for (uint8 i = 0; i < MAX_NODE_TYPES; i++)
data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1);
}
@@ -926,7 +926,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
float x = t->m_WayPoints[0].x;
float y = t->m_WayPoints[0].y;
- float z = t->m_WayPoints[0].z;
+ float z = t->m_WayPoints[0].z;
float o = 1;
// creates the Gameobject
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index b236bd41210..6d784488aad 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -37,6 +37,11 @@ BattlegroundSA::BattlegroundSA()
SignaledRoundTwo = false;
SignaledRoundTwoHalfMin = false;
InitSecondRound = false;
+
+ //! This is here to prevent an uninitialised variable warning
+ //! The warning only occurs when SetUpBattleGround fails though.
+ //! In the future this function should be called BEFORE sending initial worldstates.
+ memset(&GraveyardStatus, 0, sizeof(GraveyardStatus));
}
BattlegroundSA::~BattlegroundSA()
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 034de38fd9c..86ad749b8b7 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -37,7 +37,8 @@ enum BG_WSG_Rewards
BG_WSG_REWARD_NUM
};
-uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
+uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] =
+{
{20, 40, 40}, // normal honor
{60, 40, 80} // holiday
};
diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp
index bb744016257..b2ac090c313 100755
--- a/src/server/game/Chat/Commands/Level0.cpp
+++ b/src/server/game/Chat/Commands/Level0.cpp
@@ -17,10 +17,8 @@
*/
#include "Common.h"
-#include "DatabaseEnv.h"
#include "World.h"
#include "Player.h"
-#include "Opcodes.h"
#include "Chat.h"
#include "ObjectAccessor.h"
#include "Language.h"
@@ -54,31 +52,31 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
bool ChatHandler::HandleStartCommand(const char* /*args*/)
{
- Player* chr = m_session->GetPlayer();
+ Player* player = m_session->GetPlayer();
- if (chr->isInFlight())
+ if (player->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
- if (chr->isInCombat())
+ if (player->isInCombat())
{
SendSysMessage(LANG_YOU_IN_COMBAT);
SetSentErrorMessage(true);
return false;
}
- if (chr->isDead() || chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{
// if player is dead and stuck, send ghost to graveyard
- chr->RepopAtGraveyard();
+ player->RepopAtGraveyard();
return true;
}
// cast spell Stuck
- chr->CastSpell(chr, 7355, false);
+ player->CastSpell(player, 7355, false);
return true;
}
@@ -107,23 +105,25 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
bool ChatHandler::HandleDismountCommand(const char* /*args*/)
{
+ Player* player = m_session->GetPlayer();
+
//If player is not mounted, so go out :)
- if (!m_session->GetPlayer()->IsMounted())
+ if (!player->IsMounted())
{
SendSysMessage(LANG_CHAR_NON_MOUNTED);
SetSentErrorMessage(true);
return false;
}
- if (m_session->GetPlayer()->isInFlight())
+ if (player->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
- m_session->GetPlayer()->Dismount();
- m_session->GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ player->Dismount();
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
return true;
}
@@ -144,7 +144,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
// save if the player has last been saved over 20 seconds ago
uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
- if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
+ if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
player->SaveToDB();
return true;
diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp
index a5647d2a5c0..a10a78a35ff 100755
--- a/src/server/game/Chat/Commands/Level1.cpp
+++ b/src/server/game/Chat/Commands/Level1.cpp
@@ -488,7 +488,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
continue;
name = areaEntry->area_name[loc];
- if (name.empty ())
+ if (name.empty())
continue;
if (Utf8FitTo (name, wnamepart))
@@ -511,7 +511,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
else
ss << areaEntry->ID << " - " << name << ' ' << localeNames[loc];
- SendSysMessage (ss.str ().c_str());
+ SendSysMessage(ss.str().c_str());
if (!found)
found = true;
@@ -520,7 +520,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
}
if (!found)
- SendSysMessage (LANG_COMMAND_NOAREAFOUND);
+ SendSysMessage(LANG_COMMAND_NOAREAFOUND);
return true;
}
@@ -693,7 +693,7 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
}
Map* gmMap = m_session->GetPlayer()->GetMap();
- bool to_instance = gmMap->Instanceable();
+ bool to_instance = gmMap->Instanceable();
// we are in instance, and can summon only player in our group with us as lead
if (to_instance && (
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index d5dd233b43e..a88bf06898c 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -100,7 +100,7 @@ bool ChatHandler::HandleSetSkillCommand(const char *args)
return false;
}
- int32 level = atol (level_p);
+ int32 level = atol(level_p);
Player* target = getSelectedPlayer();
if (!target)
@@ -1239,7 +1239,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
uint8 localeIndex = GetSessionDbLocaleIndex();
if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(id))
{
- if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty ())
+ if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty())
{
std::string name = cl->Name[localeIndex];
@@ -1252,9 +1252,9 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
}
if (m_session)
- PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());
+ PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
else
- PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ());
+ PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
if (!found)
found = true;
@@ -1265,7 +1265,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
}
std::string name = itr->second.Name;
- if (name.empty ())
+ if (name.empty())
continue;
if (Utf8FitTo(name, wnamepart))
@@ -1277,9 +1277,9 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
}
if (m_session)
- PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());
+ PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
else
- PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ());
+ PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
if (!found)
found = true;
@@ -1287,7 +1287,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
}
if (!found)
- SendSysMessage (LANG_COMMAND_NOCREATUREFOUND);
+ SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
return true;
}
@@ -1375,7 +1375,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args)
return false;
// Can be NULL at console call
- Player* target = getSelectedPlayer ();
+ Player* target = getSelectedPlayer();
std::string namepart = args;
std::wstring wnamepart;
@@ -1527,10 +1527,10 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
// send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
if (m_session)
- PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc],
+ PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc],
nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
else
- PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
+ PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z);
if (!found)
@@ -1679,16 +1679,16 @@ bool ChatHandler::HandleGuildCreateCommand(const char *args)
if (target->GetGuildId())
{
- SendSysMessage (LANG_PLAYER_IN_GUILD);
+ SendSysMessage(LANG_PLAYER_IN_GUILD);
return true;
}
Guild* guild = new Guild;
- if (!guild->Create (target, guildname))
+ if (!guild->Create(target, guildname))
{
delete guild;
- SendSysMessage (LANG_GUILD_NOT_CREATED);
- SetSentErrorMessage (true);
+ SendSysMessage(LANG_GUILD_NOT_CREATED);
+ SetSentErrorMessage(true);
return false;
}
@@ -1715,7 +1715,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args)
return false;
std::string glName = guildStr;
- Guild* targetGuild = sGuildMgr->GetGuildByName (glName);
+ Guild* targetGuild = sGuildMgr->GetGuildByName(glName);
if (!targetGuild)
return false;
@@ -1730,12 +1730,11 @@ bool ChatHandler::HandleGuildUninviteCommand(const char *args)
if (!extractPlayerTarget((char*)args, &target, &target_guid))
return false;
- uint32 glId = target ? target->GetGuildId () : Player::GetGuildIdFromDB (target_guid);
-
+ uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid);
if (!glId)
return false;
- Guild* targetGuild = sGuildMgr->GetGuildById (glId);
+ Guild* targetGuild = sGuildMgr->GetGuildById(glId);
if (!targetGuild)
return false;
@@ -1757,7 +1756,7 @@ bool ChatHandler::HandleGuildRankCommand(const char *args)
if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
return false;
- uint32 glId = target ? target->GetGuildId () : Player::GetGuildIdFromDB (target_guid);
+ uint32 glId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(target_guid);
if (!glId)
return false;
@@ -1780,11 +1779,11 @@ bool ChatHandler::HandleGuildDeleteCommand(const char *args)
std::string gld = guildStr;
- Guild* targetGuild = sGuildMgr->GetGuildByName (gld);
+ Guild* targetGuild = sGuildMgr->GetGuildByName(gld);
if (!targetGuild)
return false;
- targetGuild->Disband ();
+ targetGuild->Disband();
return true;
}
@@ -2025,7 +2024,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args)
else
return false;
- WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
+ WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
if (!graveyard)
{
@@ -3365,7 +3364,7 @@ bool ChatHandler::HandleBanListHelper(PreparedQueryResult result)
{
SendSysMessage("-------------------------------------------------------------------------------");
Field* fields = result->Fetch();
- uint32 account_id = fields[0].GetUInt32 ();
+ uint32 account_id = fields[0].GetUInt32();
std::string account_name;
@@ -4464,7 +4463,7 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args)
if (!*args)
return false;
char *channel = strtok((char*)args, " ");
- char *argstr = strtok(NULL, "");
+ char *argstr = strtok(NULL, "");
if (!channel || !argstr)
return false;
@@ -4764,9 +4763,11 @@ bool ChatHandler::HandleBindSightCommand(const char * /*args*/)
bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/)
{
- if (m_session->GetPlayer()->isPossessing())
+ Player* player = m_session->GetPlayer();
+
+ if (player->isPossessing())
return false;
- m_session->GetPlayer()->StopCastingBindSight();
+ player->StopCastingBindSight();
return true;
}
diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h
index ce1f6de2ab0..e5badcd24ce 100755
--- a/src/server/game/Combat/ThreatManager.h
+++ b/src/server/game/Combat/ThreatManager.h
@@ -242,7 +242,7 @@ class ThreatManager
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
// I hope they are used as little as possible.
std::list<HostileReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
- std::list<HostileReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
+ std::list<HostileReference*>& getOfflineThreatList() { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private:
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 7fe6df14679..3fcabea4c74 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -719,8 +719,8 @@ void ConditionMgr::LoadConditions(bool isReload)
Condition* cond = new Condition();
int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
cond->SourceGroup = fields[1].GetUInt32();
- cond->SourceEntry = fields[2].GetInt32();
- cond->SourceId = fields[3].GetUInt32();
+ cond->SourceEntry = fields[2].GetUInt32();
+ cond->SourceId = fields[3].GetInt32();
cond->ElseGroup = fields[4].GetUInt32();
int32 iConditionTypeOrReference = fields[5].GetInt32();
cond->ConditionTarget = fields[6].GetUInt8();
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 65a51da037f..4be6c33db79 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -536,7 +536,7 @@ void LoadDBCStores(const std::string& dataPath)
// include existed nodes that have at least single not spell base (scripted) path
{
std::set<uint32> spellPaths;
- for (uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
+ for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
if (SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
if (sInfo->Effect[j] == SPELL_EFFECT_SEND_TAXI)
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 815861ff96a..b936d32e13f 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -1167,7 +1167,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
}
m_QueueInfoMap[gguid] = pqInfo;
- if(GetState(gguid) != LFG_STATE_NONE)
+ if (GetState(gguid) != LFG_STATE_NONE)
{
LfgGuidList& currentQueue = m_currentQueue[team];
currentQueue.push_front(gguid);
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index a8664047b89..f100d391698 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -338,7 +338,9 @@ struct VendorItemData
VendorItem* GetItem(uint32 slot) const
{
- if (slot >= m_items.size()) return NULL;
+ if (slot >= m_items.size())
+ return NULL;
+
return m_items[slot];
}
bool Empty() const { return m_items.empty(); }
@@ -373,7 +375,7 @@ struct TrainerSpell
{
TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0)
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
learnedSpell[i] = 0;
}
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index bcedfa40864..54953ef5420 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -101,7 +101,7 @@ void FormationMgr::LoadCreatureFormations()
group_member = new FormationInfo();
group_member->leaderGUID = fields[0].GetUInt32();
uint32 memberGUID = fields[1].GetUInt32();
- group_member->groupAI = fields[4].GetUInt8();
+ group_member->groupAI = fields[4].GetUInt32();
//If creature is group leader we may skip loading of dist/angle
if (group_member->leaderGUID != memberGUID)
{
@@ -134,7 +134,7 @@ void FormationMgr::LoadCreatureFormations()
CreatureGroupMap[memberGUID] = group_member;
++count;
}
- while (result->NextRow()) ;
+ while (result->NextRow());
sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 910e9c86b42..1fe83023976 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -840,7 +840,9 @@ bool GameObject::IsTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectTemplate const* gInfo = GetGOInfo();
- if (!gInfo) return false;
+ if (!gInfo)
+ return false;
+
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
}
@@ -849,7 +851,9 @@ bool GameObject::IsDynTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectTemplate const* gInfo = GetGOInfo();
- if (!gInfo) return false;
+ if (!gInfo)
+ return false;
+
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index bde8780e78f..a8035043543 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -730,7 +730,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>
bool IsInSkillupList(uint32 PlayerGuidLow) const
{
for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
- if (*i == PlayerGuidLow) return true;
+ if (*i == PlayerGuidLow)
+ return true;
+
return false;
}
void ClearSkillupList() { m_SkillupList.clear(); }
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 4a1d5d5749a..fe2e8f38e62 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -765,7 +765,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const
if (Player* owner = GetOwner())
{
- if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
+ if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
return false;
if (owner->GetLootGUID() == GetGUID())
return false;
@@ -791,16 +791,16 @@ bool Item::HasEnchantRequiredSkill(const Player* player) const
uint32 Item::GetEnchantRequiredLevel() const
{
- uint32 level = 0;
+ uint32 level = 0;
- // Check all enchants for required level
- for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
- if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
- if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
- if (enchantEntry->requiredLevel > level)
- level = enchantEntry->requiredLevel;
+ // Check all enchants for required level
+ for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
+ if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
+ if (enchantEntry->requiredLevel > level)
+ level = enchantEntry->requiredLevel;
- return level;
+ return level;
}
bool Item::IsBoundByEnchant() const
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 3a197a8347f..1d5fcae7d28 100755
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -211,7 +211,7 @@ class Item : public Object
static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL);
Item* CloneItem(uint32 count, Player const* player = NULL) const;
- Item ();
+ Item();
virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index b8eaf043b1f..f3d7d7fd56c 100755
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -49,6 +49,7 @@ void LoadRandomEnchantmentsTable()
RandomItemEnch.clear(); // for reload case
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
if (result)
@@ -101,18 +102,20 @@ uint32 GetItemEnchantMod(int32 entry)
{
fCount += ench_iter->chance;
- if (fCount > dRoll) return ench_iter->ench;
+ if (fCount > dRoll)
+ return ench_iter->ench;
}
//we could get here only if sum of all enchantment chances is lower than 100%
- dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100;
+ dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100;
fCount = 0;
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
{
fCount += ench_iter->chance;
- if (fCount > dRoll) return ench_iter->ench;
+ if (fCount > dRoll)
+ return ench_iter->ench;
}
return 0;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index fe89a346911..eef0e51392c 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1457,7 +1457,9 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset
float Position::GetAngle(const Position* obj) const
{
- if (!obj) return 0;
+ if (!obj)
+ return 0;
+
return GetAngle(obj->GetPositionX(), obj->GetPositionY());
}
@@ -1508,7 +1510,7 @@ bool Position::HasInArc(float arc, const Position* obj) const
if (angle > M_PI)
angle -= 2.0f*M_PI;
- float lborder = -1 * (arc/2.0f); // in range -pi..0
+ float lborder = -1 * (arc/2.0f); // in range -pi..0
float rborder = (arc/2.0f); // in range 0..pi
return ((angle >= lborder) && (angle <= rborder));
}
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 972be794464..6c77bf69a68 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -122,7 +122,7 @@ typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
class Object
{
public:
- virtual ~Object ();
+ virtual ~Object();
bool IsInWorld() const { return m_inWorld; }
@@ -227,7 +227,9 @@ class Object
bool HasFlag(uint16 index, uint32 flag) const
{
- if (index >= m_valuesCount && !PrintIndexError(index, false)) return false;
+ if (index >= m_valuesCount && !PrintIndexError(index, false))
+ return false;
+
return (m_uint32Values[index] & flag) != 0;
}
@@ -313,7 +315,7 @@ class Object
Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return NULL; }
protected:
- Object ();
+ Object();
void _InitValues();
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp
index ec654954b80..6f27c1cb948 100755
--- a/src/server/game/Entities/Object/ObjectPosSelector.cpp
+++ b/src/server/game/Entities/Object/ObjectPosSelector.cpp
@@ -133,7 +133,7 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle)
if (m_smallStepOk[USED_POS_MINUS])
ok = NextSmallStepAngle(-1.0f, USED_POS_MINUS, angle);
else
- ok = NextAngleFor(*m_nextUsedPos[USED_POS_MINUS], -1.0f, USED_POS_MINUS, angle);
+ ok = NextAngleFor(*m_nextUsedPos[USED_POS_MINUS], -1.0f, USED_POS_MINUS, angle);
if (!ok)
++m_nextUsedPos[USED_POS_MINUS];
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index d51af9e1ba9..0ee8381d54f 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -1308,7 +1308,7 @@ void Pet::_SaveAuras(SQLTransaction& trans)
stmt->setUInt32(0, m_charmInfo->GetPetNumber());
trans->Append(stmt);
- for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr)
+ for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
{
// check if the aura has to be saved
if (!itr->second->CanBeSaved() || IsPetAura(itr->second))
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index de66362aa27..a7788da524f 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -858,10 +858,14 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
isDebugAreaTriggers = false;
+ m_WeeklyQuestChanged = false;
+
+ m_SeasonalQuestChanged = false;
+
SetPendingBind(0, 0);
}
-Player::~Player ()
+Player::~Player()
{
// it must be unloaded already in PlayerLogout and accessed only for loggined player
//m_social = NULL;
@@ -881,7 +885,7 @@ Player::~Player ()
}
//all mailed items should be deleted, also all mail should be deallocated
- for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
+ for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
delete *itr;
for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
@@ -3141,7 +3145,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
// reset before any aura state sources (health set/aura apply)
SetUInt32Value(UNIT_FIELD_AURASTATE, 0);
- UpdateSkillsForLevel ();
+ UpdateSkillsForLevel();
// set default cast time multiplier
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
@@ -3420,7 +3424,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time)
else // not ready and no have ready mails
{
if (!m_nextMailDelivereTime || m_nextMailDelivereTime > deliver_time)
- m_nextMailDelivereTime = deliver_time;
+ m_nextMailDelivereTime = deliver_time;
}
}
@@ -3795,7 +3799,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
uint32 new_skill_max_value = spellLearnSkill->maxvalue == 0 ? maxskill : spellLearnSkill->maxvalue;
if (skill_max_value < new_skill_max_value)
- skill_max_value = new_skill_max_value;
+ skill_max_value = new_skill_max_value;
SetSkill(spellLearnSkill->skill, spellLearnSkill->step, skill_value, skill_max_value);
}
@@ -4687,7 +4691,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
return TRAINER_SPELL_RED;
bool hasSpell = true;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
@@ -4710,7 +4714,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
if (getLevel() < trainer_spell->reqLevel)
return TRAINER_SPELL_RED;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
@@ -4737,7 +4741,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
// check primary prof. limit
// first rank of primary profession spell when there are no proffesions avalible is disabled
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
@@ -5116,7 +5120,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
do
{
Field* fields = result->Fetch();
- Player::DeleteFromDB(fields[0].GetUInt64(), fields[1].GetUInt32(), true, true);
+ Player::DeleteFromDB(fields[0].GetUInt32(), fields[1].GetUInt32(), true, true);
}
while (result->NextRow());
}
@@ -5359,7 +5363,7 @@ void Player::CreateCorpse()
iDisplayID = m_items[i]->GetTemplate()->DisplayInfoID;
iIventoryType = m_items[i]->GetTemplate()->InventoryType;
- _cfi = iDisplayID | (iIventoryType << 24);
+ _cfi = iDisplayID | (iIventoryType << 24);
corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi);
}
}
@@ -5415,7 +5419,7 @@ void Player::DurabilityLoss(Item* item, double percent)
if (!item)
return;
- uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
+ uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
if (!pMaxDurability)
return;
@@ -6659,7 +6663,7 @@ uint16 Player::GetBaseSkillValue(uint32 skill) const
return 0;
int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
- result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
+ result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
return result < 0 ? 0 : result;
}
@@ -8450,7 +8454,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
- SpellEnchantProcEntry const* entry = sSpellMgr->GetSpellEnchantProcEvent(enchant_id);
+ SpellEnchantProcEntry const* entry = sSpellMgr->GetSpellEnchantProcEvent(enchant_id);
if (entry && entry->procEx)
{
@@ -8825,7 +8829,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (go->getLootState() == GO_READY)
{
- uint32 lootid = go->GetGOInfo()->GetLootId();
+ uint32 lootid = go->GetGOInfo()->GetLootId();
//TODO: fix this big hack
if ((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S))
@@ -11648,8 +11652,8 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
ItemPosCountVec off_dest;
if (offItem && (!not_loading ||
- CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND, false) != EQUIP_ERR_OK ||
- CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK))
+ CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND, false) != EQUIP_ERR_OK ||
+ CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK))
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_INVENTORY_FULL;
}
}
@@ -16641,7 +16645,7 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
EquipmentSet eqSet;
eqSet.Guid = fields[0].GetUInt64();
- uint32 index = fields[1].GetUInt32();
+ uint8 index = fields[1].GetUInt8();
eqSet.Name = fields[2].GetString();
eqSet.IconName = fields[3].GetString();
eqSet.state = EQUIPMENT_SET_UNCHANGED;
@@ -16871,7 +16875,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
uint32 transGUID = fields[30].GetUInt32();
Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat());
uint32 mapId = fields[15].GetUInt16();
- uint32 instanceId = fields[58].GetUInt8();
+ uint32 instanceId = fields[58].GetUInt32();
uint32 dungeonDiff = fields[38].GetUInt8() & 0x0F;
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
@@ -17218,7 +17222,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
float bubble0 = 0.031f;
//speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
float bubble1 = 0.125f;
- float bubble = fields[23].GetUInt32() > 0
+ float bubble = fields[23].GetUInt8() > 0
? bubble1*sWorld->getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
: bubble0*sWorld->getRate(RATE_REST_OFFLINE_IN_WILDERNESS);
@@ -17866,12 +17870,12 @@ void Player::_LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult
//set a count of unread mails
//QueryResult* resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid), (uint64)cTime);
if (resultUnread)
- unReadMails = (*resultUnread)[0].GetUInt8();
+ unReadMails = uint8((*resultUnread)[0].GetUInt64());
// store nearest delivery time (it > 0 and if it < current then at next player update SendNewMaill will be called)
//resultMails = CharacterDatabase.PQuery("SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(playerGuid));
if (resultDelivery)
- m_nextMailDelivereTime = (time_t)(*resultDelivery)[0].GetUInt64();
+ m_nextMailDelivereTime = time_t((*resultDelivery)[0].GetUInt32());
}
void Player::_LoadMail()
@@ -17900,7 +17904,7 @@ void Player::_LoadMail()
m->deliver_time = time_t(fields[8].GetUInt32());
m->money = fields[9].GetUInt32();
m->COD = fields[10].GetUInt32();
- m->checked = fields[11].GetUInt32();
+ m->checked = fields[11].GetUInt8();
m->stationery = fields[12].GetUInt8();
m->mailTemplateId = fields[13].GetInt16();
@@ -17958,14 +17962,8 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
QuestStatusData& questStatusData = m_QuestStatus[quest_id];
uint8 qstatus = fields[1].GetUInt8();
- if (qstatus < MAX_QUEST_STATUS && qstatus > QUEST_STATUS_NONE)
+ if (qstatus < MAX_QUEST_STATUS)
questStatusData.Status = QuestStatus(qstatus);
- else if (qstatus == QUEST_STATUS_NONE)
- {
- sLog->outError("Player %s (GUID: %u) has QUEST_STATUS_NONE for quest %u and should be removed from character_queststatus.",
- GetName(), GetGUIDLow(), quest_id);
- continue;
- }
else
{
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
@@ -18100,7 +18098,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
uint32 quest_id = fields[0].GetUInt32();
// save _any_ from daily quest times (it must be after last reset anyway)
- m_lastDailyQuestTime = (time_t)fields[1].GetUInt64();
+ m_lastDailyQuestTime = time_t(fields[1].GetUInt32());
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
if (!quest)
@@ -18305,7 +18303,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
{
if (!unload)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt32(1, itr->second.save->GetInstanceId());
@@ -18990,7 +18988,7 @@ void Player::_SaveAuras(SQLTransaction& trans)
stmt->setUInt32(0, GetGUIDLow());
trans->Append(stmt);
- for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr)
+ for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
{
if (!itr->second->CanBeSaved())
continue;
@@ -19531,7 +19529,6 @@ void Player::_SaveStats(SQLTransaction& trans)
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER));
stmt->setUInt32(index++, GetBaseSpellPowerBonus());
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL));
- stmt->setUInt32(index++, GetMaxHealth());
trans->Append(stmt);
}
@@ -23260,7 +23257,8 @@ void Player::SendCorpseReclaimDelay(bool load)
else
delay = GetCorpseReclaimDelay(pvp);
- if (!delay) return;
+ if (!delay)
+ return;
//! corpse reclaim delay 30 * 1000ms or longer at often deaths
WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4);
@@ -23801,7 +23799,8 @@ void Player::AddRunePower(uint8 index)
GetSession()->SendPacket(&data);
}
-static RuneType runeSlotTypes[MAX_RUNES] = {
+static RuneType runeSlotTypes[MAX_RUNES] =
+{
/*0*/ RUNE_BLOOD,
/*1*/ RUNE_BLOOD,
/*2*/ RUNE_UNHOLY,
@@ -24951,22 +24950,21 @@ void Player::_SaveGlyphs(SQLTransaction& trans)
stmt->setUInt32(0, GetGUIDLow());
trans->Append(stmt);
- uint8 index = 0;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS);
- stmt->setUInt32(index++, GetGUIDLow());
-
for (uint8 spec = 0; spec < m_specsCount; ++spec)
{
+ uint8 index = 0;
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS);
+ stmt->setUInt32(index++, GetGUIDLow());
+
stmt->setUInt8(index++, spec);
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
stmt->setUInt16(index++, uint16(m_Glyphs[spec][i]));
+ trans->Append(stmt);
}
-
- trans->Append(stmt);
}
void Player::_LoadTalents(PreparedQueryResult result)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index ac50bbd9d35..53b848a89b0 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1064,7 +1064,7 @@ class Player : public Unit, public GridObject<Player>
friend void Item::RemoveFromUpdateQueueOf(Player* player);
public:
explicit Player (WorldSession* session);
- ~Player ();
+ ~Player();
void CleanupsBeforeDelete(bool finalCleanup = true);
@@ -1511,7 +1511,7 @@ class Player : public Unit, public GridObject<Player>
static uint32 GetLevelFromDB(uint64 guid);
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
- static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE ; }
+ static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
/*********************************************************/
/*** SAVE SYSTEM ***/
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index ebb524d5f64..81a505b7acc 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -144,14 +144,14 @@ void MapManager::LoadTransportNPCs()
do
{
Field* fields = result->Fetch();
- uint32 guid = fields[0].GetUInt32();
- uint32 entry = fields[1].GetUInt32();
- uint32 transportEntry = fields[2].GetUInt32();
+ uint32 guid = fields[0].GetInt32();
+ uint32 entry = fields[1].GetInt32();
+ uint32 transportEntry = fields[2].GetInt32();
float tX = fields[3].GetFloat();
float tY = fields[4].GetFloat();
float tZ = fields[5].GetFloat();
float tO = fields[6].GetFloat();
- uint32 anim = fields[7].GetUInt32();
+ uint32 anim = fields[7].GetInt32();
for (MapManager::TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr)
{
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 283ab2c9cf6..69771129ac9 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -398,7 +398,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
break;
}
case CLASS_MAGE:
- val2 = GetStat(STAT_STRENGTH) - 10.0f;
+ val2 = GetStat(STAT_STRENGTH) - 10.0f;
break;
case CLASS_PRIEST:
val2 = GetStat(STAT_STRENGTH) - 10.0f;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ce9cec417a2..9adbb7f6cd7 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -71,7 +71,9 @@ float baseMoveSpeed[MAX_MOVE_TYPE] =
4.5f, // MOVE_FLIGHT_BACK
3.14f // MOVE_PITCH_RATE
};
-float playerBaseMoveSpeed[MAX_MOVE_TYPE] = {
+
+float playerBaseMoveSpeed[MAX_MOVE_TYPE] =
+{
2.5f, // MOVE_WALK
7.0f, // MOVE_RUN
4.5f, // MOVE_RUN_BACK
@@ -457,7 +459,8 @@ void Unit::resetAttackTimer(WeaponAttackType type)
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
{
- if (!obj || !IsInMap(obj)) return false;
+ if (!obj || !IsInMap(obj))
+ return false;
float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
@@ -472,7 +475,8 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
{
- if (!obj || !IsInMap(obj)) return false;
+ if (!obj || !IsInMap(obj))
+ return false;
float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
@@ -665,7 +669,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
duel_hasEnded = true;
}
- else if (victim->IsVehicle() && damage >= (health-1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER)
+ else if (victim->IsVehicle() && damage >= (health-1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER)
{
Player* victimRider = victim->GetCharmer()->ToPlayer();
@@ -2878,7 +2882,8 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
- if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self
+ if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
+ return;
// break same type spell if it is not delayed
InterruptSpell(CSpellType, false);
@@ -3245,7 +3250,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
aura->HandleAuraSpecificMods(aurApp, caster, true, false);
// apply effects of the aura
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (effMask & 1<<i && (!aurApp->GetRemoveMode()))
aurApp->_HandleEffect(i, true);
@@ -3304,7 +3309,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
aura->_UnapplyForTarget(this, caster, aurApp);
// remove effects of the spell - needs to be done after removing aura from lists
- for (uint8 itr = 0 ; itr < MAX_SPELL_EFFECTS; ++itr)
+ for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
{
if (aurApp->HasEffect(itr))
aurApp->_HandleEffect(itr, false);
@@ -3481,7 +3486,7 @@ void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode)
if (aurApp->GetRemoveMode())
{
// remove remaining effects of an aura
- for (uint8 itr = 0 ; itr < MAX_SPELL_EFFECTS; ++itr)
+ for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
{
if (aurApp->HasEffect(itr))
aurApp->_HandleEffect(itr, false);
@@ -4619,7 +4624,9 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
- if (!gameObj || !gameObj->GetOwnerGUID() == 0) return;
+ if (!gameObj || !gameObj->GetOwnerGUID() == 0)
+ return;
+
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGUID(GetGUID());
@@ -11879,7 +11886,9 @@ float Unit::GetWeaponProcChance() const
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const
{
// proc per minute chance calculation
- if (PPM <= 0) return 0.0f;
+ if (PPM <= 0)
+ return 0.0f;
+
// Apply chance modifer aura
if (spellProto)
if (Player* modOwner = GetSpellModOwner())
@@ -16420,7 +16429,41 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
return;
if (IsInWorld())
- RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target
+ {
+ RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target
+
+ // modify hostile references for new phasemask, some special cases deal with hostile references themselves
+ if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->isGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
+ {
+ HostileRefManager& refManager = getHostileRefManager();
+ HostileReference* ref = refManager.getFirst();
+
+ while (ref)
+ {
+ if (Unit* unit = ref->getSource()->getOwner())
+ if (Creature* creature = unit->ToCreature())
+ refManager.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask));
+
+ ref = ref->next();
+ }
+
+ // modify threat lists for new phasemask
+ if (GetTypeId() != TYPEID_PLAYER)
+ {
+ std::list<HostileReference*> threatList = getThreatManager().getThreatList();
+ std::list<HostileReference*> offlineThreatList = getThreatManager().getOfflineThreatList();
+
+ // merge expects sorted lists
+ threatList.sort();
+ offlineThreatList.sort();
+ threatList.merge(offlineThreatList);
+
+ for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+ if (Unit* unit = (*itr)->getTarget())
+ unit->getHostileRefManager().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask));
+ }
+ }
+ }
WorldObject::SetPhaseMask(newPhaseMask, update);
@@ -16975,7 +17018,7 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/)
//! to specify exit coordinates and either store those per passenger, or we need to
//! init spline movement based on those coordinates in unapply handlers, and
//! relocate exiting passengers based on Unit::moveSpline data. Either way,
- //! Coming Soon�
+ //! Coming Soon(TM)
}
void Unit::_ExitVehicle(Position const* exitPosition)
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index d85b7dd15bf..fcbe1afa389 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1236,7 +1236,7 @@ class Unit : public WorldObject
typedef std::map<uint8, AuraApplication*> VisibleAuraMap;
- virtual ~Unit ();
+ virtual ~Unit();
UnitAI* GetAI() { return i_AI; }
void SetAI(UnitAI* newAI) { i_AI = newAI; }
@@ -1336,7 +1336,7 @@ class Unit : public WorldObject
float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); }
void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); }
- uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL) ; }
+ uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); }
void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); }
uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); }
@@ -2026,7 +2026,7 @@ class Unit : public WorldObject
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
void ModifyAuraState(AuraStateType flag, bool apply);
uint32 BuildAuraStateUpdateForTarget(Unit* target) const;
- bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const ;
+ bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const;
void UnsummonAllTotems();
Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo);
Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL);
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 808da1ac791..a8492726e75 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -80,7 +80,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
if (mGameEvent[entry].state == GAMEEVENT_WORLD_CONDITIONS)
{
if (mGameEvent[entry].length)
- return mGameEvent[entry].length * 60 ;
+ return mGameEvent[entry].length * 60;
else
return max_ge_check_delay;
}
@@ -205,7 +205,7 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
-
+ // 1 2 3 4 5 6 7 8
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event");
if (!result)
{
@@ -220,7 +220,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint8 event_id = fields[0].GetUInt8();
if (event_id == 0)
{
sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used.");
@@ -232,8 +232,8 @@ void GameEventMgr::LoadFromDB()
pGameEvent.start = time_t(starttime);
uint64 endtime = fields[2].GetUInt64();
pGameEvent.end = time_t(endtime);
- pGameEvent.occurence = fields[3].GetUInt32();
- pGameEvent.length = fields[4].GetUInt32();
+ pGameEvent.occurence = fields[3].GetUInt64();
+ pGameEvent.length = fields[4].GetUInt64();
pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
@@ -283,7 +283,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint8 event_id = fields[0].GetUInt8();
if (event_id >= mGameEvent.size())
{
@@ -315,6 +315,7 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite");
if (!result)
{
@@ -328,7 +329,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint16 event_id = fields[0].GetUInt8();
if (event_id >= mGameEvent.size())
{
@@ -338,7 +339,7 @@ void GameEventMgr::LoadFromDB()
if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
{
- uint16 prerequisite_event = fields[1].GetUInt16();
+ uint16 prerequisite_event = fields[1].GetUInt32();
if (prerequisite_event >= mGameEvent.size())
{
sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event);
@@ -382,7 +383,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- int16 event_id = fields[1].GetInt16();
+ int16 event_id = fields[1].GetInt8();
int32 internal_event_id = mGameEvent.size() + event_id - 1;
@@ -408,7 +409,7 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- // 1 2
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.eventEntry FROM gameobject"
" JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid");
@@ -425,7 +426,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- int16 event_id = fields[1].GetInt16();
+ int16 event_id = fields[1].GetInt8();
int32 internal_event_id = mGameEvent.size() + event_id - 1;
@@ -468,7 +469,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- uint16 event_id = fields[1].GetUInt16();
+ uint16 event_id = fields[1].GetUInt8();
if (event_id >= mGameEventModelEquip.size())
{
@@ -525,7 +526,7 @@ void GameEventMgr::LoadFromDB()
uint32 id = fields[0].GetUInt32();
uint32 quest = fields[1].GetUInt32();
- uint16 event_id = fields[2].GetUInt16();
+ uint16 event_id = fields[2].GetUInt8();
if (event_id >= mGameEventCreatureQuests.size())
{
@@ -566,7 +567,7 @@ void GameEventMgr::LoadFromDB()
uint32 id = fields[0].GetUInt32();
uint32 quest = fields[1].GetUInt32();
- uint16 event_id = fields[2].GetUInt16();
+ uint16 event_id = fields[2].GetUInt8();
if (event_id >= mGameEventGameObjectQuests.size())
{
@@ -590,7 +591,7 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3
+ // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
if (!result)
@@ -606,7 +607,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 quest = fields[0].GetUInt32();
- uint16 event_id = fields[1].GetUInt16();
+ uint16 event_id = fields[1].GetUInt8();
uint32 condition = fields[2].GetUInt32();
float num = fields[3].GetFloat();
@@ -648,7 +649,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint16 event_id = fields[0].GetUInt8();
uint32 condition = fields[1].GetUInt32();
if (event_id >= mGameEvent.size())
@@ -659,8 +660,8 @@ void GameEventMgr::LoadFromDB()
mGameEvent[event_id].conditions[condition].reqNum = fields[2].GetFloat();
mGameEvent[event_id].conditions[condition].done = 0;
- mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt32();
- mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt32();
+ mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt16();
+ mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt16();
++count;
}
@@ -690,7 +691,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint16 event_id = fields[0].GetUInt8();
uint32 condition = fields[1].GetUInt32();
if (event_id >= mGameEvent.size())
@@ -739,7 +740,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- uint16 event_id = fields[1].GetUInt16();
+ uint16 event_id = fields[1].GetUInt8();
uint32 npcflag = fields[2].GetUInt32();
if (event_id >= mGameEvent.size())
@@ -763,7 +764,7 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- // 0 1
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation");
if (!result)
@@ -779,7 +780,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 questId = fields[0].GetUInt32();
- uint16 eventEntry = fields[1].GetUInt16();
+ uint32 eventEntry = fields[1].GetUInt32(); // TODO: Change to uint8
if (!sObjectMgr->GetQuestTemplate(questId))
{
@@ -822,7 +823,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint8 event_id = fields[0].GetUInt8();
if (event_id >= mGameEventVendors.size())
{
@@ -834,7 +835,7 @@ void GameEventMgr::LoadFromDB()
NPCVendorEntry newEntry;
uint32 guid = fields[1].GetUInt32();
newEntry.item = fields[2].GetUInt32();
- newEntry.maxcount = fields[3].GetInt32();
+ newEntry.maxcount = fields[3].GetUInt32();
newEntry.incrtime = fields[4].GetUInt32();
newEntry.ExtendedCost = fields[5].GetUInt32();
// get the event npc flag for checking if the npc will be vendor during the event or not
@@ -888,7 +889,7 @@ void GameEventMgr::LoadFromDB()
{
Field* fields = result->Fetch();
- uint16 event_id = fields[0].GetUInt16();
+ uint16 event_id = fields[0].GetUInt8();
if (event_id >= mGameEvent.size())
{
@@ -911,7 +912,7 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- // 1 2
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template"
" JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
@@ -928,7 +929,7 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- int16 event_id = fields[1].GetInt16();
+ int16 event_id = fields[1].GetInt8();
int32 internal_event_id = mGameEvent.size() + event_id - 1;
@@ -981,7 +982,7 @@ void GameEventMgr::Initialize()
{
Field* fields = result->Fetch();
- uint32 maxEventId = fields[0].GetUInt16();
+ uint32 maxEventId = fields[0].GetUInt8();
// Id starts with 1 and vector with 0, thus increment
maxEventId++;
@@ -1019,7 +1020,7 @@ void GameEventMgr::StartArenaSeason()
}
Field* fields = result->Fetch();
- uint16 eventId = fields[0].GetUInt16();
+ uint16 eventId = fields[0].GetUInt8();
if (eventId >= mGameEvent.size())
{
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index f5c2e83106a..bf647fa5c31 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -422,7 +422,7 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.GossipMenuId = fields[13].GetUInt32();
creatureTemplate.minlevel = fields[14].GetUInt8();
creatureTemplate.maxlevel = fields[15].GetUInt8();
- creatureTemplate.expansion = uint32(fields[16].GetUInt16());
+ creatureTemplate.expansion = uint32(fields[16].GetInt16());
creatureTemplate.faction_A = uint32(fields[17].GetUInt16());
creatureTemplate.faction_H = uint32(fields[18].GetUInt16());
creatureTemplate.npcflag = fields[19].GetUInt32();
@@ -455,7 +455,7 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.SkinLootId = fields[46].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- creatureTemplate.resistance[i] = fields[47 + i -1].GetInt32();
+ creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
@@ -1131,7 +1131,7 @@ void ObjectMgr::LoadCreatureModelInfo()
uint32 modelId = fields[0].GetUInt32();
- CreatureModelInfo& modelInfo = _creatureModelStore[modelId];
+ CreatureModelInfo& modelInfo = _creatureModelStore[modelId];
modelInfo.bounding_radius = fields[1].GetFloat();
modelInfo.combat_reach = fields[2].GetFloat();
@@ -1171,6 +1171,7 @@ void ObjectMgr::LoadLinkedRespawn()
uint32 oldMSTime = getMSTime();
_linkedRespawnStore.clear();
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT guid, linkedGuid, linkType FROM linked_respawn ORDER BY guid ASC");
if (!result)
@@ -1426,8 +1427,8 @@ void ObjectMgr::LoadCreatures()
{
Field* fields = result->Fetch();
- uint32 guid = fields[ 0].GetUInt32();
- uint32 entry = fields[ 1].GetUInt32();
+ uint32 guid = fields[0].GetUInt32();
+ uint32 entry = fields[1].GetUInt32();
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
@@ -1438,14 +1439,14 @@ void ObjectMgr::LoadCreatures()
CreatureData& data = _creatureDataStore[guid];
data.id = entry;
- data.mapid = fields[ 2].GetUInt32();
- data.displayid = fields[ 3].GetUInt32();
- data.equipmentId = fields[ 4].GetUInt32();
- data.posX = fields[ 5].GetFloat();
- data.posY = fields[ 6].GetFloat();
- data.posZ = fields[ 7].GetFloat();
- data.orientation = fields[ 8].GetFloat();
- data.spawntimesecs = fields[ 9].GetUInt32();
+ data.mapid = fields[2].GetUInt16();
+ data.displayid = fields[3].GetUInt32();
+ data.equipmentId = fields[4].GetInt32();
+ data.posX = fields[5].GetFloat();
+ data.posY = fields[6].GetFloat();
+ data.posZ = fields[7].GetFloat();
+ data.orientation = fields[8].GetFloat();
+ data.spawntimesecs = fields[9].GetUInt32();
data.spawndist = fields[10].GetFloat();
data.currentwaypoint= fields[11].GetUInt32();
data.curhealth = fields[12].GetUInt32();
@@ -1453,7 +1454,7 @@ void ObjectMgr::LoadCreatures()
data.movementType = fields[14].GetUInt8();
data.spawnMask = fields[15].GetUInt8();
data.phaseMask = fields[16].GetUInt16();
- int16 gameEvent = fields[17].GetInt16();
+ int16 gameEvent = fields[17].GetInt8();
uint32 PoolId = fields[18].GetUInt32();
data.npcflag = fields[19].GetUInt32();
data.unit_flags = fields[20].GetUInt32();
@@ -1735,8 +1736,8 @@ void ObjectMgr::LoadGameobjects()
{
Field* fields = result->Fetch();
- uint32 guid = fields[ 0].GetUInt32();
- uint32 entry = fields[ 1].GetUInt32();
+ uint32 guid = fields[0].GetUInt32();
+ uint32 entry = fields[1].GetUInt32();
GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry);
if (!gInfo)
@@ -1767,14 +1768,14 @@ void ObjectMgr::LoadGameobjects()
GameObjectData& data = _gameObjectDataStore[guid];
data.id = entry;
- data.mapid = fields[ 2].GetUInt32();
- data.posX = fields[ 3].GetFloat();
- data.posY = fields[ 4].GetFloat();
- data.posZ = fields[ 5].GetFloat();
- data.orientation = fields[ 6].GetFloat();
- data.rotation0 = fields[ 7].GetFloat();
- data.rotation1 = fields[ 8].GetFloat();
- data.rotation2 = fields[ 9].GetFloat();
+ data.mapid = fields[2].GetUInt16();
+ data.posX = fields[3].GetFloat();
+ data.posY = fields[4].GetFloat();
+ data.posZ = fields[5].GetFloat();
+ data.orientation = fields[6].GetFloat();
+ data.rotation0 = fields[7].GetFloat();
+ data.rotation1 = fields[8].GetFloat();
+ data.rotation2 = fields[9].GetFloat();
data.rotation3 = fields[10].GetFloat();
data.spawntimesecs = fields[11].GetInt32();
@@ -1790,10 +1791,10 @@ void ObjectMgr::LoadGameobjects()
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
}
- data.animprogress = fields[12].GetUInt32();
+ data.animprogress = fields[12].GetUInt8();
data.artKit = 0;
- uint32 go_state = fields[13].GetUInt32();
+ uint32 go_state = fields[13].GetUInt8();
if (go_state >= MAX_GO_STATE)
{
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
@@ -1807,7 +1808,7 @@ void ObjectMgr::LoadGameobjects()
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
data.phaseMask = fields[15].GetUInt16();
- int16 gameEvent = fields[16].GetInt16();
+ int16 gameEvent = fields[16].GetInt8();
uint32 PoolId = fields[17].GetUInt32();
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
@@ -2730,7 +2731,8 @@ void ObjectMgr::LoadItemSetNames()
if (setEntry->itemId[i])
itemSetItems.insert(setEntry->itemId[i]);
}
-
+
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT `entry`, `name`, `InventoryType` FROM `item_set_names`");
if (!result)
@@ -2757,7 +2759,7 @@ void ObjectMgr::LoadItemSetNames()
ItemSetNameEntry &data = _itemSetNameStore[entry];
data.name = fields[1].GetString();
- uint32 invType = fields[2].GetUInt32();
+ uint32 invType = fields[2].GetUInt8();
if (invType >= MAX_INVTYPE)
{
sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
@@ -2802,6 +2804,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
uint32 count = 0;
+ // 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT `entry`, `accessory_entry`, `seat_id`, `minion`, `summontype`, `summontimer` FROM `vehicle_template_accessory`");
if (!result)
@@ -2817,7 +2820,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
uint32 uiEntry = fields[0].GetUInt32();
uint32 uiAccessory = fields[1].GetUInt32();
- int8 uiSeat = int8(fields[2].GetInt16());
+ int8 uiSeat = int8(fields[2].GetInt8());
bool bMinion = fields[3].GetBool();
uint8 uiSummonType = fields[4].GetUInt8();
uint32 uiSummonTimer= fields[5].GetUInt32();
@@ -2858,6 +2861,7 @@ void ObjectMgr::LoadVehicleAccessories()
uint32 count = 0;
+ // 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT `guid`, `accessory_entry`, `seat_id`, `minion`, `summontype`, `summontimer` FROM `vehicle_accessory`");
if (!result)
@@ -2899,7 +2903,7 @@ void ObjectMgr::LoadPetLevelInfo()
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7 8 9
- QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");
+ QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");
if (!result)
{
@@ -2921,7 +2925,7 @@ void ObjectMgr::LoadPetLevelInfo()
continue;
}
- uint32 current_level = fields[1].GetUInt32();
+ uint32 current_level = fields[1].GetUInt8();
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
@@ -2942,14 +2946,14 @@ void ObjectMgr::LoadPetLevelInfo()
PetLevelInfo*& pInfoMapEntry = _petInfoStore[creature_id];
if (pInfoMapEntry == NULL)
- pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
+ pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
// data for level 1 stored in [0] array element, ...
PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1];
pLevelInfo->health = fields[2].GetUInt16();
pLevelInfo->mana = fields[3].GetUInt16();
- pLevelInfo->armor = fields[9].GetUInt16();
+ pLevelInfo->armor = fields[9].GetUInt32();
for (int i = 0; i < MAX_STATS; i++)
{
@@ -3045,7 +3049,7 @@ void ObjectMgr::LoadPlayerInfo()
// Load playercreate
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6
+ // 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo");
if (!result)
@@ -3062,10 +3066,10 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_race = fields[0].GetUInt32();
- uint32 current_class = fields[1].GetUInt32();
- uint32 mapId = fields[2].GetUInt32();
- uint32 areaId = fields[3].GetUInt32();
+ uint32 current_race = fields[0].GetUInt8();
+ uint32 current_class = fields[1].GetUInt8();
+ uint32 mapId = fields[2].GetUInt16();
+ uint32 areaId = fields[3].GetUInt32(); // zone
float positionX = fields[4].GetFloat();
float positionY = fields[5].GetFloat();
float positionZ = fields[6].GetFloat();
@@ -3150,14 +3154,14 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_race = fields[0].GetUInt32();
+ uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race);
continue;
}
- uint32 current_class = fields[1].GetUInt32();
+ uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class);
@@ -3172,7 +3176,7 @@ void ObjectMgr::LoadPlayerInfo()
continue;
}
- int32 amount = fields[3].GetInt32();
+ int32 amount = fields[3].GetInt8();
if (!amount)
{
@@ -3207,11 +3211,8 @@ void ObjectMgr::LoadPlayerInfo()
{
uint32 oldMSTime = getMSTime();
- QueryResult result = QueryResult(NULL);
- if (sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS))
- result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom");
- else
- result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell");
+ std::string tableName = sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell";
+ QueryResult result = WorldDatabase.PQuery("SELECT race, class, Spell FROM %s", tableName.c_str());
if (!result)
{
@@ -3226,14 +3227,14 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_race = fields[0].GetUInt32();
+ uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
sLog->outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race);
continue;
}
- uint32 current_class = fields[1].GetUInt32();
+ uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
sLog->outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class);
@@ -3283,14 +3284,14 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_race = fields[0].GetUInt32();
+ uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race);
continue;
}
- uint32 current_class = fields[1].GetUInt32();
+ uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class);
@@ -3298,7 +3299,7 @@ void ObjectMgr::LoadPlayerInfo()
}
PlayerInfo* pInfo = &_playerInfo[current_race][current_class];
- pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt8(), fields[3].GetUInt32(), fields[4].GetUInt8()));
+ pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16()));
++count;
}
@@ -3330,7 +3331,7 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_class = fields[0].GetUInt32();
+ uint32 current_class = fields[0].GetUInt8();
if (current_class >= MAX_CLASSES)
{
sLog->outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class);
@@ -3411,21 +3412,21 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_race = fields[0].GetUInt32();
+ uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race);
continue;
}
- uint32 current_class = fields[1].GetUInt32();
+ uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class);
continue;
}
- uint32 current_level = fields[2].GetUInt32();
+ uint32 current_level = fields[2].GetUInt8();
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
@@ -3529,7 +3530,7 @@ void ObjectMgr::LoadPlayerInfo()
{
Field* fields = result->Fetch();
- uint32 current_level = fields[0].GetUInt32();
+ uint32 current_level = fields[0].GetUInt8();
uint32 current_xp = fields[1].GetUInt32();
if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
@@ -4419,9 +4420,8 @@ void ObjectMgr::LoadScripts(ScriptsType type)
scripts->clear(); // need for reload support
bool isSpellScriptTable = (type == SCRIPTS_SPELL);
- char buff[125];
- sprintf(buff, "SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str());
- QueryResult result = WorldDatabase.Query(buff);
+ // 0 1 2 3 4 5 6 7 8 9
+ QueryResult result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str());
if (!result)
{
@@ -4976,6 +4976,7 @@ void ObjectMgr::LoadPageTexts()
{
uint32 oldMSTime = getMSTime();
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT entry, text, next_page FROM page_text");
if (!result)
@@ -4990,10 +4991,10 @@ void ObjectMgr::LoadPageTexts()
{
Field* fields = result->Fetch();
- PageText& pageText = _pageTextStore[fields[0].GetUInt32()];
+ PageText& pageText = _pageTextStore[fields[0].GetUInt32()];
pageText.Text = fields[1].GetString();
- pageText.NextPage = fields[2].GetInt16();
+ pageText.NextPage = fields[2].GetUInt32();
++count;
}
@@ -5054,6 +5055,7 @@ void ObjectMgr::LoadInstanceTemplate()
{
uint32 oldMSTime = getMSTime();
+ // 0 1 2 4
QueryResult result = WorldDatabase.Query("SELECT map, parent, script, allowMount FROM instance_template");
if (!result)
@@ -5105,6 +5107,7 @@ void ObjectMgr::LoadInstanceEncounters()
{
uint32 oldMSTime = getMSTime();
+ // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
if (!result)
{
@@ -5121,7 +5124,7 @@ void ObjectMgr::LoadInstanceEncounters()
uint32 entry = fields[0].GetUInt32();
uint8 creditType = fields[1].GetUInt8();
uint32 creditEntry = fields[2].GetUInt32();
- uint32 lastEncounterDungeon = fields[3].GetUInt32();
+ uint32 lastEncounterDungeon = fields[3].GetUInt16();
DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
if (!dungeonEncounter)
{
@@ -5227,13 +5230,13 @@ void ObjectMgr::LoadGossipText()
gText.Options[i].Text_0 = fields[cic++].GetString();
gText.Options[i].Text_1 = fields[cic++].GetString();
- gText.Options[i].Language = fields[cic++].GetUInt32();
+ gText.Options[i].Language = fields[cic++].GetUInt8();
gText.Options[i].Probability = fields[cic++].GetFloat();
for (uint8 j=0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
{
- gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt32();
- gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32();
+ gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16();
+ gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16();
}
}
} while (result->NextRow());
@@ -5314,7 +5317,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
std::map<uint32 /*messageId*/, MailItemInfoVec> itemsCache;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_EXPIRED_MAIL_ITEMS);
- stmt->setUInt64(0, basetime);
+ stmt->setUInt32(0, (uint32)basetime);
if (PreparedQueryResult items = CharacterDatabase.Query(stmt))
{
MailItemInfo item;
@@ -5661,6 +5664,7 @@ void ObjectMgr::LoadGraveyardZones()
GraveYardStore.clear(); // need for reload case
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT id, ghost_zone, faction FROM game_graveyard_zone");
if (!result)
@@ -5680,7 +5684,7 @@ void ObjectMgr::LoadGraveyardZones()
uint32 safeLocId = fields[0].GetUInt32();
uint32 zoneId = fields[1].GetUInt32();
- uint32 team = fields[2].GetUInt32();
+ uint32 team = fields[2].GetUInt16();
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
if (!entry)
@@ -5975,7 +5979,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
AreaTrigger at;
- at.target_mapId = fields[1].GetUInt32();
+ at.target_mapId = fields[1].GetUInt16();
at.target_X = fields[2].GetFloat();
at.target_Y = fields[3].GetFloat();
at.target_Z = fields[4].GetFloat();
@@ -6449,7 +6453,7 @@ void ObjectMgr::LoadGameObjectTemplate()
got.questItems[i] = fields[10 + i].GetUInt32();
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
- got.raw.data[i] = fields[16 + i].GetUInt32();
+ got.raw.data[i] = fields[16 + i].GetInt32(); // data1 and data6 can be -1
got.AIName = fields[40].GetString();
got.ScriptId = GetScriptId(fields[41].GetCString());
@@ -6612,7 +6616,7 @@ void ObjectMgr::LoadExplorationBaseXP()
{
Field* fields = result->Fetch();
uint8 level = fields[0].GetUInt8();
- uint32 basexp = fields[1].GetUInt32();
+ uint32 basexp = fields[1].GetInt32();
_baseXPTable[level] = basexp;
++count;
}
@@ -6637,7 +6641,7 @@ uint32 ObjectMgr::GetXPForLevel(uint8 level)
void ObjectMgr::LoadPetNames()
{
uint32 oldMSTime = getMSTime();
-
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT word, entry, half FROM pet_name_generation");
if (!result)
@@ -6751,7 +6755,7 @@ void ObjectMgr::LoadReputationRewardRate()
_repRewardRateStore.clear(); // for reload case
- uint32 count = 0;
+ uint32 count = 0; // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, creature_rate, spell_rate FROM reputation_reward_rate");
if (!result)
@@ -6837,13 +6841,13 @@ void ObjectMgr::LoadReputationOnKill()
uint32 creature_id = fields[0].GetUInt32();
ReputationOnKillEntry repOnKill;
- repOnKill.RepFaction1 = fields[1].GetUInt32();
- repOnKill.RepFaction2 = fields[2].GetUInt32();
+ repOnKill.RepFaction1 = fields[1].GetInt16();
+ repOnKill.RepFaction2 = fields[2].GetInt16();
repOnKill.IsTeamAward1 = fields[3].GetBool();
- repOnKill.ReputationMaxCap1 = fields[4].GetUInt32();
+ repOnKill.ReputationMaxCap1 = fields[4].GetUInt8();
repOnKill.RepValue1 = fields[5].GetInt32();
repOnKill.IsTeamAward2 = fields[6].GetBool();
- repOnKill.ReputationMaxCap2 = fields[7].GetUInt32();
+ repOnKill.ReputationMaxCap2 = fields[7].GetUInt8();
repOnKill.RepValue2 = fields[8].GetInt32();
repOnKill.TeamDependent = fields[9].GetUInt8();
@@ -6888,7 +6892,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
_repSpilloverTemplateStore.clear(); // for reload case
- uint32 count = 0;
+ uint32 count = 0; // 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult result = WorldDatabase.Query("SELECT faction, faction1, rate_1, rank_1, faction2, rate_2, rank_2, faction3, rate_3, rank_3, faction4, rate_4, rank_4 FROM reputation_spillover_template");
if (!result)
@@ -6902,22 +6906,22 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
{
Field* fields = result->Fetch();
- uint32 factionId = fields[0].GetUInt32();
+ uint32 factionId = fields[0].GetUInt16();
RepSpilloverTemplate repTemplate;
- repTemplate.faction[0] = fields[1].GetUInt32();
+ repTemplate.faction[0] = fields[1].GetUInt16();
repTemplate.faction_rate[0] = fields[2].GetFloat();
- repTemplate.faction_rank[0] = fields[3].GetUInt32();
- repTemplate.faction[1] = fields[4].GetUInt32();
+ repTemplate.faction_rank[0] = fields[3].GetUInt8();
+ repTemplate.faction[1] = fields[4].GetUInt16();
repTemplate.faction_rate[1] = fields[5].GetFloat();
- repTemplate.faction_rank[1] = fields[6].GetUInt32();
- repTemplate.faction[2] = fields[7].GetUInt32();
+ repTemplate.faction_rank[1] = fields[6].GetUInt8();
+ repTemplate.faction[2] = fields[7].GetUInt16();
repTemplate.faction_rate[2] = fields[8].GetFloat();
- repTemplate.faction_rank[2] = fields[9].GetUInt32();
- repTemplate.faction[3] = fields[10].GetUInt32();
+ repTemplate.faction_rank[2] = fields[9].GetUInt8();
+ repTemplate.faction[3] = fields[10].GetUInt16();
repTemplate.faction_rate[3] = fields[11].GetFloat();
- repTemplate.faction_rank[3] = fields[12].GetUInt32();
+ repTemplate.faction_rank[3] = fields[12].GetUInt8();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
@@ -7002,7 +7006,7 @@ void ObjectMgr::LoadPointsOfInterest()
uint32 count = 0;
- // 0 1 2 3 4 5 6
+ // 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest");
if (!result)
@@ -7150,7 +7154,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
continue;
}
- uint8 userType = fields[3].GetUInt8();
+ uint8 userType = fields[3].GetUInt16();
if (userType >= SPELL_CLICK_USER_MAX)
sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
@@ -7804,7 +7808,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- int32 skill = fields[1].GetInt32();
+ int32 skill = fields[1].GetInt16();
AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry);
if (!fArea)
@@ -7897,6 +7901,7 @@ void ObjectMgr::LoadGameTele()
_gameTeleStore.clear(); // for reload case
+ // 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele");
if (!result)
@@ -7920,7 +7925,7 @@ void ObjectMgr::LoadGameTele()
gt.position_y = fields[2].GetFloat();
gt.position_z = fields[3].GetFloat();
gt.orientation = fields[4].GetFloat();
- gt.mapId = fields[5].GetUInt32();
+ gt.mapId = fields[5].GetUInt16();
gt.name = fields[6].GetString();
if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation))
@@ -8037,6 +8042,7 @@ void ObjectMgr::LoadMailLevelRewards()
_mailLevelRewardStore.clear(); // for reload case
+ // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward");
if (!result)
@@ -8198,9 +8204,9 @@ void ObjectMgr::LoadTrainerSpell()
uint32 entry = fields[0].GetUInt32();
uint32 spell = fields[1].GetUInt32();
uint32 spellCost = fields[2].GetUInt32();
- uint32 reqSkill = fields[3].GetUInt32();
- uint32 reqSkillValue = fields[4].GetUInt32();
- uint32 reqLevel = fields[5].GetUInt32();
+ uint32 reqSkill = fields[3].GetUInt16();
+ uint32 reqSkillValue = fields[4].GetUInt16();
+ uint32 reqLevel = fields[5].GetUInt8();
AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel);
@@ -8234,7 +8240,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
count += LoadReferenceVendor(vendor, -item_id, skip_vendors);
else
{
- int32 maxcount = fields[1].GetUInt8(); // tinyint(3) unsigned
+ int32 maxcount = fields[1].GetUInt8();
uint32 incrtime = fields[2].GetUInt32();
uint32 ExtendedCost = fields[3].GetUInt32();
@@ -8284,7 +8290,7 @@ void ObjectMgr::LoadVendors()
count += LoadReferenceVendor(entry, -item_id, &skip_vendors);
else
{
- int32 maxcount = fields[2].GetInt32();
+ uint32 maxcount = fields[2].GetUInt8();
uint32 incrtime = fields[3].GetUInt32();
uint32 ExtendedCost = fields[4].GetUInt32();
@@ -8326,7 +8332,7 @@ void ObjectMgr::LoadGossipMenu()
GossipMenus gMenu;
- gMenu.entry = fields[0].GetUInt32();
+ gMenu.entry = fields[0].GetUInt16();
gMenu.text_id = fields[1].GetUInt32();
if (!GetGossipText(gMenu.text_id))
@@ -8352,7 +8358,9 @@ void ObjectMgr::LoadGossipMenuItems()
_gossipMenuItemsStore.clear();
QueryResult result = WorldDatabase.Query(
+ // 0 1 2 3 4
"SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, "
+ // 5 6 7 8 9
"action_menu_id, action_poi_id, box_coded, box_money, box_text "
"FROM gossip_menu_option ORDER BY menu_id, id");
@@ -8371,11 +8379,11 @@ void ObjectMgr::LoadGossipMenuItems()
GossipMenuItems gMenuItem;
- gMenuItem.MenuId = fields[0].GetUInt32();
- gMenuItem.OptionIndex = fields[1].GetUInt32();
- gMenuItem.OptionIcon = fields[2].GetUInt8();
+ gMenuItem.MenuId = fields[0].GetUInt16();
+ gMenuItem.OptionIndex = fields[1].GetUInt16();
+ gMenuItem.OptionIcon = fields[2].GetUInt32();
gMenuItem.OptionText = fields[3].GetString();
- gMenuItem.OptionType = fields[4].GetUInt32();
+ gMenuItem.OptionType = fields[4].GetUInt8();
gMenuItem.OptionNpcflag = fields[5].GetUInt32();
gMenuItem.ActionMenuId = fields[6].GetUInt32();
gMenuItem.ActionPoiId = fields[7].GetUInt32();
@@ -8590,10 +8598,13 @@ uint32 ObjectMgr::GetScriptId(const char *name)
{
// use binary search to find the script name in the sorted vector
// assume "" is the first element
- if (!name) return 0;
- ScriptNameContainer::const_iterator itr =
- std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
- if (itr == _scriptNamesStore.end() || *itr != name) return 0;
+ if (!name)
+ return 0;
+
+ ScriptNameContainer::const_iterator itr = std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
+ if (itr == _scriptNamesStore.end() || *itr != name)
+ return 0;
+
return uint32(itr - _scriptNamesStore.begin());
}
@@ -8602,6 +8613,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
ScriptMapMap* scripts = GetScriptsMapByType(type);
if (!scripts)
return;
+
for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM)
{
for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM)
@@ -8692,16 +8704,16 @@ void ObjectMgr::LoadCreatureClassLevelStats()
{
Field* fields = result->Fetch();
- uint8 Level = fields[0].GetUInt8();
- uint8 Class = fields[1].GetUInt8();
+ uint8 Level = fields[0].GetInt8();
+ uint8 Class = fields[1].GetInt8();
CreatureBaseStats stats;
for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i)
- stats.BaseHealth[i] = fields[i + 2].GetUInt32();
+ stats.BaseHealth[i] = fields[i + 2].GetInt16();
- stats.BaseMana = fields[5].GetUInt32();
- stats.BaseArmor = fields[6].GetUInt32();
+ stats.BaseMana = fields[5].GetInt16();
+ stats.BaseArmor = fields[6].GetInt16();
if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class);
diff --git a/src/server/game/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h
index 77830bc59d5..b224b3865e0 100644
--- a/src/server/game/Grids/Cells/CellImpl.h
+++ b/src/server/game/Grids/Cells/CellImpl.h
@@ -91,7 +91,7 @@ inline void Cell::Visit(CellCoord const& standing_cell, TypeContainerVisitor<T,
//if radius is known to reach cell area more than 4x4 then we should call optimized VisitCircle
//currently this technique works with MAX_NUMBER_OF_CELLS 16 and higher, with lower values
//there are nothing to optimize because SIZE_OF_GRID_CELL is too big...
- if (((area.high_bound.x_coord - area.low_bound.x_coord) > 4) && ((area.high_bound.y_coord - area.low_bound.y_coord) > 4))
+ if ((area.high_bound.x_coord > (area.low_bound.x_coord + 4)) && (area.high_bound.y_coord > (area.low_bound.y_coord + 4)))
{
VisitCircle(visitor, map, area.low_bound, area.high_bound);
return;
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index e623b98a13a..bb2a9c5130b 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -927,13 +927,15 @@ namespace Trinity
{
public:
AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range)
- : i_obj(obj), i_funit(funit), i_range(range)
+ : i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range)
{
Unit const* check = i_funit;
Unit const* owner = i_funit->GetOwner();
if (owner)
check = owner;
i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER);
+ if (i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT)
+ _spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId());
}
bool operator()(Unit* u)
{
@@ -941,7 +943,7 @@ namespace Trinity
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
- if (i_funit->IsValidAttackTarget(u) && i_obj->IsWithinDistInMap(u, i_range))
+ if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -950,6 +952,7 @@ namespace Trinity
bool i_targetForPlayer;
WorldObject const* i_obj;
Unit const* i_funit;
+ SpellInfo const* _spellInfo;
float i_range;
};
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index a27ea9eb281..5c459b45b5f 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -171,7 +171,7 @@ void Group::LoadGroupFromDB(Field* fields)
m_lootMethod = LootMethod(fields[1].GetUInt8());
m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
- m_lootThreshold = ItemQualities(fields[3].GetUInt16());
+ m_lootThreshold = ItemQualities(fields[3].GetUInt8());
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = fields[4+i].GetUInt32();
@@ -820,28 +820,28 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb
}
}
-void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
+void Group::SendLootAllPassed(uint32 numberOfPlayers, Roll const& roll)
{
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
- data << uint64(r.itemGUID); // Guid of the item rolled
- data << uint32(NumberOfPlayers); // The number of players rolling for it???
- data << uint32(r.itemid); // The itemEntryId for the item that shall be rolled for
- data << uint32(r.itemRandomPropId); // Item random property ID
- data << uint32(r.itemRandomSuffix); // Item random suffix ID
+ data << uint64(roll.itemGUID); // Guid of the item rolled
+ data << uint32(numberOfPlayers); // The number of players rolling for it
+ data << uint32(roll.itemid); // The itemEntryId for the item that shall be rolled for
+ data << uint32(roll.itemRandomPropId); // Item random property ID
+ data << uint32(roll.itemRandomSuffix); // Item random suffix ID
- for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
+ for (Roll::PlayerVote::const_iterator itr = roll.playerVote.begin(); itr != roll.playerVote.end(); ++itr)
{
- Player* p = ObjectAccessor::FindPlayer(itr->first);
- if (!p || !p->GetSession())
+ Player* player = ObjectAccessor::FindPlayer(itr->first);
+ if (!player || !player->GetSession())
continue;
if (itr->second != NOT_VALID)
- p->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
}
// notify group members which player is the allowed looter for the given creature
-void Group::SendLooter(Creature* creature, Player* pLooter)
+void Group::SendLooter(Creature* creature, Player* groupLooter)
{
ASSERT(creature);
@@ -849,8 +849,8 @@ void Group::SendLooter(Creature* creature, Player* pLooter)
data << uint64(creature->GetGUID());
data << uint8(0); // unk1
- if (pLooter)
- data.append(pLooter->GetPackGUID());
+ if (groupLooter)
+ data.append(groupLooter->GetPackGUID());
else
data << uint8(0);
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index 3d901f42501..f372f08c941 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -215,10 +215,10 @@ void GroupMgr::LoadGroups()
Group* group = GetGroupByDbStoreId(fields[0].GetUInt32());
// group will never be NULL (we have run consistency sql's before loading)
- MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32());
+ MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16());
if (!mapEntry || !mapEntry->IsDungeon())
{
- sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32());
+ sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16());
continue;
}
@@ -229,7 +229,7 @@ void GroupMgr::LoadGroups()
diff = 0; // default for both difficaly types
}
- InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt64()), fields[6].GetBool(), true);
+ InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt32()), (bool)fields[6].GetUInt64(), true);
group->BindToInstance(save, fields[3].GetBool(), true);
++count;
}
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 6c9cd428e4f..889174420c6 100755
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -588,11 +588,11 @@ bool Guild::Member::LoadFromDB(Field* fields)
}
SetStats(fields[19].GetString(),
- fields[20].GetUInt8(),
- fields[21].GetUInt8(),
- fields[22].GetUInt32(),
- fields[23].GetUInt32());
- m_logoutTime = fields[24].GetUInt32();
+ fields[20].GetUInt8(), // characters.level
+ fields[21].GetUInt8(), // characters.class
+ fields[22].GetUInt16(), // characters.zone
+ fields[23].GetUInt32()); // characters.account
+ m_logoutTime = fields[24].GetUInt32(); // characters.logout_time
if (!CheckStats())
return false;
@@ -1230,7 +1230,7 @@ void Guild::HandleQuery(WorldSession* session)
data << uint32(m_id);
data << m_name;
- for (uint8 i = 0 ; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks
+ for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks
{
if (i < _GetRanksSize())
data << m_ranks[i].GetName();
@@ -1838,7 +1838,7 @@ bool Guild::LoadFromDB(Field* fields)
m_createdDate = time_t(fields[10].GetUInt32());
m_bankMoney = fields[11].GetUInt64();
- uint8 purchasedTabs = uint8(fields[12].GetUInt32());
+ uint8 purchasedTabs = uint8(fields[12].GetUInt64());
if (purchasedTabs > GUILD_BANK_MAX_TABS)
purchasedTabs = GUILD_BANK_MAX_TABS;
@@ -1940,7 +1940,7 @@ bool Guild::LoadBankEventLogFromDB(Field* fields)
bool Guild::LoadBankTabFromDB(Field* fields)
{
- uint32 tabId = fields[1].GetUInt8();
+ uint8 tabId = fields[1].GetUInt8();
if (tabId >= _GetPurchasedTabsSize())
{
sLog->outError("Invalid tab (tabId: %u) in guild bank, skipped.", tabId);
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index f6051cd4c6e..6e98c2e248a 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -1119,8 +1119,10 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
uint8 res = ObjectMgr::CheckPlayerName(newName, true);
if (res != CHAR_NAME_SUCCESS)
{
- WorldPacket data(SMSG_CHAR_RENAME, 1);
+ WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(res);
+ data << uint64(guid);
+ data << newName;
SendPacket(&data);
return;
}
@@ -1451,6 +1453,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
std::string oldname = result->Fetch()[0].GetString();
sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}
+
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_NAME_AT_LOGIN);
@@ -1614,8 +1617,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
}
Field* fields = result->Fetch();
- uint32 playerClass = fields[0].GetUInt32();
- uint32 level = fields[1].GetUInt32();
+ uint32 playerClass = uint32(fields[0].GetUInt8());
+ uint32 level = uint32(fields[1].GetUInt8());
uint32 at_loginFlags = fields[2].GetUInt16();
uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION);
@@ -1721,7 +1724,6 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
// Switch Languages
// delete all languages first
-
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_LANGUAGES);
stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
@@ -1730,52 +1732,50 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
stmt->setUInt32(0, lowGuid);
-
// Faction specific languages
- if (team == BG_TEAM_ALLIANCE)
- {
- stmt->setUInt16(1, 98);
- }
- else if (team == BG_TEAM_HORDE)
- {
+ if (team == BG_TEAM_HORDE)
stmt->setUInt16(1, 109);
- }
+ else
+ stmt->setUInt16(1, 98);
trans->Append(stmt);
// Race specific languages
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
- stmt->setUInt32(0, lowGuid);
-
- switch (race)
+ if (race != RACE_ORC && race != RACE_HUMAN)
{
- case RACE_DWARF:
- stmt->setUInt16(1, 111);
- break;
- case RACE_DRAENEI:
- stmt->setUInt16(1, 759);
- break;
- case RACE_GNOME:
- stmt->setUInt16(1, 313);
- break;
- case RACE_NIGHTELF:
- stmt->setUInt16(1, 113);
- break;
- case RACE_UNDEAD_PLAYER:
- stmt->setUInt16(1, 673);
- break;
- case RACE_TAUREN:
- stmt->setUInt16(1, 115);
- break;
- case RACE_TROLL:
- stmt->setUInt16(1, 315);
- break;
- case RACE_BLOODELF:
- stmt->setUInt16(1, 137);
- break;
- }
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
+ stmt->setUInt32(0, lowGuid);
- trans->Append(stmt);
+ switch (race)
+ {
+ case RACE_DWARF:
+ stmt->setUInt16(1, 111);
+ break;
+ case RACE_DRAENEI:
+ stmt->setUInt16(1, 759);
+ break;
+ case RACE_GNOME:
+ stmt->setUInt16(1, 313);
+ break;
+ case RACE_NIGHTELF:
+ stmt->setUInt16(1, 113);
+ break;
+ case RACE_UNDEAD_PLAYER:
+ stmt->setUInt16(1, 673);
+ break;
+ case RACE_TAUREN:
+ stmt->setUInt16(1, 115);
+ break;
+ case RACE_TROLL:
+ stmt->setUInt16(1, 315);
+ break;
+ case RACE_BLOODELF:
+ stmt->setUInt16(1, 137);
+ break;
+ }
+
+ trans->Append(stmt);
+ }
if (recv_data.GetOpcode() == CMSG_CHAR_FACTION_CHANGE)
{
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 9343a5356b6..de8dc2b90f6 100755
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -248,8 +248,9 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE");
- Group *group = GetPlayer()->GetGroupInvite();
- if (!group) return;
+ Group* group = GetPlayer()->GetGroupInvite();
+ if (!group)
+ return;
// Remember leader if online (group pointer will be invalid if group gets disbanded)
Player* leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID());
@@ -430,7 +431,8 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data)
void WorldSession::HandleLootRoll(WorldPacket &recv_data)
{
- if (!GetPlayer()->GetGroup())
+ Group* group = GetPlayer()->GetGroup();
+ if (!group)
{
recv_data.rfinish();
return;
@@ -443,12 +445,6 @@ void WorldSession::HandleLootRoll(WorldPacket &recv_data)
recv_data >> NumberOfPlayers;
recv_data >> rollType; //0: pass, 1: need, 2: greed
- //sLog->outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise);
-
- Group* group = GetPlayer()->GetGroup();
- if (!group)
- return;
-
// everything's fine, do it
group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType);
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index 9115f8f0f1e..ccd1c931f51 100755
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -352,8 +352,8 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data)
uint64 GoGuid;
recv_data >> GoGuid;
- uint8 unk;
- recv_data >> unk;
+ uint8 fullSlotList;
+ recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
{
@@ -375,8 +375,8 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data)
uint8 tabId;
recv_data >> tabId;
- uint8 unk1;
- recv_data >> unk1;
+ uint8 fullSlotList;
+ recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = _GetPlayerGuild(this))
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 8a60f21dac9..85694dba630 100755
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -115,7 +115,7 @@ void WorldSession::HandleSwapItem(WorldPacket & recv_data)
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM");
uint8 dstbag, dstslot, srcbag, srcslot;
- recv_data >> dstbag >> dstslot >> srcbag >> srcslot ;
+ recv_data >> dstbag >> dstslot >> srcbag >> srcslot;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u", srcbag, srcslot, dstbag, dstslot);
uint16 src = ((srcbag << 8) | srcslot);
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 3c6bd28b5cb..aea7499aaa9 100755
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -70,7 +70,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
}
LfgDungeonSet newDungeons;
- for (int8 i = 0 ; i < numDungeons; ++i)
+ for (int8 i = 0; i < numDungeons; ++i)
{
recv_data >> dungeon;
newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 72488966416..187b12d5d2e 100755
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -558,7 +558,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
//load players mails, and mailed items
if (!player->m_mailsLoaded)
- player ->_LoadMail();
+ player->_LoadMail();
// client can't work with packets > max int16 value
const uint32 maxPacketSize = 32767;
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index 5479791d341..f0c3093aa25 100755
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -169,7 +169,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
bool valid = true;
bool primary_prof_first_rank = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->learnedSpell[i])
continue;
@@ -199,7 +199,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
data << uint32(tSpell->reqSkillValue);
//prev + req or req + 0
uint8 maxReq = 0;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->learnedSpell[i])
continue;
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index a6a6637deaf..7a3964b9469 100755
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -340,7 +340,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
Field* fields = result->Fetch();
ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
name = fields[1].GetString();
- type = fields[2].GetUInt32();
+ type = fields[2].GetUInt8();
}
else
{
@@ -486,7 +486,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
fields = result->Fetch();
uint64 ownerGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
uint8 signs = fields[1].GetUInt8();
- uint32 type = fields[2].GetUInt32();
+ uint8 type = fields[2].GetUInt8();
uint32 playerGuid = _player->GetGUIDLow();
if (GUID_LOPART(ownerGuid) == playerGuid)
@@ -912,7 +912,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
stmt->setUInt32(0, GUID_LOPART(petitionGuid));
trans->Append(stmt);
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID);
stmt->setUInt32(0, GUID_LOPART(petitionGuid));
trans->Append(stmt);
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index c907620193a..5061331b8de 100755
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -33,42 +33,39 @@
void WorldSession::SendNameQueryOpcode(uint64 guid)
{
- Player* player = NULL;
- const CharacterNameData* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
- if (nameData)
- player = ObjectAccessor::FindPlayer(guid);
+ Player* player = ObjectAccessor::FindPlayer(guid);
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
- // guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
data.appendPackGUID(guid);
- data << uint8(0); // added in 3.1
- if (nameData)
+ if (!player)
{
- data << nameData->m_name; // played name
- data << uint8(0); // realm name for cross realm BG usage
- data << uint8(nameData->m_race);
- data << uint8(nameData->m_gender);
- data << uint8(nameData->m_class);
+ data << uint8(1); // player unknown
+ SendPacket(&data);
+ return;
}
- else
+ if (!nameData)
{
- data << std::string(GetTrinityString(LANG_NON_EXIST_CHARACTER));
- data << uint32(0);
+ data << uint8(2); // name unknown
+ SendPacket(&data);
+ return;
}
- if (player)
+ data << uint8(0); // name known
+ data << nameData->m_name; // played name
+ data << uint8(0); // realm name - only set for cross realm interaction (such as Battlegrounds)
+ data << uint8(nameData->m_race);
+ data << uint8(nameData->m_gender);
+ data << uint8(nameData->m_class);
+
+ if (DeclinedName const* names = player->GetDeclinedNames())
{
- if (DeclinedName const* names = player->GetDeclinedNames())
- {
- data << uint8(1); // is declined
- for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
- data << names->name[i];
- }
- else
- data << uint8(0); // is not declined
+ data << uint8(1); // Name is declined
+ for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
+ data << names->name[i];
}
- else //TODO: decline names may also need to be stored in char name data
- data << uint8(0);
+ else
+ data << uint8(0); // Name is not declined
SendPacket(&data);
}
@@ -76,7 +73,6 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data)
{
uint64 guid;
-
recv_data >> guid;
// This is disable by default to prevent lots of console spam
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index a270d42b000..9c4eba67426 100755
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -38,7 +38,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
return;
}
- GMTicketResponse response = GMTICKET_RESPONSE_FAILURE;
+ GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR;
// Player must not have ticket
if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
@@ -48,7 +48,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId());
- response = GMTICKET_RESPONSE_SUCCESS;
+ response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
WorldPacket data(SMSG_GMTICKET_CREATE, 4);
@@ -61,8 +61,8 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
std::string message;
recv_data >> message;
- GMTicketResponse response = GMTICKET_RESPONSE_FAILURE;
- if (GmTicket *ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
+ GMTicketResponse response = GMTICKET_RESPONSE_UPDATE_ERROR;
+ if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
SQLTransaction trans = SQLTransaction(NULL);
ticket->SetMessage(message);
@@ -70,7 +70,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->GetId());
- response = GMTICKET_RESPONSE_SUCCESS;
+ response = GMTICKET_RESPONSE_UPDATE_SUCCESS;
}
WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4);
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 17617c399e4..dc26aaa42ca 100755
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -412,7 +412,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT);
// test if item will fit in each inventory
- hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
+ hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
clearAcceptTradeMode(myItems, hisItems);
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index ca39c137274..c17c7edbf0d 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -358,7 +358,7 @@ void InstanceSaveManager::LoadResetTimes()
{
Field* fields = result->Fetch();
uint32 mapid = fields[0].GetUInt16();
- Difficulty difficulty = Difficulty(fields[1].GetUInt32());
+ Difficulty difficulty = Difficulty(fields[1].GetUInt8());
uint64 oldresettime = fields[2].GetUInt32();
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 3522571775c..1b349b11156 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -26,7 +26,8 @@
#include "SpellInfo.h"
#include "Group.h"
-static Rates const qualityToRate[MAX_ITEM_QUALITY] = {
+static Rates const qualityToRate[MAX_ITEM_QUALITY] =
+{
RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR
RATE_DROP_ITEM_NORMAL, // ITEM_QUALITY_NORMAL
RATE_DROP_ITEM_UNCOMMON, // ITEM_QUALITY_UNCOMMON
@@ -116,7 +117,7 @@ uint32 LootStore::LoadLootTable()
uint16 lootmode = fields[3].GetUInt16();
uint8 group = fields[4].GetUInt8();
int32 mincountOrRef = fields[5].GetInt32();
- int32 maxcount = fields[6].GetInt32();
+ int32 maxcount = fields[6].GetUInt8();
if (maxcount > std::numeric_limits<uint8>::max())
{
@@ -512,7 +513,9 @@ QuestItemList* Loot::FillFFALoot(Player* player)
QuestItemList* Loot::FillQuestLoot(Player* player)
{
- if (items.size() == MAX_NR_LOOT_ITEMS) return NULL;
+ if (items.size() == MAX_NR_LOOT_ITEMS)
+ return NULL;
+
QuestItemList* ql = new QuestItemList();
for (uint8 i = 0; i < quest_items.size(); ++i)
@@ -734,7 +737,7 @@ bool Loot::hasItemFor(Player* player) const
if (q_itr != lootPlayerQuestItems.end())
{
QuestItemList* q_list = q_itr->second;
- for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi)
+ for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
{
const LootItem &item = quest_items[qi->index];
if (!qi->is_looted && !item.is_looted)
@@ -747,7 +750,7 @@ bool Loot::hasItemFor(Player* player) const
if (ffa_itr != lootPlayerFFAItems.end())
{
QuestItemList* ffa_list = ffa_itr->second;
- for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi)
+ for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
{
const LootItem &item = items[fi->index];
if (!fi->is_looted && !item.is_looted)
@@ -759,8 +762,8 @@ bool Loot::hasItemFor(Player* player) const
QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow());
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
{
- QuestItemList* conditional_list = nn_itr->second;
- for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
+ QuestItemList* conditional_list = nn_itr->second;
+ for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
{
const LootItem &item = items[ci->index];
if (!ci->is_looted && !item.is_looted)
@@ -900,7 +903,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
if (q_itr != lootPlayerQuestItems.end())
{
QuestItemList* q_list = q_itr->second;
- for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi)
+ for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
{
LootItem &item = l.quest_items[qi->index];
if (!qi->is_looted && !item.is_looted)
@@ -918,7 +921,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
if (ffa_itr != lootPlayerFFAItems.end())
{
QuestItemList* ffa_list = ffa_itr->second;
- for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi)
+ for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
{
LootItem &item = l.items[fi->index];
if (!fi->is_looted && !item.is_looted)
@@ -935,8 +938,8 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow());
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
{
- QuestItemList* conditional_list = nn_itr->second;
- for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
+ QuestItemList* conditional_list = nn_itr->second;
+ for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
{
LootItem &item = l.items[ci->index];
if (!ci->is_looted && !item.is_looted)
@@ -1285,7 +1288,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
}
// Now processing groups
- for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end(); ++i)
+ for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
if (i->HasQuestDrop())
return true;
@@ -1303,7 +1306,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
}
// Checking non-grouped entries
- for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end(); ++i)
+ for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
{
if (i->mincountOrRef < 0) // References processing
{
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index d0f99610262..766e3d23f93 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -245,8 +245,12 @@ class Map : public GridRefManager<NGridType>
// currently unused for normal maps
bool CanUnload(uint32 diff)
{
- if (!m_unloadTimer) return false;
- if (m_unloadTimer <= diff) return true;
+ if (!m_unloadTimer)
+ return false;
+
+ if (m_unloadTimer <= diff)
+ return true;
+
m_unloadTimer -= diff;
return false;
}
diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp
index 80025680753..b747d065a14 100644
--- a/src/server/game/Maps/MapUpdater.cpp
+++ b/src/server/game/Maps/MapUpdater.cpp
@@ -52,7 +52,7 @@ class MapUpdateRequest : public ACE_Method_Request
virtual int call()
{
m_map.Update (m_diff);
- m_updater.update_finished ();
+ m_updater.update_finished();
return 0;
}
};
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 91a5f602327..bca896df38f 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -248,7 +248,8 @@ enum SpellCategory
SPELL_CATEGORY_DRINK = 59,
};
-const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
+const uint32 ItemQualityColors[MAX_ITEM_QUALITY] =
+{
0xff9d9d9d, //GREY
0xffffffff, //WHITE
0xff1eff00, //GREEN
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index 32b960028c2..f7534ec800e 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -66,7 +66,7 @@ void ConfusedMovementGenerator<T>::Initialize(T &unit)
}
unit.UpdateAllowedPositionZ(i_waypoints[idx][0], i_waypoints[idx][1], z);
- i_waypoints[idx][2] = z;
+ i_waypoints[idx][2] = z;
}
unit.StopMoving();
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 2c3a58f55a3..296c9eee50f 100755
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -43,6 +43,7 @@ void WaypointMgr::Load()
{
uint32 oldMSTime = getMSTime();
+ // 0 1 2 3 4 5 6 7 8 9
QueryResult result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data ORDER BY id, point");
if (!result)
@@ -78,7 +79,7 @@ void WaypointMgr::Load()
wp->run = fields[6].GetBool();
wp->delay = fields[7].GetUInt32();
wp->event_id = fields[8].GetUInt32();
- wp->event_chance = fields[9].GetUInt8();
+ wp->event_chance = fields[9].GetInt16();
path.push_back(wp);
++count;
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index 608067935ea..a079d2f643b 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -41,7 +41,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
{
uint32 oldMSTime = getMSTime();
- // 0 1
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT TypeId, ScriptName FROM outdoorpvp_template");
if (!result)
@@ -58,7 +58,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
{
Field* fields = result->Fetch();
- typeId = fields[0].GetUInt32();
+ typeId = fields[0].GetUInt8();
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL))
continue;
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 71204f92826..5ebf78e484c 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -600,7 +600,7 @@ void PoolMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- // 1 2 3
+ // 1 2 3
QueryResult result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_creature");
if (!result)
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 173df8dc809..9221da53003 100755
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -23,31 +23,31 @@
Quest::Quest(Field* questRecord)
{
Id = questRecord[0].GetUInt32();
- Method = questRecord[1].GetUInt32();
- Level = questRecord[2].GetInt32();
- MinLevel = questRecord[3].GetUInt32();
- MaxLevel = questRecord[4].GetUInt32();
- ZoneOrSort = questRecord[5].GetInt32();
- Type = questRecord[6].GetUInt32();
- SuggestedPlayers = questRecord[7].GetUInt32();
+ Method = questRecord[1].GetUInt8();
+ Level = questRecord[2].GetInt16();
+ MinLevel = questRecord[3].GetUInt8();
+ MaxLevel = questRecord[4].GetUInt8();
+ ZoneOrSort = questRecord[5].GetInt16();
+ Type = questRecord[6].GetUInt16();
+ SuggestedPlayers = questRecord[7].GetUInt8();
LimitTime = questRecord[8].GetUInt32();
- RequiredClasses = questRecord[9].GetUInt32();
- RequiredRaces = questRecord[10].GetUInt32();
- RequiredSkillId = questRecord[11].GetUInt32();
- RequiredSkillPoints = questRecord[12].GetUInt32();
- RequiredFactionId1 = questRecord[13].GetUInt32();
- RequiredFactionId2 = questRecord[14].GetUInt32();
+ RequiredClasses = questRecord[9].GetUInt16();
+ RequiredRaces = questRecord[10].GetUInt16();
+ RequiredSkillId = questRecord[11].GetUInt16();
+ RequiredSkillPoints = questRecord[12].GetUInt16();
+ RequiredFactionId1 = questRecord[13].GetUInt16();
+ RequiredFactionId2 = questRecord[14].GetUInt16();
RequiredFactionValue1 = questRecord[15].GetInt32();
RequiredFactionValue2 = questRecord[16].GetInt32();
- RequiredMinRepFaction = questRecord[17].GetUInt32();
- RequiredMaxRepFaction = questRecord[18].GetUInt32();
+ RequiredMinRepFaction = questRecord[17].GetUInt16();
+ RequiredMaxRepFaction = questRecord[18].GetUInt16();
RequiredMinRepValue = questRecord[19].GetInt32();
RequiredMaxRepValue = questRecord[20].GetInt32();
PrevQuestId = questRecord[21].GetInt32();
NextQuestId = questRecord[22].GetInt32();
ExclusiveGroup = questRecord[23].GetInt32();
NextQuestIdChain = questRecord[24].GetUInt32();
- RewardXPId = questRecord[25].GetUInt32();
+ RewardXPId = questRecord[25].GetUInt8();
RewardOrRequiredMoney = questRecord[26].GetInt32();
RewardMoneyMaxLevel = questRecord[27].GetUInt32();
RewardSpell = questRecord[28].GetUInt32();
@@ -57,29 +57,29 @@ Quest::Quest(Field* questRecord)
RewardMailTemplateId = questRecord[32].GetUInt32();
RewardMailDelay = questRecord[33].GetUInt32();
SourceItemId = questRecord[34].GetUInt32();
- SourceItemIdCount = questRecord[35].GetUInt32();
+ SourceItemIdCount = questRecord[35].GetUInt8();
SourceSpellid = questRecord[36].GetUInt32();
Flags = questRecord[37].GetUInt32();
- uint32 SpecialFlags = questRecord[38].GetUInt16();
- RewardTitleId = questRecord[39].GetUInt32();
- RequiredPlayerKills = questRecord[40].GetUInt32();
- RewardTalents = questRecord[41].GetUInt32();
- RewardArenaPoints = questRecord[42].GetInt32();
+ uint32 SpecialFlags = questRecord[38].GetUInt8();
+ RewardTitleId = questRecord[39].GetUInt8();
+ RequiredPlayerKills = questRecord[40].GetUInt8();
+ RewardTalents = questRecord[41].GetUInt8();
+ RewardArenaPoints = questRecord[42].GetUInt16();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewardItemId[i] = questRecord[43+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewardItemIdCount[i] = questRecord[47+i].GetUInt32();
+ RewardItemIdCount[i] = questRecord[47+i].GetUInt16();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewardChoiceItemId[i] = questRecord[51+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewardChoiceItemCount[i] = questRecord[57+i].GetUInt32();
+ RewardChoiceItemCount[i] = questRecord[57+i].GetUInt16();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionId[i] = questRecord[63+i].GetUInt32();
+ RewardFactionId[i] = questRecord[63+i].GetUInt16();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewardFactionValueId[i] = questRecord[68+i].GetInt32();
@@ -87,7 +87,7 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32();
- PointMapId = questRecord[78].GetUInt32();
+ PointMapId = questRecord[78].GetUInt16();
PointX = questRecord[79].GetFloat();
PointY = questRecord[80].GetFloat();
PointOption = questRecord[81].GetUInt32();
@@ -103,39 +103,39 @@ Quest::Quest(Field* questRecord)
RequiredNpcOrGo[i] = questRecord[89+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt32();
+ RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt16();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
RequiredSourceItemId[i] = questRecord[97+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemCount[i] = questRecord[101+i].GetUInt32();
+ RequiredSourceItemCount[i] = questRecord[101+i].GetUInt16();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
RequiredItemId[i] = questRecord[105+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- RequiredItemCount[i] = questRecord[111+i].GetUInt32();
+ RequiredItemCount[i] = questRecord[111+i].GetUInt16();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
RequiredSpellCast[i] = questRecord[117+i].GetUInt32();
- // int8 Unknown0 = questRecord[121].GetUInt32();
+ // int8 Unknown0 = questRecord[121].GetUInt8();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectiveText[i] = questRecord[122+i].GetString();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmote[i] = questRecord[126+i].GetUInt32();
+ DetailsEmote[i] = questRecord[126+i].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = questRecord[130+i].GetUInt32();
- EmoteOnIncomplete = questRecord[134].GetUInt32();
- EmoteOnComplete = questRecord[135].GetUInt32();
+ EmoteOnIncomplete = questRecord[134].GetUInt16();
+ EmoteOnComplete = questRecord[135].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmote[i] = questRecord[136+i].GetInt32();
+ OfferRewardEmote[i] = questRecord[136+i].GetInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32();
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index a9a02170e5f..94a6590cc4a 100755
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -521,7 +521,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
FactionState* faction = &_factions[factionEntry->reputationListID];
// update standing to current
- faction->Standing = int32(fields[1].GetUInt32());
+ faction->Standing = fields[1].GetInt32();
// update counters
int32 BaseRep = GetBaseReputation(factionEntry);
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index e73839c8071..5387a3132c6 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -566,7 +566,7 @@ void Map::ScriptsProcess()
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
- worldObject = dynamic_cast<WorldObject*>(target);
+ worldObject = dynamic_cast<WorldObject*>(target);
}
else
{
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index ecb82a80a8d..c38d559372f 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -30,7 +30,8 @@ void SystemMgr::LoadScriptTexts()
sLog->outString("TSCR: Loading Script Texts additional data...");
uint32 oldMSTime = getMSTime();
-
+
+ // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");
if (!result)
@@ -49,9 +50,9 @@ void SystemMgr::LoadScriptTexts()
int32 iId = pFields[0].GetInt32();
temp.uiSoundId = pFields[1].GetUInt32();
- temp.uiType = pFields[2].GetUInt32();
- temp.uiLanguage = pFields[3].GetUInt32();
- temp.uiEmote = pFields[4].GetUInt32();
+ temp.uiType = pFields[2].GetUInt8();
+ temp.uiLanguage = pFields[3].GetUInt8();
+ temp.uiEmote = pFields[4].GetUInt16();
if (iId >= 0)
{
@@ -109,11 +110,11 @@ void SystemMgr::LoadScriptTextsCustom()
Field* pFields = result->Fetch();
StringTextData temp;
- int32 iId = pFields[0].GetInt32();
+ int32 iId = pFields[0].GetInt32();
temp.uiSoundId = pFields[1].GetUInt32();
- temp.uiType = pFields[2].GetUInt32();
- temp.uiLanguage = pFields[3].GetUInt32();
- temp.uiEmote = pFields[4].GetUInt32();
+ temp.uiType = pFields[2].GetUInt8();
+ temp.uiLanguage = pFields[3].GetUInt8();
+ temp.uiEmote = pFields[4].GetUInt16();
if (iId >= 0)
{
@@ -164,6 +165,7 @@ void SystemMgr::LoadScriptWaypoints()
sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
+ // 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
if (!result)
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index af38a5f4cce..9dcacb71824 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -121,8 +121,8 @@ WorldSession::~WorldSession()
/// - If have unclosed socket, close it
if (m_Socket)
{
- m_Socket->CloseSocket ();
- m_Socket->RemoveReference ();
+ m_Socket->CloseSocket();
+ m_Socket->RemoveReference();
m_Socket = NULL;
}
@@ -196,7 +196,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
#endif // !TRINITY_DEBUG
if (m_Socket->SendPacket (*packet) == -1)
- m_Socket->CloseSocket ();
+ m_Socket->CloseSocket();
}
/// Add an incoming packet to the queue
@@ -527,7 +527,7 @@ void WorldSession::LogoutPlayer(bool Save)
///- Broadcast a logout message to the player's friends
sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
- sSocialMgr->RemovePlayerSocial (_player->GetGUIDLow ());
+ sSocialMgr->RemovePlayerSocial(_player->GetGUIDLow());
// Call script hook before deletion
sScriptMgr->OnPlayerLogout(GetPlayer());
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index 3ece4b57741..e314fab07be 100755
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -71,7 +71,7 @@ void LoadSkillDiscoveryTable()
uint32 spellId = fields[0].GetUInt32();
int32 reqSkillOrSpell = fields[1].GetInt32();
- uint32 reqSkillValue = fields[2].GetUInt32();
+ uint32 reqSkillValue = fields[2].GetUInt16();
float chance = fields[3].GetFloat();
if (chance <= 0) // chance
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index c68e3cdcfe0..3bb435145f1 100755
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -55,7 +55,7 @@ void LoadSkillExtraItemTable()
SkillExtraItemStore.clear(); // need for reload
- // 0 1 2 3
+ // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
if (!result)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index f7635f3fab5..6383c7ff3ef 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3481,7 +3481,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint
{
bool banishFound = false;
Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
- for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
+ for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
{
banishFound = true;
@@ -4594,7 +4594,7 @@ void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mod
flag96 mask;
Unit::AuraEffectList const& noReagent = target->GetAuraEffectsByType(SPELL_AURA_NO_REAGENT_USE);
- for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
+ for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]);
@@ -5189,7 +5189,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true);
}
else
- target-> RemoveAurasDueToSpell(50322);
+ target->RemoveAurasDueToSpell(50322);
break;
}
}
@@ -6173,7 +6173,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
uint32 absorb = 0;
uint32 resist = 0;
- CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
+ CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
// ignore non positive values (can be result apply spellmods to aura damage
uint32 damage = std::max(GetAmount(), 0);
@@ -6466,7 +6466,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
caster->DealDamageMods(caster, funnelDamage, &funnelAbsorb);
caster->SendSpellNonMeleeDamageLog(caster, GetId(), funnelDamage, GetSpellInfo()->GetSchoolMask(), funnelAbsorb, 0, false, 0, false);
- CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
+ CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
caster->DealDamage(caster, funnelDamage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index a22b9e73fc6..b6cdc006d2d 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -350,7 +350,7 @@ m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount)
{
// shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism
- for (uint8 i=0 ; i<MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (effMask & (uint8(1) << i))
m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : NULL, caster);
@@ -371,7 +371,7 @@ Aura::~Aura()
}
// free effects memory
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
delete m_effects[i];
ASSERT(m_applications.empty());
@@ -453,7 +453,7 @@ void Aura::_Remove(AuraRemoveMode removeMode)
ApplicationMap::iterator appItr = m_applications.begin();
for (appItr = m_applications.begin(); appItr != m_applications.end();)
{
- AuraApplication * aurApp = appItr->second;
+ AuraApplication * aurApp = appItr->second;
Unit* target = aurApp->GetTarget();
target->_UnapplyAura(aurApp, removeMode);
appItr = m_applications.begin();
@@ -2043,7 +2043,7 @@ void Aura::_DeleteRemovedApplications()
void Aura::LoadScripts()
{
sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
- for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
+ for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
{
if (!(*itr)->_Load(this))
{
@@ -2060,11 +2060,11 @@ void Aura::LoadScripts()
bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
if (!(*hookItr).Call(*scritr, target))
return false;
(*scritr)->_FinishScriptCall();
@@ -2074,11 +2074,11 @@ bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
void Aura::CallScriptDispel(DispelInfo* dispelInfo)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr, dispelInfo);
(*scritr)->_FinishScriptCall();
}
@@ -2086,11 +2086,11 @@ void Aura::CallScriptDispel(DispelInfo* dispelInfo)
void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr, dispelInfo);
(*scritr)->_FinishScriptCall();
}
@@ -2099,11 +2099,11 @@ void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
bool preventDefault = false;
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2118,11 +2118,11 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati
bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
bool preventDefault = false;
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2136,11 +2136,11 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat
void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2151,11 +2151,11 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl
void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2167,11 +2167,11 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp
bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp)
{
bool preventDefault = false;
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
@@ -2185,11 +2185,11 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic
void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
@@ -2200,11 +2200,11 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)
void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
@@ -2215,11 +2215,11 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &
void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
@@ -2230,11 +2230,11 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &
void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, spellMod);
@@ -2245,11 +2245,11 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2260,11 +2260,11 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co
void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2275,11 +2275,11 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplicati
void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2290,11 +2290,11 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplicatio
void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2339,7 +2339,7 @@ void UnitAura::Remove(AuraRemoveMode removeMode)
void UnitAura::FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster)
{
- for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS ; ++effIndex)
+ for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
if (!HasEffect(effIndex))
continue;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 2032c883256..942f9dc7e86 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1274,7 +1274,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
break;
// Remove targets outside caster's raid
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
{
if (!(*itr)->IsInRaidWith(m_caster))
itr = unitTargets.erase(itr);
@@ -1291,7 +1291,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall
{
// Remove targets not in LoS or in stealth
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
{
if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster))
itr = unitTargets.erase(itr);
@@ -1304,7 +1304,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
break;
// Remove targets outside caster's raid
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
if (!(*itr)->IsInRaidWith(m_caster))
itr = unitTargets.erase(itr);
else
@@ -1326,7 +1326,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
}
else
{
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
if ((*itr)->getPowerType() != (Powers)power)
itr = unitTargets.erase(itr);
else
@@ -2166,7 +2166,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (targetInfo.missCondition == SPELL_MISS_REFLECT)
{
// Calculate reflected spell result on caster
- targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect);
+ targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect);
if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell
targetInfo.reflectResult = SPELL_MISS_PARRY;
@@ -4984,7 +4984,7 @@ SpellCastResult Spell::CheckCast(bool strict)
break;
}
- if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))
+ if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL) && !IsTriggered())
return SPELL_FAILED_NOTHING_TO_DISPEL;
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
@@ -6039,7 +6039,7 @@ SpellCastResult Spell::CheckItems()
// check totem-item requirements (items presence in inventory)
uint32 totems = 2;
- for (int i = 0; i < 2 ; ++i)
+ for (int i = 0; i < 2; ++i)
{
if (m_spellInfo->Totem[i] != 0)
{
@@ -6262,9 +6262,12 @@ SpellCastResult Spell::CheckItems()
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
{
- if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
+ return SPELL_FAILED_TARGET_NOT_PLAYER;
+
if (m_attackType != RANGED_ATTACK)
break;
+
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
@@ -6276,7 +6279,8 @@ SpellCastResult Spell::CheckItems()
uint32 ammo = pItem->GetEntry();
if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
return SPELL_FAILED_NO_AMMO;
- }; break;
+ };
+ break;
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
@@ -6987,7 +6991,7 @@ void Spell::CheckEffectExecuteData()
void Spell::LoadScripts()
{
sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts);
- for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
+ for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
{
if (!(*itr)->_Load(this))
{
@@ -7004,11 +7008,11 @@ void Spell::LoadScripts()
void Spell::CallScriptBeforeCastHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7017,11 +7021,11 @@ void Spell::CallScriptBeforeCastHandlers()
void Spell::CallScriptOnCastHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7030,11 +7034,11 @@ void Spell::CallScriptOnCastHandlers()
void Spell::CallScriptAfterCastHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7044,7 +7048,7 @@ void Spell::CallScriptAfterCastHandlers()
SpellCastResult Spell::CallScriptCheckCastHandlers()
{
SpellCastResult retVal = SPELL_CAST_OK;
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST);
std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin();
@@ -7062,7 +7066,7 @@ SpellCastResult Spell::CallScriptCheckCastHandlers()
void Spell::PrepareScriptHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
(*scritr)->_InitHit();
}
@@ -7070,7 +7074,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
{
// execute script effect handler hooks and check if effects was prevented
bool preventDefault = false;
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr;
SpellScriptHookType hookType;
@@ -7101,7 +7105,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
return false;
}
(*scritr)->_PrepareScriptCall(hookType);
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
// effect execution can be prevented
if (!(*scritr)->_IsEffectPrevented(effIndex) && (*effItr).IsEffectAffected(m_spellInfo, effIndex))
(*effItr).Call(*scritr, effIndex);
@@ -7116,11 +7120,11 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
void Spell::CallScriptBeforeHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7129,11 +7133,11 @@ void Spell::CallScriptBeforeHitHandlers()
void Spell::CallScriptOnHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7142,11 +7146,11 @@ void Spell::CallScriptOnHitHandlers()
void Spell::CallScriptAfterHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7155,11 +7159,11 @@ void Spell::CallScriptAfterHitHandlers()
void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex)
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT);
std::list<SpellScript::UnitTargetHandler>::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
(*hookItr).Call(*scritr, unitTargets);
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 716c6bec54d..37842433eb3 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -455,7 +455,7 @@ class Spell
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsNextMeleeSwingSpell() const;
- bool IsTriggered() const {return _triggeredCastFlags & TRIGGERED_FULL_MASK;};
+ bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; };
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
bool IsAutoActionResetSpell() const;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 56cc6b6f8ec..ce64c2e9560 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1992,7 +1992,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_GUARDIAN, avalibleElixirs);
if (!battleFound)
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, avalibleElixirs);
- for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end() ;)
+ for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end();)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(*itr);
if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel())
@@ -2761,7 +2761,7 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex)
if (damage < 0)
return;
- uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue;
+ uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue;
uint16 skillval = unitTarget->ToPlayer()->GetPureSkillValue(skillid);
unitTarget->ToPlayer()->SetSkill(skillid, m_spellInfo->Effects[effIndex].CalcValue(), skillval?skillval:1, damage*75);
}
@@ -4630,7 +4630,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
45684 // Polymorph
};
- static uint32 const spellTarget[5] = {
+ static uint32 const spellTarget[5] =
+ {
45673, // Bigger!
45672, // Shrunk
45677, // Yellow
@@ -5079,7 +5080,7 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex)
return;
// must be equipped
- if (!item ->IsEquipped())
+ if (!item->IsEquipped())
return;
if (m_spellInfo->Effects[effIndex].MiscValue)
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index c1b267d9fac..895dc9ab4b7 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -111,24 +111,14 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto,
}
case SPELLFAMILY_WARLOCK:
{
- // Death Coil
- if (spellproto->SpellFamilyFlags[0] & 0x80000)
- return DIMINISHING_HORROR;
// Curses/etc
- else if ((spellproto->SpellFamilyFlags[0] & 0x80000000) || (spellproto->SpellFamilyFlags[1] & 0x200))
+ if ((spellproto->SpellFamilyFlags[0] & 0x80000000) || (spellproto->SpellFamilyFlags[1] & 0x200))
return DIMINISHING_LIMITONLY;
// Seduction
else if (spellproto->SpellFamilyFlags[1] & 0x10000000)
return DIMINISHING_FEAR;
break;
}
- case SPELLFAMILY_PRIEST:
- {
- // Psychic Horror
- if (spellproto->SpellFamilyFlags[2] & 0x2000)
- return DIMINISHING_HORROR;
- break;
- }
case SPELLFAMILY_DRUID:
{
// Pounce
@@ -228,6 +218,8 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto,
return DIMINISHING_BANISH;
if (mechanic & (1 << MECHANIC_ROOT))
return triggered ? DIMINISHING_ROOT : DIMINISHING_CONTROLLED_ROOT;
+ if (mechanic & (1 << MECHANIC_HORROR))
+ return DIMINISHING_HORROR;
return DIMINISHING_NONE;
}
@@ -651,7 +643,7 @@ SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id)
uint32 SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
{
SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid);
- for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr)
{
if (itr->second == groupid)
return true;
@@ -677,7 +669,7 @@ void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>&
usedGroups.insert(group_id);
SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(group_id);
- for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr)
+ for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second; ++itr)
{
if (itr->second < 0)
{
@@ -696,7 +688,7 @@ bool SpellMgr::AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int
uint32 spellId = spellInfo->GetFirstRankSpell()->Id;
SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellId);
// Find group with SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT if it belongs to one
- for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr)
{
SpellGroup group = itr->second;
SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(group);
@@ -732,13 +724,13 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn
// find SpellGroups which are common for both spells
SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1);
std::set<SpellGroup> groups;
- for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr)
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second; ++itr)
{
if (IsSpellMemberOfSpellGroup(spellid_2, itr->second))
{
bool add = true;
SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second);
- for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2)
+ for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second; ++itr2)
{
if (itr2->second < 0)
{
@@ -757,7 +749,7 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn
SpellGroupStackRule rule = SPELL_GROUP_STACK_RULE_DEFAULT;
- for (std::set<SpellGroup>::iterator itr = groups.begin() ; itr!= groups.end() ; ++itr)
+ for (std::set<SpellGroup>::iterator itr = groups.begin(); itr!= groups.end(); ++itr)
{
SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(*itr);
if (found != mSpellGroupStack.end())
@@ -1148,11 +1140,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return true;
}
-void SpellMgr::LoadSpellInfos()
-{
-
-}
-
void SpellMgr::LoadSpellRanks()
{
uint32 oldMSTime = getMSTime();
@@ -1163,18 +1150,17 @@ void SpellMgr::LoadSpellRanks()
mSpellInfoMap[itr->first]->ChainEntry = NULL;
}
mSpellChains.clear();
-
+ // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT first_spell_id, spell_id, rank from spell_ranks ORDER BY first_spell_id, rank");
if (!result)
{
- sLog->outString(">> Loaded 0 spell rank records");
+ sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
sLog->outString();
- sLog->outErrorDb("`spell_ranks` table is empty!");
return;
}
- uint32 rows = 0;
+ uint32 count = 0;
bool finished = false;
do
@@ -1193,7 +1179,7 @@ void SpellMgr::LoadSpellRanks()
if (lastSpell == -1)
lastSpell = currentSpell;
uint32 spell_id = fields[1].GetUInt32();
- uint32 rank = fields[2].GetUInt32();
+ uint32 rank = fields[2].GetUInt8();
// don't drop the row if we're moving to the next rank
if (currentSpell == lastSpell)
@@ -1221,7 +1207,7 @@ void SpellMgr::LoadSpellRanks()
int32 curRank = 0;
bool valid = true;
// check spells in chain
- for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
+ for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin(); itr!= rankChain.end(); ++itr)
{
SpellInfo const* spell = GetSpellInfo(itr->first);
if (!spell)
@@ -1245,7 +1231,7 @@ void SpellMgr::LoadSpellRanks()
std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin();
do
{
- ++rows;
+ ++count;
int32 addedSpell = itr->first;
mSpellChains[addedSpell].first = GetSpellInfo(lastSpell);
mSpellChains[addedSpell].last = GetSpellInfo(rankChain.back().first);
@@ -1265,7 +1251,7 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
- sLog->outString(">> Loaded %u spell rank records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -1276,23 +1262,24 @@ void SpellMgr::LoadSpellRequired()
mSpellsReqSpell.clear(); // need for reload case
mSpellReq.clear(); // need for reload case
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required");
if (!result)
{
- sLog->outString(">> Loaded 0 spell required records");
+ sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty.");
sLog->outString();
- sLog->outErrorDb("`spell_required` table is empty!");
return;
}
- uint32 rows = 0;
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
- uint32 spell_id = fields[0].GetUInt32();
+ uint32 spell_id = fields[0].GetUInt32();
uint32 spell_req = fields[1].GetUInt32();
+
// check if chain is made with valid first spell
SpellInfo const* spell = GetSpellInfo(spell_id);
if (!spell)
@@ -1300,17 +1287,20 @@ void SpellMgr::LoadSpellRequired()
sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
continue;
}
+
SpellInfo const* req_spell = GetSpellInfo(spell_req);
if (!req_spell)
{
sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
continue;
}
+
if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
{
sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
continue;
}
+
if (IsSpellRequiringSpell(spell_id, spell_req))
{
sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
@@ -1319,10 +1309,10 @@ void SpellMgr::LoadSpellRequired()
mSpellReq.insert (std::pair<uint32, uint32>(spell_id, spell_req));
mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id));
- ++rows;
+ ++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell required records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -1374,24 +1364,22 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 spell learn spells");
+ sLog->outString(">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
sLog->outString();
- sLog->outErrorDb("`spell_learn_spell` table is empty!");
return;
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
- uint32 spell_id = fields[0].GetUInt32();
+ uint32 spell_id = fields[0].GetUInt16();
SpellLearnSpellNode node;
- node.spell = fields[1].GetUInt32();
- node.active = fields[2].GetBool();
- node.autoLearned= false;
+ node.spell = fields[1].GetUInt16();
+ node.active = fields[2].GetBool();
+ node.autoLearned = false;
if (!GetSpellInfo(spell_id))
{
@@ -1475,7 +1463,7 @@ void SpellMgr::LoadSpellTargetPositions()
mSpellTargetPositions.clear(); // need for reload case
- // 0 1 2 3 4 5
+ // 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
@@ -1485,7 +1473,6 @@ void SpellMgr::LoadSpellTargetPositions()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
@@ -1494,7 +1481,7 @@ void SpellMgr::LoadSpellTargetPositions()
SpellTargetPosition st;
- st.target_mapId = fields[1].GetUInt32();
+ st.target_mapId = fields[1].GetUInt16();
st.target_X = fields[2].GetFloat();
st.target_Y = fields[3].GetFloat();
st.target_Z = fields[4].GetFloat();
@@ -1597,19 +1584,17 @@ void SpellMgr::LoadSpellGroups()
mSpellSpellGroup.clear(); // need for reload case
mSpellGroupSpell.clear();
- uint32 count = 0;
-
- // 0 1
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
if (!result)
{
+ sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
sLog->outString();
- sLog->outString(">> Loaded %u spell group definitions", count);
return;
}
std::set<uint32> groups;
-
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1627,7 +1612,7 @@ void SpellMgr::LoadSpellGroups()
} while (result->NextRow());
- for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end() ;)
+ for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end();)
{
if (itr->second < 0)
{
@@ -1658,12 +1643,12 @@ void SpellMgr::LoadSpellGroups()
}
}
- for (std::set<uint32>::iterator groupItr = groups.begin() ; groupItr != groups.end() ; ++groupItr)
+ for (std::set<uint32>::iterator groupItr = groups.begin(); groupItr != groups.end(); ++groupItr)
{
std::set<uint32> spells;
GetSetOfSpellsInSpellGroup(SpellGroup(*groupItr), spells);
- for (std::set<uint32>::iterator spellItr = spells.begin() ; spellItr != spells.end() ; ++spellItr)
+ for (std::set<uint32>::iterator spellItr = spells.begin(); spellItr != spells.end(); ++spellItr)
{
++count;
mSpellSpellGroup.insert(SpellSpellGroupMap::value_type(*spellItr, SpellGroup(*groupItr)));
@@ -1680,23 +1665,22 @@ void SpellMgr::LoadSpellGroupStackRules()
mSpellGroupStack.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
- sLog->outString(">> Loaded 0 spell group stack rules");
+ sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 group_id = fields[0].GetUInt32();
- uint8 stack_rule = fields[1].GetUInt32();
+ uint8 stack_rule = fields[1].GetInt8();
if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX)
{
sLog->outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule);
@@ -1726,17 +1710,16 @@ void SpellMgr::LoadSpellProcEvents()
mSpellProcEventMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outString(">> Loaded %u spell proc event conditions", count);
+ sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
uint32 customProc = 0;
do
{
@@ -1753,8 +1736,8 @@ void SpellMgr::LoadSpellProcEvents()
SpellProcEventEntry spe;
- spe.schoolMask = fields[1].GetUInt32();
- spe.spellFamilyName = fields[2].GetUInt32();
+ spe.schoolMask = fields[1].GetInt8();
+ spe.spellFamilyName = fields[2].GetUInt16();
spe.spellFamilyMask[0] = fields[3].GetUInt32();
spe.spellFamilyMask[1] = fields[4].GetUInt32();
spe.spellFamilyMask[2] = fields[5].GetUInt32();
@@ -1791,17 +1774,16 @@ void SpellMgr::LoadSpellProcs()
mSpellProcMap.clear(); // need for reload case
- uint32 count = 0;
-
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
if (!result)
{
- sLog->outString(">> Loaded %u spell proc conditions and data", count);
+ sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1833,8 +1815,8 @@ void SpellMgr::LoadSpellProcs()
SpellProcEntry baseProcEntry;
- baseProcEntry.schoolMask = fields[1].GetUInt32();
- baseProcEntry.spellFamilyName = fields[2].GetUInt32();
+ baseProcEntry.schoolMask = fields[1].GetInt8();
+ baseProcEntry.spellFamilyName = fields[2].GetUInt16();
baseProcEntry.spellFamilyMask[0] = fields[3].GetUInt32();
baseProcEntry.spellFamilyMask[1] = fields[4].GetUInt32();
baseProcEntry.spellFamilyMask[2] = fields[5].GetUInt32();
@@ -1932,16 +1914,17 @@ void SpellMgr::LoadSpellBonusess()
uint32 oldMSTime = getMSTime();
mSpellBonusMap.clear(); // need for reload case
- uint32 count = 0;
+
// 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if (!result)
{
- sLog->outString(">> Loaded %u spell bonus data", count);
+ sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1973,17 +1956,16 @@ void SpellMgr::LoadSpellThreats()
mSpellThreatMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
if (!result)
{
- sLog->outString(">> Loaded 0 aggro generating spells");
+ sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1997,7 +1979,7 @@ void SpellMgr::LoadSpellThreats()
}
SpellThreatEntry ste;
- ste.flatMod = fields[1].GetInt16();
+ ste.flatMod = fields[1].GetInt32();
ste.pctMod = fields[2].GetFloat();
ste.apPctMod = fields[3].GetFloat();
@@ -2047,7 +2029,6 @@ void SpellMgr::LoadSpellPetAuras()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
@@ -2102,11 +2083,10 @@ void SpellMgr::LoadEnchantCustomAttr()
uint32 size = sSpellItemEnchantmentStore.GetNumRows();
mEnchantCustomAttr.resize(size);
- uint32 count = 0;
-
for (uint32 i = 0; i < size; ++i)
mEnchantCustomAttr[i] = 0;
+ uint32 count = 0;
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo const* spellInfo = GetSpellInfo(i);
@@ -2142,17 +2122,16 @@ void SpellMgr::LoadSpellEnchantProcData()
mSpellEnchantProcEventMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outString(">> Loaded %u spell enchant proc event conditions", count);
+ sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -2197,14 +2176,13 @@ void SpellMgr::LoadSpellLinked()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
int32 trigger = fields[0].GetInt32();
- int32 effect = fields[1].GetInt32();
- int32 type = fields[2].GetInt32();
+ int32 effect = fields[1].GetInt32();
+ int32 type = fields[2].GetUInt8();
SpellInfo const* spellInfo = GetSpellInfo(abs(trigger));
if (!spellInfo)
@@ -2442,7 +2420,6 @@ void SpellMgr::LoadSpellAreas()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index 9fffd474651..521070f7879 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -693,7 +693,6 @@ class SpellMgr
public:
// Loading data at server startup
- void LoadSpellInfos();
void LoadSpellRanks();
void LoadSpellRequired();
void LoadSpellLearnSkills();
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index e4b8ea2e034..930bf0d3372 100755
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -37,19 +37,28 @@ GmTicket::GmTicket(Player* player, WorldPacket& recv_data) : _createTime(time(NU
_playerName = player->GetName();
_playerGuid = player->GetGUID();
- uint32 mapId;
- recv_data >> mapId;
- _mapId = mapId;
-
+ recv_data >> _mapId;
recv_data >> _posX;
recv_data >> _posY;
recv_data >> _posZ;
recv_data >> _message;
-
- uint32 unk1;
- recv_data >> unk1; // not sure what this is... replyTo?
- uint8 needResponse;
- recv_data >> needResponse; // always 1/0 -- not sure what retail does with this
+ uint32 needResponse;
+ recv_data >> needResponse;
+ _needResponse = (needResponse == 17); // Requires GM response. 17 = true, 1 = false (17 is default)
+ uint8 unk1;
+ recv_data >> unk1; // Requests further GM interaction on a ticket to which a GM has already responded
+
+ recv_data.rfinish();
+ /*
+ recv_data >> uint32(count); // text lines
+ for (int i = 0; i < count; i++)
+ recv_data >> uint32();
+
+ if (something)
+ recv_data >> uint32();
+ else
+ compressed uint32 + string;
+ */
}
GmTicket::~GmTicket() { }
@@ -125,11 +134,11 @@ void GmTicket::WritePacket(WorldPacket& data) const
void GmTicket::SendResponse(WorldSession* session) const
{
WorldPacket data(SMSG_GMRESPONSE_RECEIVED);
- data << uint32(1); // unk? Zor says "hasActiveTicket"
- data << uint32(0); // can-edit - always 1 or 0, not flags
+ data << uint32(1); // responseID
+ data << uint32(_id); // ticketID
data << _message.c_str();
data << _response.c_str();
- // 3 null strings
+ // 3 null strings (unused)
data << uint8(0);
data << uint8(0);
data << uint8(0);
@@ -191,7 +200,7 @@ void GmTicket::SetUnassigned()
void GmTicket::TeleportTo(Player* player) const
{
- player->TeleportTo(_mapId, _posX, _posY, _posZ, 1, 0);
+ player->TeleportTo(_mapId, _posX, _posY, _posZ, 0.0f, 0);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -345,13 +354,13 @@ void TicketMgr::SendTicket(WorldSession* session, GmTicket* ticket) const
}
WorldPacket data(SMSG_GMTICKET_GETTICKET, (4 + 4 + (ticket ? message.length() + 1 + 4 + 4 + 4 + 1 + 1 : 0)));
- data << uint32(status); // standard 0x0A, 0x06 if text present
- data << uint32(1); // g_HasActiveGMTicket -- not a flag
+ data << uint32(status); // standard 0x0A, 0x06 if text present
+ data << uint32(ticket ? ticket->GetId() : 0); // ticketID
if (ticket)
{
- data << message.c_str(); // ticket text
- data << uint8(0x7); // ticket category; why is this hardcoded? does it make a diff re: client?
+ data << message.c_str(); // ticket text
+ data << uint8(0x7); // ticket category; why is this hardcoded? does it make a diff re: client?
// we've got the easy stuff done by now.
// Now we need to go through the client logic for displaying various levels of ticket load
diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h
index 5695880542c..be8b4063d84 100755
--- a/src/server/game/Tickets/TicketMgr.h
+++ b/src/server/game/Tickets/TicketMgr.h
@@ -40,8 +40,11 @@ enum GMTicketStatus
enum GMTicketResponse
{
- GMTICKET_RESPONSE_FAILURE = 1,
- GMTICKET_RESPONSE_SUCCESS = 2,
+ GMTICKET_RESPONSE_ALREADY_EXIST = 1,
+ GMTICKET_RESPONSE_CREATE_SUCCESS = 2,
+ GMTICKET_RESPONSE_CREATE_ERROR = 3,
+ GMTICKET_RESPONSE_UPDATE_SUCCESS = 4,
+ GMTICKET_RESPONSE_UPDATE_ERROR = 5,
GMTICKET_RESPONSE_TICKET_DELETED = 9,
};
@@ -156,6 +159,7 @@ private:
bool _completed;
GMTicketEscalationStatus _escalatedStatus;
bool _viewed;
+ bool _needResponse; // TODO: find out the use of this, and then store it in DB
std::string _response;
};
typedef std::map<uint32, GmTicket*> GmTicketList;
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index 7567b3976db..90d1cfc0140 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -59,7 +59,7 @@ void WardenCheckMgr::LoadWardenChecks()
Field* fields = result->Fetch();
- uint32 maxCheckId = fields[0].GetUInt32();
+ uint16 maxCheckId = fields[0].GetUInt16();
CheckStore.resize(maxCheckId + 1);
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index 2a48ede4c81..965e6bf3805 100755
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
@@ -147,7 +147,7 @@ bool Weather::ReGenerate()
}
// At this point, only weather that isn't doing anything remains but that have weather data
- uint32 chance1 = m_weatherChances->data[season].rainChance;
+ uint32 chance1 = m_weatherChances->data[season].rainChance;
uint32 chance2 = chance1+ m_weatherChances->data[season].snowChance;
uint32 chance3 = chance2+ m_weatherChances->data[season].stormChance;
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 41241583ea1..bb8fadf08bc 100755
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -108,9 +108,9 @@ void LoadWeatherData()
for (uint8 season = 0; season < WEATHER_SEASONS; ++season)
{
- wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt32();
- wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt32();
- wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt32();
+ wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt8();
+ wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt8();
+ wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt8();
if (wzc.data[season].rainChance > 100)
{
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 99a04ddfd7e..8a9c07a7187 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -78,7 +78,7 @@
#include "Warden.h"
#include "CalendarMgr.h"
-volatile bool World::m_stopEvent = false;
+ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
volatile uint32 World::m_worldLoopCounter = 0;
@@ -207,6 +207,7 @@ bool World::RemoveSession(uint32 id)
{
if (itr->second->PlayerLoading())
return false;
+
itr->second->KickPlayer();
}
@@ -218,8 +219,7 @@ void World::AddSession(WorldSession* s)
addSessQueue.add(s);
}
-void
-World::AddSession_(WorldSession* s)
+void World::AddSession_(WorldSession* s)
{
ASSERT (s);
@@ -272,11 +272,8 @@ World::AddSession_(WorldSession* s)
}
s->SendAuthResponse(AUTH_OK, true);
-
s->SendAddonsInfo();
-
s->SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION));
-
s->SendTutorialsData();
UpdateMaxSessionCounters();
@@ -1625,9 +1622,6 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading Autobroadcasts...");
LoadAutobroadcasts();
- sLog->outString("Loading Ip2nation...");
- LoadIp2nation();
-
///- Load and initialize scripts
sObjectMgr->LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
@@ -1672,18 +1666,10 @@ void World::SetInitialWorldSettings()
///- Initialize game time and timers
sLog->outString("Initialize game time and timers");
m_gameTime = time(NULL);
- m_startTime=m_gameTime;
-
- tm local;
- time_t curr;
- time(&curr);
- local=*(localtime(&curr)); // dereference and assign
- char isoDate[128];
- sprintf(isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
- local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
+ m_startTime = m_gameTime;
- LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime, revision) VALUES('%u', " UI64FMTD ", '%s', 0, '%s')",
- realmID, uint64(m_startTime), isoDate, _FULLVERSION); // One-time query
+ LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')",
+ realmID, uint32(m_startTime), _FULLVERSION); // One-time query
m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILLISECONDS);
m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILLISECONDS);
@@ -1884,23 +1870,6 @@ void World::LoadAutobroadcasts()
sLog->outString();
}
-void World::LoadIp2nation()
-{
- uint32 oldMSTime = getMSTime();
-
- QueryResult result = WorldDatabase.Query("SELECT count(c.code) FROM ip2nationCountries c, ip2nation i WHERE c.code = i.country");
- uint32 count = 0;
-
- if (result)
- {
- Field* fields = result->Fetch();
- count = fields[0].GetUInt32();
- }
-
- sLog->outString(">> Loaded %u ip2nation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
/// Update the World !
void World::Update(uint32 diff)
{
@@ -1985,10 +1954,10 @@ void World::Update(uint32 diff)
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_UPTIME_PLAYERS);
- stmt->setUInt64(0, uint64(tmpDiff));
+ stmt->setUInt32(0, tmpDiff);
stmt->setUInt16(1, uint16(maxOnlinePlayers));
stmt->setUInt32(2, realmID);
- stmt->setUInt64(3, uint64(m_startTime));
+ stmt->setUInt32(3, uint32(m_startTime));
LoginDatabase.Execute(stmt);
}
@@ -2470,7 +2439,7 @@ void World::_UpdateGameTime()
m_gameTime = thisTime;
///- if there is a shutdown timer
- if (!m_stopEvent && m_ShutdownTimer > 0 && elapsed > 0)
+ if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
{
///- ... and it is overdue, stop the world (set m_stopEvent)
if (m_ShutdownTimer <= elapsed)
@@ -2494,7 +2463,7 @@ void World::_UpdateGameTime()
void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
{
// ignore if server shutdown at next tick
- if (m_stopEvent)
+ if (IsStopped())
return;
m_ShutdownMask = options;
@@ -2546,7 +2515,7 @@ void World::ShutdownMsg(bool show, Player* player)
void World::ShutdownCancel()
{
// nothing cancel or too later
- if (!m_ShutdownTimer || m_stopEvent)
+ if (!m_ShutdownTimer || m_stopEvent.value())
return;
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;
@@ -2965,7 +2934,7 @@ void World::LoadCharacterNameData()
do
{
- Field *fields = result->Fetch();
+ Field* fields = result->Fetch();
AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(),
fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/);
++count;
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index cab9c19da8b..95e9fbda8ca 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -26,6 +26,7 @@
#include "Common.h"
#include "Timer.h"
#include <ace/Singleton.h>
+#include <ace/Atomic_Op.h>
#include "SharedDefines.h"
#include "QueryResult.h"
#include "Callback.h"
@@ -650,7 +651,7 @@ class World
void ShutdownMsg(bool show = false, Player* player = NULL);
static uint8 GetExitCode() { return m_ExitCode; }
static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; }
- static bool IsStopped() { return m_stopEvent; }
+ static bool IsStopped() { return m_stopEvent.value(); }
void Update(uint32 diff);
@@ -740,8 +741,6 @@ class World
void LoadAutobroadcasts();
- void LoadIp2nation();
-
void UpdateAreaDependentAuras();
void ProcessStartEvent();
@@ -770,7 +769,7 @@ class World
void ResetWeeklyQuests();
void ResetRandomBG();
private:
- static volatile bool m_stopEvent;
+ static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent;
static uint8 m_ExitCode;
uint32 m_ShutdownTimer;
uint32 m_ShutdownMask;
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 249506fb0f1..a9959c60201 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -694,7 +694,7 @@ public:
{
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE);
- stmt->setInt16(0, int16(emote));
+ stmt->setInt32(0, int32(emote));
stmt->setInt32(1, target->GetTransport()->GetEntry());
stmt->setInt32(2, target->GetGUIDTransport());
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 4e04284354e..9d863544c24 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -203,16 +203,16 @@ public:
pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
float angle = me->GetAngle(pAttumen);
float distance = me->GetDistance2d(pAttumen);
- float newX = me->GetPositionX() + cos(angle)*(distance/2) ;
- float newY = me->GetPositionY() + sin(angle)*(distance/2) ;
+ float newX = me->GetPositionX() + cos(angle)*(distance/2);
+ float newY = me->GetPositionY() + sin(angle)*(distance/2);
float newZ = 50;
//me->Relocate(newX, newY, newZ, angle);
//me->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
distance += 10;
- newX = me->GetPositionX() + cos(angle)*(distance/2) ;
- newY = me->GetPositionY() + sin(angle)*(distance/2) ;
+ newX = me->GetPositionX() + cos(angle)*(distance/2);
+ newY = me->GetPositionY() + sin(angle)*(distance/2);
pAttumen->GetMotionMaster()->Clear();
pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
//pAttumen->Relocate(newX, newY, newZ, -angle);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 447703aa5a7..65fb6759722 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -201,7 +201,7 @@ public:
void DeSpawnAdds()
{
- for (uint8 i = 0; i < 4 ; ++i)
+ for (uint8 i = 0; i < 4; ++i)
{
Creature* Temp = NULL;
if (AddGUID[i])
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index bd5cec9e3cb..bf208baf873 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -277,9 +277,7 @@ public:
void JustSummoned(Creature* summoned)
{
if (Player* player = GetPlayerForEscort())
- {
summoned->AI()->AttackStart(player);
- }
if (summoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH)
m_uiValrothGUID = summoned->GetGUID();
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 8918bca637e..6f71b100bb7 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -1011,8 +1011,7 @@ public:
if (fLichPositionX && fLichPositionY)
{
- Unit* temp;
- temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
+ Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED);
temp->SetWalk(false);
temp->SetSpeed(MOVE_RUN, 2.0f);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index fa0627df5f3..269c6fa0923 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -301,7 +301,7 @@ class boss_hexlord_malacrass : public CreatureScript
me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, 0);
DoPlaySoundToSet(me, SOUND_YELL_DEATH);
- for (uint8 i = 0; i < 4 ; ++i)
+ for (uint8 i = 0; i < 4; ++i)
{
Unit* Temp = Unit::GetUnit((*me), AddGUID[i]);
if (Temp && Temp->isAlive())
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
index f9fdd3a9587..06448032dff 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
@@ -198,7 +198,7 @@ class boss_venoxis : public CreatureScript
case EVENT_HOLY_NOVA:
_inMeleeRange = 0;
- for (uint8 i = 0; i < 10 ; ++i)
+ for (uint8 i = 0; i < 10; ++i)
{
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, i))
// check if target is within melee-distance
diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
index 6e8a354ef58..b53770badab 100644
--- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
+++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
@@ -99,8 +99,7 @@ class npc_professor_phizzlethorpe : public CreatureScript
case 20:
Talk(EMOTE_PROGRESS_8);
Talk(SAY_PROGRESS_9, player->GetGUID());
- if (player)
- CAST_PLR(player)->GroupEventHappens(QUEST_SUNKEN_TREASURE, me);
+ CAST_PLR(player)->GroupEventHappens(QUEST_SUNKEN_TREASURE, me);
break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp
index 841e577e333..8859dff1c77 100644
--- a/src/server/scripts/EasternKingdoms/ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp
@@ -139,52 +139,61 @@ public:
switch (i)
{
- case 0:
- {
- me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
- if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
- Cage->SetGoState(GO_STATE_ACTIVE);
- DoScriptText(SAY_START, me, player);
- break;
- }
- case 5:
- DoScriptText(SAY_PROGRESS1, me, player);
- case 11:
- DoScriptText(SAY_PROGRESS2, me, player);
- me->SetOrientation(4.762841f);
- break;
- case 18:
- {
- DoScriptText(SAY_PROGRESS3, me, player);
- Creature* Summ1 = me->SummonCreature(16342, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0);
- Creature* Summ2 = me->SummonCreature(16343, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0);
- if (Summ1 && Summ2)
- {
- Summ1->Attack(me, true);
- Summ2->Attack(player, true);
- }
- me->AI()->AttackStart(Summ1);
- break;
- }
- case 19: me->SetWalk(false);
- break;
- case 25: me->SetWalk(true);
- break;
- case 30:
- if (player && player->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me);
- break;
- case 32:
- me->SetOrientation(2.978281f);
- DoScriptText(SAY_END1, me, player);
- break;
- case 33:
- me->SetOrientation(5.858011f);
- DoScriptText(SAY_END2, me, player);
- Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
- if (CaptainHelios)
- DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player);
- break;
+ case 0:
+ me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
+ if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
+ Cage->SetGoState(GO_STATE_ACTIVE);
+ DoScriptText(SAY_START, me, player);
+ break;
+
+ case 5:
+ DoScriptText(SAY_PROGRESS1, me, player);
+ break;
+
+ case 11:
+ DoScriptText(SAY_PROGRESS2, me, player);
+ me->SetOrientation(4.762841f);
+ break;
+
+ case 18:
+ {
+ DoScriptText(SAY_PROGRESS3, me, player);
+ Creature* Summ1 = me->SummonCreature(16342, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ Creature* Summ2 = me->SummonCreature(16343, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ if (Summ1 && Summ2)
+ {
+ Summ1->Attack(me, true);
+ Summ2->Attack(player, true);
+ }
+ me->AI()->AttackStart(Summ1);
+ }
+ break;
+
+ case 19:
+ me->SetWalk(false);
+ break;
+
+ case 25:
+ me->SetWalk(true);
+ break;
+
+ case 30:
+ if (player->GetTypeId() == TYPEID_PLAYER)
+ CAST_PLR(player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me);
+ break;
+
+ case 32:
+ me->SetOrientation(2.978281f);
+ DoScriptText(SAY_END1, me, player);
+ break;
+
+ case 33:
+ me->SetOrientation(5.858011f);
+ DoScriptText(SAY_END2, me, player);
+ Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
+ if (CaptainHelios)
+ DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player);
+ break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp
index 08abdc26725..f217cb2a0dd 100644
--- a/src/server/scripts/EasternKingdoms/hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp
@@ -314,7 +314,7 @@ public:
{
m_uiPostEventTimer = 3000;
- if (Unit* player = GetPlayerForEscort())
+ if (Player* player = GetPlayerForEscort())
{
switch (m_uiPostEventCount)
{
diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
index ad76f29a634..88df13ffc26 100644
--- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
@@ -75,25 +75,44 @@ public:
switch (i)
{
- case 1: DoScriptText(SAY_START, me, player);break;
- case 13:
- DoScriptText(SAY_LAST, me, player);
- player->GroupEventHappens(QUEST_ESCORTING, me); break;
- case 14: DoScriptText(SAY_THANKS, me, player); break;
- case 15: {
- Unit* Rane = me->FindNearestCreature(NPC_RANE, 20);
- if (Rane)
+ case 1:
+ DoScriptText(SAY_START, me, player);
+ break;
+
+ case 13:
+ DoScriptText(SAY_LAST, me, player);
+ player->GroupEventHappens(QUEST_ESCORTING, me);
+ break;
+
+ case 14:
+ DoScriptText(SAY_THANKS, me, player);
+ break;
+
+ case 15:
+ if (Unit* Rane = me->FindNearestCreature(NPC_RANE, 20))
DoScriptText(SAY_RANE, Rane);
- break;}
- case 16: DoScriptText(SAY_ANSWER, me); break;
- case 17: DoScriptText(SAY_MOVE_QUINN, me); break;
- case 24: DoScriptText(SAY_GREETINGS, me); break;
- case 25: {
- Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20);
- if (Quinn)
+ break;
+
+ case 16:
+ DoScriptText(SAY_ANSWER, me);
+ break;
+
+ case 17:
+ DoScriptText(SAY_MOVE_QUINN, me);
+ break;
+
+ case 24:
+ DoScriptText(SAY_GREETINGS, me);
+ break;
+
+ case 25:
+ if (Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20))
DoScriptText(SAY_QUINN, Quinn);
- break;}
- case 26: DoScriptText(SAY_ON_BYE, me, NULL); break;
+ break;
+
+ case 26:
+ DoScriptText(SAY_ON_BYE, me, NULL);
+ break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
index f36f5b5950e..94b5b070992 100644
--- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
@@ -85,6 +85,7 @@ public:
{
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
+
if (creature->isVendor())
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
@@ -95,7 +96,8 @@ public:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
player->SEND_GOSSIP_MENU(3985, creature->GetGUID());
- }else
+ }
+ else
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
@@ -378,8 +380,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- Player* player = GetPlayerForEscort();
- if (player)
+ if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_TOMB_LIGHTBRINGER);
}
diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp
index 2285d3877e4..c8d2afc3375 100644
--- a/src/server/scripts/EasternKingdoms/westfall.cpp
+++ b/src/server/scripts/EasternKingdoms/westfall.cpp
@@ -243,13 +243,11 @@ public:
break;
case 44:
DoScriptText(SAY_END, me, player);
- {
- if (player)
- player->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD, me);
- }
+ player->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD, me);
break;
}
}
+
void EnterCombat(Unit* who)
{
DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me, who);
diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp
index e22c2f85506..76c4f793a42 100644
--- a/src/server/scripts/Examples/example_escort.cpp
+++ b/src/server/scripts/Examples/example_escort.cpp
@@ -123,9 +123,7 @@ class example_escort : public CreatureScript
{
// not a likely case, code here for the sake of example
if (killer == me)
- {
DoScriptText(SAY_DEATH_1, me, player);
- }
else
DoScriptText(SAY_DEATH_2, me, player);
}
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index 8cef144f4c5..b84ecea4de3 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -52,7 +52,7 @@ class npc_henry_stern : public CreatureScript
public:
npc_henry_stern() : CreatureScript("npc_henry_stern") { }
- bool OnGossipSelect (Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
@@ -70,7 +70,7 @@ public:
return true;
}
- bool OnGossipHello (Player* player, Creature* creature)
+ bool OnGossipHello(Player* player, Creature* creature)
{
if (player->GetBaseSkillValue(SKILL_COOKING) >= 175 && !player->HasSpell(SPELL_GOLDTHORN_TEA))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
@@ -81,7 +81,6 @@ public:
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
-
};
/*######
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 747a2f2880f..789e7096433 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -115,7 +115,7 @@ public:
case 45:
DoScriptText(SAY_WIN, me, player);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- if (player && player->GetTypeId() == TYPEID_PLAYER)
+ if (player->GetTypeId() == TYPEID_PLAYER)
CAST_PLR(player)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER, me);
break;
case 46:
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 91d90ffe202..538a38f4a3b 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -399,9 +399,9 @@ public:
enum
{
- ZOMBIE = 7286,
- DEAD_HERO = 7276,
- ZOMBIE_CHANCE = 65,
+ ZOMBIE = 7286,
+ DEAD_HERO = 7276,
+ ZOMBIE_CHANCE = 65,
DEAD_HERO_CHANCE = 10
};
@@ -419,13 +419,12 @@ public:
if (randomchance < ZOMBIE_CHANCE)
go->SummonCreature(ZOMBIE, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
else
- if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
+ if ((randomchance - ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
go->SummonCreature(DEAD_HERO, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
}
go->AddUse();
return false;
}
-
};
/*######
diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp
index 9d0423181de..08b9778cf49 100644
--- a/src/server/scripts/Kalimdor/ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/ashenvale.cpp
@@ -100,8 +100,7 @@ class npc_torek : public CreatureScript
case 20:
DoScriptText(SAY_WIN, me, player);
Completed = true;
- if (player)
- player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
+ player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
break;
case 21:
Talk(SAY_END, player->GetGUID());
@@ -177,47 +176,41 @@ class npc_torek : public CreatureScript
class npc_ruul_snowhoof : public CreatureScript
{
public:
-
- npc_ruul_snowhoof()
- : CreatureScript("npc_ruul_snowhoof")
- {
- }
+ npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
struct npc_ruul_snowhoofAI : public npc_escortAI
{
- npc_ruul_snowhoofAI(Creature* creature) : npc_escortAI(creature) {}
+ npc_ruul_snowhoofAI(Creature* creature) : npc_escortAI(creature) { }
void WaypointReached(uint32 i)
{
Player* player = GetPlayerForEscort();
-
if (!player)
return;
switch (i)
{
- case 0: {
+ case 0:
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
- GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20);
- if (Cage)
+ if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_ACTIVE);
- break;}
- case 13:
+ break;
+
+ case 13:
me->SummonCreature(3922, 3449.218018f, -587.825073f, 174.978867f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3921, 3446.384521f, -587.830872f, 175.186279f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3926, 3444.218994f, -587.835327f, 175.380600f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
- case 19:
+
+ case 19:
me->SummonCreature(3922, 3508.344482f, -492.024261f, 186.929031f, 4.145029f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3921, 3506.265625f, -490.531006f, 186.740128f, 4.239277f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3926, 3503.682373f, -489.393799f, 186.629684f, 4.349232f, TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
- case 21:{
- if (player)
- player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me);
-
- break; }
+ case 21:
+ player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me);
+ break;
}
}
@@ -330,12 +323,10 @@ class npc_muglash : public CreatureScript
switch (i)
{
case 0:
- if (player)
- DoScriptText(SAY_MUG_START2, me, player);
+ DoScriptText(SAY_MUG_START2, me, player);
break;
case 24:
- if (player)
- DoScriptText(SAY_MUG_BRAZIER, me, player);
+ DoScriptText(SAY_MUG_BRAZIER, me, player);
if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2))
{
@@ -345,9 +336,7 @@ class npc_muglash : public CreatureScript
break;
case 25:
DoScriptText(SAY_MUG_GRATITUDE, me);
-
- if (player)
- player->GroupEventHappens(QUEST_VORSHA, me);
+ player->GroupEventHappens(QUEST_VORSHA, me);
break;
case 26:
DoScriptText(SAY_MUG_PATROL, me);
@@ -378,14 +367,9 @@ class npc_muglash : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- Player* player = GetPlayerForEscort();
if (HasEscortState(STATE_ESCORT_ESCORTING))
- {
- if (player)
- {
+ if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_VORSHA);
- }
- }
}
void DoWaveSummon()
diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
index fd86a08f06a..258e4d259fc 100644
--- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
@@ -602,7 +602,7 @@ public:
ravager->AI()->AttackStart(player);
}
}
- return true ;
+ return true;
}
};
diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp
index 49a9be21a98..fa337a9cf3c 100644
--- a/src/server/scripts/Kalimdor/desolace.cpp
+++ b/src/server/scripts/Kalimdor/desolace.cpp
@@ -238,7 +238,7 @@ public:
break;
case 15:
if (player)
- player->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me);
+ player->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me);
break;
}
}
@@ -249,8 +249,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- Player* player = GetPlayerForEscort();
- if (player)
+ if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_RETURN_TO_VAHLARRIEL);
return;
}
diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
index 94702a85d64..04c4d2922f1 100644
--- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
@@ -641,9 +641,9 @@ public:
DoScriptText(SAY_QUEST_COMPLETE, me, player);
me->SetSpeed(MOVE_RUN, 1.2f, true);
me->SetWalk(false);
- if (player && player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H))
+ if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H))
player->GroupEventHappens(QUEST_STINKYS_ESCAPE_H, me);
- if (player && player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A))
+ if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A))
player->GroupEventHappens(QUEST_STINKYS_ESCAPE_A, me);
break;
case 39:
@@ -663,10 +663,11 @@ public:
void JustDied(Unit* /*killer*/)
{
Player* player = GetPlayerForEscort();
- if (HasEscortState(STATE_ESCORT_ESCORTING) && player)
+ if (player && HasEscortState(STATE_ESCORT_ESCORTING))
{
if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H))
player->FailQuest(QUEST_STINKYS_ESCAPE_H);
+
if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A))
player->FailQuest(QUEST_STINKYS_ESCAPE_A);
}
diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp
index 82e85c16564..01193b66e30 100644
--- a/src/server/scripts/Kalimdor/feralas.cpp
+++ b/src/server/scripts/Kalimdor/feralas.cpp
@@ -154,9 +154,7 @@ public:
DoScriptText(SAY_OOX_END, me);
// Award quest credit
if (Player* player = GetPlayerForEscort())
- {
- player->GroupEventHappens(QUEST_RESCUE_OOX22FE, me);
- }
+ player->GroupEventHappens(QUEST_RESCUE_OOX22FE, me);
break;
}
}
diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
index 0141564a140..e887f076e29 100644
--- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
+++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
@@ -123,17 +123,18 @@ public:
switch (i)
{
- case 16:
- DoScriptText(SAY_AMBUSH, me);
- me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53f, -503.34f, -46.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85f, -503.77f, -45.90f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37f, -496.23f, -45.71f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- break;
- case 18: me->SetInFront(player);
- DoScriptText(SAY_END, me, player);
- if (player)
+ case 16:
+ DoScriptText(SAY_AMBUSH, me);
+ me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53f, -503.34f, -46.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85f, -503.77f, -45.90f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37f, -496.23f, -45.71f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ break;
+
+ case 18:
+ me->SetInFront(player);
+ DoScriptText(SAY_END, me, player);
player->GroupEventHappens(QUEST_PROTECT_KAYA, me);
- break;
+ break;
}
}
diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp
index c1a5d9de10e..204668b086d 100644
--- a/src/server/scripts/Kalimdor/tanaris.cpp
+++ b/src/server/scripts/Kalimdor/tanaris.cpp
@@ -435,7 +435,8 @@ public:
if (!player)
return;
- switch (i) {
+ switch (i)
+ {
case 23:
me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
@@ -453,11 +454,8 @@ public:
break;
case 86:
- if (player)
- {
- DoScriptText(SAY_OOX_END, me);
- player->GroupEventHappens(Q_OOX17, me);
- }
+ DoScriptText(SAY_OOX_END, me);
+ player->GroupEventHappens(Q_OOX17, me);
break;
}
}
@@ -474,7 +472,6 @@ public:
summoned->AI()->AttackStart(me);
}
};
-
};
/*####
diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp
index 89f1ac3e7a5..27f3f1fd52b 100644
--- a/src/server/scripts/Kalimdor/the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/the_barrens.cpp
@@ -595,11 +595,6 @@ public:
void WaypointReached(uint32 uiPointId)
{
- Player* player = GetPlayerForEscort();
-
- if (!player)
- return;
-
switch (uiPointId)
{
case 0:
diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp
index c6824447e1b..4c7c717c7e2 100644
--- a/src/server/scripts/Kalimdor/thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/thousand_needles.cpp
@@ -277,7 +277,6 @@ public:
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
}
};
-
};
/*#####
@@ -316,6 +315,7 @@ public:
{
if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+
player->SEND_GOSSIP_MENU(738, creature->GetGUID());
return true;
@@ -410,7 +410,6 @@ public:
bool OnGossipHello(Player* player, GameObject* go)
{
-
if (player->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE)
{
if (Creature* panther = go->FindNearestCreature(ENRAGED_PANTHER, 5, true))
@@ -421,7 +420,7 @@ public:
}
}
- return true ;
+ return true;
}
};
diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp
index fc720f04ad1..2ca932de169 100644
--- a/src/server/scripts/Kalimdor/ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp
@@ -104,8 +104,7 @@ public:
break;
case 55:
DoScriptText(SAY_FINISH, me, player);
- if (player)
- player->GroupEventHappens(QUEST_CHASING_AME, me);
+ player->GroupEventHappens(QUEST_CHASING_AME, me);
break;
}
}
diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp
index 3547b09a34b..ab5e4c4023a 100644
--- a/src/server/scripts/Kalimdor/winterspring.cpp
+++ b/src/server/scripts/Kalimdor/winterspring.cpp
@@ -161,12 +161,12 @@ public:
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(3377, creature->GetGUID());
- }else
+ }
+ else
player->SEND_GOSSIP_MENU(3375, creature->GetGUID());
return true;
}
-
};
void AddSC_winterspring()
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index 79a102c803f..ca71d8c313e 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -267,7 +267,7 @@ public:
}
} else DatterTimer -= diff;
- if(me->HasAura(SPELL_LEECHING_SWARM))
+ if (me->HasAura(SPELL_LEECHING_SWARM))
me->RemoveAurasDueToSpell(SPELL_LEECHING_SWARM);
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index 03de3d374ef..1966e26b128 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -105,7 +105,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
bool IsEncounterInProgress() const
{
- for (uint8 i = 0; i < MAX_ENCOUNTERS ; ++i)
+ for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
if (EncounterStatus[i] == IN_PROGRESS)
return true;
return false;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 1a51f424dc8..93f4b58120f 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -457,7 +457,7 @@ public:
{
if (HealthBelowPct(45))
{
- Phase = 3 ;
+ Phase = 3;
DoScriptText(SAY_REQUEST_AID, me);
//here Lich King should respond to KelThuzad but I don't know which Creature to make talk
//so for now just make Kelthuzad says it.
diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
index c05d9a21850..50eb52cc4c2 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -465,7 +465,6 @@ public:
playerDied = buff2;
}
};
-
};
void AddSC_instance_naxxramas()
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index 357b0bad13c..b96d7c4aa84 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -203,7 +203,7 @@ public:
if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2)
return;
- for (uint8 i = 0; i < 4 ; i++)
+ for (uint8 i = 0; i < 4; i++)
{
SetPosition(i);
me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation());
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index 7ebaac1e938..19a84fdae84 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -308,7 +308,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
- for (std::list<Unit*>::iterator itr = targetList.begin() ; itr != targetList.end();)
+ for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
{
Position pos;
(*itr)->GetPosition(&pos);
@@ -355,7 +355,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
- for (std::list<Unit*>::iterator itr = targetList.begin() ; itr != targetList.end();)
+ for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
{
Position pos;
(*itr)->GetPosition(&pos);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index 1bc5563acfa..5f4f8dfde9d 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -1685,7 +1685,7 @@ class spell_pursue : public SpellScriptLoader
void FilterTargetsSubsequently(std::list<Unit*>& targets)
{
targets.clear();
- if(_target)
+ if (_target)
targets.push_back(_target);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index 50417b0ac07..95d2cb1709e 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -48,65 +48,77 @@ public:
void Reset()
{
- if (fm_Type == 0) fm_Type = GetForgeMasterType();
+ if (fm_Type == 0)
+ fm_Type = GetForgeMasterType();
+
CheckForge();
}
void CheckForge()
{
- if (instance)
+ if (instance)
{
switch (fm_Type)
{
- case 1:
- instance->SetData(EVENT_FORGE_1, me->isAlive() ? NOT_STARTED : DONE);
- break;
- case 2:
- instance->SetData(EVENT_FORGE_2, me->isAlive() ? NOT_STARTED : DONE);
- break;
- case 3:
- instance->SetData(EVENT_FORGE_3, me->isAlive() ? NOT_STARTED : DONE);
- break;
+ case 1:
+ instance->SetData(EVENT_FORGE_1, me->isAlive() ? NOT_STARTED : DONE);
+ break;
+
+ case 2:
+ instance->SetData(EVENT_FORGE_2, me->isAlive() ? NOT_STARTED : DONE);
+ break;
+
+ case 3:
+ instance->SetData(EVENT_FORGE_3, me->isAlive() ? NOT_STARTED : DONE);
+ break;
}
}
}
void JustDied(Unit* /*killer*/)
{
- if (fm_Type == 0) fm_Type = GetForgeMasterType();
+ if (fm_Type == 0)
+ fm_Type = GetForgeMasterType();
+
if (instance)
{
switch (fm_Type)
{
- case 1:
- instance->SetData(EVENT_FORGE_1, DONE);
- break;
- case 2:
- instance->SetData(EVENT_FORGE_2, DONE);
- break;
- case 3:
- instance->SetData(EVENT_FORGE_3, DONE);
- break;
+ case 1:
+ instance->SetData(EVENT_FORGE_1, DONE);
+ break;
+
+ case 2:
+ instance->SetData(EVENT_FORGE_2, DONE);
+ break;
+
+ case 3:
+ instance->SetData(EVENT_FORGE_3, DONE);
+ break;
}
}
}
void EnterCombat(Unit* /*who*/)
{
- if (fm_Type == 0) fm_Type = GetForgeMasterType();
+ if (fm_Type == 0)
+ fm_Type = GetForgeMasterType();
+
if (instance)
{
switch (fm_Type)
{
- case 1:
- instance->SetData(EVENT_FORGE_1, IN_PROGRESS);
- break;
- case 2:
- instance->SetData(EVENT_FORGE_2, IN_PROGRESS);
- break;
- case 3:
- instance->SetData(EVENT_FORGE_3, IN_PROGRESS);
- break;
+ case 1:
+ instance->SetData(EVENT_FORGE_1, IN_PROGRESS);
+ break;
+
+ case 2:
+ instance->SetData(EVENT_FORGE_2, IN_PROGRESS);
+ break;
+
+ case 3:
+ instance->SetData(EVENT_FORGE_3, IN_PROGRESS);
+ break;
}
}
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
@@ -115,29 +127,26 @@ public:
uint8 GetForgeMasterType()
{
float diff = 30.0f;
- int near_f = 0;
+ uint8 near_f = 0;
- for (uint8 i = 0; i < 3 ; ++i)
+ for (uint8 i = 0; i < 3; ++i)
{
- GameObject* temp;
- temp = me->FindNearestGameObject(entry_search[i], 30);
- if (temp)
+ if (GameObject* go = me->FindNearestGameObject(entry_search[i], 30))
{
- if (me->IsWithinDist(temp, diff, false))
+ if (me->IsWithinDist(go, diff, false))
{
near_f = i + 1;
- diff = me->GetDistance2d(temp);
-
+ diff = me->GetDistance2d(go);
}
}
}
switch (near_f)
{
- case 1: return 1;
- case 2: return 2;
- case 3: return 3;
- default: return 0;
+ case 1: return 1;
+ case 2: return 2;
+ case 3: return 3;
+ default: return 0;
}
}
@@ -152,7 +161,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_utgarde_keep()
diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
index df33ffff01a..37ef8bf2788 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
@@ -168,7 +168,7 @@ class achievement_defenseless : public AchievementCriteriaScript
bool OnCheck(Player* /*player*/, Unit* target)
{
- if(!target)
+ if (!target)
return false;
InstanceScript* instance = target->GetInstanceScript();
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp
index 6b6a58f7b38..6c1b5ca36d2 100644
--- a/src/server/scripts/Northrend/borean_tundra.cpp
+++ b/src/server/scripts/Northrend/borean_tundra.cpp
@@ -1876,8 +1876,7 @@ public:
me->SetPhaseMask(1, true);
DoScriptText(SAY_5, me);
me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
- if (player)
- player->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me);
+ player->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me);
SetRun(true);
break;
}
diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp
index bf130bc0355..07fb398ff8a 100644
--- a/src/server/scripts/Northrend/grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/grizzly_hills.cpp
@@ -79,6 +79,7 @@ public:
Player* player = GetPlayerForEscort();
if (!player)
return;
+
switch (i)
{
case 9:
diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp
index 49bf06f55c4..86fc4a50b6c 100644
--- a/src/server/scripts/Northrend/howling_fjord.cpp
+++ b/src/server/scripts/Northrend/howling_fjord.cpp
@@ -102,6 +102,7 @@ public:
Player* player = GetPlayerForEscort();
if (!player)
return;
+
switch (i)
{
case 1:
@@ -109,8 +110,7 @@ public:
SetRun(true);
break;
case 23:
- if (player)
- player->GroupEventHappens(QUEST_TRAIL_OF_FIRE, me);
+ player->GroupEventHappens(QUEST_TRAIL_OF_FIRE, me);
me->DespawnOrUnsummon();
break;
case 5:
diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp
index 1f00ca51d0b..afc742c9f7e 100644
--- a/src/server/scripts/Northrend/sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/sholazar_basin.cpp
@@ -113,8 +113,8 @@ public:
if (Player* player = GetPlayerForEscort())
{
- if (player->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE)
- player->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS);
+ if (player->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE)
+ player->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS);
}
}
};
@@ -401,12 +401,12 @@ public:
{
m_uiChatTimer = 4000;
}
+
void JustDied(Unit* /*killer*/)
{
- Player* player = GetPlayerForEscort();
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
- if (player)
+ if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_DISASTER);
}
}
diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp
index 8e7d66a33c1..8253e2615cf 100644
--- a/src/server/scripts/Northrend/storm_peaks.cpp
+++ b/src/server/scripts/Northrend/storm_peaks.cpp
@@ -377,15 +377,18 @@ public:
void WaypointReached(uint32 i)
{
Player* player = GetPlayerForEscort();
+ if (!player)
+ return;
+
switch (i)
{
- case 26:
- DoScriptText(SAY_END_WP_REACHED, me, player);
- break;
- case 27:
- if (player)
+ case 26:
+ DoScriptText(SAY_END_WP_REACHED, me, player);
+ break;
+
+ case 27:
player->GroupEventHappens(QUEST_BITTER_DEPARTURE, me);
- break;
+ break;
}
}
diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp
index 33d295e5970..f0e8ce9b2c1 100644
--- a/src/server/scripts/Northrend/zuldrak.cpp
+++ b/src/server/scripts/Northrend/zuldrak.cpp
@@ -1071,7 +1071,7 @@ public:
SummonList.clear();
- for (uint8 uiI = 0; uiI < 16 ; uiI++)
+ for (uint8 uiI = 0; uiI < 16; uiI++)
{
if (Creature* summon = me->SummonCreature(Boss[uiBossRandom].uiAdd, AddSpawnPosition[uiI]))
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
index 1e80a1b7c99..a6b1d4772b9 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
@@ -236,8 +236,8 @@ class boss_warchief_kargath_bladefist : public CreatureScript
float x, y, randx, randy;
randx = 0.0f + rand()%40;
randy = 0.0f + rand()%40;
- x = 210+ randx ;
- y = -60- randy ;
+ x = 210+ randx;
+ y = -60- randy;
me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ());
Wait_Timer = 0;
}
diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp
index a89d06072a7..50cc1a00e47 100644
--- a/src/server/scripts/Outland/nagrand.cpp
+++ b/src/server/scripts/Outland/nagrand.cpp
@@ -90,7 +90,6 @@ public:
player->AreaExploredOrEventHappens(10044);
player->CLOSE_GOSSIP_MENU();
break;
-
case GOSSIP_ACTION_INFO_DEF + 10:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
@@ -135,12 +134,10 @@ public:
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
}
else
-
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
-
};
/*#####
@@ -235,7 +232,6 @@ public:
DoScriptText(SAY_MAG_MORE_REPLY, temp);
me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
-
me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
@@ -311,7 +307,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
/*######
@@ -356,7 +351,6 @@ public:
}
}
};
-
};
/*######
@@ -401,6 +395,7 @@ public:
player->KilledMonsterCredit(NPC_CORKI_CREDIT_1, 0);
}
}
+
if (go->GetEntry() == GO_CORKIS_PRISON_2)
{
if (Creature* corki = go->FindNearestCreature(NPC_CORKI_2, 25, true))
@@ -411,6 +406,7 @@ public:
player->KilledMonsterCredit(NPC_CORKI_2, 0);
}
}
+
if (go->GetEntry() == GO_CORKIS_PRISON_3)
{
if (Creature* corki = go->FindNearestCreature(NPC_CORKI_3, 25, true))
@@ -689,15 +685,11 @@ class go_warmaul_prison : public GameObjectScript
if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f))
{
- if (prisoner)
- {
- go->UseDoorOrButton();
- if (player)
- player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
+ go->UseDoorOrButton();
+ player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
- prisoner->AI()->Talk(SAY_FREE, player->GetGUID());
- prisoner->ForcedDespawn(6000);
- }
+ prisoner->AI()->Talk(SAY_FREE, player->GetGUID());
+ prisoner->ForcedDespawn(6000);
}
return true;
}
diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp
index 5bd6ff795eb..dc401ac3c7a 100644
--- a/src/server/scripts/Outland/netherstorm.cpp
+++ b/src/server/scripts/Outland/netherstorm.cpp
@@ -910,8 +910,7 @@ public:
break;
case 12:
- if (player)
- player->GroupEventHappens(Q_ALMABTRIEB, me);
+ player->GroupEventHappens(Q_ALMABTRIEB, me);
if (me->FindNearestCreature(N_THADELL, 30))
DoScriptText(SAY_THADELL_1, me); break;
case 13:
@@ -986,16 +985,14 @@ public:
}
break;
case 36: //return and quest_complete
- if (player)
- player->CompleteQuest(QUEST_MARK_V_IS_ALIVE);
+ player->CompleteQuest(QUEST_MARK_V_IS_ALIVE);
break;
}
}
void JustDied(Unit* /*killer*/)
{
- Player* player = GetPlayerForEscort();
- if (player)
+ if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_MARK_V_IS_ALIVE);
}
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 96b1247c152..059373c6589 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -1108,7 +1108,6 @@ public:
break;
case 50:
DoScriptText(SAY_WIL_END, me, player);
-
player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me);
break;
}
diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp
index f5d725364c0..639c0c25cf4 100644
--- a/src/server/scripts/Outland/shattrath_city.cpp
+++ b/src/server/scripts/Outland/shattrath_city.cpp
@@ -349,9 +349,9 @@ public:
case 53: DoScriptText(WHISP18, me, player); break;
case 54: DoScriptText(WHISP19, me, player); break;
case 55: DoScriptText(WHISP20, me, player); break;
- case 56: DoScriptText(WHISP21, me, player);
- if (player)
- player->GroupEventHappens(10211, me);
+ case 56:
+ DoScriptText(WHISP21, me, player);
+ player->GroupEventHappens(10211, me);
break;
}
}
diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp
index 67852e9be84..87cbf095848 100644
--- a/src/server/scripts/Outland/terokkar_forest.cpp
+++ b/src/server/scripts/Outland/terokkar_forest.cpp
@@ -470,29 +470,40 @@ public:
switch (i)
{
- case 0:
- {
- GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10);
- if (Cage)
- Cage->SetGoState(GO_STATE_ACTIVE);
- }
- break;
- case 2: DoScriptText(SAY_PROGRESS_1, me, player); break;
- case 5: DoScriptText(SAY_PROGRESS_2, me, player); break;
- case 6: DoScriptText(SAY_PROGRESS_3, me, player); break;
- case 29:DoScriptText(SAY_PROGRESS_4, me, player);
- if (player)
- {
+ case 0:
+ if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10))
+ Cage->SetGoState(GO_STATE_ACTIVE);
+ break;
+
+ case 2:
+ DoScriptText(SAY_PROGRESS_1, me, player);
+ break;
+
+ case 5:
+ DoScriptText(SAY_PROGRESS_2, me, player);
+ break;
+
+ case 6:
+ DoScriptText(SAY_PROGRESS_3, me, player);
+ break;
+
+ case 29:
+ DoScriptText(SAY_PROGRESS_4, me, player);
if (player->GetTeam() == ALLIANCE)
player->GroupEventHappens(QUEST_EFTW_A, me);
else if (player->GetTeam() == HORDE)
player->GroupEventHappens(QUEST_EFTW_H, me);
- }
- me->SetInFront(player); break;
- case 30: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
- case 31: DoCast(me, SPELL_CAT);
- me->SetWalk(false);
- break;
+ me->SetInFront(player);
+ break;
+
+ case 30:
+ me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);
+ break;
+
+ case 31:
+ DoCast(me, SPELL_CAT);
+ me->SetWalk(false);
+ break;
}
}
@@ -676,7 +687,7 @@ public:
me->SummonCreature(NPC_CABAL_SKRIMISHER, -2793.55f, 5412.79f, -34.53f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 11:
- if (player && player->GetTypeId() == TYPEID_PLAYER)
+ if (player->GetTypeId() == TYPEID_PLAYER)
player->GroupEventHappens(QUEST_ESCAPING_THE_TOMB, me);
break;
}
diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp
index 296c95dcbd7..7557de9ca36 100644
--- a/src/server/scripts/Outland/zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zangarmarsh.cpp
@@ -56,6 +56,7 @@ public:
{
if (creature->GetEntry() == 17900)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+
if (creature->GetEntry() == 17901)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
}
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index ddbdf6db36e..5d874faf411 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -337,7 +337,7 @@ class spell_dk_death_pact : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& unitList)
{
Unit* unit_to_add = NULL;
- for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end(); ++itr)
+ for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
if ((*itr)->GetTypeId() == TYPEID_UNIT
&& (*itr)->GetOwnerGUID() == GetCaster()->GetGUID()
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index f2f2f9e3cdd..666477e68e7 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -1589,15 +1589,15 @@ class spell_item_brewfest_mount_transformation : public SpellScriptLoader
{
case SPELL_BREWFEST_MOUNT_TRANSFORM:
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
- spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ;
+ spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
else
- spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ;
+ spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
break;
case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE:
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
- spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ;
+ spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
else
- spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ;
+ spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
break;
default:
return;
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index b012fe5f183..d2bba2b8bc3 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -185,6 +185,11 @@ class spell_pri_penance : public SpellScriptLoader
{
PrepareSpellScript(spell_pri_penance_SpellScript);
+ bool Load()
+ {
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
bool Validate(SpellInfo const* spellEntry)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_PENANCE_R1))
@@ -207,7 +212,7 @@ class spell_pri_penance : public SpellScriptLoader
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
{
- if(!unitTarget->isAlive())
+ if (!unitTarget->isAlive())
return;
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
@@ -219,10 +224,21 @@ class spell_pri_penance : public SpellScriptLoader
}
}
+ SpellCastResult CheckCast()
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ if (GetTargetUnit())
+ if (Player* target = GetTargetUnit()->ToPlayer())
+ if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target))
+ return SPELL_FAILED_BAD_TARGETS;
+ return SPELL_CAST_OK;
+ }
+
void Register()
{
// add dummy effect spell handler to Penance
OnEffectHitTarget += SpellEffectFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnCheckCast += SpellCheckCastFn(spell_pri_penance_SpellScript::CheckCast);
}
};
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index a844e500ce5..045dea9c9a9 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -371,7 +371,7 @@ class boss_ysondre : public CreatureScript
{
Talk(SAY_YSONDRE_SUMMON_DRUIDS);
- for (uint8 i = 0 ; i < 10 ; ++i)
+ for (uint8 i = 0; i < 10; ++i)
DoCast(me, SPELL_SUMMON_DRUID_SPIRITS, true);
++_stage;
}
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index aef952fab55..5fe31006bb2 100755
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -33,17 +33,11 @@
class PingOperation : public SQLOperation
{
- /// Operation for idle delaythreads
+ //! Operation for idle delaythreads
bool Execute()
{
- if (m_conn->LockIfReady())
- {
- m_conn->Ping();
- m_conn->Unlock();
- return true;
- }
-
- return false;
+ m_conn->Ping();
+ return true;
}
};
@@ -53,10 +47,10 @@ class DatabaseWorkerPool
public:
/* Activity state */
DatabaseWorkerPool() :
- m_queue(new ACE_Activation_Queue())
+ _queue(new ACE_Activation_Queue())
{
- memset(m_connectionCount, 0, sizeof(m_connectionCount));
- m_connections.resize(IDX_SIZE);
+ memset(_connectionCount, 0, sizeof(_connectionCount));
+ _connections.resize(IDX_SIZE);
WPFatal (mysql_thread_safe(), "Used MySQL library isn't thread-safe.");
}
@@ -68,66 +62,72 @@ class DatabaseWorkerPool
bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads)
{
bool res = true;
- m_connectionInfo = MySQLConnectionInfo(infoString);
+ _connectionInfo = MySQLConnectionInfo(infoString);
- sLog->outSQLDriver("Opening databasepool '%s'. Async threads: %u, synch threads: %u", m_connectionInfo.database.c_str(), async_threads, synch_threads);
+ sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
+ GetDatabaseName(), async_threads, synch_threads);
- /// Open asynchronous connections (delayed operations)
- m_connections[IDX_ASYNC].resize(async_threads);
+ //! Open asynchronous connections (delayed operations)
+ _connections[IDX_ASYNC].resize(async_threads);
for (uint8 i = 0; i < async_threads; ++i)
{
- T* t = new T(m_queue, m_connectionInfo);
+ T* t = new T(_queue, _connectionInfo);
res &= t->Open();
- m_connections[IDX_ASYNC][i] = t;
- ++m_connectionCount[IDX_ASYNC];
+ _connections[IDX_ASYNC][i] = t;
+ ++_connectionCount[IDX_ASYNC];
}
- /// Open synchronous connections (direct, blocking operations)
- m_connections[IDX_SYNCH].resize(synch_threads);
+ //! Open synchronous connections (direct, blocking operations)
+ _connections[IDX_SYNCH].resize(synch_threads);
for (uint8 i = 0; i < synch_threads; ++i)
{
- T* t = new T(m_connectionInfo);
+ T* t = new T(_connectionInfo);
res &= t->Open();
- m_connections[IDX_SYNCH][i] = t;
- ++m_connectionCount[IDX_SYNCH];
+ _connections[IDX_SYNCH][i] = t;
+ ++_connectionCount[IDX_SYNCH];
}
- sLog->outSQLDriver("Databasepool opened successfully. %u total connections running.", (m_connectionCount[IDX_SYNCH] + m_connectionCount[IDX_ASYNC]));
+ if (res)
+ sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
+ (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
+ else
+ sLog->outError("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
+ "for specific errors.", GetDatabaseName());
return res;
}
void Close()
{
- sLog->outSQLDriver("Closing down databasepool '%s'.", m_connectionInfo.database.c_str());
+ sLog->outSQLDriver("Closing down DatabasePool '%s'.", GetDatabaseName());
- /// Shuts down delaythreads for this connection pool by underlying deactivate()
- m_queue->queue()->close();
+ //! Shuts down delaythreads for this connection pool by underlying deactivate().
+ //! The next dequeue attempt in the worker thread tasks will result in an error,
+ //! ultimately ending the worker thread task.
+ _queue->queue()->close();
- for (uint8 i = 0; i < m_connectionCount[IDX_ASYNC]; ++i)
+ for (uint8 i = 0; i < _connectionCount[IDX_ASYNC]; ++i)
{
- /// TODO: Better way. probably should flip a boolean and check it on low level code before doing anything on the mysql ctx
- /// Now we just wait until m_queue gives the signal to the worker threads to stop
- T* t = m_connections[IDX_ASYNC][i];
+ T* t = _connections[IDX_ASYNC][i];
DatabaseWorker* worker = t->m_worker;
- worker->wait();
+ worker->wait(); //! Block until no more threads are running this task.
delete worker;
- t->Close();
+ t->Close(); //! Closes the actualy MySQL connection.
}
- sLog->outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str());
+ sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
+ GetDatabaseName());
- /// Shut down the synchronous connections
- for (uint8 i = 0; i < m_connectionCount[IDX_SYNCH]; ++i)
- {
- T* t = m_connections[IDX_SYNCH][i];
- //while (1)
- // if (t->LockIfReady()) -- For some reason deadlocks us
- t->Close();
- }
+ //! Shut down the synchronous connections
+ //! There's no need for locking the connection, because DatabaseWorkerPool<>::Close
+ //! should only be called after any other thread tasks in the core have exited,
+ //! meaning there can be no concurrent access at this point.
+ for (uint8 i = 0; i < _connectionCount[IDX_SYNCH]; ++i)
+ _connections[IDX_SYNCH][i]->Close();
- delete m_queue;
+ //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue
+ delete _queue;
- sLog->outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str());
+ sLog->outSQLDriver("All connections on DatabasePool '%s' closed.", GetDatabaseName());
}
/**
@@ -344,20 +344,22 @@ class DatabaseWorkerPool
//! were appended to the transaction will be respected during execution.
void CommitTransaction(SQLTransaction transaction)
{
- if (sLog->GetSQLDriverQueryLogging())
+ #ifdef TRINITY_DEBUG
+ //! Only analyze transaction weaknesses in Debug mode.
+ //! Ideally we catch the faults in Debug mode and then correct them,
+ //! so there's no need to waste these CPU cycles in Release mode.
+ switch (transaction->GetSize())
{
- switch (transaction->GetSize())
- {
- case 0:
- sLog->outSQLDriver("Transaction contains 0 queries. Not executing.");
- return;
- case 1:
- sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
- break;
- default:
- break;
- }
+ case 0:
+ sLog->outSQLDriver("Transaction contains 0 queries. Not executing.");
+ return;
+ case 1:
+ sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
+ break;
+ default:
+ break;
}
+ #endif // TRINITY_DEBUG
Enqueue(new TransactionTask(transaction));
}
@@ -373,9 +375,11 @@ class DatabaseWorkerPool
return;
}
+ //! Handle MySQL Errno 1213 without extending deadlock to the core itself
+ //! TODO: More elegant way
if (con->GetLastError() == 1213)
{
- uint8 loopBreaker = 5; // Handle MySQL Errno 1213 without extending deadlock to the core itself
+ uint8 loopBreaker = 5;
for (uint8 i = 0; i < loopBreaker; ++i)
{
if (con->ExecuteTransaction(transaction))
@@ -383,7 +387,7 @@ class DatabaseWorkerPool
}
}
- // Clean up now.
+ //! Clean up now.
transaction->Cleanup();
con->Unlock();
@@ -414,6 +418,7 @@ class DatabaseWorkerPool
*/
//! Automanaged (internally) pointer to a prepared statement object for usage in upper level code.
+ //! Pointer is deleted in this->Query(PreparedStatement*) or PreparedStatementTask::~PreparedStatementTask.
//! This object is not tied to the prepared statement on the MySQL context yet until execution.
PreparedStatement* GetPreparedStatement(uint32 index)
{
@@ -435,10 +440,10 @@ class DatabaseWorkerPool
//! Keeps all our MySQL connections alive, prevent the server from disconnecting us.
void KeepAlive()
{
- /// Ping synchronous connections
- for (uint8 i = 0; i < m_connectionCount[IDX_SYNCH]; ++i)
+ //! Ping synchronous connections
+ for (uint8 i = 0; i < _connectionCount[IDX_SYNCH]; ++i)
{
- T* t = m_connections[IDX_SYNCH][i];
+ T* t = _connections[IDX_SYNCH][i];
if (t->LockIfReady())
{
t->Ping();
@@ -446,10 +451,10 @@ class DatabaseWorkerPool
}
}
- /// Assuming all worker threads are free, every worker thread will receive 1 ping operation request
- /// If one or more worker threads are busy, the ping operations will not be split evenly, but this doesn't matter
- /// as the sole purpose is to prevent connections from idling.
- for (size_t i = 0; i < m_connections[IDX_ASYNC].size(); ++i)
+ //! Assuming all worker threads are free, every worker thread will receive 1 ping operation request
+ //! If one or more worker threads are busy, the ping operations will not be split evenly, but this doesn't matter
+ //! as the sole purpose is to prevent connections from idling.
+ for (size_t i = 0; i < _connections[IDX_ASYNC].size(); ++i)
Enqueue(new PingOperation);
}
@@ -459,41 +464,50 @@ class DatabaseWorkerPool
if (!to || !from || !length)
return 0;
- return mysql_real_escape_string(m_connections[IDX_SYNCH][0]->GetHandle(), to, from, length);
+ return mysql_real_escape_string(_connections[IDX_SYNCH][0]->GetHandle(), to, from, length);
}
void Enqueue(SQLOperation* op)
{
- m_queue->enqueue(op);
+ _queue->enqueue(op);
}
+ //! Gets a free connection in the synchronous connection pool.
+ //! Caller MUST call t->Unlock() after touching the MySQL context to prevent deadlocks.
T* GetFreeConnection()
{
uint8 i = 0;
- size_t num_cons = m_connectionCount[IDX_SYNCH];
- for (;;) /// Block forever until a connection is free
+ size_t num_cons = _connectionCount[IDX_SYNCH];
+ //! Block forever until a connection is free
+ for (;;)
{
- T* t = m_connections[IDX_SYNCH][++i % num_cons ];
- if (t->LockIfReady()) /// Must be matched with t->Unlock() or you will get deadlocks
+ T* t = _connections[IDX_SYNCH][++i % num_cons];
+ //! Must be matched with t->Unlock() or you will get deadlocks
+ if (t->LockIfReady())
return t;
}
- // This will be called when Celine Dion learns to sing
+ //! This will be called when Celine Dion learns to sing
return NULL;
}
+ char const* GetDatabaseName() const
+ {
+ return _connectionInfo.database.c_str();
+ }
+
private:
- enum
+ enum _internalIndex
{
IDX_ASYNC,
IDX_SYNCH,
IDX_SIZE,
};
- ACE_Activation_Queue* m_queue; //! Queue shared by async worker threads.
- std::vector< std::vector<T*> > m_connections;
- uint32 m_connectionCount[2]; //! Counter of MySQL connections;
- MySQLConnectionInfo m_connectionInfo;
+ ACE_Activation_Queue* _queue; //! Queue shared by async worker threads.
+ std::vector< std::vector<T*> > _connections;
+ uint32 _connectionCount[2]; //! Counter of MySQL connections;
+ MySQLConnectionInfo _connectionInfo;
};
#endif
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 3d30e97544a..9d29aa6f9a9 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -71,7 +71,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges FROM character_aura WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, "
- "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ?", CONNECTION_ASYNC)
+ "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ? AND status <> 0", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS, "SELECT quest, event FROM character_queststatus_seasonal WHERE guid = ?", CONNECTION_ASYNC)
@@ -506,7 +506,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_DEL_CHAR_AURA, "DELETE FROM character_aura WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_GIFT, "DELETE FROM character_gifts WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_INSTANCE, "DELETE FROM character_instance WHERE guid = ?", CONNECTION_ASYNC);
- PREPARE_STATEMENT(CHAR_DEL_CHAR_INVENTORY, "DELETE FROM character_instance WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_CHAR_INVENTORY, "DELETE FROM character_inventory WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED, "DELETE FROM character_queststatus_rewarded WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_REPUTATION, "DELETE FROM character_reputation WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL, "DELETE FROM character_spell WHERE guid = ?", CONNECTION_ASYNC);
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index f686db4c199..7fb4a4f7025 100755
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -58,17 +58,13 @@ MySQLConnection::~MySQLConnection()
{
ASSERT (m_Mysql); /// MySQL context must be present at this point
- sLog->outSQLDriver("MySQLConnection::~MySQLConnection()");
for (size_t i = 0; i < m_stmts.size(); ++i)
delete m_stmts[i];
for (PreparedStatementMap::const_iterator itr = m_queries.begin(); itr != m_queries.end(); ++itr)
- {
free((void *)m_queries[itr->first].first);
- }
mysql_close(m_Mysql);
- Unlock(); /// Unlock while we die, how ironic
}
void MySQLConnection::Close()
diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h
index 2c09cb19c81..e32b16555bc 100755
--- a/src/server/shared/Database/QueryResult.h
+++ b/src/server/shared/Database/QueryResult.h
@@ -58,7 +58,7 @@ class ResultSet
MYSQL_FIELD* _fields;
};
-typedef Trinity::AutoPtr<ResultSet, ACE_Null_Mutex> QueryResult;
+typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;
class PreparedResultSet
{
@@ -103,7 +103,7 @@ class PreparedResultSet
};
-typedef Trinity::AutoPtr<PreparedResultSet, ACE_Null_Mutex> PreparedQueryResult;
+typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult;
#endif
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index a9bb282cf86..0a53706fea2 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -382,7 +382,7 @@ void Log::outDB(LogTypes type, const char * str)
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
stmt->setInt32(0, realm);
- stmt->setInt32(1, type);
+ stmt->setUInt8(1, uint8(type));
stmt->setString(2, logStr);
LoginDatabase.Execute(stmt);
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 35cb62240d8..fb2fdf09583 100755
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -363,7 +363,7 @@ class ByteBuffer
void resize(size_t newsize)
{
- _storage.resize(newsize);
+ _storage.resize(newsize, 0);
_rpos = 0;
_wpos = size();
}
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 52ce74be8f8..7bedf9690ca 100755
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -19,15 +19,10 @@
#include <iostream>
#include "Util.h"
#include "utf8.h"
-#ifdef USE_SFMT_FOR_RNG
#include "SFMT.h"
-#else
-#include "MersenneTwister.h"
-#endif
#include <ace/TSS_T.h>
#include <ace/INET_Addr.h>
-#ifdef USE_SFMT_FOR_RNG
typedef ACE_TSS<SFMTRand> SFMTRandTSS;
static SFMTRandTSS sfmtRand;
@@ -61,41 +56,6 @@ double rand_chance(void)
return sfmtRand->Random() * 100.0;
}
-#else
-typedef ACE_TSS<MTRand> MTRandTSS;
-static MTRandTSS mtRand;
-
-int32 irand(int32 min, int32 max)
-{
- return int32(mtRand->randInt(max - min)) + min;
-}
-
-uint32 urand(uint32 min, uint32 max)
-{
- return mtRand->randInt(max - min) + min;
-}
-
-float frand(float min, float max)
-{
- return float(mtRand->randExc(max - min) + min);
-}
-
-int32 rand32()
-{
- return mtRand->randInt();
-}
-
-double rand_norm(void)
-{
- return mtRand->randExc();
-}
-
-double rand_chance(void)
-{
- return mtRand->randExc(100.0);
-}
-#endif
-
Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
{
m_str = new char[src.length() + 1];
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index f1be4a6889b..03b2859c514 100755
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -137,13 +137,6 @@ int Master::Run()
sLog->outString(" C O R E /\\___/");
sLog->outString("http://TrinityCore.org \\/__/\n");
-#ifdef USE_SFMT_FOR_RNG
- sLog->outString("\n");
- sLog->outString("SFMT has been enabled as the random number generator, if worldserver");
- sLog->outString("freezes or crashes randomly, first, try disabling SFMT in CMAKE configuration");
- sLog->outString("\n");
-#endif //USE_SFMT_FOR_RNG
-
/// worldserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
if (!pidfile.empty())
@@ -277,7 +270,11 @@ int Master::Run()
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION);
- sWorldSocketMgr->Wait();
+
+ // when the main thread closes the singletons get unloaded
+ // since worldrunnable uses them, it will crash if unloaded after master
+ world_thread.wait();
+ rar_thread.wait();
if (soap_thread)
{
@@ -289,11 +286,6 @@ int Master::Run()
// set server offline
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
- // when the main thread closes the singletons get unloaded
- // since worldrunnable uses them, it will crash if unloaded after master
- world_thread.wait();
- rar_thread.wait();
-
///- Clean database before leaving
ClearOnlineAccounts();
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index ab4a8a832b8..5d837100b0e 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -1408,10 +1408,10 @@ AllowTickets = 1
#
# DungeonFinder.Enable
# Description: Dungeon and raid finder system.
-# Default: 0 - (Disabled)
-# 1 - (Enabled, Experimental as of still being in development)
+# Default: 1 - (Enabled)
+# 0 - (Disabled)
-DungeonFinder.Enable = 0
+DungeonFinder.Enable = 1
#
# DBC.EnforceItemAttributes