Merge pull request #3391 from Bootz/master

Code-Stlye clean-ups
This commit is contained in:
Shocker
2011-10-07 09:19:37 -07:00
82 changed files with 837 additions and 841 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ struct DefaultTargetSelector : public std::unary_function<Unit*, bool>
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
+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);
+20 -20
View File
@@ -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)
+10 -10
View File
@@ -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;
}
+4 -4
View File
@@ -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())
{
+51 -51
View File
@@ -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)
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;
@@ -822,65 +822,65 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
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();
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();
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();
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*/)
@@ -2132,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
+2 -2
View File
@@ -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;
+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;
+4 -4
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)
+46 -46
View File
@@ -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);
@@ -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;
@@ -13291,11 +13291,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 +13303,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);
@@ -14348,11 +14348,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 +14459,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 +14507,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
@@ -15668,9 +15668,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();
@@ -16253,12 +16253,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");
@@ -20434,24 +20434,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 +20459,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;
}
@@ -20525,17 +20525,17 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
// reputation discount
if (price)
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))
@@ -20545,7 +20545,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
@@ -21961,9 +21961,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;
@@ -22374,9 +22374,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)
@@ -22390,7 +22390,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);
}
@@ -22609,14 +22609,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();
+4 -4
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);
@@ -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(),
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;
}
+19 -19
View File
@@ -10081,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)
@@ -10098,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
@@ -13805,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()
@@ -15682,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
@@ -16183,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();
@@ -16214,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();
@@ -16251,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();
+20 -20
View File
@@ -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);
}
}
}
@@ -1180,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
@@ -1213,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;
@@ -1230,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;
};
+11 -15
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())
@@ -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;
}
}
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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();
+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
@@ -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)));
@@ -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,7 +576,7 @@ 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",
// GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
@@ -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
@@ -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);
@@ -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()))
{
@@ -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
@@ -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.
@@ -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;
}
@@ -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
@@ -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);
}
}
}
@@ -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,19 +604,19 @@ 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;
@@ -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;
+2 -2
View File
@@ -441,8 +441,8 @@ void WorldSession::LogoutPlayer(bool Save)
HandleMoveWorldportAckOpcode();
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
if (Guild* pGuild = sGuildMgr->GetGuildById(_player->GetGuildId()))
pGuild->HandleMemberLogout(this);
if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
guild->HandleMemberLogout(this);
///- Remove pet
_player->RemovePet(NULL, PET_SAVE_AS_CURRENT, true);
+1 -1
View File
@@ -367,7 +367,7 @@ class WorldSession
uint32 GetLatency() const { return m_latency; }
void SetLatency(uint32 latency) { m_latency = latency; }
uint32 getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus);
uint32 getDialogStatus(Player* player, Object* questgiver, uint32 defstatus);
time_t m_timeOutTime;
void UpdateTimeOutTime(uint32 diff)
+3 -3
View File
@@ -2665,10 +2665,10 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
Player* targetPlayer = m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER
? (Player*)m_targets.GetUnitTarget() : NULL;
Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL;
if (pGroup)
Group* group = targetPlayer ? targetPlayer->GetGroup() : NULL;
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();
+10 -10
View File
@@ -3328,9 +3328,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue();
m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true);
// Glyph of Felhunter
if (Unit* pOwner = m_caster->GetOwner())
if (pOwner->GetAura(56249))
pOwner->CastCustomSpell(pOwner, 19658, &heal_amount, NULL, NULL, true);
if (Unit* owner = m_caster->GetOwner())
if (owner->GetAura(56249))
owner->CastCustomSpell(owner, 19658, &heal_amount, NULL, NULL, true);
}
}
@@ -6287,7 +6287,7 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player* pPlayer = unitTarget->ToPlayer();
Player* player = unitTarget->ToPlayer();
uint32 quest_id = m_spellInfo->Effects[effIndex].MiscValue;
@@ -6297,24 +6297,24 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex)
return;
// Player has never done this quest
if (pPlayer->GetQuestStatus(quest_id) == QUEST_STATUS_NONE)
if (player->GetQuestStatus(quest_id) == QUEST_STATUS_NONE)
return;
// remove all quest entries for 'entry' from quest log
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
{
uint32 quest = pPlayer->GetQuestSlotQuestId(slot);
uint32 quest = player->GetQuestSlotQuestId(slot);
if (quest == quest_id)
{
pPlayer->SetQuestSlot(slot, 0);
player->SetQuestSlot(slot, 0);
// we ignore unequippable quest items in this case, its' still be equipped
pPlayer->TakeQuestSourceItem(quest, false);
player->TakeQuestSourceItem(quest, false);
}
}
pPlayer->RemoveActiveQuest(quest_id);
pPlayer->RemoveRewardedQuest(quest_id);
player->RemoveActiveQuest(quest_id);
player->RemoveRewardedQuest(quest_id);
}
void Spell::EffectSendTaxi(SpellEffIndex effIndex)
@@ -244,22 +244,22 @@ public:
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit;
Unit* unit;
if ((*i) && (*i)->getSource())
{
pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit)
unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit)
{
//Cast affliction
DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true);
//Chromatic mutation if target is effected by all afflictions
if (pUnit->HasAura(SPELL_BROODAF_BLUE)
&& pUnit->HasAura(SPELL_BROODAF_BLACK)
&& pUnit->HasAura(SPELL_BROODAF_RED)
&& pUnit->HasAura(SPELL_BROODAF_BRONZE)
&& pUnit->HasAura(SPELL_BROODAF_GREEN))
if (unit->HasAura(SPELL_BROODAF_BLUE)
&& unit->HasAura(SPELL_BROODAF_BLACK)
&& unit->HasAura(SPELL_BROODAF_RED)
&& unit->HasAura(SPELL_BROODAF_BRONZE)
&& unit->HasAura(SPELL_BROODAF_GREEN))
{
//pTarget->RemoveAllAuras();
//DoCast(target, SPELL_CHROMATIC_MUT_1);
@@ -269,8 +269,8 @@ public:
//So instead we instant kill our target
//WORKAROUND
if (pUnit->GetTypeId() == TYPEID_PLAYER)
pUnit->CastSpell(pUnit, 5, false);
if (unit->GetTypeId() == TYPEID_PLAYER)
unit->CastSpell(unit, 5, false);
}
}
}
@@ -141,8 +141,8 @@ public:
{
if (Phase == 2)
{
if (Unit* pUnit = Unit::GetUnit(*me, Attumen))
DoScriptText(SAY_MIDNIGHT_KILL, pUnit);
if (Unit* unit = Unit::GetUnit(*me, Attumen))
DoScriptText(SAY_MIDNIGHT_KILL, unit);
}
}
@@ -359,9 +359,9 @@ struct boss_moroes_guestAI : public ScriptedAI
uint64 TempGUID = GuestGUID[rand()%4];
if (TempGUID)
{
Unit* pUnit = Unit::GetUnit((*me), TempGUID);
if (pUnit && pUnit->isAlive())
return pUnit;
Unit* unit = Unit::GetUnit((*me), TempGUID);
if (unit && unit->isAlive())
return unit;
}
return me;
@@ -424,10 +424,10 @@ public:
for (uint32 i = 0; i < 4; ++i)
{
if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
if (Creature* unit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
{
pUnit->Attack(me->getVictim(), true);
pUnit->setFaction(me->getFaction());
unit->Attack(me->getVictim(), true);
unit->setFaction(me->getFaction());
}
}
@@ -438,10 +438,10 @@ public:
{
for (uint32 i = 0; i < 5; ++i)
{
if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
if (Creature* unit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
pUnit->Attack(me->getVictim(), true);
pUnit->setFaction(me->getFaction());
unit->Attack(me->getVictim(), true);
unit->setFaction(me->getFaction());
}
}
@@ -464,11 +464,11 @@ public:
if (!FlameWreathTarget[i])
continue;
Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]);
if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
Unit* unit = Unit::GetUnit(*me, FlameWreathTarget[i]);
if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
{
pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID());
pUnit->CastSpell(pUnit, 11027, true);
unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, 11027, true);
FlameWreathTarget[i] = 0;
}
}
@@ -193,11 +193,11 @@ public:
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && pUnit->isAlive())
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && unit->isAlive())
{
float threat = me->getThreatManager().getThreat(pUnit);
SummonedUnit->AddThreat(pUnit, threat);
float threat = me->getThreatManager().getThreat(unit);
SummonedUnit->AddThreat(unit, threat);
}
}
}
@@ -211,9 +211,9 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true);
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true);
}
DoCast(me, SPELL_TELEPORT_CENTER, true);
}
@@ -223,10 +223,10 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
// Knockback into the air
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
}
}
@@ -235,17 +235,17 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
// Also needs an exception in spell system.
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
// Use packet hack
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
data.append(pUnit->GetPackGUID());
data.append(unit->GetPackGUID());
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
unit->SendMessageToSet(&data, true);
}
}
}
@@ -255,17 +255,17 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
data.append(pUnit->GetPackGUID());
data.append(unit->GetPackGUID());
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
unit->SendMessageToSet(&data, true);
}
}
}
@@ -527,12 +527,12 @@ public:
{
DoCast(me, SPELL_VANISH);
Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0);
Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0);
DoResetThreat();
if (pUnit)
me->AddThreat(pUnit, 1000.0f);
if (unit)
me->AddThreat(unit, 1000.0f);
InVanish = true;
Vanish_Timer = 30000;
@@ -644,24 +644,24 @@ public:
if (Seed_of_Corruption_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_SEED_OF_CORRUPTION);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_SEED_OF_CORRUPTION);
Seed_of_Corruption_Timer = 10000;
} else Seed_of_Corruption_Timer -= diff;
if (Curse_of_Agony_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_CURSE_OF_AGONY);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_CURSE_OF_AGONY);
Curse_of_Agony_Timer = 13000;
} else Curse_of_Agony_Timer -= diff;
if (Fear_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_FEAR);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_FEAR);
Fear_Timer = 10000;
} else Fear_Timer -= diff;
@@ -806,8 +806,8 @@ public:
if (Blizzard_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_BLIZZARD);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_BLIZZARD);
Blizzard_Timer = 8000;
} else Blizzard_Timer -= diff;
@@ -937,8 +937,8 @@ public:
//if nobody is in melee range than try to use Intercept
if (!InMeleeRange)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_INTERCEPT_STUN);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_INTERCEPT_STUN);
}
Intercept_Stun_Timer = 10000;
@@ -1168,8 +1168,8 @@ public:
if (Purge_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_PURGE);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_PURGE);
Purge_Timer = 15000;
} else Purge_Timer -= diff;
@@ -103,15 +103,15 @@ public:
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* pUnit = Unit::GetUnit(*me, *itr);
if (pUnit)
//Unit* unit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* unit = Unit::GetUnit(*me, *itr);
if (unit)
{
if (!pUnit->isAlive())
CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc.
if (!unit->isAlive())
CAST_CRE(unit)->Respawn(); // Let the core handle setting death state, etc.
// Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here.
pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
@@ -478,8 +478,8 @@ public:
{
me->setFaction(FACTION_HOSTILE);
if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID))
AttackStart(pUnit);
if (Unit* unit = Unit::GetUnit(*me, m_uiDuelerGUID))
AttackStart(unit);
}
else
m_uiDuelTimer -= uiDiff;
@@ -569,9 +569,9 @@ public:
std::list<HostileReference*>::const_iterator itr;
for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive() && pUnit != caster)
me->AddThreat(pUnit, caster->getThreatManager().getThreat(pUnit));
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive() && unit != caster)
me->AddThreat(unit, caster->getThreatManager().getThreat(unit));
}
}
}
@@ -53,9 +53,9 @@ public:
if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED)
return false;
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* pGroupie = itr->getSource();
if (!pGroupie)
@@ -760,11 +760,11 @@ public:
{
for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() > me->GetPositionZ()+5)
if (unit->GetPositionZ() > me->GetPositionZ()+5)
{
me->getThreatManager().modifyThreatPercent(pUnit, -100);
me->getThreatManager().modifyThreatPercent(unit, -100);
}
}
}
@@ -994,9 +994,9 @@ public:
std::list<HostileReference*>::iterator itr;
for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
{
Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (pUnit)
pPortal->AddThreat(pUnit, 1.0f);
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit)
pPortal->AddThreat(unit, 1.0f);
}
}
FelfirePortalTimer = 20000;
@@ -160,23 +160,23 @@ class boss_mandokir : public CreatureScript
{
if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him
{
Unit* pUnit = Unit::GetUnit(*me, WatchTarget);
Unit* unit = Unit::GetUnit(*me, WatchTarget);
if (pUnit && (
targetX != pUnit->GetPositionX() ||
targetY != pUnit->GetPositionY() ||
targetZ != pUnit->GetPositionZ() ||
pUnit->isInCombat()))
if (unit && (
targetX != unit->GetPositionX() ||
targetY != unit->GetPositionY() ||
targetZ != unit->GetPositionZ() ||
unit->isInCombat()))
{
if (me->IsWithinMeleeRange(pUnit))
if (me->IsWithinMeleeRange(unit))
{
DoCast(pUnit, 24316);
DoCast(unit, 24316);
}
else
{
DoCast(pUnit, SPELL_CHARGE);
//me->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true, 1);
AttackStart(pUnit);
DoCast(unit, SPELL_CHARGE);
//me->SendMonsterMove(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0, true, 1);
AttackStart(unit);
}
}
}
@@ -198,12 +198,12 @@ class boss_mandokir : public CreatureScript
if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position
{
Unit* pUnit = Unit::GetUnit(*me, WatchTarget);
if (pUnit)
Unit* unit = Unit::GetUnit(*me, WatchTarget);
if (unit)
{
targetX = pUnit->GetPositionX();
targetY = pUnit->GetPositionY();
targetZ = pUnit->GetPositionZ();
targetX = unit->GetPositionX();
targetY = unit->GetPositionY();
targetZ = unit->GetPositionZ();
}
endWatch = false;
}
@@ -232,8 +232,8 @@ class boss_mandokir : public CreatureScript
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (pUnit && me->IsWithinMeleeRange(pUnit))
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && me->IsWithinMeleeRange(unit))
++TargetInRange;
}
@@ -358,9 +358,9 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive())
targets.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive())
targets.push_back(unit);
}
if (targets.empty())
@@ -714,9 +714,9 @@ void hyjalAI::DeSpawnVeins()
return;
if (Faction == 1)
{
Creature* pUnit=Unit::GetCreature((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE));
if (!pUnit)return;
hyjalAI* ai = CAST_AI(hyjalAI, pUnit->AI());
Creature* unit=Unit::GetCreature((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
for (uint8 i = 0; i<7; ++i)
{
@@ -725,9 +725,9 @@ void hyjalAI::DeSpawnVeins()
}
} else if (Faction)
{
Creature* pUnit=Unit::GetCreature((*me), pInstance->GetData64(DATA_THRALL));
if (!pUnit)return;
hyjalAI* ai = CAST_AI(hyjalAI, pUnit->AI());
Creature* unit=Unit::GetCreature((*me), pInstance->GetData64(DATA_THRALL));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
for (uint8 i = 7; i<14; ++i)
{
@@ -853,8 +853,8 @@ void hyjalAI::UpdateAI(const uint32 diff)
{
if (BossGUID[i])
{
Unit* pUnit = Unit::GetUnit((*me), BossGUID[i]);
if (pUnit && (!pUnit->isAlive()))
Unit* unit = Unit::GetUnit((*me), BossGUID[i]);
if (unit && (!unit->isAlive()))
{
if (BossGUID[i] == BossGUID[0])
{
@@ -1080,37 +1080,37 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
{
Creature* pUnit = me->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
pUnit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]);
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
unit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
break;
@@ -1120,38 +1120,38 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
for (uint8 i = 0; i < 26; ++i)//summon infernals
{
Creature* pUnit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
pUnit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
break;
@@ -191,12 +191,12 @@ public:
Creature* creature = instance->GetCreature(Azgalor);
if (creature)
{
Creature* pUnit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000);
Creature* unit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000);
Map* pMap = creature->GetMap();
if (pMap->IsDungeon() && pUnit)
if (pMap->IsDungeon() && unit)
{
pUnit->SetVisible(false);
unit->SetVisible(false);
Map::PlayerList const &PlayerList = pMap->GetPlayers();
if (PlayerList.isEmpty())
return;
@@ -206,7 +206,7 @@ public:
if (i->getSource())
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
pUnit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
unit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
i->getSource()->GetSession()->SendPacket(&data);
WorldPacket data2(SMSG_PLAY_SOUND, 4);
@@ -576,11 +576,11 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, i->first);
Unit* unit = Unit::GetUnit(*me, i->first);
//Only units out of stomach
if (pUnit && i->second == false)
temp.push_back(pUnit);
if (unit && i->second == false)
temp.push_back(unit);
++i;
}
@@ -724,19 +724,19 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, i->first);
Unit* unit = Unit::GetUnit(*me, i->first);
//Only move units in stomach
if (pUnit && i->second == true)
if (unit && i->second == true)
{
//Teleport each player out
DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
//Cast knockback on them
DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
//Remove the acid debuff
pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
i->second = false;
}
@@ -755,25 +755,25 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, i->first);
Unit* unit = Unit::GetUnit(*me, i->first);
//Only apply to units in stomach
if (pUnit && i->second == true)
if (unit && i->second == true)
{
//Cast digestive acid on them
DoCast(pUnit, SPELL_DIGESTIVE_ACID, true);
DoCast(unit, SPELL_DIGESTIVE_ACID, true);
//Check if player should be kicked from stomach
if (pUnit->IsWithinDist3d(&KickPos, 15.0f))
if (unit->IsWithinDist3d(&KickPos, 15.0f))
{
//Teleport each player out
DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
//Cast knockback on them
DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
//Remove the acid debuff
pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
i->second = false;
}
@@ -805,11 +805,11 @@ public:
if (StomachEnterVisTimer <= diff)
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget);
Unit* unit = Unit::GetUnit(*me, StomachEnterTarget);
if (pUnit)
if (unit)
{
DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
}
StomachEnterTarget = 0;
@@ -87,10 +87,10 @@ public:
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation());
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, unit->GetOrientation());
}
}
@@ -535,8 +535,8 @@ public:
SetCombatMovement(true);
if (me->isInCombat())
if (Unit* pUnit = me->getVictim())
me->GetMotionMaster()->MoveChase(pUnit);
if (Unit* unit = me->getVictim())
me->GetMotionMaster()->MoveChase(unit);
}
void MoveToDock()
+4 -4
View File
@@ -160,9 +160,9 @@ public:
switch (uiEventPhase)
{
case 1:
if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID))
if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID))
{
if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH))
if (GameObject* pGo = unit->GetGameObject(SPELL_LUNCH))
{
m_bIsMovingToLunch = true;
me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ());
@@ -174,8 +174,8 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING);
break;
case 3:
if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID))
pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID());
if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID))
unit->TalkedToCreature(me->GetEntry(), me->GetGUID());
me->UpdateEntry(NPC_KYLE_FRIENDLY);
break;
@@ -223,8 +223,8 @@ public:
uint64 uiGrandChampionBoss1 = 0;
if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID))
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* pUnit = pVehicle->GetPassenger(0))
uiGrandChampionBoss1 = pUnit->GetGUID();
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss1 = unit->GetGUID();
if (pInstance)
{
pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID);
@@ -239,8 +239,8 @@ public:
uint64 uiGrandChampionBoss2 = 0;
if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID))
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* pUnit = pVehicle->GetPassenger(0))
uiGrandChampionBoss2 = pUnit->GetGUID();
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss2 = unit->GetGUID();
if (pInstance)
{
pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID);
@@ -255,8 +255,8 @@ public:
uint64 uiGrandChampionBoss3 = 0;
if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID))
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* pUnit = pVehicle->GetPassenger(0))
uiGrandChampionBoss3 = pUnit->GetGUID();
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss3 = unit->GetGUID();
if (pInstance)
{
pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID);
@@ -292,14 +292,14 @@ struct boss_faction_championsAI : public ScriptedAI
std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && me->getThreatManager().getThreat(pUnit))
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && me->getThreatManager().getThreat(unit))
{
if (pUnit->GetTypeId()==TYPEID_PLAYER)
if (unit->GetTypeId()==TYPEID_PLAYER)
{
float threat = CalculateThreat(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth());
me->getThreatManager().modifyThreatPercent(pUnit, -100);
me->AddThreat(pUnit, 1000000.0f * threat);
float threat = CalculateThreat(me->GetDistance2d(unit), (float)unit->GetArmor(), unit->GetHealth());
me->getThreatManager().modifyThreatPercent(unit, -100);
me->AddThreat(unit, 1000000.0f * threat);
}
}
}
@@ -114,8 +114,8 @@ struct boss_horAI : ScriptedAI
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
if (Unit* pUnit = me->SelectNearestTarget())
AttackStart(pUnit);
if (Unit* unit = me->SelectNearestTarget())
AttackStart(unit);
DoZoneInCombat();
break;
@@ -276,8 +276,8 @@ public:
if (timeBombTimer <= uiDiff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(pUnit, SPELL_TIME_BOMB);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(unit, SPELL_TIME_BOMB);
timeBombTimer = urand(20000, 25000);
} else timeBombTimer -= uiDiff;
@@ -137,8 +137,8 @@ public:
if (SpellVoidShiftTimer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_VOID_SHIFT);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_VOID_SHIFT);
SpellVoidShiftTimer = 20000;
} else SpellVoidShiftTimer -=diff;
@@ -1706,12 +1706,12 @@ public:
{
}
void SpellHit(Unit* pUnit, const SpellInfo* pSpell)
void SpellHit(Unit* unit, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_NEURAL_NEEDLE && pUnit->GetTypeId() == TYPEID_PLAYER)
if (pSpell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER)
{
++uiPhase;
CasterGUID = pUnit->GetGUID();
CasterGUID = unit->GetGUID();
}
}
+1 -1
View File
@@ -399,7 +399,7 @@ public:
struct npc_vereth_the_cunningAI : public ScriptedAI
{
npc_vereth_the_cunningAI(Creature* pCreature) : ScriptedAI(pCreature) {}
npc_vereth_the_cunningAI(Creature* creature) : ScriptedAI(creature) {}
void MoveInLineOfSight(Unit* who)
{
+11 -11
View File
@@ -839,12 +839,12 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() <= 286.276f)
if (unit->GetPositionZ() <= 286.276f)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(pUnit, 5.0f);
me->AddThreat(unit, 5.0f);
break;
}
EnterEvadeMode();
@@ -961,12 +961,12 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() <= 286.276f)
if (unit->GetPositionZ() <= 286.276f)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(pUnit, 5.0f);
me->AddThreat(unit, 5.0f);
break;
}
EnterEvadeMode();
@@ -1083,7 +1083,7 @@ public:
}
void EnterCombat(Unit* pUnit)
void EnterCombat(Unit* unit)
{
if (!SummonList.empty())
for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
@@ -1091,7 +1091,7 @@ public:
if (Creature* pTemp = Unit::GetCreature(*me, *itr))
{
pTemp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :(
pTemp->AI()->AttackStart(pUnit);
pTemp->AI()->AttackStart(unit);
}
}
}
@@ -1106,12 +1106,12 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() <= 286.276f)
if (unit->GetPositionZ() <= 286.276f)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(pUnit, 5.0f);
me->AddThreat(unit, 5.0f);
break;
}
EnterEvadeMode();
@@ -185,14 +185,14 @@ public:
void RevertThreatOnTarget(uint64 guid)
{
Unit* pUnit = NULL;
pUnit = Unit::GetUnit((*me), guid);
if (pUnit)
Unit* unit = NULL;
unit = Unit::GetUnit((*me), guid);
if (unit)
{
if (DoGetThreat(pUnit))
DoModifyThreatPercent(pUnit, -100);
if (DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
if (TargetThreat)
me->AddThreat(pUnit, TargetThreat);
me->AddThreat(unit, TargetThreat);
}
}
@@ -1474,9 +1474,9 @@ public:
std::vector<Unit*> eliteList;
for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE)
eliteList.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->GetEntry() == ILLIDARI_ELITE)
eliteList.push_back(unit);
}
for (std::vector<Unit*>::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr)
(*itr)->setDeathState(JUST_DIED);
@@ -165,12 +165,12 @@ public:
float Z = TeleportPoint[random].z;
for (uint8 i = 0; i < 3; ++i)
{
Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER))
{
TargetGUID[i] = pUnit->GetGUID();
pUnit->CastSpell(pUnit, SPELL_TELEPORT_VISUAL, true);
DoTeleportPlayer(pUnit, X, Y, Z, pUnit->GetOrientation());
TargetGUID[i] = unit->GetGUID();
unit->CastSpell(unit, SPELL_TELEPORT_VISUAL, true);
DoTeleportPlayer(unit, X, Y, Z, unit->GetOrientation());
}
}
}
@@ -247,12 +247,12 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
Unit* pUnit = NULL;
Unit* unit = NULL;
if (TargetGUID[i])
{
pUnit = Unit::GetUnit((*me), TargetGUID[i]);
if (pUnit)
pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true);
unit = Unit::GetUnit((*me), TargetGUID[i]);
if (unit)
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
}
@@ -216,12 +216,12 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit)
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit)
{
DoModifyThreatPercent(pUnit, -100);
float threat = target->getThreatManager().getThreat(pUnit);
me->AddThreat(pUnit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences).
DoModifyThreatPercent(unit, -100);
float threat = target->getThreatManager().getThreat(unit);
me->AddThreat(unit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences).
}
}
}
@@ -438,9 +438,9 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) // Only alive players
targets.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players
targets.push_back(unit);
}
if (targets.empty())
return; // No targets added for some reason. No point continuing.
@@ -821,14 +821,14 @@ public:
{
bool Yelled = false;
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature(*me, *itr))
if (Creature* unit = Unit::GetCreature(*me, *itr))
{
if (!Yelled)
{
DoScriptText(SAY_BROKEN_FREE_01, pUnit);
DoScriptText(SAY_BROKEN_FREE_01, unit);
Yelled = true;
}
pUnit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
unit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
}
}
++EndingTalkCount;
@@ -838,9 +838,9 @@ public:
if (!BrokenList.empty())
{
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature(*me, *itr))
if (Creature* unit = Unit::GetCreature(*me, *itr))
// This is the incorrect spell, but can't seem to find the right one.
pUnit->CastSpell(pUnit, 39656, true);
unit->CastSpell(unit, 39656, true);
}
++EndingTalkCount;
SoulRetrieveTimer = 5000;
@@ -849,8 +849,8 @@ public:
if (!BrokenList.empty())
{
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature((*me), *itr))
pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0);
if (Creature* unit = Unit::GetCreature((*me), *itr))
unit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0);
}
SoulRetrieveTimer = 0;
break;
@@ -177,13 +177,13 @@ public:
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && me->IsWithinMeleeRange(pUnit))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && me->IsWithinMeleeRange(unit))
{
if (pUnit->GetHealth() > health)
if (unit->GetHealth() > health)
{
health = pUnit->GetHealth();
target = pUnit;
health = unit->GetHealth();
target = unit;
}
}
}
@@ -173,9 +173,9 @@ public:
std::list<Unit*> targets;
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive())
targets.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive())
targets.push_back(unit);
}
targets.sort(Trinity::ObjectDistanceOrderPred(me));
Unit* target = targets.front();
@@ -322,11 +322,11 @@ public:
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && pUnit->isAlive())
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && unit->isAlive())
{
float threat = DoGetThreat(pUnit);
Blossom->AddThreat(pUnit, threat);
float threat = DoGetThreat(unit);
Blossom->AddThreat(unit, threat);
}
}
}
@@ -389,9 +389,9 @@ public:
Done = true;
if (AggroTargetGUID)
{
Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID);
if (pUnit)
AttackStart(pUnit);
Unit* unit = Unit::GetUnit((*me), AggroTargetGUID);
if (unit)
AttackStart(unit);
DoZoneInCombat();
}
@@ -419,10 +419,10 @@ struct boss_illidari_councilAI : public ScriptedAI
{
for (uint8 i = 0; i < 4; ++i)
{
if (Unit* pUnit = Unit::GetUnit(*me, Council[i]))
if (pUnit != me && pUnit->getVictim())
if (Unit* unit = Unit::GetUnit(*me, Council[i]))
if (unit != me && unit->getVictim())
{
AttackStart(pUnit->getVictim());
AttackStart(unit->getVictim());
return;
}
}
@@ -437,11 +437,11 @@ struct boss_illidari_councilAI : public ScriptedAI
damage /= 4;
for (uint8 i = 0; i < 4; ++i)
{
if (Creature* pUnit = Unit::GetCreature(*me, Council[i]))
if (pUnit != me && damage < pUnit->GetHealth())
if (Creature* unit = Unit::GetCreature(*me, Council[i]))
if (unit != me && damage < unit->GetHealth())
{
pUnit->ModifyHealth(-int32(damage));
pUnit->LowerPlayerDamageReq(damage);
unit->ModifyHealth(-int32(damage));
unit->LowerPlayerDamageReq(damage);
}
}
}
@@ -504,15 +504,15 @@ public:
Unit* SelectCouncilMember()
{
Unit* pUnit = me;
Unit* unit = me;
uint32 member = 0; // He chooses Lady Malande most often
if (rand()%10 == 0) // But there is a chance he picks someone else.
member = urand(1, 3);
if (member != 2) // No need to create another pointer to us using Unit::GetUnit
pUnit = Unit::GetUnit((*me), Council[member]);
return pUnit;
unit = Unit::GetUnit((*me), Council[member]);
return unit;
}
void CastAuraOnCouncil()
@@ -525,9 +525,9 @@ public:
}
for (uint8 i = 0; i < 4; ++i)
{
Unit* pUnit = Unit::GetUnit((*me), Council[i]);
if (pUnit)
pUnit->CastSpell(pUnit, spellid, true, 0, 0, me->GetGUID());
Unit* unit = Unit::GetUnit((*me), Council[i]);
if (unit)
unit->CastSpell(unit, spellid, true, 0, 0, me->GetGUID());
}
}
@@ -538,12 +538,12 @@ public:
if (BlessingTimer <= diff)
{
if (Unit* pUnit = SelectCouncilMember())
if (Unit* unit = SelectCouncilMember())
{
switch (urand(0, 1))
{
case 0: DoCast(pUnit, SPELL_BLESS_SPELLWARD); break;
case 1: DoCast(pUnit, SPELL_BLESS_PROTECTION); break;
case 0: DoCast(unit, SPELL_BLESS_SPELLWARD); break;
case 1: DoCast(unit, SPELL_BLESS_PROTECTION); break;
}
}
BlessingTimer = 60000;
@@ -707,15 +707,15 @@ public:
if (Heal_Timer <= diff)
{
// It can be cast on any of the mobs
Unit* pUnit = NULL;
Unit* unit = NULL;
while (pUnit == NULL || !pUnit->isAlive())
while (unit == NULL || !unit->isAlive())
{
pUnit = selectAdvisorUnit();
unit = selectAdvisorUnit();
}
if (pUnit && pUnit->isAlive())
DoCast(pUnit, SPELL_HEAL);
if (unit && unit->isAlive())
DoCast(unit, SPELL_HEAL);
Heal_Timer = 60000;
} else Heal_Timer -= diff;
@@ -724,26 +724,26 @@ public:
Unit* selectAdvisorUnit()
{
Unit* pUnit = NULL;
Unit* unit = NULL;
if (pInstance)
{
switch (rand()%4)
{
case 0:
pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS));
unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS));
break;
case 1:
pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS));
unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS));
break;
case 2:
pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS));
unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS));
break;
case 3:
pUnit = me;
unit = me;
break;
}
} else pUnit = me;
return pUnit;
} else unit = me;
return unit;
}
};
};
@@ -96,9 +96,9 @@ public:
}
void JustDied(Unit* /*victim*/)
{
Unit* pUnit = Unit::GetUnit((*me), victimGUID);
if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER))
pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER);
Unit* unit = Unit::GetUnit((*me), victimGUID);
if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER))
unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER);
}
void DamageTaken(Unit* done_by, uint32 &damage)
@@ -353,13 +353,13 @@ public:
{
if (InnderDemon[i] > 0)
{
Creature* pUnit = Unit::GetCreature((*me), InnderDemon[i]);
if (pUnit && pUnit->isAlive())
Creature* unit = Unit::GetCreature((*me), InnderDemon[i]);
if (unit && unit->isAlive())
{
Unit* unit_target = Unit::GetUnit(*pUnit, CAST_AI(mob_inner_demon::mob_inner_demonAI, pUnit->AI())->victimGUID);
Unit* unit_target = Unit::GetUnit(*unit, CAST_AI(mob_inner_demon::mob_inner_demonAI, unit->AI())->victimGUID);
if (unit_target && unit_target->isAlive())
{
pUnit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true);
unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true);
DoModifyThreatPercent(unit_target, -100);
}
}
@@ -770,8 +770,8 @@ class boss_kaelthas : public CreatureScript
if (FlameStrike_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_FLAME_STRIKE);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_FLAME_STRIKE);
FlameStrike_Timer = 30000;
}
@@ -784,7 +784,7 @@ class boss_kaelthas : public CreatureScript
for (uint32 i = 0; i < 3; ++i)
{
sLog->outDebug(LOG_FILTER_TSCR, "SD2: Kael'Thas mind control not supported.");
//DoCast(pUnit, SPELL_MIND_CONTROL);
//DoCast(unit, SPELL_MIND_CONTROL);
}
MindControl_Timer = 60000;
@@ -892,11 +892,11 @@ class boss_kaelthas : public CreatureScript
// 1) Kael'thas will portal the whole raid right into his body
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
//Use work around packet to prevent player from being dropped from combat
DoTeleportPlayer(pUnit, afGravityPos[0], afGravityPos[1], afGravityPos[2], pUnit->GetOrientation());
DoTeleportPlayer(unit, afGravityPos[0], afGravityPos[1], afGravityPos[2], unit->GetOrientation());
}
}
@@ -913,20 +913,20 @@ class boss_kaelthas : public CreatureScript
// 2) At that point he will put a Gravity Lapse debuff on everyone
for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
{
if (Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
{
DoCast(pUnit, SPELL_KNOCKBACK, true);
DoCast(unit, SPELL_KNOCKBACK, true);
//Gravity lapse - needs an exception in Spell system to work
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE, true, 0, 0, me->GetGUID());
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID());
//Using packet workaround
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
data.append(pUnit->GetPackGUID());
data.append(unit->GetPackGUID());
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
unit->SendMessageToSet(&data, true);
}
}
GravityLapse_Timer = 10000;
@@ -946,14 +946,14 @@ class boss_kaelthas : public CreatureScript
//Remove flight
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
if (Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
{
//Using packet workaround
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
data.append(pUnit->GetPackGUID());
data.append(unit->GetPackGUID());
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
unit->SendMessageToSet(&data, true);
}
}
@@ -982,8 +982,8 @@ class boss_kaelthas : public CreatureScript
//NetherBeam_Timer
if (NetherBeam_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_NETHER_BEAM);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_NETHER_BEAM);
NetherBeam_Timer = 4000;
}
@@ -1286,12 +1286,12 @@ class boss_grand_astromancer_capernian : public CreatureScript
std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
//if in melee range
if (pUnit && pUnit->IsWithinDistInMap(me, 5))
if (unit && unit->IsWithinDistInMap(me, 5))
{
InMeleeRange = true;
target = pUnit;
target = unit;
break;
}
}
+3 -3
View File
@@ -809,10 +809,10 @@ public:
for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetCreateMana() > 0)
UnitsWithMana.push_back(pUnit);
if (unit->GetCreateMana() > 0)
UnitsWithMana.push_back(unit);
}
}
if (!UnitsWithMana.empty())
@@ -129,9 +129,9 @@ public:
{
if (bCanEat && !bIsEating)
{
if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID))
if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID))
{
if (GameObject* pGo = pUnit->FindNearestGameObject(GO_CARCASS, 10))
if (GameObject* pGo = unit->FindNearestGameObject(GO_CARCASS, 10))
{
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();
@@ -95,9 +95,9 @@ public:
if (done_by->GetTypeId() == TYPEID_PLAYER)
if (me->HealthBelowPctDamaged(30, damage))
{
if (Group* pGroup = CAST_PLR(done_by)->GetGroup())
if (Group* group = CAST_PLR(done_by)->GetGroup())
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupie = itr->getSource();
if (pGroupie &&