Conflicts:
	src/server/game/Entities/Player/Player.cpp
This commit is contained in:
megamage
2011-10-07 12:48:20 -04:00
486 changed files with 7564 additions and 2642 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ void UnitAI::DoCast(uint32 spellId)
{
Unit* target = NULL;
//sLog->outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
switch(AISpellInfo[spellId].target)
switch (AISpellInfo[spellId].target)
{
default:
case AITARGET_SELF: target = me; break;
+4 -4
View File
@@ -49,14 +49,14 @@ enum SelectAggroTarget
};
// default predicate function to select target based on distance, player and/or aura criteria
struct DefaultTargetSelector : public std::unary_function<Unit* , bool>
struct DefaultTargetSelector : public std::unary_function<Unit*, bool>
{
const Unit* me;
float m_dist;
bool m_playerOnly;
int32 m_aura;
// pUnit: the reference unit
// unit: the reference unit
// dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit
// playerOnly: self explaining
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
@@ -152,7 +152,7 @@ class UnitAI
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satifying the predicate.
// predicate shall extend std::unary_function<Unit* , bool>
// predicate shall extend std::unary_function<Unit*, bool>
template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
{
const std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
@@ -202,7 +202,7 @@ class UnitAI
void SelectTargetList(std::list<Unit*>& targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satifying the predicate.
// predicate shall extend std::unary_function<Unit* , bool>
// predicate shall extend std::unary_function<Unit*, bool>
template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
{
std::list<HostileReference*> const& threatlist = me->getThreatManager().getThreatList();
+1 -1
View File
@@ -100,7 +100,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
}
/* Causes certain things to never leave the threat list (Priest Lightwell, etc):
for (Unit::ControlList::const_iterator itr = pPlayer->m_Controlled.begin(); itr != pPlayer->m_Controlled.end(); ++itr)
for (Unit::ControlList::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
{
creature->SetInCombatWith(*itr);
(*itr)->SetInCombatWith(creature);
+2 -2
View File
@@ -142,7 +142,7 @@ class CreatureAI : public UnitAI
// Called when creature attack expected (if creature can and no have current victim)
// Note: for reaction at hostile action must be called AttackedBy function.
//virtual void AttackStart(Unit* ) {}
//virtual void AttackStart(Unit*) {}
// Called at World update tick
//virtual void UpdateAI(const uint32 /*diff*/) {}
@@ -150,7 +150,7 @@ class CreatureAI : public UnitAI
/// == State checks =================================
// Is unit visible for MoveInLineOfSight
//virtual bool IsVisible(Unit* ) const { return false; }
//virtual bool IsVisible(Unit*) const { return false; }
// called when the corpse of this creature gets removed
virtual void CorpseRemoved(uint32& /*respawnDelay*/) {}
+2 -2
View File
@@ -329,7 +329,7 @@ class EventMap : private std::map<uint32, uint32>
// Sets event phase, must be in range 1 - 8
void SetPhase(uint32 phase)
{
if (phase && phase < 9)
if (phase && phase < 8)
_phase = (1 << (phase + 24));
}
@@ -340,7 +340,7 @@ class EventMap : private std::map<uint32, uint32>
time += _time;
if (groupId && groupId < 9)
eventId |= (1 << (groupId + 16));
if (phase && phase < 9)
if (phase && phase < 8)
eventId |= (1 << (phase + 24));
const_iterator itr = find(time);
while (itr != end())
@@ -1272,7 +1272,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId());
}
switch((*i).second.Type)
switch ((*i).second.Type)
{
case CHAT_TYPE_SAY:
source->MonsterSay(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
@@ -278,7 +278,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SPAWNED:
switch(temp.spawned.condition)
switch (temp.spawned.condition)
{
case SPAWNED_EVENT_ALWAY:
break;
@@ -52,8 +52,7 @@ void SummonList::DespawnEntry(uint32 entry)
else if (summon->GetEntry() == entry)
{
erase(i++);
summon->setDeathState(JUST_DIED);
summon->RemoveCorpse();
summon->DespawnOrUnsummon();
}
else
++i;
@@ -70,13 +69,7 @@ void SummonList::DespawnAll()
else
{
erase(begin());
if (TempSummon* summ = summon->ToTempSummon())
{
summon->DestroyForNearbyPlayers();
summ->UnSummon();
}
else
summon->DisappearAndDie();
summon->DespawnOrUnsummon();
}
}
}
@@ -436,7 +429,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
float y = me->GetPositionY();
float z = me->GetPositionZ();
switch(me->GetEntry())
switch (me->GetEntry())
{
case NPC_BROODLORD: // broodlord (not move down stairs)
if (z > 448.60f)
@@ -457,7 +450,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
default: // For most of creatures that certain area is their home area.
sLog->outDetail("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ());
if(me->GetAreaId() == homeAreaId)
if (me->GetAreaId() == homeAreaId)
return false;
}
@@ -82,7 +82,7 @@ enum eTradeskill
#define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, "", 0)
#define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, e, f, g)
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32) , b - npc guid(uint64)
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32), b - npc guid(uint64)
#define SEND_GOSSIP_MENU(a, b) PlayerTalkClass->SendGossipMenu(a, b)
// Closes the Menu
+11 -8
View File
@@ -462,13 +462,19 @@ void SmartAI::EnterEvadeMode()
void SmartAI::MoveInLineOfSight(Unit* who)
{
if (!who) return;
if (!who)
return;
GetScript()->OnMoveInLineOfSight(who);
if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
return;
if (!CanAIAttack(who))
return;
if (!me->canStartAttack(who, false))
return;
if (me->IsHostileTo(who))
{
@@ -487,9 +493,6 @@ void SmartAI::MoveInLineOfSight(Unit* who)
}
}
}
//if (me->canStartAttack(who, false))
// AttackStart(who);
}
bool SmartAI::CanAIAttack(const Unit* /*who*/) const
@@ -843,7 +846,7 @@ void SmartGameObjectAI::Reset()
bool SmartGameObjectAI::GossipHello(Player* player)
{
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartGameObjectAI::GossipHello");
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, 0 , 0 , false, NULL, go);
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, 0, 0, false, NULL, go);
return false;
}
@@ -863,14 +866,14 @@ bool SmartGameObjectAI::GossipSelectCode(Player* /*player*/, uint32 /*sender*/,
// Called when a player accepts a quest from the gameobject.
bool SmartGameObjectAI::QuestAccept(Player* player, Quest const* quest)
{
GetScript()->ProcessEventsFor(SMART_EVENT_ACCEPTED_QUEST, player, quest->GetQuestId() , 0 , false, NULL, go);
GetScript()->ProcessEventsFor(SMART_EVENT_ACCEPTED_QUEST, player, quest->GetQuestId(), 0, false, NULL, go);
return false;
}
// Called when a player selects a quest reward.
bool SmartGameObjectAI::QuestReward(Player* player, Quest const* quest, uint32 opt)
{
GetScript()->ProcessEventsFor(SMART_EVENT_REWARD_QUEST, player, quest->GetQuestId() , opt , false, NULL, go);
GetScript()->ProcessEventsFor(SMART_EVENT_REWARD_QUEST, player, quest->GetQuestId(), opt, false, NULL, go);
return false;
}
@@ -880,7 +883,7 @@ uint32 SmartGameObjectAI::GetDialogStatus(Player* /*player*/) { return 100; }
// Called when the gameobject is destroyed (destructible buildings only).
void SmartGameObjectAI::Destroyed(Player* player, uint32 eventId)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, player, eventId , 0 , false, NULL, go);
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, player, eventId, 0, false, NULL, go);
}
void SmartGameObjectAI::SetData(uint32 id, uint32 value)
@@ -460,7 +460,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsPlayer(*itr))
{
(*itr)->ToPlayer()->CastedCreatureOrGO(e.action.castedCreatureOrGO.creature, GetBaseObject()->GetGUID(), e.action.castedCreatureOrGO.spell);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_CASTCREATUREORGO: Player guidLow %u.org Creature: %u, BaseObject GUID: "UI64FMTD" , Spell: %u",
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_CASTCREATUREORGO: Player guidLow %u.org Creature: %u, BaseObject GUID: "UI64FMTD", Spell: %u",
(*itr)->GetGUIDLow(), e.action.castedCreatureOrGO.creature, GetBaseObject()->GetGUID(), e.action.castedCreatureOrGO.spell);
}
}
@@ -1309,7 +1309,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
bool run = e.action.setRun.run ? true : false;
CAST_AI(SmartAI, me->AI())->SetRun(run);
me->GetMotionMaster()->MovePoint(0, e.target.x, e.target.y , e.target.z);
me->GetMotionMaster()->MovePoint(0, e.target.x, e.target.y, e.target.z);
break;
}
case SMART_ACTION_RESPAWN_TARGET:
@@ -1323,7 +1323,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsCreature(*itr))
(*itr)->ToCreature()->Respawn();
else if (IsGameObject(*itr))
(*itr)->ToGameObject()->Respawn();
(*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.GoRespawnTime);
}
delete targets;
@@ -1781,7 +1781,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_JUMP_TO_POS:
{
me->GetMotionMaster()->MoveJump(e.target.x, e.target.y , e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
me->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
break;
}
default:
@@ -123,7 +123,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
if (temp.entryOrGuid >= 0)
{
switch(source_type)
switch (source_type)
{
case SMART_SCRIPT_TYPE_CREATURE:
{
@@ -857,6 +857,11 @@ struct SmartAction
uint32 withEmote;
} flee;
struct
{
uint32 GoRespawnTime;
} RespawnTarget;
struct
{
uint32 param1;
@@ -506,11 +506,9 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
iter->second.changed = false;
}
if (need_execute)
ssdel << ')';
if (need_execute)
{
ssdel << ')';
trans->Append(ssdel.str().c_str());
trans->Append(ssins.str().c_str());
}
@@ -1600,7 +1598,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
}
static const uint32 achievIdByClass[MAX_CLASSES] = { 0, 459, 465 , 462, 458, 464, 461, 467, 460, 463, 0, 466 };
static const uint32 achievIdByClass[MAX_CLASSES] = { 0, 459, 465, 462, 458, 464, 461, 467, 460, 463, 0, 466 };
static const uint32 achievIdByRace[MAX_RACES] = { 0, 1408, 1410, 1407, 1409, 1413, 1411, 1404, 1412, 0, 1405, 1406 };
bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement)
@@ -2039,9 +2037,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
return;
// titles
//! Currently there's only one achievement that deals with gender-specific titles.
//! Currently there's only one achievement that deals with gender-specific titles.
//! Since no common attributes were found, (not even in titleRewardFlags field)
//! we explicitly check by ID. Maybe in the future we could move the achievement_reward
//! we explicitly check by ID. Maybe in the future we could move the achievement_reward
//! condition fields to the condition system.
if (uint32 titleId = reward->titleId[achievement->ID == 1793 ? GetPlayer()->getGender() : (GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1)])
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
+22 -22
View File
@@ -255,7 +255,7 @@ void Battleground::Update(uint32 diff)
return;
}
switch(GetStatus())
switch (GetStatus())
{
case STATUS_WAIT_JOIN:
if (GetPlayersSize())
@@ -890,7 +890,7 @@ uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
uint32 Battleground::GetBattlemasterEntry() const
{
switch(GetTypeID(true))
switch (GetTypeID(true))
{
case BATTLEGROUND_AV: return 15972;
case BATTLEGROUND_WS: return 14623;
@@ -1527,36 +1527,36 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
if (!map)
return NULL;
Creature* pCreature = new Creature;
if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
Creature* creature = new Creature;
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
{
sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete pCreature;
delete creature;
return NULL;
}
pCreature->SetHomePosition(x, y, z, o);
creature->SetHomePosition(x, y, z, o);
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete pCreature;
delete creature;
return NULL;
}
// Force using DB speeds
pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run);
creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
map->Add(pCreature);
m_BgCreatures[type] = pCreature->GetGUID();
map->Add(creature);
m_BgCreatures[type] = creature->GetGUID();
if (respawntime)
pCreature->SetRespawnDelay(respawntime);
creature->SetRespawnDelay(respawntime);
return pCreature;
return creature;
}
bool Battleground::DelCreature(uint32 type)
@@ -1601,18 +1601,18 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
BG_CREATURE_ENTRY_A_SPIRITGUIDE :
BG_CREATURE_ENTRY_H_SPIRITGUIDE;
if (Creature* pCreature = AddCreature(entry, type, team, x, y, z, o))
if (Creature* creature = AddCreature(entry, type, team, x, y, z, o))
{
pCreature->setDeathState(DEAD);
pCreature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pCreature->GetGUID());
creature->setDeathState(DEAD);
creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
// aura
// TODO: Fix display here
// pCreature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
// creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
// casting visual effect
pCreature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL);
creature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL);
// correct cast speed
pCreature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
//pCreature->CastSpell(pCreature, SPELL_SPIRIT_HEAL_CHANNEL, true);
creature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
//creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
return true;
}
sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
@@ -1887,8 +1887,8 @@ bool Battleground::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxSc
void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first))
pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry);
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
player->GetAchievementMgr().StartTimedAchievement(type, entry);
}
void Battleground::SetBracket(PvPDifficultyEntry const* bracketEntry)
@@ -573,6 +573,8 @@ class Battleground
void RewardXPAtKill(Player* killer, Player* victim);
bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
void EndNow();
@@ -203,7 +203,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
*data << uint8(bg->isRated()); // 1 for rated match, 0 for bg or non rated match
*data << uint32(StatusID); // status
switch(StatusID)
switch (StatusID)
{
case STATUS_WAIT_QUEUE: // status_in_queue
*data << uint32(Time1); // average wait time, milliseconds
@@ -300,10 +300,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
}
*data << uint32(itr2->second->DamageDone); // damage done
*data << uint32(itr2->second->HealingDone); // healing done
switch(bg->GetTypeID(true)) // battleground specific things
switch (bg->GetTypeID(true)) // battleground specific things
{
case BATTLEGROUND_RB:
switch(bg->GetMapId())
switch (bg->GetMapId())
{
case 489:
*data << uint32(0x00000002); // count of next fields
@@ -554,7 +554,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
Battleground* bg = NULL;
// create a copy of the BG template
switch(bgTypeId)
switch (bgTypeId)
{
case BATTLEGROUND_AV:
bg = new BattlegroundAV(*(BattlegroundAV*)bg_template);
@@ -863,7 +863,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
*data << uint32(*itr);
++count;
}
data->put<uint32>(count_pos , count);
data->put<uint32>(count_pos, count);
}
}
}
@@ -907,13 +907,12 @@ bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
bgTypeId == BATTLEGROUND_NA ||
bgTypeId == BATTLEGROUND_DS ||
bgTypeId == BATTLEGROUND_RV ||
bgTypeId == BATTLEGROUND_RL ||
bgTypeId == BATTLEGROUND_DS);
bgTypeId == BATTLEGROUND_RL);
}
BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
{
switch(bgTypeId)
switch (bgTypeId)
{
case BATTLEGROUND_WS:
return BATTLEGROUND_QUEUE_WS;
@@ -935,7 +934,7 @@ BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgType
case BATTLEGROUND_BE:
case BATTLEGROUND_DS:
case BATTLEGROUND_RV:
switch(arenaType)
switch (arenaType)
{
case ARENA_TYPE_2v2:
return BATTLEGROUND_QUEUE_2v2;
@@ -953,7 +952,7 @@ BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgType
BattlegroundTypeId BattlegroundMgr::BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId)
{
switch(bgQueueTypeId)
switch (bgQueueTypeId)
{
case BATTLEGROUND_QUEUE_WS:
return BATTLEGROUND_WS;
@@ -980,7 +979,7 @@ BattlegroundTypeId BattlegroundMgr::BGTemplateId(BattlegroundQueueTypeId bgQueue
uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId)
{
switch(bgQueueTypeId)
switch (bgQueueTypeId)
{
case BATTLEGROUND_QUEUE_2v2:
return ARENA_TYPE_2v2;
@@ -805,7 +805,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
//this switch can be much shorter
MaxPlayersPerTeam = arenaType;
MinPlayersPerTeam = arenaType;
/*switch(arenaType)
/*switch (arenaType)
{
case ARENA_TYPE_2v2:
MaxPlayersPerTeam = 2;
@@ -618,9 +618,9 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
//send a nice message to all :)
char buf[256];
if (IsTower(node))
sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node), (owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN), GetNodeName(node), (owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
else
sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node), (owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE));
sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN), GetNodeName(node), (owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if (creature)
@@ -1298,17 +1298,17 @@ bool BattlegroundAV::SetupBattleground()
}
}
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N , BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
{
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A , BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA , BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H , BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH , BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
return false;
@@ -48,7 +48,7 @@ enum BG_EY_WorldStates
BLOOD_ELF_ALLIANCE_CONTROL = 2723,
BLOOD_ELF_UNCONTROL = 2722,
PROGRESS_BAR_PERCENT_GREY = 2720, //100 = empty (only grey), 0 = blue|red (no grey)
PROGRESS_BAR_STATUS = 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky , 100 = full alliance
PROGRESS_BAR_STATUS = 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky, 100 = full alliance
PROGRESS_BAR_SHOW = 2718, //1 init, 0 druhy send - bez messagu, 1 = controlled aliance
NETHERSTORM_FLAG = 2757,
//set to 2 when flag is picked up, and to 1 if it is dropped
@@ -341,7 +341,7 @@ class BattlegroundEY : public Battleground
virtual void StartingEventOpenDoors();
/* BG Flags */
uint64 GetFlagPickerGUID() const { return m_FlagKeeper; }
uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return m_FlagKeeper; }
void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; }
bool IsFlagPickedup() const { return m_FlagKeeper != 0; }
uint8 GetFlagState() const { return m_FlagState; }
@@ -332,7 +332,7 @@ void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
switch (type)
{
case SCORE_BASES_ASSAULTED:
((BattlegroundICScore*)itr->second)->BasesAssaulted += value;
@@ -642,7 +642,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
}
switch(nodePoint->gameobject_type)
switch (nodePoint->gameobject_type)
{
case BG_IC_GO_HANGAR_BANNER:
// all the players on the stopped transport should be teleported out
@@ -833,7 +833,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
uint32 lang_entry = 0;
switch(go->GetEntry())
switch (go->GetEntry())
{
case GO_HORDE_GATE_1:
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
@@ -940,7 +940,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
t->SetMap(GetBgMap());
for (uint8 i = 0; i < 5; i++)
t->AddNPCPassenger(0, (goEntry == GO_HORDE_GUNSHIP ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionX() : allianceGunshipPassengers[i].GetPositionX()) , (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionY() : allianceGunshipPassengers[i].GetPositionY()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionZ() : allianceGunshipPassengers[i].GetPositionZ()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetOrientation() : allianceGunshipPassengers[i].GetOrientation()));
t->AddNPCPassenger(0, (goEntry == GO_HORDE_GUNSHIP ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionX() : allianceGunshipPassengers[i].GetPositionX()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionY() : allianceGunshipPassengers[i].GetPositionY()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionZ() : allianceGunshipPassengers[i].GetPositionZ()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetOrientation() : allianceGunshipPassengers[i].GetOrientation()));
return t;
}
@@ -911,7 +911,7 @@ class BattlegroundIC : public Battleground
uint32 GetGateIDFromEntry(uint32 id)
{
uint32 i = 0;
switch(id)
switch (id)
{
case GO_HORDE_GATE_1: i = BG_IC_H_FRONT ;break;
case GO_HORDE_GATE_2: i = BG_IC_H_WEST ;break;
@@ -927,7 +927,7 @@ class BattlegroundIC : public Battleground
{
uint32 uws = 0;
switch(id)
switch (id)
{
case GO_HORDE_GATE_1:
uws = (open ? BG_IC_GATE_FRONT_H_WS_OPEN : BG_IC_GATE_FRONT_H_WS_CLOSED);
@@ -201,13 +201,13 @@ bool BattlegroundSA::ResetObjs()
}
//Player may enter BEFORE we set up bG - lets update his worldstates anyway...
UpdateWorldState(BG_SA_RIGHT_GY_HORDE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_HORDE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_HORDE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
if (Attackers == TEAM_ALLIANCE)
{
@@ -612,7 +612,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
UpdateWorldState(uws, GateStatus[i]);
bool rewardHonor = true;
gateDestroyed = true;
switch(i)
switch (i)
{
case BG_SA_GREEN_GATE:
if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
@@ -686,7 +686,7 @@ void BattlegroundSA::SendTime()
void BattlegroundSA::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
{
switch(target_obj->GetEntry())
switch (target_obj->GetEntry())
{
case 191307:
case 191308:
@@ -721,7 +721,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
uint32 npc = 0;
uint32 flag = 0;
switch(i)
switch (i)
{
case BG_SA_LEFT_CAPTURABLE_GY:
flag = BG_SA_LEFT_FLAG;
@@ -168,7 +168,7 @@ const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] =
{ 1232.345f, -187.517f, 66.945f, 0.45f },
{ 1249.634f, -224.189f, 66.72f, 0.635f },
{ 1236.213f, 92.287f, 64.965f, 5.751f },
{ 1215.11f, 57.772f, 64.739f, 5.78f } ,
{ 1215.11f, 57.772f, 64.739f, 5.78f },
//Demolishers
{ 1611.597656f, -117.270073f, 8.719355f, 2.513274f},
{ 1575.562500f, -158.421875f, 5.024450f, 2.129302f},
@@ -446,7 +446,7 @@ class BattlegroundSA : public Battleground
uint32 GetGateIDFromDestroyEventID(uint32 id)
{
uint32 i = 0;
switch(id)
switch (id)
{
case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed
case 19045: i = BG_SA_BLUE_GATE; break; //blue gate
@@ -461,7 +461,7 @@ class BattlegroundSA : public Battleground
uint32 GetWorldStateFromGateID(uint32 id)
{
uint32 uws = 0;
switch(id)
switch (id)
{
case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break;
case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break;
@@ -359,7 +359,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!this->IsHordeFlagPickedup())
return;
if (GetHordeFlagPickerGUID() == Source->GetGUID())
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -369,7 +369,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!this->IsAllianceFlagPickedup())
return;
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
@@ -384,7 +384,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!IsHordeFlagPickedup())
return;
if (GetHordeFlagPickerGUID() == Source->GetGUID())
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -401,7 +401,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!IsAllianceFlagPickedup())
return;
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
@@ -607,7 +607,7 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
//uint32 SpellId = 0;
//uint64 buff_guid = 0;
switch(Trigger)
switch (Trigger)
{
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
@@ -629,12 +629,12 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
break;
case 3646: // Alliance Flag spawn
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
if (GetHordeFlagPickerGUID() == Source->GetGUID())
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
EventPlayerCapturedFlag(Source);
break;
case 3647: // Horde Flag spawn
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
EventPlayerCapturedFlag(Source);
break;
case 3649: // unk1
@@ -761,7 +761,7 @@ void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
switch (type)
{
case SCORE_FLAG_CAPTURES: // flags captured
((BattlegroundWGScore*)itr->second)->FlagCaptures += value;
@@ -168,8 +168,12 @@ class BattlegroundWS : public Battleground
virtual void StartingEventOpenDoors();
/* BG Flags */
uint64 GetAllianceFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_ALLIANCE]; }
uint64 GetHordeFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_HORDE]; }
uint64 GetFlagPickerGUID(int32 team) const
{
if (team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE)
return m_FlagKeepers[team];
return 0;
}
void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
bool IsAllianceFlagPickedup() const { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; }
@@ -177,10 +181,6 @@ class BattlegroundWS : public Battleground
void RespawnFlag(uint32 Team, bool captured);
void RespawnFlagAfterDrop(uint32 Team);
uint8 GetFlagState(uint32 team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
void AddTimedAura(uint32 aura);
void RemoveTimedAura(uint32 aura);
bool IsBrutalTimerDone;
bool IsForceTimerDone;
/* Battleground Events */
virtual void EventPlayerDroppedFlag(Player* Source);
+3 -3
View File
@@ -986,7 +986,7 @@ void ChatHandler::FillMessageData(WorldPacket* data, WorldSession* session, uint
else
*data << uint32(LANG_UNIVERSAL);
switch(type)
switch (type)
{
case CHAT_MSG_SAY:
case CHAT_MSG_PARTY:
@@ -1287,7 +1287,7 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text)
uint32 id = (uint32)atol(idS);
switch(type)
switch (type)
{
case SPELL_LINK_SPELL:
return id;
@@ -1367,7 +1367,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
if (!idS)
return 0;
switch(type)
switch (type)
{
case SPELL_LINK_PLAYER:
{
+2 -2
View File
@@ -373,7 +373,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
std::string race_s, Class_s;
switch(race)
switch (race)
{
case RACE_HUMAN: race_s = "Human"; break;
case RACE_ORC: race_s = "Orc"; break;
@@ -386,7 +386,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
case RACE_BLOODELF: race_s = "Blood Elf"; break;
case RACE_DRAENEI: race_s = "Draenei"; break;
}
switch(Class)
switch (Class)
{
case CLASS_WARRIOR: Class_s = "Warrior"; break;
case CLASS_PALADIN: Class_s = "Paladin"; break;
+19 -19
View File
@@ -1596,7 +1596,7 @@ bool ChatHandler::HandleLookupMapCommand(const char *args)
if (MapInfo->IsContinent())
ss << GetTrinityString(LANG_CONTINENT);
switch(MapInfo->map_type)
switch (MapInfo->map_type)
{
case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break;
case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break;
@@ -2908,7 +2908,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
if (!reason)
return false;
switch(mode)
switch (mode)
{
case BAN_ACCOUNT:
if (!AccountMgr::normalizeString(nameOrIP))
@@ -2932,7 +2932,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
break;
}
switch(sWorld->BanAccount(mode, nameOrIP, duration, reason, m_session ? m_session->GetPlayerName() : ""))
switch (sWorld->BanAccount(mode, nameOrIP, duration, reason, m_session ? m_session->GetPlayerName() : ""))
{
case BAN_SUCCESS:
if (atoi(duration)>0)
@@ -2943,7 +2943,7 @@ bool ChatHandler::HandleBanHelper(BanMode mode, const char *args)
case BAN_SYNTAX_ERROR:
return false;
case BAN_NOTFOUND:
switch(mode)
switch (mode)
{
default:
PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
@@ -3016,7 +3016,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args)
std::string nameOrIP = cnameOrIP;
switch(mode)
switch (mode)
{
case BAN_ACCOUNT:
if (!AccountMgr::normalizeString(nameOrIP))
@@ -3569,7 +3569,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args)
}
}
switch(PlayerDumpReader().LoadDump(file, account_id, name, guid))
switch (PlayerDumpReader().LoadDump(file, account_id, name, guid))
{
case DUMP_SUCCESS:
PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
@@ -3630,7 +3630,7 @@ bool ChatHandler::HandlePDumpWriteCommand(const char *args)
return false;
}
switch(PlayerDumpWriter().WriteDump(file, uint32(guid)))
switch (PlayerDumpWriter().WriteDump(file, uint32(guid)))
{
case DUMP_SUCCESS:
PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
@@ -3673,7 +3673,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
SendSysMessage("Empty");
continue;
}
switch(mg->GetMovementGeneratorType())
switch (mg->GetMovementGeneratorType())
{
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
@@ -3766,7 +3766,7 @@ bool ChatHandler::HandleServerPLimitCommand(const char *args)
uint32 pLimit = sWorld->GetPlayerAmountLimit();
AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit();
char const* secName = "";
switch(allowedAccountType)
switch (allowedAccountType)
{
case SEC_PLAYER: secName = "Player"; break;
case SEC_MODERATOR: secName = "Moderator"; break;
@@ -4689,32 +4689,32 @@ bool ChatHandler::HandleGroupRemoveCommand(const char *args)
bool ChatHandler::HandlePossessCommand(const char * /*args*/)
{
Unit* pUnit = getSelectedUnit();
if (!pUnit)
Unit* unit = getSelectedUnit();
if (!unit)
return false;
m_session->GetPlayer()->CastSpell(pUnit, 530, true);
m_session->GetPlayer()->CastSpell(unit, 530, true);
return true;
}
bool ChatHandler::HandleUnPossessCommand(const char * /*args*/)
{
Unit* pUnit = getSelectedUnit();
if (!pUnit)
pUnit = m_session->GetPlayer();
Unit* unit = getSelectedUnit();
if (!unit)
unit = m_session->GetPlayer();
pUnit->RemoveCharmAuras();
unit->RemoveCharmAuras();
return true;
}
bool ChatHandler::HandleBindSightCommand(const char * /*args*/)
{
Unit* pUnit = getSelectedUnit();
if (!pUnit)
Unit* unit = getSelectedUnit();
if (!unit)
return false;
m_session->GetPlayer()->CastSpell(pUnit, 6277, true);
m_session->GetPlayer()->CastSpell(unit, 6277, true);
return true;
}
+1 -1
View File
@@ -519,7 +519,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
HostileReference* hostilRef = threatRefStatusChangeEvent->getReference();
switch(threatRefStatusChangeEvent->getType())
switch (threatRefStatusChangeEvent->getType())
{
case UEV_THREAT_REF_THREAT_CHANGE:
if ((getCurrentVictim() == hostilRef && threatRefStatusChangeEvent->getFValue()<0.0f) ||
+1 -1
View File
@@ -1213,7 +1213,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
return false;
}
switch(cond->mConditionValue1)
switch (cond->mConditionValue1)
{
case SPELL_TARGET_TYPE_GAMEOBJECT:
{
+1 -1
View File
@@ -739,7 +739,7 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
if (!mapEntry)
return CONTENT_1_60;
switch(mapEntry->Expansion())
switch (mapEntry->Expansion())
{
default: return CONTENT_1_60;
case 1: return CONTENT_61_70;
+1 -1
View File
@@ -1056,7 +1056,7 @@ struct HolidaysEntry
//uint32 holidayDescriptionId; // 50 m_holidayDescriptionID (HolidayDescriptions.dbc)
//char *textureFilename; // 51 m_textureFilename
//uint32 priority; // 52 m_priority
//uint32 calendarFilterType; // 53 m_calendarFilterType (-1 = Fishing Contest, 0 = Unk,1 = Darkmoon Festival, 2 = Yearly holiday)
//uint32 calendarFilterType; // 53 m_calendarFilterType (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday)
//uint32 flags; // 54 m_flags (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1)
};
@@ -30,7 +30,7 @@ LfgGroupData::~LfgGroupData()
void LfgGroupData::SetState(LfgState state)
{
switch(state)
switch (state)
{
case LFG_STATE_NONE:
case LFG_STATE_DUNGEON:
+9 -9
View File
@@ -271,7 +271,7 @@ void LFGMgr::Update(uint32 diff)
role &= ~ROLE_LEADER;
int32 waitTime = -1;
switch(role)
switch (role)
{
case ROLE_NONE: // Should not happen - just in case
waitTime = -1;
@@ -514,7 +514,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon
bool isDungeon = false;
for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end() && joinData.result == LFG_JOIN_OK; ++it)
{
switch(GetDungeonType(*it))
switch (GetDungeonType(*it))
{
case LFG_TYPE_RANDOM:
if (dungeons.size() > 1) // Only allow 1 random dungeon
@@ -657,7 +657,7 @@ void LFGMgr::Leave(Player* plr, Group* grp /* = NULL*/)
LfgState state = GetState(guid);
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
switch(state)
switch (state)
{
case LFG_STATE_QUEUED:
{
@@ -904,7 +904,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
{
LfgQueueInfoMap::const_iterator itOther = itFirst;
++itOther;
while(itOther != pqInfoMap.end() && itOther->second->dungeons.find(*itDungeon) != itOther->second->dungeons.end())
while (itOther != pqInfoMap.end() && itOther->second->dungeons.find(*itDungeon) != itOther->second->dungeons.end())
++itOther;
if (itOther == pqInfoMap.end())
@@ -1308,12 +1308,12 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
// Save wait times before redoing groups
for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
{
LfgProposalPlayer* pPlayer = pProposal->players[(*it)->GetGUID()];
LfgProposalPlayer* player = pProposal->players[(*it)->GetGUID()];
uint32 lowgroupguid = (*it)->GetGroup() ? (*it)->GetGroup()->GetLowGUID() : 0;
if (pPlayer->groupLowGuid != lowgroupguid)
sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, pPlayer->groupLowGuid);
if (player->groupLowGuid != lowgroupguid)
sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid);
uint64 guid = pPlayer->groupLowGuid ? MAKE_NEW_GUID(pPlayer->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
uint64 guid = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
if (itQueue == m_QueueInfoMap.end())
{
@@ -1358,7 +1358,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
// Update timers
uint8 role = GetRoles(pguid);
role &= ~ROLE_LEADER;
switch(role)
switch (role)
{
case ROLE_DAMAGE:
{
@@ -27,7 +27,7 @@ LfgPlayerData::~LfgPlayerData()
void LfgPlayerData::SetState(LfgState state)
{
switch(state)
switch (state)
{
case LFG_STATE_NONE:
case LFG_STATE_DUNGEON:
+61 -57
View File
@@ -434,7 +434,7 @@ void Creature::Update(uint32 diff)
m_vehicleKit->Reset();
}
switch(m_deathState)
switch (m_deathState)
{
case JUST_ALIVED:
// Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting.
@@ -657,14 +657,14 @@ void Creature::DoFleeToGetAssistance()
float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
if (radius >0)
{
Creature* pCreature = NULL;
Creature* creature = NULL;
CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this, getVictim(), radius);
Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, pCreature, u_check);
Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, creature, u_check);
TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
@@ -673,12 +673,12 @@ void Creature::DoFleeToGetAssistance()
SetNoSearchAssistance(true);
UpdateSpeed(MOVE_RUN, false);
if (!pCreature)
//SetFeared(true, getVictim()->GetGUID(), 0 , sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
if (!creature)
//SetFeared(true, getVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
//TODO: use 31365
SetControlled(true, UNIT_STAT_FLEEING);
else
GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ());
GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
}
}
@@ -805,7 +805,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
return true;
}
bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
bool Creature::isCanTrainingOf(Player* player, bool msg) const
{
if (!isTrainer())
return false;
@@ -819,68 +819,68 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
return false;
}
switch(GetCreatureInfo()->trainer_type)
switch (GetCreatureInfo()->trainer_type)
{
case TRAINER_TYPE_CLASS:
if (pPlayer->getClass() != GetCreatureInfo()->trainer_class)
if (player->getClass() != GetCreatureInfo()->trainer_class)
{
if (msg)
{
pPlayer->PlayerTalkClass->ClearMenus();
switch(GetCreatureInfo()->trainer_class)
player->PlayerTalkClass->ClearMenus();
switch (GetCreatureInfo()->trainer_class)
{
case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu(4913, GetGUID()); break;
case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090, GetGUID()); break;
case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu(328, GetGUID()); break;
case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu(1635, GetGUID()); break;
case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu(4436, GetGUID()); break;
case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu(4797, GetGUID()); break;
case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5003, GetGUID()); break;
case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu(5836, GetGUID()); break;
case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu(4985, GetGUID()); break;
case CLASS_DRUID: player->PlayerTalkClass->SendGossipMenu(4913, GetGUID()); break;
case CLASS_HUNTER: player->PlayerTalkClass->SendGossipMenu(10090, GetGUID()); break;
case CLASS_MAGE: player->PlayerTalkClass->SendGossipMenu(328, GetGUID()); break;
case CLASS_PALADIN:player->PlayerTalkClass->SendGossipMenu(1635, GetGUID()); break;
case CLASS_PRIEST: player->PlayerTalkClass->SendGossipMenu(4436, GetGUID()); break;
case CLASS_ROGUE: player->PlayerTalkClass->SendGossipMenu(4797, GetGUID()); break;
case CLASS_SHAMAN: player->PlayerTalkClass->SendGossipMenu(5003, GetGUID()); break;
case CLASS_WARLOCK:player->PlayerTalkClass->SendGossipMenu(5836, GetGUID()); break;
case CLASS_WARRIOR:player->PlayerTalkClass->SendGossipMenu(4985, GetGUID()); break;
}
}
return false;
}
break;
case TRAINER_TYPE_PETS:
if (pPlayer->getClass() != CLASS_HUNTER)
if (player->getClass() != CLASS_HUNTER)
{
pPlayer->PlayerTalkClass->ClearMenus();
pPlayer->PlayerTalkClass->SendGossipMenu(3620, GetGUID());
player->PlayerTalkClass->ClearMenus();
player->PlayerTalkClass->SendGossipMenu(3620, GetGUID());
return false;
}
break;
case TRAINER_TYPE_MOUNTS:
if (GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race)
if (GetCreatureInfo()->trainer_race && player->getRace() != GetCreatureInfo()->trainer_race)
{
if (msg)
{
pPlayer->PlayerTalkClass->ClearMenus();
switch(GetCreatureInfo()->trainer_class)
player->PlayerTalkClass->ClearMenus();
switch (GetCreatureInfo()->trainer_class)
{
case RACE_DWARF: pPlayer->PlayerTalkClass->SendGossipMenu(5865, GetGUID()); break;
case RACE_GNOME: pPlayer->PlayerTalkClass->SendGossipMenu(4881, GetGUID()); break;
case RACE_HUMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5861, GetGUID()); break;
case RACE_NIGHTELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break;
case RACE_ORC: pPlayer->PlayerTalkClass->SendGossipMenu(5863, GetGUID()); break;
case RACE_TAUREN: pPlayer->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break;
case RACE_TROLL: pPlayer->PlayerTalkClass->SendGossipMenu(5816, GetGUID()); break;
case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu(624, GetGUID()); break;
case RACE_BLOODELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break;
case RACE_DRAENEI: pPlayer->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break;
case RACE_DWARF: player->PlayerTalkClass->SendGossipMenu(5865, GetGUID()); break;
case RACE_GNOME: player->PlayerTalkClass->SendGossipMenu(4881, GetGUID()); break;
case RACE_HUMAN: player->PlayerTalkClass->SendGossipMenu(5861, GetGUID()); break;
case RACE_NIGHTELF: player->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break;
case RACE_ORC: player->PlayerTalkClass->SendGossipMenu(5863, GetGUID()); break;
case RACE_TAUREN: player->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break;
case RACE_TROLL: player->PlayerTalkClass->SendGossipMenu(5816, GetGUID()); break;
case RACE_UNDEAD_PLAYER:player->PlayerTalkClass->SendGossipMenu(624, GetGUID()); break;
case RACE_BLOODELF: player->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break;
case RACE_DRAENEI: player->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break;
}
}
return false;
}
break;
case TRAINER_TYPE_TRADESKILLS:
if (GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell))
if (GetCreatureInfo()->trainer_spell && !player->HasSpell(GetCreatureInfo()->trainer_spell))
{
if (msg)
{
pPlayer->PlayerTalkClass->ClearMenus();
pPlayer->PlayerTalkClass->SendGossipMenu(11031, GetGUID());
player->PlayerTalkClass->ClearMenus();
player->PlayerTalkClass->SendGossipMenu(11031, GetGUID());
}
return false;
}
@@ -891,23 +891,23 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
return true;
}
bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const
{
if (!isBattleMaster())
return false;
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(GetEntry());
if (!msg)
return pPlayer->GetBGAccessByLevel(bgTypeId);
return player->GetBGAccessByLevel(bgTypeId);
if (!pPlayer->GetBGAccessByLevel(bgTypeId))
if (!player->GetBGAccessByLevel(bgTypeId))
{
pPlayer->PlayerTalkClass->ClearMenus();
switch(bgTypeId)
player->PlayerTalkClass->ClearMenus();
switch (bgTypeId)
{
case BATTLEGROUND_AV: pPlayer->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
case BATTLEGROUND_WS: pPlayer->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
case BATTLEGROUND_AB: pPlayer->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
case BATTLEGROUND_AV: player->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
case BATTLEGROUND_WS: player->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
case BATTLEGROUND_AB: player->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
case BATTLEGROUND_EY:
case BATTLEGROUND_NA:
case BATTLEGROUND_BE:
@@ -915,7 +915,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
case BATTLEGROUND_RL:
case BATTLEGROUND_SA:
case BATTLEGROUND_DS:
case BATTLEGROUND_RV: pPlayer->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
case BATTLEGROUND_RV: player->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
default: break;
}
return false;
@@ -923,11 +923,11 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
return true;
}
bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const
bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const
{
return pPlayer->getLevel() >= 10
return player->getLevel() >= 10
&& GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS
&& pPlayer->getClass() == GetCreatureInfo()->trainer_class;
&& player->getClass() == GetCreatureInfo()->trainer_class;
}
void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 /*MovementFlags*/, uint8 /*type*/)
@@ -1411,6 +1411,10 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
return false;
// Do not attack non-combat pets
if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
return false;
if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
//|| who->IsControlledByPlayer() && who->IsFlying()))
@@ -2128,16 +2132,16 @@ void Creature::SetInCombatWithZone()
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
if (Player* pPlayer = i->getSource())
if (Player* player = i->getSource())
{
if (pPlayer->isGameMaster())
if (player->isGameMaster())
continue;
if (pPlayer->isAlive())
if (player->isAlive())
{
this->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(this);
AddThreat(pPlayer, 0.0f);
this->SetInCombatWith(player);
player->SetInCombatWith(this);
AddThreat(player, 0.0f);
}
}
}
+1 -1
View File
@@ -456,7 +456,7 @@ class Creature : public Unit, public GridObject<Creature>
///// TODO RENAME THIS!!!!!
bool isCanTrainingOf(Player* player, bool msg) const;
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const;
bool isCanTrainingAndResetTalentsOf(Player* player) const;
bool canCreatureAttack(Unit const* pVictim, bool force = true) const;
bool IsImmunedToSpell(SpellInfo const* spellInfo);
// redefine Unit::IsImmunedToSpell
@@ -44,7 +44,7 @@ void TempSummon::Update(uint32 diff)
UnSummon();
return;
}
switch(m_type)
switch (m_type)
{
case TEMPSUMMON_MANUAL_DESPAWN:
break;
@@ -276,7 +276,7 @@ void GameObject::Update(uint32 diff)
{
case GO_NOT_READY:
{
switch(GetGoType())
switch (GetGoType())
{
case GAMEOBJECT_TYPE_TRAP:
{
@@ -484,7 +484,7 @@ void GameObject::Update(uint32 diff)
}
case GO_ACTIVATED:
{
switch(GetGoType())
switch (GetGoType())
{
case GAMEOBJECT_TYPE_DOOR:
case GAMEOBJECT_TYPE_BUTTON:
@@ -1211,15 +1211,13 @@ void GameObject::Use(Unit* user)
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
SetLootState(GO_ACTIVATED);
uint32 time_to_restore = info->GetAutoCloseTime();
// this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389)
if (time_to_restore && info->goober.customAnim)
if (info->goober.customAnim)
SendCustomAnim(GetGoAnimProgress());
else
SetGoState(GO_STATE_ACTIVE);
m_cooldownTime = time(NULL) + time_to_restore;
m_cooldownTime = time(NULL) + info->GetAutoCloseTime();
// cast this spell later if provided
spellId = info->goober.spellId;
@@ -1537,14 +1535,11 @@ void GameObject::Use(Unit* user)
GameObjectTemplate const* info = GetGOInfo();
if (info)
{
switch(info->entry)
switch (info->entry)
{
case 179785: // Silverwing Flag
// check if it's correct bg
if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag
// check if it's correct bg
if (bg->IsRandom() ? bg->GetTypeID(true) : bg->GetTypeID(false) == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
@@ -1660,7 +1655,7 @@ void GameObject::SendCustomAnim(uint32 anim)
bool GameObject::IsInRange(float x, float y, float z, float radius) const
{
GameObjectDisplayInfoEntry const* info = sGameObjectDisplayInfoStore.LookupEntry(GetUInt32Value(GAMEOBJECT_DISPLAYID));
GameObjectDisplayInfoEntry const* info = sGameObjectDisplayInfoStore.LookupEntry(m_goInfo->displayId);
if (!info)
return IsWithinDist3d(x, y, z, radius);
@@ -409,7 +409,7 @@ struct GameObjectTemplate
// helpers
bool IsDespawnAtAction() const
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_CHEST: return chest.consumable;
case GAMEOBJECT_TYPE_GOOBER: return goober.consumable;
@@ -419,7 +419,7 @@ struct GameObjectTemplate
uint32 GetLockId() const
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_DOOR: return door.lockId;
case GAMEOBJECT_TYPE_BUTTON: return button.lockId;
@@ -438,7 +438,7 @@ struct GameObjectTemplate
bool GetDespawnPossibility() const // despawn at targeting of cast?
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune;
case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune;
@@ -452,7 +452,7 @@ struct GameObjectTemplate
uint32 GetCharges() const // despawn at uses amount
{
switch(type)
switch (type)
{
//case GAMEOBJECT_TYPE_TRAP: return trap.charges;
case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges;
@@ -463,7 +463,7 @@ struct GameObjectTemplate
uint32 GetLinkedGameObjectEntry() const
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId;
case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId;
@@ -475,7 +475,7 @@ struct GameObjectTemplate
uint32 GetAutoCloseTime() const
{
uint32 autoCloseTime = 0;
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break;
case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break;
@@ -490,7 +490,7 @@ struct GameObjectTemplate
uint32 GetLootId() const
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_CHEST: return chest.lootId;
case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId;
@@ -500,7 +500,7 @@ struct GameObjectTemplate
uint32 GetGossipMenuId() const
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID;
case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID;
@@ -510,7 +510,7 @@ struct GameObjectTemplate
uint32 GetEventScriptId() const
{
switch(type)
switch (type)
{
case GAMEOBJECT_TYPE_GOOBER: return goober.eventId;
case GAMEOBJECT_TYPE_CHEST: return chest.eventId;
@@ -31,7 +31,7 @@ Bag::Bag(): Item()
m_valuesCount = CONTAINER_END;
memset(m_bagslot, 0, sizeof(Item* ) * MAX_BAG_SIZE);
memset(m_bagslot, 0, sizeof(Item*) * MAX_BAG_SIZE);
}
Bag::~Bag()
+7 -7
View File
@@ -173,10 +173,10 @@ bool ItemCanGoIntoBag(ItemTemplate const* pProto, ItemTemplate const* pBagProto)
if (!pProto || !pBagProto)
return false;
switch(pBagProto->Class)
switch (pBagProto->Class)
{
case ITEM_CLASS_CONTAINER:
switch(pBagProto->SubClass)
switch (pBagProto->SubClass)
{
case ITEM_SUBCLASS_CONTAINER:
return true;
@@ -216,7 +216,7 @@ bool ItemCanGoIntoBag(ItemTemplate const* pProto, ItemTemplate const* pBagProto)
return false;
}
case ITEM_CLASS_QUIVER:
switch(pBagProto->SubClass)
switch (pBagProto->SubClass)
{
case ITEM_SUBCLASS_QUIVER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS))
@@ -778,14 +778,14 @@ bool Item::CanBeTraded(bool mail, bool trade) const
return true;
}
bool Item::HasEnchantRequiredSkill(const Player* pPlayer) const
bool Item::HasEnchantRequiredSkill(const Player* player) const
{
// Check all enchants for required skill
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->requiredSkill && pPlayer->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
return false;
return true;
@@ -1103,7 +1103,7 @@ bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const
if (pUnitTarget->GetEntry() != m_uiTargetEntry)
return false;
switch(m_uiType)
switch (m_uiType)
{
case ITEM_TARGET_TYPE_CREATURE:
return pUnitTarget->isAlive();
@@ -1145,7 +1145,7 @@ void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransa
// Following is not applicable in the trading procedure
if (changestate)
SetState(ITEM_CHANGED, owner);
SetRefundRecipient(0);
SetPaidMoney(0);
SetPaidExtendedCost(0);
+1 -1
View File
@@ -264,7 +264,7 @@ class Item : public Object
void SetInTrade(bool b = true) { mb_in_trade = b; }
bool IsInTrade() const { return mb_in_trade; }
bool HasEnchantRequiredSkill(const Player* pPlayer) const;
bool HasEnchantRequiredSkill(const Player* player) const;
uint32 GetEnchantRequiredLevel() const;
bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
@@ -132,7 +132,7 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
return 0;
uint32 suffixFactor;
switch(itemProto->InventoryType)
switch (itemProto->InventoryType)
{
// Items of that type don`t have points
case INVTYPE_NON_EQUIP:
@@ -527,7 +527,7 @@ const uint32 MaxItemSubclassValues[MAX_ITEM_CLASS] =
inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemSubClass)
{
switch(ItemClass)
switch (ItemClass)
{
case ITEM_CLASS_WEAPON: return ItemSubClass;
case ITEM_CLASS_ARMOR: return ItemSubClass + 21;
@@ -656,7 +656,7 @@ struct ItemTemplate
// helpers
bool CanChangeEquipStateInCombat() const
{
switch(InventoryType)
switch (InventoryType)
{
case INVTYPE_RELIC:
case INVTYPE_SHIELD:
@@ -664,7 +664,7 @@ struct ItemTemplate
return true;
}
switch(Class)
switch (Class)
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_PROJECTILE:
+15 -15
View File
@@ -48,7 +48,7 @@
uint32 GuidHigh2TypeId(uint32 guid_hi)
{
switch(guid_hi)
switch (guid_hi)
{
case HIGHGUID_ITEM: return TYPEID_ITEM;
//case HIGHGUID_CONTAINER: return TYPEID_CONTAINER; HIGHGUID_CONTAINER == HIGHGUID_ITEM currently
@@ -134,7 +134,7 @@ void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh);
SetUInt64Value(OBJECT_FIELD_GUID, guid);
uint32 type = 0;
switch(m_objectType)
switch (m_objectType)
{
//case TYPEID_ITEM: type = 3; break;
//case TYPEID_CONTAINER: type = 7; break; //+4
@@ -220,7 +220,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
if (isType(TYPEMASK_GAMEOBJECT))
{
switch(((GameObject*)this)->GetGoType())
switch (((GameObject*)this)->GetGoType())
{
case GAMEOBJECT_TYPE_TRAP:
case GAMEOBJECT_TYPE_DUEL_ARBITER:
@@ -414,14 +414,14 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
*data << (float)0;
*data << (float)0;
*data << (float)0;
*data << ((WorldObject* )this)->GetOrientation();
*data << ((WorldObject*)this)->GetOrientation();
}
else
{
*data << ((WorldObject* )this)->GetPositionX();
*data << ((WorldObject* )this)->GetPositionY();
*data << ((WorldObject* )this)->GetPositionZ();
*data << ((WorldObject* )this)->GetOrientation();
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
*data << ((WorldObject*)this)->GetOrientation();
}
}
}
@@ -430,7 +430,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
// 0x8
if (flags & UPDATEFLAG_LOWGUID)
{
switch(GetTypeId())
switch (GetTypeId())
{
case TYPEID_OBJECT:
case TYPEID_ITEM:
@@ -895,7 +895,7 @@ void Object::SetUInt64Value(uint16 index, uint64 value)
bool Object::AddUInt64Value(uint16 index, uint64 value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true));
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
if (value && !*((uint64*)&(m_uint32Values[index])))
{
m_uint32Values[index] = PAIR64_LOPART(value);
@@ -917,7 +917,7 @@ bool Object::AddUInt64Value(uint16 index, uint64 value)
bool Object::RemoveUInt64Value(uint16 index, uint64 value)
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true));
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
if (value && *((uint64*)&(m_uint32Values[index])) == value)
{
m_uint32Values[index] = 0;
@@ -1488,7 +1488,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
float dx = GetPositionX() - x;
float dy = GetPositionY() - y;
if (dx < 0.001f && dy < 0.001f)
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
{
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
vcos = cos(angle);
@@ -2285,13 +2285,13 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
pet->setPowerType(POWER_MANA);
pet->SetUInt32Value(UNIT_NPC_FLAGS , 0);
pet->SetUInt32Value(UNIT_NPC_FLAGS, 0);
pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pet->InitStatsForLevel(getLevel());
SetMinion(pet, true);
switch(petType)
switch (petType)
{
case SUMMON_PET:
// this enables pet details window (Shift+P)
@@ -2309,7 +2309,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
map->Add(pet->ToCreature());
switch(petType)
switch (petType)
{
case SUMMON_PET:
pet->InitPetCreateSpells();
+10 -10
View File
@@ -151,38 +151,38 @@ class Object
int32 GetInt32Value(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return m_int32Values[index];
}
uint32 GetUInt32Value(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return m_uint32Values[index];
}
uint64 GetUInt64Value(uint16 index) const
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , false));
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
return *((uint64*)&(m_uint32Values[index]));
}
float GetFloatValue(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return m_floatValues[index];
}
uint8 GetByteValue(uint16 index, uint8 offset) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
ASSERT(offset < 4);
return *(((uint8*)&m_uint32Values[index])+offset);
}
uint16 GetUInt16Value(uint16 index, uint8 offset) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
ASSERT(offset < 2);
return *(((uint16*)&m_uint32Values[index])+offset);
}
@@ -227,7 +227,7 @@ 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;
}
@@ -244,7 +244,7 @@ class Object
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
ASSERT(offset < 4);
return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0;
}
@@ -278,7 +278,7 @@ class Object
bool HasFlag64(uint16 index, uint64 flag) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return (GetUInt64Value(index) & flag) != 0;
}
@@ -294,7 +294,7 @@ class Object
virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
virtual void BuildUpdate(UpdateDataMapType&) {}
void BuildFieldsUpdate(Player* , UpdateDataMapType &) const;
void BuildFieldsUpdate(Player*, UpdateDataMapType &) const;
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
@@ -80,7 +80,7 @@ enum HighGuid
inline bool IsGuidHaveEnPart(uint64 guid)
{
switch(GUID_HIPART(guid))
switch (GUID_HIPART(guid))
{
case HIGHGUID_ITEM:
case HIGHGUID_PLAYER:
@@ -104,7 +104,7 @@ inline bool IsGuidHaveEnPart(uint64 guid)
inline char const* GetLogNameForGuid(uint64 guid)
{
switch(GUID_HIPART(guid))
switch (GUID_HIPART(guid))
{
case HIGHGUID_ITEM: return "item";
case HIGHGUID_PLAYER: return guid ? "player" : "none";
@@ -85,7 +85,7 @@ bool ObjectPosSelector::FirstAngle(float& angle)
bool ObjectPosSelector::NextAngle(float& angle)
{
while(m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() ||
while (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() ||
m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end() ||
m_smallStepOk[USED_POS_PLUS] || m_smallStepOk[USED_POS_MINUS] )
{
@@ -99,7 +99,7 @@ bool ObjectPosSelector::NextAngle(float& angle)
bool ObjectPosSelector::NextUsedAngle(float& angle)
{
while(m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() ||
while (m_nextUsedPos[USED_POS_PLUS]!=m_UsedPosLists[USED_POS_PLUS].end() ||
m_nextUsedPos[USED_POS_MINUS]!=m_UsedPosLists[USED_POS_MINUS].end() )
{
// calculate next possible angle
+5 -5
View File
@@ -348,13 +348,13 @@ void Pet::SavePetToDB(PetSaveMode mode)
if (!IS_PLAYER_GUID(GetOwnerGUID()))
return;
Player* pOwner = (Player*)GetOwner();
if (!pOwner)
Player* owner = (Player*)GetOwner();
if (!owner)
return;
// not save pet as current if another pet temporary unsummoned
if (mode == PET_SAVE_AS_CURRENT && pOwner->GetTemporaryUnsummonedPetNumber() &&
pOwner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
if (mode == PET_SAVE_AS_CURRENT && owner->GetTemporaryUnsummonedPetNumber() &&
owner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
{
// pet will lost anyway at restore temporary unsummoned
if (getPetType() == HUNTER_PET)
@@ -483,7 +483,7 @@ void Pet::Update(uint32 diff)
if (m_loading)
return;
switch(m_deathState)
switch (m_deathState)
{
case CORPSE:
{
+78 -84
View File
@@ -151,7 +151,7 @@ PlayerTaxi::PlayerTaxi()
void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level)
{
// class specific initial known nodes
switch(chrClass)
switch (chrClass)
{
case CLASS_DEATH_KNIGHT:
{
@@ -162,7 +162,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
}
// race specific initial known nodes: capital and taxi hub masks
switch(race)
switch (race)
{
case RACE_HUMAN: SetTaximaskNode(2); break; // Human
case RACE_ORC: SetTaximaskNode(23); break; // Orc
@@ -178,7 +178,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
}
// new continent starting masks (It will be accessible only at new map)
switch(Player::TeamForRace(race))
switch (Player::TeamForRace(race))
{
case ALLIANCE: SetTaximaskNode(100); break;
case HORDE: SetTaximaskNode(99); break;
@@ -1035,7 +1035,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1077), 42999);
// Factions depending on team, like cities and some more stuff
switch(GetTeam())
switch (GetTeam())
{
case ALLIANCE:
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(72), 42999);
@@ -1132,7 +1132,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
// special amount for food/drink
if (iProto->Class == ITEM_CLASS_CONSUMABLE && iProto->SubClass == ITEM_SUBCLASS_FOOD)
{
switch(iProto->Spells[0].SpellCategory)
switch (iProto->Spells[0].SpellCategory)
{
case SPELL_CATEGORY_FOOD: // food
count = getClass() == CLASS_DEATH_KNIGHT ? 10 : 4;
@@ -1220,7 +1220,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
}
// item can't be added
sLog->outError("STORAGE: Can't equip or store initial item %u for race %u class %u , error msg = %u", titem_id, getRace(), getClass(), msg);
sLog->outError("STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
return false;
}
@@ -2384,13 +2384,13 @@ void Player::ProcessDelayedOperations()
ContinueTaxiFlight();
}
}
if (m_DelayedOperations & DELAYED_BG_GROUP_RESTORE)
{
if (Group *g = GetGroup())
g->SendUpdateToPlayer(GetGUID());
}
//we have executed ALL delayed ops, so clear the flag
m_DelayedOperations = 0;
}
@@ -2876,7 +2876,7 @@ void Player::SetGMVisible(bool on)
bool Player::IsGroupVisibleFor(Player const* p) const
{
switch(sWorld->getIntConfig(CONFIG_GROUP_VISIBILITY))
switch (sWorld->getIntConfig(CONFIG_GROUP_VISIBILITY))
{
default: return IsInSameGroupWith(p);
case 1: return IsInSameRaidWith(p);
@@ -3627,7 +3627,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
disabled_case = true;
}
else switch(itr->second->state)
else switch (itr->second->state)
{
case PLAYERSPELL_UNCHANGED: // known saved spell
return false;
@@ -3813,7 +3813,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0))
{
switch(GetSkillRangeType(pSkill, _spell_idx->second->racemask != 0))
switch (GetSkillRangeType(pSkill, _spell_idx->second->racemask != 0))
{
case SKILL_RANGE_LANGUAGE:
SetSkill(pSkill->id, GetSkillStep(pSkill->id), 300, 300);
@@ -4774,8 +4774,8 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
sObjectAccessor->ConvertCorpseForPlayer(playerguid);
if (uint32 guildId = GetGuildIdFromDB(playerguid))
if (Guild* pGuild = sGuildMgr->GetGuildById(guildId))
pGuild->DeleteMember(guid);
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
guild->DeleteMember(guid);
// remove from arena teams
LeaveAllArenaTeams(playerguid);
@@ -4992,14 +4992,14 @@ void Player::DeleteOldCharacters(uint32 keepDays)
{
Field* charFields = resultChars->Fetch();
Player::DeleteFromDB(charFields[0].GetUInt64(), charFields[1].GetUInt32(), true, true);
} while(resultChars->NextRow());
} while (resultChars->NextRow());
}
}
void Player::SetMovement(PlayerMovementType pType)
{
WorldPacket data;
switch(pType)
switch (pType)
{
case MOVE_ROOT: data.Initialize(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size()+4); break;
case MOVE_UNROOT: data.Initialize(SMSG_FORCE_MOVE_UNROOT, GetPackGUID().size()+4); break;
@@ -5462,11 +5462,11 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
return TotalCost;
}
Guild* pGuild = sGuildMgr->GetGuildById(GetGuildId());
if (!pGuild)
Guild* guild = sGuildMgr->GetGuildById(GetGuildId());
if (!guild)
return TotalCost;
if (!pGuild->HandleMemberWithdrawMoney(GetSession(), costs, true))
if (!guild->HandleMemberWithdrawMoney(GetSession(), costs, true))
return TotalCost;
TotalCost = costs;
@@ -5699,7 +5699,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
if (!CanModifyStats())
return;
switch(modGroup)
switch (modGroup)
{
case CRIT_PERCENTAGE: UpdateCritPercentage(BASE_ATTACK); break;
case RANGED_CRIT_PERCENTAGE: UpdateCritPercentage(RANGED_ATTACK); break;
@@ -6250,7 +6250,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
switch(attType)
switch (attType)
{
case BASE_ATTACK:
{
@@ -9057,11 +9057,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 3698:
case 3702:
case 3968:
NumberOfFields = 11;
break;
case 4378:
NumberOfFields = 11;
break;
case 3703:
NumberOfFields = 11;
break;
@@ -9072,8 +9068,6 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
NumberOfFields = 28;
break;
case 4812: // Icecrown Citadel
NumberOfFields = 13;
break;
case 4100: // The Culling of Stratholme
NumberOfFields = 13;
break;
@@ -10166,7 +10160,7 @@ Item* Player::GetShield(bool useable) const
uint8 Player::GetAttackBySlot(uint8 slot)
{
switch(slot)
switch (slot)
{
case EQUIPMENT_SLOT_MAINHAND: return BASE_ATTACK;
case EQUIPMENT_SLOT_OFFHAND: return OFF_ATTACK;
@@ -12149,7 +12143,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
else if (slot == EQUIPMENT_SLOT_OFFHAND)
UpdateExpertise(OFF_ATTACK);
switch(slot)
switch (slot)
{
case EQUIPMENT_SLOT_MAINHAND:
case EQUIPMENT_SLOT_OFFHAND:
@@ -12307,7 +12301,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
else if (slot == EQUIPMENT_SLOT_OFFHAND)
UpdateExpertise(OFF_ATTACK);
// update armor penetration - passive auras may need it
switch(slot)
switch (slot)
{
case EQUIPMENT_SLOT_MAINHAND:
case EQUIPMENT_SLOT_OFFHAND:
@@ -13260,7 +13254,7 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint
data << uint64(pItem2 ? pItem2->GetGUID() : 0);
data << uint8(0); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
switch(msg)
switch (msg)
{
case EQUIP_ERR_CANT_EQUIP_LEVEL_I:
case EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW:
@@ -13291,11 +13285,11 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint
GetSession()->SendPacket(&data);
}
void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param)
void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_BUY_FAILED");
WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1));
data << uint64(pCreature ? pCreature->GetGUID() : 0);
data << uint64(creature ? creature->GetGUID() : 0);
data << uint32(item);
if (param > 0)
data << uint32(param);
@@ -13303,11 +13297,11 @@ void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint3
GetSession()->SendPacket(&data);
}
void Player::SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param)
void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SELL_ITEM");
WorldPacket data(SMSG_SELL_ITEM, (8+8+(param?4:0)+1)); // last check 2.0.10
data << uint64(pCreature ? pCreature->GetGUID() : 0);
data << uint64(creature ? creature->GetGUID() : 0);
data << uint64(guid);
if (param > 0)
data << uint32(param);
@@ -13563,7 +13557,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
uint32 enchant_amount = pEnchant->amount[s];
uint32 enchant_spell_id = pEnchant->spellid[s];
switch(enchant_display_type)
switch (enchant_display_type)
{
case ITEM_ENCHANTMENT_TYPE_NONE:
break;
@@ -13864,7 +13858,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
default:
sLog->outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type);
break;
} /*switch(enchant_display_type)*/
} /*switch (enchant_display_type)*/
} /*for*/
}
@@ -14348,11 +14342,11 @@ void Player::PrepareQuestMenu(uint64 guid)
QuestRelationBounds pObjectQIR;
// pets also can have quests
Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (pCreature)
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (creature)
{
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry());
pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(pCreature->GetEntry());
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
}
else
{
@@ -14459,10 +14453,10 @@ void Player::SendPreparedQuest(uint64 guid)
std::string title = "";
// need pet case for some quests
Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (pCreature)
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (creature)
{
uint32 textid = GetGossipTextId(pCreature);
uint32 textid = GetGossipTextId(creature);
GossipText const* gossiptext = sObjectMgr->GetGossipText(textid);
if (!gossiptext)
{
@@ -14507,9 +14501,9 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* pQuest)
{
QuestRelationBounds pObjectQR;
Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (pCreature)
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry());
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (creature)
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
else
{
//we should obtain map pointer from GetMap() in 99% of cases. Special case
@@ -15284,7 +15278,7 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
return false;
}
// ReputationObjective2 does not seem to be an objective requirement but a requirement
// to be able to accept the quest
uint32 fIdObj = qInfo->GetRepObjectiveFaction2();
@@ -15668,9 +15662,9 @@ void Player::AreaExploredOrEventHappens(uint32 questId)
//not used in Trinityd, function for external script library
void Player::GroupEventHappens(uint32 questId, WorldObject const* pEventObject)
{
if (Group* pGroup = GetGroup())
if (Group* group = GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
@@ -15863,7 +15857,7 @@ void Player::KilledPlayerCredit()
{
uint32 reqkill = qInfo->GetPlayersSlain();
uint16 curkill = q_status.m_playercount;
if (curkill < reqkill)
{
q_status.m_playercount = curkill + addkillcount;
@@ -16253,12 +16247,12 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
}
}
void Player::SendPushToPartyResponse(Player* pPlayer, uint32 msg)
void Player::SendPushToPartyResponse(Player* player, uint32 msg)
{
if (pPlayer)
if (player)
{
WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1));
data << uint64(pPlayer->GetGUID());
data << uint64(player->GetGUID());
data << uint8(msg); // valid values: 0-8
GetSession()->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_QUEST_PUSH_RESULT");
@@ -17122,7 +17116,7 @@ bool Player::isAllowedToLoot(const Creature* creature)
{
if (!creature->isDead() || !creature->IsDamageEnoughForLootingAndReward())
return false;
if (HasPendingBind())
return false;
@@ -17136,7 +17130,7 @@ bool Player::isAllowedToLoot(const Creature* creature)
else if (thisGroup != creature->GetLootRecipientGroup())
return false;
switch(thisGroup->GetLootMethod())
switch (thisGroup->GetLootMethod())
{
case FREE_FOR_ALL:
return true;
@@ -19295,7 +19289,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
if (returnreagent)
{
switch(pet->GetEntry())
switch (pet->GetEntry())
{
//warlock pets except imp are removed(?) when logging out
case 1860:
@@ -20336,7 +20330,7 @@ void Player::InitDisplayIds()
}
uint8 gender = getGender();
switch(gender)
switch (gender)
{
case GENDER_FEMALE:
SetDisplayId(info->displayId_f);
@@ -20434,24 +20428,24 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
return false;
}
Creature* pCreature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature)
Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)));
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0);
return false;
}
VendorItemData const* vItems = pCreature->GetVendorItems();
VendorItemData const* vItems = creature->GetVendorItems();
if (!vItems || vItems->Empty())
{
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
return false;
}
if (vendorslot >= vItems->GetItemCount())
{
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
return false;
}
@@ -20459,23 +20453,23 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
// store diff item (cheating)
if (!crItem || crItem->item != item)
{
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
return false;
}
// check current item amount if it limited
if (crItem->maxcount != 0)
{
if (pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
if (creature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
{
SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0);
SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0);
return false;
}
}
if (pProto->RequiredReputationFaction && (uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank))
{
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0);
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0);
return false;
}
@@ -20533,18 +20527,18 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
// reputation discount
price = uint32(floor(price * GetReputationPriceDiscount(pCreature)));
price = uint32(floor(price * GetReputationPriceDiscount(creature)));
if (!HasEnoughMoney(price))
{
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, item, 0);
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0);
return false;
}
}
if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot))
{
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, pCreature, crItem, true))
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, true))
return false;
}
else if (IsEquipmentPos(bag, slot))
@@ -20554,7 +20548,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL);
return false;
}
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, pCreature, crItem, false))
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false))
return false;
}
else
@@ -20881,7 +20875,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
// if have <CompareColor> use them as count, else use <value> from Condition
uint32 _cmp_gem = Condition->CompareColor[i] ? curcount[Condition->CompareColor[i] - 1]: Condition->Value[i];
switch(Condition->Comparator[i])
switch (Condition->Comparator[i])
{
case 2: // requires less <color> than (<value> || <comparecolor>) gems
activate &= (_cur_gem < _cmp_gem) ? true : false;
@@ -21603,7 +21597,7 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8
WorldPacket data(SMSG_TRANSFER_ABORTED, 4+2);
data << uint32(mapid);
data << uint8(reason); // transfer abort reason
switch(reason)
switch (reason)
{
case TRANSFER_ABORT_INSUF_EXPAN_LVL:
case TRANSFER_ABORT_DIFFICULTY:
@@ -21970,9 +21964,9 @@ bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
return true;
}
float Player::GetReputationPriceDiscount(Creature const* pCreature) const
float Player::GetReputationPriceDiscount(Creature const* creature) const
{
FactionTemplateEntry const* vendor_faction = pCreature->getFactionTemplateEntry();
FactionTemplateEntry const* vendor_faction = creature->getFactionTemplateEntry();
if (!vendor_faction || !vendor_faction->faction)
return 1.0f;
@@ -22383,9 +22377,9 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
uint64 creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0);
// prepare data for near group iteration
if (Group* pGroup = GetGroup())
if (Group* group = GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if (!pGroupGuy)
@@ -22399,7 +22393,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
}
}
else // if (!pGroup)
else // if (!group)
KilledMonsterCredit(creature_id, creature_guid);
}
@@ -22518,7 +22512,7 @@ void Player::UpdateAreaDependentAuras(uint32 newArea)
if (newArea == 4273 && GetVehicle() && GetPositionX() > 400) // Ulduar
{
switch(GetVehicleBase()->GetEntry())
switch (GetVehicleBase()->GetEntry())
{
case 33062:
case 33109:
@@ -22618,14 +22612,14 @@ void Player::SendCorpseReclaimDelay(bool load)
Player* Player::GetNextRandomRaidMember(float radius)
{
Group* pGroup = GetGroup();
if (!pGroup)
Group* group = GetGroup();
if (!group)
return NULL;
std::vector<Player*> nearMembers;
nearMembers.reserve(pGroup->GetMembersCount());
nearMembers.reserve(group->GetMembersCount());
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
@@ -23319,7 +23313,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
}
// set fixed skill ranges
switch(GetSkillRangeType(pSkill, false))
switch (GetSkillRangeType(pSkill, false))
{
case SKILL_RANGE_LANGUAGE: // 300..300
value = max = 300;
@@ -23522,7 +23516,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
}
//Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d" , movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
}
}
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute
+5 -5
View File
@@ -1317,8 +1317,8 @@ class Player : public Unit, public GridObject<Player>
void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; }
void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0);
void SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param);
void SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param);
void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param);
void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param);
void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
@@ -1337,7 +1337,7 @@ class Player : public Unit, public GridObject<Player>
bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
float GetReputationPriceDiscount(Creature const* pCreature) const;
float GetReputationPriceDiscount(Creature const* creature) const;
Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : NULL; }
TradeData* GetTradeData() const { return m_trade; }
@@ -1485,7 +1485,7 @@ class Player : public Unit, public GridObject<Player>
void SendQuestTimerFailed(uint32 quest_id);
void SendCanTakeQuestResponse(uint32 msg);
void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver);
void SendPushToPartyResponse(Player* pPlayer, uint32 msg);
void SendPushToPartyResponse(Player* player, uint32 msg);
void SendQuestUpdateAddItem(Quest const* pQuest, uint32 item_idx, uint16 count);
void SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count);
void SendQuestUpdateAddPlayer(Quest const* pQuest, uint16 old_count, uint16 add_count);
@@ -1806,7 +1806,7 @@ class Player : public Unit, public GridObject<Player>
bool IsInSameGroupWith(Player const* p) const;
bool IsInSameRaidWith(Player const* p) const { return p == this || (GetGroup() != NULL && GetGroup() == p->GetGroup()); }
void UninviteFromGroup();
static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0 , const char* reason = NULL);
static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
void SendUpdateToOutOfRangeGroupMembers();
@@ -116,7 +116,7 @@ void MapManager::LoadTransports()
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
std::string name = fields[2].GetString();
sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid);
sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);
}
while (result->NextRow());
}
@@ -642,39 +642,39 @@ void Transport::BuildStopMovePacket(Map const* targetMap)
uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim)
{
Map* map = GetMap();
Creature* pCreature = new Creature;
Creature* creature = new Creature;
if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
{
delete pCreature;
delete creature;
return 0;
}
pCreature->SetTransport(this);
pCreature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
pCreature->m_movementInfo.guid = GetGUID();
pCreature->m_movementInfo.t_pos.Relocate(x, y, z, o);
creature->SetTransport(this);
creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
creature->m_movementInfo.guid = GetGUID();
creature->m_movementInfo.t_pos.Relocate(x, y, z, o);
if (anim)
pCreature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
pCreature->Relocate(
creature->Relocate(
GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
z + GetPositionZ() ,
z + GetPositionZ(),
o + GetOrientation());
pCreature->SetHomePosition(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ(), pCreature->GetOrientation());
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
if (!pCreature->IsPositionValid())
if (!creature->IsPositionValid())
{
sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", pCreature->GetGUIDLow(), pCreature->GetEntry(), pCreature->GetPositionX(), pCreature->GetPositionY());
delete pCreature;
sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
delete creature;
return 0;
}
map->Add(pCreature);
m_NPCPassengerSet.insert(pCreature);
map->Add(creature);
m_NPCPassengerSet.insert(creature);
if (tguid == 0)
{
@@ -684,8 +684,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
else
currenttguid = std::max(tguid, currenttguid);
pCreature->SetGUIDTransport(tguid);
sScriptMgr->OnAddCreaturePassenger(this, pCreature);
creature->SetGUIDTransport(tguid);
sScriptMgr->OnAddCreaturePassenger(this, creature);
return tguid;
}
+9 -9
View File
@@ -68,7 +68,7 @@ bool Player::UpdateStats(Stats stat)
pet->UpdateStats(stat);
}
switch(stat)
switch (stat)
{
case STAT_STRENGTH:
UpdateShieldBlockValue();
@@ -472,7 +472,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
{
UnitMods unitMod;
switch(attType)
switch (attType)
{
case BASE_ATTACK:
default:
@@ -584,7 +584,7 @@ void Player::UpdateCritPercentage(WeaponAttackType attType)
uint16 index;
CombatRating cr;
switch(attType)
switch (attType)
{
case OFF_ATTACK:
modGroup = OFFHAND_CRIT_PERCENTAGE;
@@ -814,7 +814,7 @@ void Player::UpdateExpertise(WeaponAttackType attack)
if (expertise < 0)
expertise = 0;
switch(attack)
switch (attack)
{
case BASE_ATTACK: SetUInt32Value(PLAYER_EXPERTISE, expertise); break;
case OFF_ATTACK: SetUInt32Value(PLAYER_OFFHAND_EXPERTISE, expertise); break;
@@ -998,7 +998,7 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
void Creature::UpdateDamagePhysical(WeaponAttackType attType)
{
UnitMods unitMod;
switch(attType)
switch (attType)
{
case BASE_ATTACK:
default:
@@ -1034,7 +1034,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
float mindamage = ((base_value + weapon_mindamage) * dmg_multiplier * base_pct + total_value) * total_pct;
float maxdamage = ((base_value + weapon_maxdamage) * dmg_multiplier * base_pct + total_value) * total_pct;
switch(attType)
switch (attType)
{
case BASE_ATTACK:
default:
@@ -1221,7 +1221,7 @@ void Guardian::UpdateMaxHealth()
float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA);
float multiplicator;
switch(GetEntry())
switch (GetEntry())
{
case ENTRY_IMP: multiplicator = 8.4f; break;
case ENTRY_VOIDWALKER: multiplicator = 11.0f; break;
@@ -1246,7 +1246,7 @@ void Guardian::UpdateMaxPower(Powers power)
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
float multiplicator = 15.0f;
switch(GetEntry())
switch (GetEntry())
{
case ENTRY_IMP: multiplicator = 4.95f; break;
case ENTRY_VOIDWALKER:
@@ -1386,7 +1386,7 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
// Pet's base damage changes depending on happiness
if (isHunterPet() && attType == BASE_ATTACK)
{
switch(ToPet()->GetHappinessState())
switch (ToPet()->GetHappinessState())
{
case HAPPY:
// 125% of normal damage
+78 -76
View File
@@ -685,7 +685,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
uint32 weaponSpeedHitFactor;
uint32 rage_damage = damage + cleanDamage->absorbed_damage;
switch(cleanDamage->attackType)
switch (cleanDamage->attackType)
{
case BASE_ATTACK:
{
@@ -1196,7 +1196,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
// Calculate armor reduction
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
{
damageInfo->damage = CalcArmorReducedDamage(damageInfo->target, damage, NULL , damageInfo->attackType);
damageInfo->damage = CalcArmorReducedDamage(damageInfo->target, damage, NULL, damageInfo->attackType);
damageInfo->cleanDamage += damage - damageInfo->damage;
}
else
@@ -1420,7 +1420,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
{
SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
// Damage shield can be resisted...
if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto , false))
if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false))
{
victim->SendSpellMiss(this, i_spellProto->Id, missInfo);
continue;
@@ -2734,7 +2734,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victi
if (GetTypeId() == TYPEID_PLAYER)
{
switch(attackType)
switch (attackType)
{
case BASE_ATTACK:
crit = GetFloatValue(PLAYER_CRIT_PERCENTAGE);
@@ -3601,7 +3601,7 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster, AuraRemoveMode rem
if ((aura->GetType() == UNIT_AURA_TYPE)
&& (!caster || aura->GetCasterGUID() == caster))
{
aura->ModStackAmount(-1,removeMode);
aura->ModStackAmount(-1, removeMode);
return;
}
else
@@ -4079,7 +4079,7 @@ void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime)
// update for out of range group members (on 1 slot use)
aura->SetNeedClientUpdateForTargets();
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura %u partially interrupted on unit %u, new duration: %u ms", aura->GetId() , GetGUIDLow(), aura->GetDuration());
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura %u partially interrupted on unit %u, new duration: %u ms", aura->GetId(), GetGUIDLow(), aura->GetDuration());
}
}
}
@@ -4769,7 +4769,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
data << uint32(aura->GetId()); // spellId
data << uint32(1); // count
data << uint32(aura->GetAuraType()); // auraId
switch(aura->GetAuraType())
switch (aura->GetAuraType())
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
@@ -4928,11 +4928,11 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
Unit* target = victim;
int32 basepoints0 = 0;
switch(hasteSpell->SpellFamilyName)
switch (hasteSpell->SpellFamilyName)
{
case SPELLFAMILY_ROGUE:
{
switch(hasteSpell->Id)
switch (hasteSpell->Id)
{
// Blade Flurry
case 13877:
@@ -4987,11 +4987,11 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
Unit* target = victim;
int32 basepoints0 = 0;
switch(triggeredByAuraSpell->SpellFamilyName)
switch (triggeredByAuraSpell->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
{
switch(triggeredByAuraSpell->Id)
switch (triggeredByAuraSpell->Id)
{
// Focus Magic
case 54646:
@@ -5054,7 +5054,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
int32 basepoints0 = 0;
uint64 originalCaster = 0;
switch(dummySpell->SpellFamilyName)
switch (dummySpell->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
@@ -5118,7 +5118,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!GetAuraEffect(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELLFAMILY_MAGE, 0x10000000, 0, 0))
return false;
switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
case SPELL_SCHOOL_HOLY:
@@ -5141,7 +5141,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!procSpell)
return false;
switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
@@ -5701,7 +5701,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 37436;
break;
}
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Glyph of Polymorph
case 56375:
@@ -5795,7 +5795,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
case SPELLFAMILY_WARRIOR:
{
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Sweeping Strikes
case 12328:
@@ -6206,7 +6206,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
case SPELLFAMILY_DRUID:
{
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Glyph of Innervate
case 54832:
@@ -6957,7 +6957,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
case SPELLFAMILY_SHAMAN:
{
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Earthen Power (Rank 1, 2)
case 51523:
@@ -7271,6 +7271,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Frozen Power
if (dummySpell->SpellIconID == 3780)
{
if (!target)
return false;
if (GetDistance(target) < 15.0f)
return false;
float chance = (float)triggerAmount;
@@ -7776,7 +7778,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
Unit* target = victim;
int32 basepoints0 = 0;
switch(dummySpell->SpellFamilyName)
switch (dummySpell->SpellFamilyName)
{
case SPELLFAMILY_HUNTER:
{
@@ -7829,7 +7831,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
Unit* target = victim;
int32 basepoints0 = 0;
switch(dummySpell->SpellFamilyName)
switch (dummySpell->SpellFamilyName)
{
case SPELLFAMILY_PALADIN:
{
@@ -7878,7 +7880,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
{
SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
switch(dummySpell->SpellFamilyName)
switch (dummySpell->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch (dummySpell->Id)
@@ -7943,7 +7945,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
if (procSpell->SpellFamilyFlags[0] & 0x40000000 && procSpell->SpellIconID == 242)
{
*handled = true;
if (victim->HasAura(53601))
if (victim && victim->HasAura(53601))
{
int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2]. CalcValue());
// Item - Paladin T9 Holy 4P Bonus
@@ -8084,7 +8086,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
return false;
}
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Bone Shield cooldown
case 49222:
@@ -8270,7 +8272,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
@@ -8456,7 +8458,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Holy Shock heal
if (procSpell->SpellFamilyFlags[1] & 0x00010000)
{
switch(procSpell->Id)
switch (procSpell->Id)
{
case 25914: originalSpellId = 20473; break;
case 25913: originalSpellId = 20929; break;
@@ -8562,7 +8564,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
@@ -9038,7 +9040,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au
uint32 triggered_spell_id = 0;
switch(scriptId)
switch (scriptId)
{
case 836: // Improved Blizzard (Rank 1)
{
@@ -9089,7 +9091,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au
{
if (!roll_chance_i(triggeredByAura->GetAmount()))
return false;
switch(victim->getPowerType())
switch (victim->getPowerType())
{
case POWER_MANA: triggered_spell_id = 48542; break;
case POWER_RAGE: triggered_spell_id = 48541; break;
@@ -9147,7 +9149,7 @@ void Unit::setPowerType(Powers new_powertype)
}
}
switch(new_powertype)
switch (new_powertype)
{
default:
case POWER_MANA:
@@ -10079,9 +10081,9 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
if (!player)
return NULL;
Group* pGroup = player->GetGroup();
Group* group = player->GetGroup();
// When there is no group check pet presence
if (!pGroup)
if (!group)
{
// We are pet now, return owner
if (player != this)
@@ -10096,9 +10098,9 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
std::vector<Unit*> nearMembers;
// reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
nearMembers.reserve(pGroup->GetMembersCount() * 2);
nearMembers.reserve(group->GetMembersCount() * 2);
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player* Target = itr->getSource())
{
// IsHostileTo check duel and controlled by enemy
@@ -10405,7 +10407,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
}
// Custom scripted damage
switch(spellProto->SpellFamilyName)
switch (spellProto->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
// Ice Lance
@@ -10577,7 +10579,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
switch((*i)->GetSpellInfo()->SpellIconID)
switch ((*i)->GetSpellInfo()->SpellIconID)
{
// Cheat Death
case 2109:
@@ -10814,7 +10816,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
return false;
float crit_chance = 0.0f;
switch(spellProto->DmgClass)
switch (spellProto->DmgClass)
{
case SPELL_DAMAGE_CLASS_NONE:
// We need more spells to find a general way (if there is any)
@@ -10857,7 +10859,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
if (!((*i)->IsAffectedOnSpell(spellProto)))
continue;
int32 modChance = 0;
switch((*i)->GetMiscValue())
switch ((*i)->GetMiscValue())
{
// Shatter
case 911: modChance+= 16;
@@ -10954,7 +10956,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
if (victim)
{
// Custom crit by class
switch(spellProto->SpellFamilyName)
switch (spellProto->SpellFamilyName)
{
case SPELLFAMILY_DRUID:
// Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets
@@ -11008,7 +11010,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage
int32 crit_bonus = damage;
float crit_mod = 0.0f;
switch(spellProto->DmgClass)
switch (spellProto->DmgClass)
{
case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
case SPELL_DAMAGE_CLASS_RANGED:
@@ -11043,7 +11045,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag
{
// Calculate critical bonus
int32 crit_bonus;
switch(spellProto->DmgClass)
switch (spellProto->DmgClass)
{
case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
case SPELL_DAMAGE_CLASS_RANGED:
@@ -11099,7 +11101,7 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32
{
if (!(*i)->IsAffectedOnSpell(spellProto))
continue;
switch((*i)->GetMiscValue())
switch ((*i)->GetMiscValue())
{
case 4415: // Increased Rejuvenation Healing
case 4953:
@@ -11144,7 +11146,7 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32
}
case 7871: // Glyph of Lesser Healing Wave
{
if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0 , 0x00000400, 0, GetGUID()))
if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
break;
}
@@ -11680,7 +11682,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
// Custom scripted damage
if (spellProto)
switch(spellProto->SpellFamilyName)
switch (spellProto->SpellFamilyName)
{
case SPELLFAMILY_DEATHKNIGHT:
// Glacier Rot
@@ -11723,7 +11725,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
switch((*i)->GetSpellInfo()->SpellIconID)
switch ((*i)->GetSpellInfo()->SpellIconID)
{
// Cheat Death
case 2109:
@@ -11759,7 +11761,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
/*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
{
switch((*i)->GetMiscValue())
switch ((*i)->GetMiscValue())
{
}
}*/
@@ -12559,7 +12561,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
WorldPacket data;
if (!forced)
{
switch(mtype)
switch (mtype)
{
case MOVE_WALK:
data.Initialize(MSG_MOVE_SET_WALK_SPEED, 8+4+2+4+4+4+4+4+4+4);
@@ -12618,7 +12620,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
pet->SetSpeed(mtype, m_speed_rate[mtype], forced);
}
switch(mtype)
switch (mtype)
{
case MOVE_WALK:
data.Initialize(SMSG_FORCE_WALK_SPEED_CHANGE, 16);
@@ -13202,7 +13204,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
{
DiminishingLevels diminish = Level;
switch(diminish)
switch (diminish)
{
case DIMINISHING_LEVEL_1: break;
case DIMINISHING_LEVEL_2: mod = 0.65f; break;
@@ -13220,7 +13222,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
|| GetDiminishingReturnsGroupType(group) == DRTYPE_ALL)
{
DiminishingLevels diminish = Level;
switch(diminish)
switch (diminish)
{
case DIMINISHING_LEVEL_1: break;
case DIMINISHING_LEVEL_2: mod = 0.5f; break;
@@ -13334,7 +13336,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
if (!CanModifyStats())
return false;
switch(unitMod)
switch (unitMod)
{
case UNIT_MOD_STAT_STRENGTH:
case UNIT_MOD_STAT_AGILITY:
@@ -13427,7 +13429,7 @@ SpellSchools Unit::GetSpellSchoolByAuraGroup(UnitMods unitMod) const
{
SpellSchools school = SPELL_SCHOOL_NORMAL;
switch(unitMod)
switch (unitMod)
{
case UNIT_MOD_RESISTANCE_HOLY: school = SPELL_SCHOOL_HOLY; break;
case UNIT_MOD_RESISTANCE_FIRE: school = SPELL_SCHOOL_FIRE; break;
@@ -13447,7 +13449,7 @@ Stats Unit::GetStatByAuraGroup(UnitMods unitMod) const
{
Stats stat = STAT_STRENGTH;
switch(unitMod)
switch (unitMod)
{
case UNIT_MOD_STAT_STRENGTH: stat = STAT_STRENGTH; break;
case UNIT_MOD_STAT_AGILITY: stat = STAT_AGILITY; break;
@@ -13495,7 +13497,7 @@ float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
}
}
float Unit::GetWeaponDamageRange(WeaponAttackType attType , WeaponDamageRange type) const
float Unit::GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const
{
if (attType == OFF_ATTACK && !haveOffhandWeapon())
return 0.0f;
@@ -13803,8 +13805,8 @@ CharmInfo::~CharmInfo()
void CharmInfo::RestoreState()
{
if (m_unit->GetTypeId() == TYPEID_UNIT)
if (Creature* pCreature = m_unit->ToCreature())
pCreature->SetReactState(m_oldReactState);
if (Creature* creature = m_unit->ToCreature())
creature->SetReactState(m_oldReactState);
}
void CharmInfo::InitPetActionBar()
@@ -14306,7 +14308,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
AuraEffect* triggeredByAura = i->aura->GetEffect(effIndex);
ASSERT(triggeredByAura);
switch(triggeredByAura->GetAuraType())
switch (triggeredByAura->GetAuraType())
{
case SPELL_AURA_PROC_TRIGGER_SPELL:
{
@@ -14318,7 +14320,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
}
case SPELL_AURA_PROC_TRIGGER_DAMAGE:
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount() , spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, spellInfo->SchoolMask);
uint32 damage = SpellDamageBonus(pTarget, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
@@ -15588,7 +15590,7 @@ void Unit::SetControlled(bool apply, UnitState state)
return;
AddUnitState(state);
switch(state)
switch (state)
{
case UNIT_STAT_STUNNED:
SetStunned(true);
@@ -15618,7 +15620,7 @@ void Unit::SetControlled(bool apply, UnitState state)
}
else
{
switch(state)
switch (state)
{
case UNIT_STAT_STUNNED: if (HasAuraType(SPELL_AURA_MOD_STUN)) return;
else SetStunned(false); break;
@@ -15680,8 +15682,8 @@ void Unit::SetStunned(bool apply)
SetTarget(getVictim()->GetGUID());
// don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
Unit* pOwner = GetOwner();
if (!pOwner || (pOwner->GetTypeId() == TYPEID_PLAYER && !pOwner->ToPlayer()->IsMounted()))
Unit* owner = GetOwner();
if (!owner || (owner->GetTypeId() == TYPEID_PLAYER && !owner->ToPlayer()->IsMounted()))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
if (!HasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
@@ -15901,7 +15903,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (charmer->GetTypeId() == TYPEID_PLAYER)
{
switch(type)
switch (type)
{
case CHARM_TYPE_VEHICLE:
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
@@ -16008,7 +16010,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (charmer->GetTypeId() == TYPEID_PLAYER)
{
switch(type)
switch (type)
{
case CHARM_TYPE_VEHICLE:
charmer->ToPlayer()->SetClientControl(charmer, 1);
@@ -16181,10 +16183,10 @@ void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius)
if (!owner)
return;
Group* pGroup = owner->GetGroup();
if (pGroup)
Group* group = owner->GetGroup();
if (group)
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
@@ -16212,15 +16214,15 @@ void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius)
void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius)
{
Unit* owner = GetCharmerOrOwnerOrSelf();
Group* pGroup = NULL;
Group* group = NULL;
if (owner->GetTypeId() == TYPEID_PLAYER)
pGroup = owner->ToPlayer()->GetGroup();
group = owner->ToPlayer()->GetGroup();
if (pGroup)
if (group)
{
uint8 subgroup = owner->ToPlayer()->GetSubGroup();
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
@@ -16249,15 +16251,15 @@ void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius)
void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap)
{
Unit* owner = GetCharmerOrOwnerOrSelf();
Group* pGroup = NULL;
Group* group = NULL;
if (owner->GetTypeId() == TYPEID_PLAYER)
pGroup = owner->ToPlayer()->GetGroup();
group = owner->ToPlayer()->GetGroup();
if (pGroup)
if (group)
{
uint8 subgroup = owner->ToPlayer()->GetSubGroup();
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
@@ -16510,7 +16512,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
data.append(GetPackGUID());
data << uint32(0); // Sequence
data << uint32(0); // counter
data << float(vcos); // x direction
data << float(vsin); // y direction
data << float(speedXY); // Horizontal speed
@@ -16572,7 +16574,7 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form)
// Male
if (getGender() == GENDER_MALE)
{
switch(skinColor)
switch (skinColor)
{
case 12: // White
case 13:
+5 -5
View File
@@ -1443,7 +1443,7 @@ class Unit : public WorldObject
int32 DealHeal(Unit* pVictim, uint32 addhealth);
void ProcDamageAndSpell(Unit* pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL);
void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage , SpellInfo const* procAura = NULL);
void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = NULL);
void GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTriggeringProc, std::list<AuraApplication*>* procAuras, ProcEventInfo eventInfo);
void TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo);
@@ -1490,7 +1490,7 @@ class Unit : public WorldObject
int32 GetMechanicResistChance(const SpellInfo* spell);
bool CanUseAttackType(uint8 attacktype) const
{
switch(attacktype)
switch (attacktype)
{
case BASE_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED);
case OFF_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND);
@@ -1783,7 +1783,7 @@ class Unit : public WorldObject
AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags
AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1 , uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0);
AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0);
inline AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);}
AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
@@ -1926,8 +1926,8 @@ class Unit : public WorldObject
virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0;
virtual void UpdateDamagePhysical(WeaponAttackType attType) = 0;
float GetTotalAttackPowerValue(WeaponAttackType attType) const;
float GetWeaponDamageRange(WeaponAttackType attType , WeaponDamageRange type) const;
void SetBaseWeaponDamage(WeaponAttackType attType , WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const;
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
bool isInFrontInMap(Unit const* target, float distance, float arc = M_PI) const;
void SetInFront(Unit const* target)
+1 -1
View File
@@ -159,7 +159,7 @@ void Vehicle::ApplyAllImmunities()
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_UNATTACKABLE, true);
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_SCHOOL_ABSORB, true);
_me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHIELD, true);
_me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_IMMUNE_SHIELD , true);
_me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_IMMUNE_SHIELD, true);
// ... Resistance, Split damage, Change stats ...
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_DAMAGE_SHIELD, true);
+22 -22
View File
@@ -30,7 +30,7 @@
bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
{
switch(mGameEvent[entry].state)
switch (mGameEvent[entry].state)
{
default:
case GAMEEVENT_NORMAL:
@@ -1079,7 +1079,7 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
void GameEventMgr::ApplyNewEvent(uint16 event_id)
{
switch(sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE))
switch (sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE))
{
case 0: // disable
break;
@@ -1174,12 +1174,12 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
Creature* pCreature = new Creature;
Creature* creature = new Creature;
//sLog->outDebug("Spawning creature %u", *itr);
if (!pCreature->LoadFromDB(*itr, map))
delete pCreature;
if (!creature->LoadFromDB(*itr, map))
delete creature;
else
map->Add(pCreature);
map->Add(creature);
}
}
}
@@ -1248,8 +1248,8 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{
sObjectMgr->RemoveCreatureFromGrid(*itr, data);
if (Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
pCreature->AddObjectToRemoveList();
if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
creature->AddObjectToRemoveList();
}
}
@@ -1296,38 +1296,38 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
continue;
// Update if spawned
Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL);
if (pCreature)
Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL);
if (creature)
{
if (activate)
{
itr->second.equipement_id_prev = pCreature->GetCurrentEquipmentId();
itr->second.modelid_prev = pCreature->GetDisplayId();
pCreature->LoadEquipment(itr->second.equipment_id, true);
itr->second.equipement_id_prev = creature->GetCurrentEquipmentId();
itr->second.modelid_prev = creature->GetDisplayId();
creature->LoadEquipment(itr->second.equipment_id, true);
if (itr->second.modelid >0 && itr->second.modelid_prev != itr->second.modelid)
{
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(itr->second.modelid);
if (minfo)
{
pCreature->SetDisplayId(itr->second.modelid);
pCreature->SetNativeDisplayId(itr->second.modelid);
pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius);
pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach);
creature->SetDisplayId(itr->second.modelid);
creature->SetNativeDisplayId(itr->second.modelid);
creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius);
creature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach);
}
}
}
else
{
pCreature->LoadEquipment(itr->second.equipement_id_prev, true);
creature->LoadEquipment(itr->second.equipement_id_prev, true);
if (itr->second.modelid_prev >0 && itr->second.modelid_prev != itr->second.modelid)
{
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(itr->second.modelid_prev);
if (minfo)
{
pCreature->SetDisplayId(itr->second.modelid_prev);
pCreature->SetNativeDisplayId(itr->second.modelid_prev);
pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius);
pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach);
creature->SetDisplayId(itr->second.modelid_prev);
creature->SetNativeDisplayId(itr->second.modelid_prev);
creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius);
creature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach);
}
}
}
+13 -13
View File
@@ -199,7 +199,7 @@ bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clicke
if (questStart)
{
// not in expected required quest state
if (((!questStartCanActive || !playerClicker->IsActiveQuest(questStart)) && !playerClicker->GetQuestRewardStatus(questStart)))
if ((!questStartCanActive || !playerClicker->IsActiveQuest(questStart)) && !playerClicker->GetQuestRewardStatus(questStart))
return false;
}
@@ -2266,7 +2266,7 @@ void ObjectMgr::LoadItemTemplates()
if (itemTemplate.Unk0 != dbcitem->Unk0)
{
sLog->outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i) , must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0);
sLog->outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0);
if (enforceDBCAttributes)
itemTemplate.Unk0 = dbcitem->Unk0;
}
@@ -3612,7 +3612,7 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play
// if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
{
switch(_class)
switch (_class)
{
case CLASS_WARRIOR:
info->stats[STAT_STRENGTH] += (lvl > 23 ? 2: (lvl > 1 ? 1: 0));
@@ -4206,7 +4206,7 @@ void ObjectMgr::LoadQuests()
}
if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
{
sLog->outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewRepFaction[j] , qinfo->RewRepFaction[j]);
sLog->outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewRepFaction[j], qinfo->RewRepFaction[j]);
qinfo->RewRepFaction[j] = 0; // quest will not reward this
}
}
@@ -4298,7 +4298,7 @@ void ObjectMgr::LoadQuests()
if (qNextItr == mQuestTemplates.end())
{
sLog->outErrorDb("Quest %u has `NextQuestInChain` = %u but quest %u does not exist, quest chain will not work.",
qinfo->GetQuestId(), qinfo->NextQuestInChain , qinfo->NextQuestInChain);
qinfo->GetQuestId(), qinfo->NextQuestInChain, qinfo->NextQuestInChain);
qinfo->NextQuestInChain = 0;
}
else
@@ -4362,7 +4362,7 @@ void ObjectMgr::LoadQuests()
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -4921,7 +4921,7 @@ void ObjectMgr::LoadSpellScriptNames()
sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
while(spellInfo)
while (spellInfo)
{
mSpellScripts.insert(SpellScriptsMap::value_type(spellInfo->Id, GetScriptId(scriptName)));
spellInfo = sSpellMgr->GetSpellInfo(spellInfo->Id)->GetNextRankSpell();
@@ -6255,7 +6255,7 @@ uint32 ObjectMgr::GenerateMailID()
uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
{
switch(guidhigh)
switch (guidhigh)
{
case HIGHGUID_ITEM:
if (m_hiItemGuid >= 0xFFFFFFFE)
@@ -6474,7 +6474,7 @@ void ObjectMgr::LoadGameObjectTemplate()
// Checks
switch(got.type)
switch (got.type)
{
case GAMEOBJECT_TYPE_DOOR: //0
{
@@ -7562,7 +7562,7 @@ enum LanguageType
static LanguageType GetRealmLanguageType(bool create)
{
switch(sWorld->getIntConfig(CONFIG_REALM_ZONE))
switch (sWorld->getIntConfig(CONFIG_REALM_ZONE))
{
case REALM_ZONE_UNKNOWN: // any language
case REALM_ZONE_DEVELOPMENT:
@@ -7701,7 +7701,7 @@ void ObjectMgr::LoadGameObjectForQuests()
GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
{
switch(itr->second.type)
switch (itr->second.type)
{
// scan GO chest with loot including quest items
case GAMEOBJECT_TYPE_CHEST:
@@ -7933,7 +7933,7 @@ SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id)
SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
{
switch(pSkill->categoryId)
switch (pSkill->categoryId)
{
case SKILL_CATEGORY_LANGUAGES: return SKILL_RANGE_LANGUAGE;
case SKILL_CATEGORY_WEAPON:
@@ -8648,7 +8648,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
{
for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM)
{
switch(itrM->second.command)
switch (itrM->second.command)
{
case SCRIPT_COMMAND_TALK:
{
+1 -1
View File
@@ -54,7 +54,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
CellPair begin_cell = standing_cell;
CellPair end_cell = standing_cell;
switch(district)
switch (district)
{
case ALL_DISTRICT:
{
@@ -1025,15 +1025,11 @@ namespace Trinity
return false;
if (m_force)
{
if (!me->IsValidAttackTarget(u))
return false;
}
else
{
if (!me->canStartAttack(u, false))
return false;
}
m_range = me->GetDistance(u); // use found unit range as new range limit for next check
return true;
@@ -1184,16 +1180,16 @@ namespace Trinity
class AllFriendlyCreaturesInGrid
{
public:
AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {}
AllFriendlyCreaturesInGrid(Unit const* obj) : unit(obj) {}
bool operator() (Unit* u)
{
if (u->isAlive() && u->IsVisible() && u->IsFriendlyTo(pUnit))
if (u->isAlive() && u->IsVisible() && u->IsFriendlyTo(unit))
return true;
return false;
}
private:
Unit const* pUnit;
Unit const* unit;
};
class AllGameObjectsWithEntryInRange
@@ -1217,9 +1213,9 @@ namespace Trinity
{
public:
AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
bool operator() (Unit* pUnit)
bool operator() (Unit* unit)
{
if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit, m_fRange, false))
if (unit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(unit, m_fRange, false))
return true;
return false;
@@ -1234,18 +1230,18 @@ namespace Trinity
class PlayerAtMinimumRangeAway
{
public:
PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : pUnit(unit), fRange(fMinRange) {}
bool operator() (Player* pPlayer)
PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : unit(unit), fRange(fMinRange) {}
bool operator() (Player* player)
{
//No threat list check, must be done explicit if expected to be in combat with creature
if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer, fRange, false))
if (!player->isGameMaster() && player->isAlive() && !unit->IsWithinDist(player, fRange, false))
return true;
return false;
}
private:
Unit const* pUnit;
Unit const* unit;
float fRange;
};
+12 -16
View File
@@ -172,7 +172,6 @@ void Group::LoadGroupFromDB(Field* fields)
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
else
m_raidDifficulty = Difficulty(r_diff);
}
void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles)
@@ -720,12 +719,12 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
}
// notify group members which player is the allowed looter for the given creature
void Group::SendLooter(Creature* pCreature, Player* pLooter)
void Group::SendLooter(Creature* creature, Player* pLooter)
{
ASSERT(pCreature);
ASSERT(creature);
WorldPacket data(SMSG_LOOT_LIST, (8+8));
data << uint64(pCreature->GetGUID());
data << uint64(creature->GetGUID());
data << uint8(0); // unk1
if (pLooter)
@@ -770,7 +769,6 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
{
if (member->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
{
r->totalPlayersRolling++;
if (member->GetPassOnGroupLoot())
@@ -1207,7 +1205,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
slot = &(*witr);
}
WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+1+4+8+4+4+(GetMembersCount()-1)*(13+8+1+1+1+1)+8+1+8+1+1+1+1));
data << uint8(m_groupType); // group type (flags in 3.3)
data << uint8(slot->group);
@@ -1255,19 +1253,18 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
player->GetSession()->SendPacket(&data);
}
void Group::UpdatePlayerOutOfRange(Player* pPlayer)
void Group::UpdatePlayerOutOfRange(Player* player)
{
if (!pPlayer || !pPlayer->IsInWorld())
if (!player || !player->IsInWorld())
return;
Player* player;
WorldPacket data;
pPlayer->GetSession()->BuildPartyMemberStatsChangedPacket(pPlayer, &data);
player->GetSession()->BuildPartyMemberStatsChangedPacket(player, &data);
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
player = itr->getSource();
if (player && !player->IsWithinDist(pPlayer, player->GetSightRange(), false))
if (player && !player->IsWithinDist(player, player->GetSightRange(), false))
player->GetSession()->SendPacket(&data);
}
}
@@ -1589,9 +1586,9 @@ bool Group::InCombatToInstance(uint32 instanceId)
{
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pPlayer = itr->getSource();
if (pPlayer && !pPlayer->getAttackers().empty() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i != pPlayer->getAttackers().end(); ++i)
Player* player = itr->getSource();
if (player && !player->getAttackers().empty() && player->GetInstanceId() == instanceId && (player->GetMap()->IsRaidOrHeroicDungeon()))
for (std::set<Unit*>::const_iterator i = player->getAttackers().begin(); i != player->getAttackers().end(); ++i)
if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
return true;
}
@@ -1755,7 +1752,6 @@ void Group::BroadcastGroupUpdate(void)
// -- not very efficient but safe
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
Player* pp = ObjectAccessor::FindPlayer(citr->guid);
if (pp && pp->IsInWorld())
{
@@ -2069,4 +2065,4 @@ void Group::ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
slot->flags |= flag;
else
slot->flags &= ~flag;
}
}
+2 -2
View File
@@ -261,7 +261,7 @@ class Group
void SendTargetIconList(WorldSession* session);
void SendUpdate();
void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL);
void UpdatePlayerOutOfRange(Player* pPlayer);
void UpdatePlayerOutOfRange(Player* player);
// ignore: GUID of player that will be ignored
void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0);
void BroadcastReadyCheck(WorldPacket* packet);
@@ -276,7 +276,7 @@ class Group
void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
void SendLooter(Creature* pCreature, Player* pLooter);
void SendLooter(Creature* creature, Player* pLooter);
void GroupLoot(Loot* loot, WorldObject* pLootedObject);
void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject);
void MasterLoot(Loot* loot, WorldObject* pLootedObject);
+8 -8
View File
@@ -489,7 +489,7 @@ bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem)
return true;
}
void Guild::BankTab::SendText(const Guild* pGuild, WorldSession* session) const
void Guild::BankTab::SendText(const Guild* guild, WorldSession* session) const
{
WorldPacket data(MSG_QUERY_GUILD_BANK_TEXT, 1 + m_text.size() + 1);
data << uint8(m_tabId);
@@ -498,7 +498,7 @@ void Guild::BankTab::SendText(const Guild* pGuild, WorldSession* session) const
if (session)
session->SendPacket(&data);
else
pGuild->BroadcastPacket(&data);
guild->BroadcastPacket(&data);
}
///////////////////////////////////////////////////////////////////////////////
@@ -671,7 +671,7 @@ void Guild::Member::DecreaseBankRemainingValue(SQLTransaction& trans, uint8 tabI
// If (tabId == GUILD_BANK_MAX_TABS) return money amount.
// Otherwise return remaining items amount for specified tab.
// If reset time was more than 24 hours ago, renew reset time and reset amount to maximum value.
uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* pGuild) const
uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* guild) const
{
// Guild master has unlimited amount.
if (IsRank(GR_GUILDMASTER))
@@ -679,7 +679,7 @@ uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* pGuild) co
// Check rights for non-money tab.
if (tabId != GUILD_BANK_MAX_TABS)
if ((pGuild->_GetRankBankTabRights(m_rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
if ((guild->_GetRankBankTabRights(m_rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
return 0;
uint32 curTime = uint32(::time(NULL) / MINUTE); // minutes
@@ -688,8 +688,8 @@ uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* pGuild) co
RemainingValue& rv = const_cast <RemainingValue&> (m_bankRemaining[tabId]);
rv.resetTime = curTime;
rv.value = tabId == GUILD_BANK_MAX_TABS ?
pGuild->_GetRankBankMoneyPerDay(m_rankId) :
pGuild->_GetRankBankTabSlotsPerDay(m_rankId, tabId);
guild->_GetRankBankMoneyPerDay(m_rankId) :
guild->_GetRankBankTabSlotsPerDay(m_rankId, tabId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(
tabId == GUILD_BANK_MAX_TABS ?
@@ -1293,7 +1293,7 @@ void Guild::HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo)
{
Player* player = session->GetPlayer();
if (!_IsLeader(player))
// "Only pGuild leaders can create emblems."
// "Only guild leaders can create emblems."
SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTGUILDMASTER);
else if (!player->HasEnoughMoney(EMBLEM_PRICE))
// "You can't afford to do that."
@@ -1634,7 +1634,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(player->GetSession()->GetAccountId(),
"GM %s (Account: %u) deposit money (Amount: %u) to pGuild bank (Guild ID %u)",
"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
player->GetName(), player->GetSession()->GetAccountId(), amount, m_id);
}
// Log guild bank event
+6 -6
View File
@@ -473,7 +473,7 @@ private:
void SetInfo(const std::string& name, const std::string& icon);
void SetText(const std::string& text);
void SendText(const Guild* pGuild, WorldSession* session) const;
void SendText(const Guild* guild, WorldSession* session) const;
inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; }
bool SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem);
@@ -492,7 +492,7 @@ private:
class MoveItemData
{
public:
MoveItemData(Guild* pGuild, Player* player, uint8 container, uint8 slotId) : m_pGuild(pGuild), m_pPlayer(player),
MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player),
m_container(container), m_slotId(slotId), m_pItem(NULL), m_pClonedItem(NULL) { }
virtual ~MoveItemData() { }
@@ -538,8 +538,8 @@ private:
class PlayerMoveItemData : public MoveItemData
{
public:
PlayerMoveItemData(Guild* pGuild, Player* player, uint8 container, uint8 slotId) :
MoveItemData(pGuild, player, container, slotId) { }
PlayerMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) :
MoveItemData(guild, player, container, slotId) { }
bool IsBank() const { return false; }
bool InitItem();
@@ -553,8 +553,8 @@ private:
class BankMoveItemData : public MoveItemData
{
public:
BankMoveItemData(Guild* pGuild, Player* player, uint8 container, uint8 slotId) :
MoveItemData(pGuild, player, container, slotId) { }
BankMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) :
MoveItemData(guild, player, container, slotId) { }
bool IsBank() const { return true; }
bool InitItem();
+10 -10
View File
@@ -292,8 +292,8 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
if (!lPlayers.isEmpty())
{
for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
if (Player* pPlayer = itr->getSource())
pPlayer->SendUpdateWorldState(uiStateId, uiStateData);
if (Player* player = itr->getSource())
player->SendUpdateWorldState(uiStateId, uiStateData);
}
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoUpdateWorldState attempt send data but no players in map.");
@@ -311,8 +311,8 @@ void InstanceScript::DoSendNotifyToInstance(const char *format, ...)
va_start(ap, format);
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (Player* pPlayer = i->getSource())
if (WorldSession* pSession = pPlayer->GetSession())
if (Player* player = i->getSource())
if (WorldSession* pSession = player->GetSession())
pSession->SendNotification(format, ap);
}
va_end(ap);
@@ -326,8 +326,8 @@ void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type,
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* pPlayer = i->getSource())
pPlayer->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit);
if (Player* player = i->getSource())
player->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit);
}
// Start timed achievement for all players in instance
@@ -337,8 +337,8 @@ void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type,
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* pPlayer = i->getSource())
pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry);
if (Player* player = i->getSource())
player->GetAchievementMgr().StartTimedAchievement(type, entry);
}
// Stop timed achievement for all players in instance
@@ -348,8 +348,8 @@ void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type,
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* pPlayer = i->getSource())
pPlayer->GetAchievementMgr().RemoveTimedAchievement(type, entry);
if (Player* player = i->getSource())
player->GetAchievementMgr().RemoveTimedAchievement(type, entry);
}
// Remove Auras due to Spell on all players in instance
+4 -4
View File
@@ -430,19 +430,19 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
tab->Process(*this, store.IsRatesAllowed(), lootMode); // Processing is done there, callback via Loot::AddItem()
// Setting access rights for group loot case
Group* pGroup = lootOwner->GetGroup();
if (!personal && pGroup)
Group* group = lootOwner->GetGroup();
if (!personal && group)
{
roundRobinPlayer = lootOwner->GetGUID();
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player* pl = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
FillNotNormalLootFor(pl, pl->IsAtGroupRewardDistance(lootOwner));
for (uint8 i = 0; i < items.size(); ++i)
{
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(items[i].itemid))
if (proto->Quality < uint32(pGroup->GetLootThreshold()))
if (proto->Quality < uint32(group->GetLootThreshold()))
items[i].is_underthreshold = true;
}
}
+1 -1
View File
@@ -29,7 +29,7 @@
MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery)
{
switch(sender->GetTypeId())
switch (sender->GetTypeId())
{
case TYPEID_UNIT:
m_messageType = MAIL_CREATURE;
+16 -16
View File
@@ -119,7 +119,7 @@ void Map::LoadVMap(int gx, int gy)
{
// x and y are swapped !!
int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld->GetDataPath()+ "vmaps").c_str(), GetId(), gx, gy);
switch(vmapLoadResult)
switch (vmapLoadResult)
{
case VMAP::VMAP_LOAD_RESULT_OK:
sLog->outDetail("VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
@@ -305,8 +305,8 @@ void Map::SwitchGridContainers(T* obj, bool on)
obj->m_isWorldObject = on;
}
template void Map::SwitchGridContainers(Creature* , bool);
//template void Map::SwitchGridContainers(DynamicObject* , bool);
template void Map::SwitchGridContainers(Creature*, bool);
//template void Map::SwitchGridContainers(DynamicObject*, bool);
template<class T>
void Map::DeleteFromWorld(T* obj)
@@ -2028,7 +2028,7 @@ void Map::RemoveAllObjectsInRemoveList()
bool on = itr->second;
i_objectsToSwitch.erase(itr);
switch(obj->GetTypeId())
switch (obj->GetTypeId())
{
case TYPEID_UNIT:
if (!obj->ToCreature()->isPet())
@@ -2045,7 +2045,7 @@ void Map::RemoveAllObjectsInRemoveList()
std::set<WorldObject*>::iterator itr = i_objectsToRemove.begin();
WorldObject* obj = *itr;
switch(obj->GetTypeId())
switch (obj->GetTypeId())
{
case TYPEID_CORPSE:
{
@@ -2176,15 +2176,15 @@ void Map::RemoveFromActive(Creature* c)
}
}
template void Map::Add(Corpse* );
template void Map::Add(Creature* );
template void Map::Add(GameObject* );
template void Map::Add(DynamicObject* );
template void Map::Add(Corpse*);
template void Map::Add(Creature*);
template void Map::Add(GameObject*);
template void Map::Add(DynamicObject*);
template void Map::Remove(Corpse* , bool);
template void Map::Remove(Creature* , bool);
template void Map::Remove(GameObject* , bool);
template void Map::Remove(DynamicObject* , bool);
template void Map::Remove(Corpse*, bool);
template void Map::Remove(Creature*, bool);
template void Map::Remove(GameObject*, bool);
template void Map::Remove(DynamicObject*, bool);
/* ******* Dungeon Instance Maps ******* */
@@ -2240,8 +2240,8 @@ bool InstanceMap::CanEnter(Player* player)
}
// cannot enter while an encounter is in progress on raids
/*Group* pGroup = player->GetGroup();
if (!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/
/*Group* group = player->GetGroup();
if (!player->isGameMaster() && group && group->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/
if (IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress())
{
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
@@ -2593,7 +2593,7 @@ BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Ma
BattlegroundMap::~BattlegroundMap()
{
if(m_bg)
if (m_bg)
{
//unlink to prevent crash, always unlink all pointer reference before destruction
m_bg->SetBgMap(NULL);
+7 -7
View File
@@ -254,8 +254,8 @@ class Map : public GridRefManager<NGridType>
return false;
}
virtual bool Add(Player* );
virtual void Remove(Player* , bool);
virtual bool Add(Player*);
virtual void Remove(Player*, bool);
template<class T> void Add(T *);
template<class T> void Remove(T *, bool);
@@ -266,7 +266,7 @@ class Map : public GridRefManager<NGridType>
//function for setting up visibility distance for maps on per-type/per-Id basis
virtual void InitVisibilityDistance();
void PlayerRelocation(Player* , float x, float y, float z, float orientation);
void PlayerRelocation(Player*, float x, float y, float z, float orientation);
void CreatureRelocation(Creature* creature, float x, float y, float z, float ang, bool respawnRelocationOnFail = true);
template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor);
@@ -577,8 +577,8 @@ class InstanceMap : public Map
public:
InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
~InstanceMap();
bool Add(Player* );
void Remove(Player* , bool);
bool Add(Player*);
void Remove(Player*, bool);
void Update(const uint32);
void CreateInstanceData(bool load);
bool Reset(uint8 method);
@@ -607,8 +607,8 @@ class BattlegroundMap : public Map
BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattlegroundMap();
bool Add(Player* );
void Remove(Player* , bool);
bool Add(Player*);
void Remove(Player*, bool);
bool CanEnter(Player* player);
void SetUnload();
//void UnloadAll(bool pForce);
+2 -2
View File
@@ -343,7 +343,7 @@ uint32 MapManager::GetNumInstances()
Map* map = itr->second;
if (!map->Instanceable())
continue;
MapInstanced::InstancedMaps &maps = ((MapInstanced* )map)->GetInstancedMaps();
MapInstanced::InstancedMaps &maps = ((MapInstanced*)map)->GetInstancedMaps();
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
if (mitr->second->IsDungeon()) ret++;
}
@@ -360,7 +360,7 @@ uint32 MapManager::GetNumPlayersInInstances()
Map* map = itr->second;
if (!map->Instanceable())
continue;
MapInstanced::InstancedMaps &maps = ((MapInstanced* )map)->GetInstancedMaps();
MapInstanced::InstancedMaps &maps = ((MapInstanced*)map)->GetInstancedMaps();
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
if (mitr->second->IsDungeon())
ret += ((InstanceMap*)mitr->second)->GetPlayers().getSize();
@@ -2402,7 +2402,7 @@ enum QuestSort
inline uint8 ClassByQuestSort(int32 QuestSort)
{
switch(QuestSort)
switch (QuestSort)
{
case QUEST_SORT_WARLOCK: return CLASS_WARLOCK;
case QUEST_SORT_WARRIOR: return CLASS_WARRIOR;
@@ -2578,7 +2578,7 @@ enum SkillType
inline SkillType SkillByLockType(LockType locktype)
{
switch(locktype)
switch (locktype)
{
case LOCKTYPE_PICKLOCK: return SKILL_LOCKPICKING;
case LOCKTYPE_HERBALISM: return SKILL_HERBALISM;
@@ -2592,7 +2592,7 @@ inline SkillType SkillByLockType(LockType locktype)
inline uint32 SkillByQuestSort(int32 QuestSort)
{
switch(QuestSort)
switch (QuestSort)
{
case QUEST_SORT_HERBALISM: return SKILL_HERBALISM;
case QUEST_SORT_FISHING: return SKILL_FISHING;
@@ -113,7 +113,7 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
return true;
if (traveller.GetTraveller().HasUnitState(UNIT_STAT_IN_FLIGHT))
GetLocationNow(traveller.GetTraveller().GetBaseMap() , x, y, z, true); // Should reposition Object with right Coord, so I can bypass some Grid Relocation
GetLocationNow(traveller.GetTraveller().GetBaseMap(), x, y, z, true); // Should reposition Object with right Coord, so I can bypass some Grid Relocation
else
GetLocationNow(traveller.GetTraveller().GetBaseMap(), x, y, z, false);
@@ -85,7 +85,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
float distance = 5.0f;
switch(i)
switch (i)
{
case 0:
angle = i_cur_angle;
@@ -37,7 +37,7 @@ class RandomMovementGenerator
void Reset(T &);
bool Update(T &, const uint32);
bool GetDestination(float &x, float &y, float &z) const;
void UpdateMapPosition(uint32 mapid, float &x , float &y, float &z)
void UpdateMapPosition(uint32 mapid, float &x, float &y, float &z)
{
i_destinationHolder.GetLocationNow(mapid, x, y, z);
}
+3 -3
View File
@@ -413,7 +413,7 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
{
uint32 team;
switch(m_State)
switch (m_State)
{
case OBJECTIVESTATE_ALLIANCE:
team = 0;
@@ -432,9 +432,9 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
{
if (Group* pGroup = killer->GetGroup())
if (Group* group = killer->GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
+2 -2
View File
@@ -180,7 +180,7 @@ class OPvPCapturePoint
OutdoorPvP* m_PvP;
// map to store the various gameobjects and creatures spawned by the objective
// type , guid
// type, guid
std::map<uint32, uint64> m_Objects;
std::map<uint32, uint64> m_Creatures;
std::map<uint64, uint32> m_ObjectTypes;
@@ -221,7 +221,7 @@ class OutdoorPvP : public ZoneScript
void OnGameObjectCreate(GameObject* go);
void OnGameObjectRemove(GameObject* go);
void OnCreatureCreate(Creature* ) {}
void OnCreatureCreate(Creature*) {}
// send world state update to all players present
void SendUpdateWorldState(uint32 field, uint32 value);
+8 -8
View File
@@ -220,8 +220,8 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid)
{
sObjectMgr->RemoveCreatureFromGrid(guid, data);
if (Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
pCreature->AddObjectToRemoveList();
if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
creature->AddObjectToRemoveList();
}
}
@@ -363,15 +363,15 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
Creature* pCreature = new Creature;
Creature* creature = new Creature;
//sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning creature %u", guid);
if (!pCreature->LoadFromDB(obj->guid, map))
if (!creature->LoadFromDB(obj->guid, map))
{
delete pCreature;
delete creature;
return;
}
else
map->Add(pCreature);
map->Add(creature);
}
}
}
@@ -506,8 +506,8 @@ template <>
void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj)
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid))
if (Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
pCreature->GetMap()->Add(pCreature);
if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL))
creature->GetMap()->Add(creature);
}
// Method that does the respawn job on the specified gameobject
+4 -4
View File
@@ -166,16 +166,16 @@ Quest::Quest(Field* questRecord)
++m_rewchoiceitemscount;
}
uint32 Quest::XPValue(Player* pPlayer) const
uint32 Quest::XPValue(Player* player) const
{
if (pPlayer)
if (player)
{
int32 quest_level = (QuestLevel == -1 ? pPlayer->getLevel() : QuestLevel);
int32 quest_level = (QuestLevel == -1 ? player->getLevel() : QuestLevel);
const QuestXPEntry* xpentry = sQuestXPStore.LookupEntry(quest_level);
if (!xpentry)
return 0;
int32 diffFactor = 2 * (quest_level - pPlayer->getLevel()) + 20;
int32 diffFactor = 2 * (quest_level - player->getLevel()) + 20;
if (diffFactor < 1)
diffFactor = 1;
else if (diffFactor > 10)
+1 -1
View File
@@ -183,7 +183,7 @@ class Quest
friend class ObjectMgr;
public:
Quest(Field* questRecord);
uint32 XPValue(Player* pPlayer) const;
uint32 XPValue(Player* player) const;
bool HasFlag(uint32 flag) const { return (QuestFlags & flag) != 0; }
void SetFlag(uint32 flag) { QuestFlags |= flag; }
+27 -27
View File
@@ -100,29 +100,29 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
// Helpers for ScriptProcess method.
inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo) const
{
Player* pPlayer = NULL;
Player* player = NULL;
if (!source && !target)
sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
{
// Check target first, then source.
if (target)
pPlayer = target->ToPlayer();
if (!pPlayer && source)
pPlayer = source->ToPlayer();
player = target->ToPlayer();
if (!player && source)
player = source->ToPlayer();
if (!pPlayer)
if (!player)
sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
}
return pPlayer;
return player;
}
inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse) const
{
Creature* pCreature = NULL;
Creature* creature = NULL;
if (!source && !target)
sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
@@ -131,31 +131,31 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
{
// Check target first, then source.
if (target)
pCreature = target->ToCreature();
if (!pCreature && source)
pCreature = source->ToCreature();
creature = target->ToCreature();
if (!creature && source)
creature = source->ToCreature();
}
else
{
// Check source first, then target.
if (source)
pCreature = source->ToCreature();
if (!pCreature && target)
pCreature = target->ToCreature();
creature = source->ToCreature();
if (!creature && target)
creature = target->ToCreature();
}
if (!pCreature)
if (!creature)
sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
}
return pCreature;
return creature;
}
inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Unit* pUnit = NULL;
Unit* unit = NULL;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else if (!obj->isType(TYPEMASK_UNIT))
@@ -163,42 +163,42 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
else
{
pUnit = obj->ToUnit();
if (!pUnit)
unit = obj->ToUnit();
if (!unit)
sLog->outError("%s %s object could not be casted to unit.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
}
return pUnit;
return unit;
}
inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Player* pPlayer = NULL;
Player* player = NULL;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
pPlayer = obj->ToPlayer();
if (!pPlayer)
player = obj->ToPlayer();
if (!player)
sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return pPlayer;
return player;
}
inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Creature* pCreature = NULL;
Creature* creature = NULL;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
pCreature = obj->ToCreature();
if (!pCreature)
creature = obj->ToCreature();
if (!creature)
sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return pCreature;
return creature;
}
inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
@@ -479,6 +479,7 @@ void AddSC_boss_blood_prince_council();
void AddSC_boss_blood_queen_lana_thel();
void AddSC_boss_valithria_dreamwalker();
void AddSC_boss_sindragosa();
void AddSC_boss_the_lich_king();
void AddSC_icecrown_citadel_teleport();
void AddSC_instance_icecrown_citadel();
void AddSC_icecrown_citadel();
@@ -1181,6 +1182,7 @@ void AddNorthrendScripts()
AddSC_boss_blood_queen_lana_thel();
AddSC_boss_valithria_dreamwalker();
AddSC_boss_sindragosa();
AddSC_boss_the_lich_king();
AddSC_icecrown_citadel_teleport();
AddSC_instance_icecrown_citadel();
AddSC_icecrown_citadel();
@@ -130,14 +130,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (!item || !bid || !etime)
return; //check for cheaters
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
return;
}
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction());
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction());
if (!auctionHouseEntry)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", uint32(GUID_LOPART(auctioneer)));
@@ -148,7 +148,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
etime *= MINUTE;
// client understand only 3 auction time
switch(etime)
switch (etime)
{
case 1*MIN_AUCTION_TIME:
case 2*MIN_AUCTION_TIME:
@@ -195,7 +195,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
return;
}
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
//we have to take deposit :
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it, count);
@@ -262,8 +262,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
if (!auctionId || !price)
return; //check for cheaters
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
return;
@@ -273,7 +273,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
Player* pl = GetPlayer();
@@ -380,8 +380,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
recv_data >> auctionId;
//sLog->outDebug("Cancel AUCTION AuctionID: %u", auctionId);
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
return;
@@ -391,7 +391,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
Player* pl = GetPlayer();
@@ -465,8 +465,8 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
outbiddedCount = 0;
}
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
@@ -476,7 +476,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
Player* pl = GetPlayer();
@@ -512,8 +512,8 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
recv_data >> guid;
recv_data >> listfrom; // not used in fact (this list not have page control in client)
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
@@ -523,7 +523,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4));
data << (uint32) 0; // amount place holder
@@ -565,8 +565,8 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
recv_data.read_skip<uint8>();
}
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
@@ -576,9 +576,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
//sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
//sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
// GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4));
@@ -25,7 +25,6 @@
#include "ArenaTeam.h"
#include "BattlegroundMgr.h"
#include "BattlegroundWS.h"
#include "Battleground.h"
#include "Chat.h"
#include "Language.h"
@@ -252,56 +251,42 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_
if (!bg) // can't be received if player not in battleground
return;
switch(bg->GetTypeID(true))
uint32 count = 0;
Player* aplr = NULL;
Player* hplr = NULL;
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE))
{
case BATTLEGROUND_WS:
{
uint32 count = 0;
Player* aplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID());
if (aplr)
++count;
Player* hplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID());
if (hplr)
++count;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
data << 0;
data << count;
if (aplr)
{
data << uint64(aplr->GetGUID());
data << float(aplr->GetPositionX());
data << float(aplr->GetPositionY());
}
if (hplr)
{
data << uint64(hplr->GetGUID());
data << float(hplr->GetPositionX());
data << float(hplr->GetPositionY());
}
SendPacket(&data);
break;
}
case BATTLEGROUND_EY:
//TODO : fix me!
break;
case BATTLEGROUND_AB:
case BATTLEGROUND_AV:
{
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4));
data << uint32(0);
data << uint32(0);
SendPacket(&data);
break;
}
default:
//maybe it is sent also in arena - do nothing
break;
aplr = ObjectAccessor::FindPlayer(guid);
if (aplr)
++count;
}
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
{
hplr = ObjectAccessor::FindPlayer(guid);
if (hplr)
++count;
}
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
data << 0;
data << count;
if (aplr)
{
data << uint64(aplr->GetGUID());
data << float(aplr->GetPositionX());
data << float(aplr->GetPositionY());
}
if (hplr)
{
data << uint64(hplr->GetGUID());
data << float(hplr->GetPositionX());
data << float(hplr->GetPositionY());
}
SendPacket(&data);
}
void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
@@ -429,7 +414,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
}
uint32 queueSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId);
WorldPacket data;
switch(action)
switch (action)
{
case 1: // port to battleground
if (!_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId))
@@ -646,7 +631,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
uint32 arenaRating = 0;
uint32 matchmakerRating = 0;
switch(arenaslot)
switch (arenaslot)
{
case 0:
arenatype = ARENA_TYPE_2v2;
@@ -883,8 +883,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (pCurrChar->GetGuildId() != 0)
{
if (Guild* pGuild = sGuildMgr->GetGuildById(pCurrChar->GetGuildId()))
pGuild->SendLoginInfo(this);
if (Guild* guild = sGuildMgr->GetGuildById(pCurrChar->GetGuildId()))
guild->SendLoginInfo(this);
else
{
// remove wrong guild data
@@ -1006,7 +1006,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
std::string IP_str = GetRemoteAddress();
sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u)",
GetAccountId(), IP_str.c_str(), pCurrChar->GetName() , pCurrChar->GetGUIDLow());
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow());
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STAT_STUNNED))
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
@@ -141,7 +141,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
lang = LANG_UNIVERSAL;
else
{
switch(type)
switch (type)
{
case CHAT_MSG_PARTY:
case CHAT_MSG_PARTY_LEADER:
@@ -549,7 +549,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data)
uint32 emote_anim = em->textid;
switch(emote_anim)
switch (emote_anim)
{
case EMOTE_STATE_SLEEP:
case EMOTE_STATE_SIT:
@@ -33,8 +33,8 @@
inline Guild* _GetPlayerGuild(WorldSession* session, bool sendError = false)
{
if (uint32 guildId = session->GetPlayer()->GetGuildId()) // If guild id = 0, player is not in guild
if (Guild* pGuild = sGuildMgr->GetGuildById(guildId)) // Find guild by id
return pGuild;
if (Guild* guild = sGuildMgr->GetGuildById(guildId)) // Find guild by id
return guild;
if (sendError)
Guild::SendCommandResult(session, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
return NULL;
@@ -47,8 +47,8 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
uint32 guildId;
recvPacket >> guildId;
// Use received guild id to access guild method (not player's guild id)
if (Guild* pGuild = sGuildMgr->GetGuildById(guildId))
pGuild->HandleQuery(this);
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
guild->HandleQuery(this);
else
Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
}
@@ -62,11 +62,11 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
if (!GetPlayer()->GetGuildId()) // Player cannot be in guild
{
Guild* pGuild = new Guild();
if (pGuild->Create(GetPlayer(), name))
sGuildMgr->AddGuild(pGuild);
Guild* guild = new Guild();
if (guild->Create(GetPlayer(), name))
sGuildMgr->AddGuild(guild);
else
delete pGuild;
delete guild;
}
}
@@ -78,8 +78,8 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
recvPacket >> invitedName;
if (normalizePlayerName(invitedName))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleInviteMember(this, invitedName);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleInviteMember(this, invitedName);
}
void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
@@ -90,8 +90,8 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
recvPacket >> playerName;
if (normalizePlayerName(playerName))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleRemoveMember(this, playerName);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleRemoveMember(this, playerName);
}
void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
@@ -100,8 +100,8 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
// Player cannot be in guild
if (!GetPlayer()->GetGuildId())
// Guild where player was invited must exist
if (Guild* pGuild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited()))
pGuild->HandleAcceptMember(this);
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited()))
guild->HandleAcceptMember(this);
}
void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/)
@@ -116,16 +116,16 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INFO");
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->SendInfo(this);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->SendInfo(this);
}
void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ROSTER");
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->HandleRoster(this);
if (Guild* guild = _GetPlayerGuild(this))
guild->HandleRoster(this);
}
void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
@@ -136,8 +136,8 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
recvPacket >> playerName;
if (normalizePlayerName(playerName))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleUpdateMemberRank(this, playerName, false);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleUpdateMemberRank(this, playerName, false);
}
void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
@@ -148,24 +148,24 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
recvPacket >> playerName;
if (normalizePlayerName(playerName))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleUpdateMemberRank(this, playerName, true);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleUpdateMemberRank(this, playerName, true);
}
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_LEAVE");
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleLeaveMember(this);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleLeaveMember(this);
}
void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DISBAND");
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleDisband(this);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleDisband(this);
}
void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
@@ -176,8 +176,8 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
recvPacket >> name;
if (normalizePlayerName(name))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleSetLeader(this, name);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleSetLeader(this, name);
}
void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
@@ -188,8 +188,8 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
if (!recvPacket.empty())
recvPacket >> motd;
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleSetMOTD(this, motd);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleSetMOTD(this, motd);
}
void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
@@ -203,8 +203,8 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
recvPacket >> publicNote;
if (normalizePlayerName(playerName))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleSetMemberNote(this, playerName, publicNote, false);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleSetMemberNote(this, playerName, publicNote, false);
}
void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
@@ -218,16 +218,16 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
recvPacket >> officerNote;
if (normalizePlayerName(playerName))
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleSetMemberNote(this, playerName, officerNote, true);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleSetMemberNote(this, playerName, officerNote, true);
}
void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_RANK");
Guild* pGuild = _GetPlayerGuild(this, true);
if (!pGuild)
Guild* guild = _GetPlayerGuild(this, true);
if (!guild)
{
recvPacket.rpos(recvPacket.wpos());
return;
@@ -257,7 +257,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
rightsAndSlots[tabId] = GuildBankRightsAndSlots(uint8(bankRights), slots);
}
pGuild->HandleSetRankInfo(this, rankId, rankName, rights, money, rightsAndSlots);
guild->HandleSetRankInfo(this, rankId, rankName, rights, money, rightsAndSlots);
}
void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
@@ -267,16 +267,16 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
std::string rankName;
recvPacket >> rankName;
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleAddNewRank(this, rankName);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleAddNewRank(this, rankName);
}
void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DEL_RANK");
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleRemoveLowestRank(this);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleRemoveLowestRank(this);
}
void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
@@ -286,8 +286,8 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
std::string info;
recvPacket >> info;
if (Guild* pGuild = _GetPlayerGuild(this, true))
pGuild->HandleSetInfo(this, info);
if (Guild* guild = _GetPlayerGuild(this, true))
guild->HandleSetInfo(this, info);
}
void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
@@ -306,10 +306,10 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->HandleSetEmblem(this, emblemInfo);
if (Guild* guild = _GetPlayerGuild(this))
guild->HandleSetEmblem(this, emblemInfo);
else
// "You are not part of a pGuild!";
// "You are not part of a guild!";
Guild::SendSaveEmblemResult(this, ERR_GUILDEMBLEM_NOGUILD);
}
else
@@ -324,24 +324,24 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)");
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendEventLog(this);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendEventLog(this);
}
void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recv_data */)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)");
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendMoneyInfo(this);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendMoneyInfo(this);
}
void WorldSession::HandleGuildPermissions(WorldPacket& /* recv_data */)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_PERMISSIONS)");
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendPermissions(this);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendPermissions(this);
}
// Called when clicking on Guild bank gameobject
@@ -357,14 +357,14 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data)
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
{
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendBankTabsInfo(this);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendBankTabsInfo(this);
else
Guild::SendCommandResult(this, GUILD_UNK1, ERR_GUILD_PLAYER_NOT_IN_GUILD);
}
}
// Called when opening pGuild bank tab only (first one)
// Called when opening guild bank tab only (first one)
void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)");
@@ -379,8 +379,8 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data)
recv_data >> unk1;
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendBankTabData(this, tabId);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendBankTabData(this, tabId);
}
void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data)
@@ -395,8 +395,8 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data)
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (money && GetPlayer()->HasEnoughMoney(money))
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->HandleMemberDepositMoney(this, money);
if (Guild* guild = _GetPlayerGuild(this))
guild->HandleMemberDepositMoney(this, money);
}
void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket & recv_data)
@@ -411,8 +411,8 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket & recv_data)
if (money)
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->HandleMemberWithdrawMoney(this, money);
if (Guild* guild = _GetPlayerGuild(this))
guild->HandleMemberWithdrawMoney(this, money);
}
void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
@@ -428,8 +428,8 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
return;
}
Guild* pGuild = _GetPlayerGuild(this);
if (!pGuild)
Guild* guild = _GetPlayerGuild(this);
if (!guild)
{
recv_data.rfinish(); // Prevent additional spam at rejected packet
return;
@@ -459,7 +459,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
recv_data >> splitedAmount;
pGuild->SwapItems(GetPlayer(), tabId, slotId, destTabId, destSlotId, splitedAmount);
guild->SwapItems(GetPlayer(), tabId, slotId, destTabId, destSlotId, splitedAmount);
}
else
{
@@ -492,7 +492,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
if (!Player::IsInventoryPos(playerBag, playerSlotId) && !(playerBag == NULL_BAG && playerSlotId == NULL_SLOT))
GetPlayer()->SendEquipError(EQUIP_ERR_NONE, NULL);
else
pGuild->SwapItemsWithInventory(GetPlayer(), toChar, tabId, slotId, playerBag, playerSlotId, splitedAmount);
guild->SwapItemsWithInventory(GetPlayer(), toChar, tabId, slotId, playerBag, playerSlotId, splitedAmount);
}
}
@@ -507,8 +507,8 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket & recv_data)
recv_data >> tabId;
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->HandleBuyBankTab(this, tabId);
if (Guild* guild = _GetPlayerGuild(this))
guild->HandleBuyBankTab(this, tabId);
}
void WorldSession::HandleGuildBankUpdateTab(WorldPacket & recv_data)
@@ -529,8 +529,8 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPacket & recv_data)
if (!name.empty() && !icon.empty())
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->HandleSetBankTabInfo(this, tabId, name, icon);
if (Guild* guild = _GetPlayerGuild(this))
guild->HandleSetBankTabInfo(this, tabId, name, icon);
}
void WorldSession::HandleGuildBankLogQuery(WorldPacket & recv_data)
@@ -540,8 +540,8 @@ void WorldSession::HandleGuildBankLogQuery(WorldPacket & recv_data)
uint8 tabId;
recv_data >> tabId;
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendBankLog(this, tabId);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendBankLog(this, tabId);
}
void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
@@ -551,8 +551,8 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
uint8 tabId;
recv_data >> tabId;
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SendBankTabText(this, tabId);
if (Guild* guild = _GetPlayerGuild(this))
guild->SendBankTabText(this, tabId);
}
void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
@@ -565,6 +565,6 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
std::string text;
recv_data >> text;
if (Guild* pGuild = _GetPlayerGuild(this))
pGuild->SetBankTabText(tabId, text);
if (Guild* guild = _GetPlayerGuild(this))
guild->SetBankTabText(tabId, text);
}
@@ -494,8 +494,8 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
if (!itemguid)
return;
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0);
@@ -512,21 +512,21 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
// prevent sell not owner item
if (_player->GetGUID() != pItem->GetOwnerGUID())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
// prevent sell non empty bag by drag-and-drop at vendor's item list
if (pItem->IsNotEmptyBag())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
// prevent sell currently looted item
if (_player->GetLootGUID() == pItem->GetGUID())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
@@ -546,7 +546,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
// prevent sell more items that exist in stack (possible only not from client)
if (count > pItem->GetCount())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
}
@@ -562,7 +562,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
if (!pNewItem)
{
sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
@@ -589,11 +589,11 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
}
else
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
}
_player->SendSellError(SELL_ERR_CANT_FIND_ITEM, pCreature, itemguid, 0);
_player->SendSellError(SELL_ERR_CANT_FIND_ITEM, creature, itemguid, 0);
return;
}
@@ -605,8 +605,8 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
recv_data >> vendorguid >> slot;
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
@@ -623,7 +623,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START);
if (!_player->HasEnoughMoney(price))
{
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0);
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0);
return;
}
@@ -642,7 +642,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
return;
}
else
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, 0, 0);
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0);
}
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data)
@@ -867,8 +867,8 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
// cheating protection
/* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if (!creature)
{
sLog->outDebug("WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
@@ -78,17 +78,17 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data)
}
else
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed);
bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed);
if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
{
player->SendLootRelease(lguid);
return;
}
loot = &pCreature->loot;
loot = &creature->loot;
}
player->StoreLootItem(lootSlot, loot);
@@ -106,7 +106,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/)
Loot* loot = NULL;
bool shareMoney = true;
switch(GUID_HIPART(guid))
switch (GUID_HIPART(guid))
{
case HIGHGUID_GAMEOBJECT:
{
@@ -329,9 +329,9 @@ void WorldSession::DoLootRelease(uint64 lguid)
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
if (Group* pGroup = player->GetGroup())
if (Group* group = player->GetGroup())
{
if (pGroup->GetLootMethod() != MASTER_LOOT)
if (group->GetLootMethod() != MASTER_LOOT)
{
loot->roundRobinPlayer = 0;
}
@@ -384,20 +384,20 @@ void WorldSession::DoLootRelease(uint64 lguid)
}
else
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed);
if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed);
if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
loot = &pCreature->loot;
loot = &creature->loot;
if (loot->isLooted())
{
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
if (!pCreature->isAlive())
pCreature->AllLootRemovedFromCorpse();
if (!creature->isAlive())
creature->AllLootRemovedFromCorpse();
pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
loot->clear();
}
else
@@ -405,15 +405,15 @@ void WorldSession::DoLootRelease(uint64 lguid)
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
if (Group* pGroup = player->GetGroup())
if (Group* group = player->GetGroup())
{
if (pGroup->GetLootMethod() != MASTER_LOOT)
if (group->GetLootMethod() != MASTER_LOOT)
{
loot->roundRobinPlayer = 0;
pGroup->SendLooter(pCreature, NULL);
group->SendLooter(creature, NULL);
// force update of dynamic flags, otherwise other group's players still not able to loot.
pCreature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS);
creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS);
}
}
else
@@ -452,11 +452,11 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
if (!pCreature)
Creature* creature = GetPlayer()->GetMap()->GetCreature(lootguid);
if (!creature)
return;
pLoot = &pCreature->loot;
pLoot = &creature->loot;
}
else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
{
@@ -577,7 +577,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
data << uint32((*itr)->messageID); // Message ID
data << uint8((*itr)->messageType); // Message Type
switch((*itr)->messageType)
switch ((*itr)->messageType)
{
case MAIL_NORMAL: // sender guid
data << uint64(MAKE_NEW_GUID((*itr)->sender, 0, HIGHGUID_PLAYER));
@@ -743,7 +743,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/)
else
data << uint32(m->sender); // creature entry
switch(m->messageType)
switch (m->messageType)
{
case MAIL_AUCTION:
data << uint32(2);
@@ -820,7 +820,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (player->GetMapId() != atEntry->mapid)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
player->GetName(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId);
return;
}
@@ -1036,7 +1036,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
}
else
{
switch(type)
switch (type)
{
case ACTION_BUTTON_MACRO:
case ACTION_BUTTON_CMACRO:
@@ -1347,7 +1347,7 @@ void WorldSession::HandleComplainOpcode(WorldPacket & recv_data)
std::string description = "";
recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
recv_data >> spammer_guid; // player guid
switch(spam_type)
switch (spam_type)
{
case 0:
recv_data >> unk1; // const 0
@@ -1401,7 +1401,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data)
uint8 apply;
recv_data >> apply;
switch(apply)
switch (apply)
{
case 0:
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player %u set vision to self", _player->GetGUIDLow());
@@ -1464,13 +1464,13 @@ void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data)
void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES");
Group* pGroup = _player->GetGroup();
if (pGroup)
Group* group = _player->GetGroup();
if (group)
{
if (pGroup->IsLeader(_player->GetGUID()))
if (group->IsLeader(_player->GetGUID()))
{
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
pGroup->ResetInstances(INSTANCE_RESET_ALL, true, _player);
group->ResetInstances(INSTANCE_RESET_ALL, false, _player);
group->ResetInstances(INSTANCE_RESET_ALL, true, _player);
}
}
else
@@ -1504,12 +1504,12 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
return;
}
Group* pGroup = _player->GetGroup();
if (pGroup)
Group* group = _player->GetGroup();
if (group)
{
if (pGroup->IsLeader(_player->GetGUID()))
if (group->IsLeader(_player->GetGUID()))
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if (!pGroupGuy)
@@ -1527,8 +1527,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
}
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
pGroup->SetDungeonDifficulty(Difficulty(mode));
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
group->SetDungeonDifficulty(Difficulty(mode));
}
}
else
@@ -1562,12 +1562,12 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
if (Difficulty(mode) == _player->GetRaidDifficulty())
return;
Group* pGroup = _player->GetGroup();
if (pGroup)
Group* group = _player->GetGroup();
if (group)
{
if (pGroup->IsLeader(_player->GetGUID()))
if (group->IsLeader(_player->GetGUID()))
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if (!pGroupGuy)
@@ -1585,8 +1585,8 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
}
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
pGroup->SetRaidDifficulty(Difficulty(mode));
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
group->SetRaidDifficulty(Difficulty(mode));
}
}
else
@@ -374,17 +374,11 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
{
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
// pl can be alive if GM/etc
// change the death state to CORPSE to prevent the death timer from
// starting in the next player update
if (!plMover->isAlive())
{
// change the death state to CORPSE to prevent the death timer from
// starting in the next player update
plMover->KillPlayer();
plMover->BuildPlayerRepop();
}
}
// cancel the death timer here if started
plMover->RepopAtGraveyard();
}
}
}
@@ -427,7 +421,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" };
switch(opcode)
switch (opcode)
{
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break;
@@ -523,13 +517,29 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK");
uint64 guid; // guid - unused
uint64 guid;
recv_data.readPackGUID(guid);
if (_player->m_mover->GetGUID() != guid)
return;
recv_data.read_skip<uint32>(); // unk
MovementInfo movementInfo;
ReadMovementInfo(recv_data, &movementInfo);
_player->m_movementInfo = movementInfo;
WorldPacket data(MSG_MOVE_KNOCK_BACK, 66);
data.appendPackGUID(guid);
_player->BuildMovementPacket(&data);
// knockback specific info
data << movementInfo.j_sinAngle;
data << movementInfo.j_cosAngle;
data << movementInfo.j_xyspeed;
data << movementInfo.j_zspeed;
_player->SendMessageToSet(&data, false);
}
void WorldSession::HandleMoveHoverAck(WorldPacket& recv_data)
@@ -147,10 +147,10 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
return;
}
switch(flag)
switch (flag)
{
case ACT_COMMAND: //0x07
switch(spellid)
switch (spellid)
{
case COMMAND_STAY: //flat=1792 //STAY
pet->AttackStop();
@@ -267,7 +267,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
}
break;
case ACT_REACTION: // 0x6
switch(spellid)
switch (spellid)
{
case REACT_PASSIVE: //passive
pet->AttackStop();
@@ -677,7 +677,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data)
if (pet->GetGUID() == _player->GetPetGUID())
{
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
pet->SetPower(POWER_HAPPINESS , feelty > 50000 ? (feelty-50000) : 0);
pet->SetPower(POWER_HAPPINESS, feelty > 50000 ? (feelty-50000) : 0);
}
_player->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
@@ -90,8 +90,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
// prevent cheating
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
return;
@@ -104,7 +104,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
uint32 charterid = 0;
uint32 cost = 0;
uint32 type = 0;
if (pCreature->isTabardDesigner())
if (creature->isTabardDesigner())
{
// if tabard designer, then trying to buy a guild charter.
// do not let if already in guild.
@@ -124,7 +124,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
return;
}
switch(clientIndex) // arenaSlot+1 as received from client (1 from 3 case)
switch (clientIndex) // arenaSlot+1 as received from client (1 from 3 case)
{
case 1:
charterid = ARENA_TEAM_CHARTER_2v2;
@@ -189,7 +189,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
if (!_player->HasEnoughMoney(cost))
{ //player hasn't got enough money
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0);
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, charterid, 0);
return;
}
@@ -224,7 +224,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
do
{
Field* fields = result->Fetch();
ssInvalidPetitionGUIDs << '\'' << fields[0].GetUInt32() << "' , ";
ssInvalidPetitionGUIDs << '\'' << fields[0].GetUInt32() << "', ";
} while (result->NextRow());
}
@@ -881,8 +881,8 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data)
void WorldSession::SendPetitionShowList(uint64 guid)
{
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
return;
@@ -891,7 +891,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6);
data << guid; // npc guid
if (pCreature->isTabardDesigner())
if (creature->isTabardDesigner())
{
data << uint8(1); // count
data << uint32(1); // index
@@ -47,7 +47,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
return;
}
switch(questgiver->GetTypeId())
switch (questgiver->GetTypeId())
{
case TYPEID_UNIT:
{
@@ -86,8 +86,8 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!pCreature)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
GUID_LOPART(guid));
@@ -98,15 +98,15 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
creature->StopMoving();
if (sScriptMgr->OnGossipHello(_player, pCreature))
if (sScriptMgr->OnGossipHello(_player, creature))
return;
_player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId, true);
_player->SendPreparedGossip(pCreature);
_player->PrepareGossipMenu(creature, creature->GetCreatureInfo()->GossipMenuId, true);
_player->SendPreparedGossip(creature);
pCreature->AI()->sGossipHello(_player);
creature->AI()->sGossipHello(_player);
}
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
@@ -146,10 +146,10 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
if (_player->GetDivider() != 0)
{
Player* pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider());
if (pPlayer)
Player* player = ObjectAccessor::FindPlayer(_player->GetDivider());
if (player)
{
pPlayer->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST);
player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST);
_player->SetDivider(0);
}
}
@@ -160,23 +160,23 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
if (qInfo->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
{
if (Group* pGroup = _player->GetGroup())
if (Group* group = _player->GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pPlayer = itr->getSource();
Player* player = itr->getSource();
if (!pPlayer || pPlayer == _player) // not self
if (!player || player == _player) // not self
continue;
if (pPlayer->CanTakeQuest(qInfo, true))
if (player->CanTakeQuest(qInfo, true))
{
pPlayer->SetDivider(_player->GetGUID());
player->SetDivider(_player->GetGUID());
//need confirmation that any gossip window will close
pPlayer->PlayerTalkClass->SendCloseGossip();
player->PlayerTalkClass->SendCloseGossip();
_player->SendQuestConfirmAccept(qInfo, pPlayer);
_player->SendQuestConfirmAccept(qInfo, player);
}
}
}
@@ -185,7 +185,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
if (_player->CanCompleteQuest(quest))
_player->CompleteQuest(quest);
switch(pObject->GetTypeId())
switch (pObject->GetTypeId())
{
case TYPEID_UNIT:
sScriptMgr->OnQuestAccept(_player, (pObject->ToCreature()), qInfo);
@@ -327,7 +327,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
if (!(sScriptMgr->OnQuestReward(_player, (object->ToCreature()), quest, reward)))
{
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(guid , quest))
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
{
if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true))
{
@@ -346,7 +346,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
if (!sScriptMgr->OnQuestReward(_player, ((GameObject*)object), quest, reward))
{
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(guid , quest))
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
{
if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true))
{
@@ -546,49 +546,49 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(questId))
{
if (Group* pGroup = _player->GetGroup())
if (Group* group = _player->GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pPlayer = itr->getSource();
Player* player = itr->getSource();
if (!pPlayer || pPlayer == _player) // skip self
if (!player || player == _player) // skip self
continue;
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_SHARING_QUEST);
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_SHARING_QUEST);
if (!pPlayer->SatisfyQuestStatus(pQuest, false))
if (!player->SatisfyQuestStatus(pQuest, false))
{
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_HAVE_QUEST);
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_HAVE_QUEST);
continue;
}
if (pPlayer->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
if (player->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
{
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_FINISH_QUEST);
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_FINISH_QUEST);
continue;
}
if (!pPlayer->CanTakeQuest(pQuest, false))
if (!player->CanTakeQuest(pQuest, false))
{
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_CANT_TAKE_QUEST);
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_CANT_TAKE_QUEST);
continue;
}
if (!pPlayer->SatisfyQuestLog(false))
if (!player->SatisfyQuestLog(false))
{
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_LOG_FULL);
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_LOG_FULL);
continue;
}
if (pPlayer->GetDivider() != 0)
if (player->GetDivider() != 0)
{
_player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_BUSY);
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_BUSY);
continue;
}
pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true);
pPlayer->SetDivider(_player->GetGUID());
player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true);
player->SetDivider(_player->GetGUID());
}
}
}
@@ -604,26 +604,26 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
if (_player->GetDivider() != 0)
{
Player* pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider());
if (pPlayer)
Player* player = ObjectAccessor::FindPlayer(_player->GetDivider());
if (player)
{
WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1));
data << uint64(guid);
data << uint8(msg); // valid values: 0-8
pPlayer->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
_player->SetDivider(0);
}
}
}
uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus)
uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 defstatus)
{
uint32 result = defstatus;
QuestRelationBounds qr;
QuestRelationBounds qir;
switch(questgiver->GetTypeId())
switch (questgiver->GetTypeId())
{
case TYPEID_GAMEOBJECT:
{
@@ -651,12 +651,12 @@ uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32
if (!pQuest) continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
if (!sConditionMgr->IsPlayerMeetToConditions(pPlayer, conditions))
if (!sConditionMgr->IsPlayerMeetToConditions(player, conditions))
continue;
QuestStatus status = pPlayer->GetQuestStatus(quest_id);
if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) ||
(pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false)))
QuestStatus status = player->GetQuestStatus(quest_id);
if ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) ||
(pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)))
{
if (pQuest->IsAutoComplete() && pQuest->IsRepeatable())
result2 = DIALOG_STATUS_REWARD_REP;
@@ -679,19 +679,19 @@ uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
if (!sConditionMgr->IsPlayerMeetToConditions(pPlayer, conditions))
if (!sConditionMgr->IsPlayerMeetToConditions(player, conditions))
continue;
QuestStatus status = pPlayer->GetQuestStatus(quest_id);
QuestStatus status = player->GetQuestStatus(quest_id);
if (status == QUEST_STATUS_NONE)
{
if (pPlayer->CanSeeStartQuest(pQuest))
if (player->CanSeeStartQuest(pQuest))
{
if (pPlayer->SatisfyQuestLevel(pQuest, false))
if (player->SatisfyQuestLevel(pQuest, false))
{
if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->IsQuestRewarded(quest_id)))
if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && player->IsQuestRewarded(quest_id)))
result2 = DIALOG_STATUS_REWARD_REP;
else if (pPlayer->getLevel() <= ((pPlayer->GetQuestLevel(pQuest) == -1) ? pPlayer->getLevel() : pPlayer->GetQuestLevel(pQuest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF)))
else if (player->getLevel() <= ((player->GetQuestLevel(pQuest) == -1) ? player->getLevel() : player->GetQuestLevel(pQuest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF)))
{
if (pQuest->HasFlag(QUEST_FLAGS_DAILY) || pQuest->HasFlag(QUEST_FLAGS_WEEKLY))
result2 = DIALOG_STATUS_AVAILABLE_REP;
@@ -191,7 +191,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recv_data)
if (nodes.empty())
return;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d" , nodes.front(), nodes.back());
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d", nodes.front(), nodes.back());
GetPlayer()->ActivateTaxiPathTo(nodes, npc);
}
@@ -283,7 +283,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recv_data)
nodes.resize(2);
recv_data >> guid >> nodes[0] >> nodes[1];
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d" , nodes[0], nodes[1]);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]);
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
{
@@ -34,7 +34,7 @@ void WorldSession::SendTradeStatus(TradeStatus status)
{
WorldPacket data;
switch(status)
switch (status)
{
case TRADE_STATUS_BEGIN_TRADE:
data.Initialize(SMSG_TRADE_STATUS, 4+8);
+5 -5
View File
@@ -856,9 +856,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x33B*/ { "SMSG_INSTANCE_DIFFICULTY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x33C*/ { "MSG_GM_RESETINSTANCELIMIT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x33D*/ { "SMSG_MOTD", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x33E*/ { "SMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY",STATUS_NEVER,PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x33F*/ { "SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY",STATUS_NEVER,PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x340*/ { "CMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY_ACK",STATUS_NEVER,PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x33E*/ { "SMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x33F*/ { "SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x340*/ { "CMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x341*/ { "MSG_MOVE_START_SWIM_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x342*/ { "MSG_MOVE_STOP_SWIM_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x343*/ { "SMSG_MOVE_SET_CAN_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
@@ -868,7 +868,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x347*/ { "CMSG_SOCKET_GEMS", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSocketOpcode },
/*0x348*/ { "CMSG_ARENA_TEAM_CREATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x349*/ { "SMSG_ARENA_TEAM_COMMAND_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x34A*/ { "MSG_MOVE_UPDATE_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY",STATUS_NEVER,PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x34A*/ { "MSG_MOVE_UPDATE_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x34B*/ { "CMSG_ARENA_TEAM_QUERY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleArenaTeamQueryOpcode },
/*0x34C*/ { "SMSG_ARENA_TEAM_QUERY_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x34D*/ { "CMSG_ARENA_TEAM_ROSTER", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleArenaTeamRosterOpcode },
@@ -1284,7 +1284,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E8*/ { "SMSG_BATTLEFIELD_MGR_STATE_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E9*/ { "CMSG_BATTLEFIELD_MANAGER_ADVANCE_STATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EA*/ { "CMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME",STATUS_NEVER,PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EA*/ { "CMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EB*/ { "MSG_SET_RAID_DIFFICULTY", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetRaidDifficultyOpcode },
/*0x4EC*/ { "CMSG_TOGGLE_XP_GAIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4ED*/ { "SMSG_TOGGLE_XP_GAIN", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
+2 -2
View File
@@ -1282,7 +1282,7 @@ enum Opcodes
CMSG_SET_PAID_SERVICE_CHEAT = 0x4DD,
SMSG_BATTLEFIELD_MGR_ENTRY_INVITE = 0x4DE, // uint32
CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE = 0x4DF,
SMSG_BATTLEFIELD_MGR_ENTERED = 0x4E0, // uint32, uint8, uint8
SMSG_BATTLEFIELD_MGR_ENTERED = 0x4E0, // uint32, uint8, uint8
SMSG_BATTLEFIELD_MGR_QUEUE_INVITE = 0x4E1, // uint32
CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE = 0x4E2,
CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST = 0x4E3,
@@ -1300,7 +1300,7 @@ enum Opcodes
SMSG_GMRESPONSE_RECEIVED = 0x4EF, // uint32, uint32, string[2000], string[4000][4]
CMSG_GMRESPONSE_RESOLVE = 0x4F0,
SMSG_GMRESPONSE_STATUS_UPDATE = 0x4F1, // uint8 (1 - EVENT_GMSURVEY_DISPLAY, 0 - EVENT_UPDATE_TICKET)
SMSG_GMRESPONSE_CREATE_TICKET = 0x4F2,
SMSG_GMRESPONSE_CREATE_TICKET = 0x4F2,
CMSG_GMRESPONSE_CREATE_TICKET = 0x4F3,
CMSG_SERVERINFO = 0x4F4,
SMSG_SERVERINFO = 0x4F5,

Some files were not shown because too many files have changed in this diff Show More