Apply style fix pt3

This commit is contained in:
Antz 2020-01-13 10:14:05 +00:00
parent 1392c131e7
commit d93dbd95fe
191 changed files with 9851 additions and 676 deletions

View file

@ -212,7 +212,9 @@ class TypeUnorderedMapContainer
return NULL;
}
else
{ return i->second; }
{
return i->second;
}
}
template<class SPECIFIC_TYPE>

View file

@ -270,7 +270,9 @@ class LinkedListHead
return result;
}
else
{ return iSize; }
{
return iSize;
}
}
/**

View file

@ -148,9 +148,13 @@ class AHB_Seller_Config
return 1;
}
else if ((m_maxTime) && (m_minTime > m_maxTime))
{ return m_maxTime; }
{
return m_maxTime;
}
else
{ return m_minTime; }
{
return m_minTime;
}
}
void SetMaxTime(uint32 value) { m_maxTime = value; }
@ -167,7 +171,9 @@ class AHB_Seller_Config
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
}
else
{ m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0; }
{
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
}
}
uint32 GetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems; }
@ -408,7 +414,9 @@ bool AuctionBotConfig::Initialize()
return false;
}
else
{ sLog.outString("AHBot using configuration file %s", m_configFileName.c_str()); }
{
sLog.outString("AHBot using configuration file %s", m_configFileName.c_str());
}
GetConfigFromFile();
@ -747,14 +755,18 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount();
}
else if (buyerItem.MinBuyPrice == 0)
{ buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount(); }
{
buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount();
}
}
if (Aentry->startbid / item->GetCount() < buyerItem.MinBidPrice)
{
buyerItem.MinBidPrice = Aentry->startbid / item->GetCount();
}
else if (buyerItem.MinBidPrice == 0)
{ buyerItem.MinBidPrice = Aentry->startbid / item->GetCount(); }
{
buyerItem.MinBidPrice = Aentry->startbid / item->GetCount();
}
if (Aentry->owner == sAuctionBotConfig.GetAHBotId())
{
@ -803,7 +815,9 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
config.CheckedEntry.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: CheckedEntry size = " SIZEFMTD, config.CheckedEntry.size());
@ -858,7 +872,9 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
}
}
else if (buyoutPrice <= MaxBuyablePrice)
{ Chance = MaxChance / 10; }
{
Chance = MaxChance / 10;
}
else
{
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
@ -909,12 +925,16 @@ bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, do
Chance = ((MaxChance / 500) * ratio);
}
else
{ Chance = (MaxChance / 500); }
{
Chance = (MaxChance / 500);
}
}
}
}
else if (bidPrice < (InGame_BuyPrice - (InGame_BuyPrice / 30)))
{ Chance = (MaxChance / 10); }
{
Chance = (MaxChance / 10);
}
else
{
if (bidPrice < MaxBidablePrice)
@ -925,7 +945,9 @@ bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, do
Chance = ((MaxChance / 1000) * ratio);
}
else
{ Chance = (MaxChance / 1000); }
{
Chance = (MaxChance / 1000);
}
}
}
uint32 RandNum = urand(1, ChanceRatio);
@ -967,7 +989,9 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
}
else
{ BuyCycles = sAuctionBotConfig.GetItemPerCycleNormal(); }
{
BuyCycles = sAuctionBotConfig.GetItemPerCycleNormal();
}
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
{
@ -1077,7 +1101,9 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
BuyEntry(auction);
}
else
{ BuyEntry(auction); }
{
BuyEntry(auction);
}
}
else
{
@ -1981,7 +2007,9 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
buyoutPrice = prototype->BuyPrice * item->GetCount();
}
else
{ buyoutPrice = prototype->SellPrice * item->GetCount(); }
{
buyoutPrice = prototype->SellPrice * item->GetCount();
}
// Price of items are set here
SetPricesOfItem(prototype, config, buyoutPrice, bidPrice, stackCount, ItemQualities(prototype->Quality));
@ -2001,7 +2029,9 @@ bool AuctionBotSeller::Update(AuctionHouseType houseType)
return true;
}
else
{ return false; }
{
return false;
}
}
//== AuctionHouseBot functions =============================

View file

@ -76,7 +76,9 @@ namespace MaNGOS
ChatHandler::BuildChatPacket(data, i_msgtype, &str[0], LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str());
}
else
{ ChatHandler::BuildChatPacket(data, i_msgtype, text, LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str(), sourceGuid, sourceName.c_str()); }
{
ChatHandler::BuildChatPacket(data, i_msgtype, text, LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str(), sourceGuid, sourceName.c_str());
}
}
private:
ChatMsg i_msgtype;
@ -114,7 +116,9 @@ namespace MaNGOS
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, &str[0], i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName());
}
else
{ ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, text, i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName()); }
{
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, text, i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName());
}
}
private:
Language i_language;
@ -401,7 +405,9 @@ void BattleGround::Update(uint32 diff)
}
}
else if (m_PrematureCountDown)
{ m_PrematureCountDown = false; }
{
m_PrematureCountDown = false;
}
/*********************************************************/
/*** ARENA BUFF OBJECT SPAWNING ***/
@ -574,7 +580,9 @@ void BattleGround::SendPacketToAll(WorldPacket* packet)
plr->GetSession()->SendPacket(packet);
}
else
{ sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str()); }
{
sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str());
}
}
}
@ -1006,7 +1014,9 @@ void BattleGround::EndBattleGround(Team winner)
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
}
else
{ RewardMark(plr, ITEM_LOSER_COUNT); }
{
RewardMark(plr, ITEM_LOSER_COUNT);
}
plr->CombatStopWithPets(true);
@ -1081,7 +1091,9 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
RewardSpellCast(plr, SPELL_AV_MARK_WINNER);
}
else
{ RewardSpellCast(plr, SPELL_AV_MARK_LOSER); }
{
RewardSpellCast(plr, SPELL_AV_MARK_LOSER);
}
break;
case BATTLEGROUND_WS:
if (count == ITEM_WINNER_COUNT)
@ -1089,7 +1101,9 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
RewardSpellCast(plr, SPELL_WS_MARK_WINNER);
}
else
{ RewardSpellCast(plr, SPELL_WS_MARK_LOSER); }
{
RewardSpellCast(plr, SPELL_WS_MARK_LOSER);
}
break;
case BATTLEGROUND_AB:
if (count == ITEM_WINNER_COUNT)
@ -1097,7 +1111,9 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
RewardSpellCast(plr, SPELL_AB_MARK_WINNER);
}
else
{ RewardSpellCast(plr, SPELL_AB_MARK_LOSER); }
{
RewardSpellCast(plr, SPELL_AB_MARK_LOSER);
}
break;
case BATTLEGROUND_EY: // no rewards
default:
@ -1114,7 +1130,9 @@ void BattleGround::RewardSpellCast(Player* plr, uint32 spell_id)
{
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
{
return;
}
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
if (!spellInfo)
@ -1136,7 +1154,9 @@ void BattleGround::RewardItem(Player* plr, uint32 item_id, uint32 count)
{
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
{
return;
}
ItemPosCountVec dest;
uint32 no_space_count = 0;
@ -1740,7 +1760,9 @@ void BattleGround::DoorClose(ObjectGuid guid)
}
}
else
{ sLog.outError("BattleGround: Door %s not found (can not close doors)", guid.GetString().c_str()); }
{
sLog.outError("BattleGround: Door %s not found (can not close doors)", guid.GetString().c_str());
}
}
/// <summary>
@ -1757,7 +1779,9 @@ void BattleGround::DoorOpen(ObjectGuid guid)
obj->UseDoorOrButton(RESPAWN_ONE_DAY);
}
else
{ sLog.outError("BattleGround: Door %s not found! - doors will be closed.", guid.GetString().c_str()); }
{
sLog.outError("BattleGround: Door %s not found! - doors will be closed.", guid.GetString().c_str());
}
}
Team BattleGround::GetPrematureWinner()
@ -1766,9 +1790,13 @@ Team BattleGround::GetPrematureWinner()
uint32 alliancePlayers = GetPlayersCountByTeam(ALLIANCE);
if (hordePlayers > alliancePlayers)
{
return HORDE;
}
if (alliancePlayers > hordePlayers)
{
return ALLIANCE;
}
return TEAM_NONE;
}

View file

@ -668,7 +668,9 @@ class BattleGround
return m_InvitedAlliance;
}
else
{ return m_InvitedHorde; }
{
return m_InvitedHorde;
}
}
/**
* @brief
@ -1036,7 +1038,9 @@ class BattleGround
--m_PlayersCount[GetTeamIndexByTeamId(team)];
}
else
{ ++m_PlayersCount[GetTeamIndexByTeamId(team)]; }
{
++m_PlayersCount[GetTeamIndexByTeamId(team)];
}
}
// used for rated arena battles

View file

@ -150,7 +150,9 @@ void BattleGroundAB::Update(uint32 diff)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
else
{ SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
{
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
@ -237,7 +239,9 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
}
else
{ source->LeaveBattleground(); }
{
source->LeaveBattleground();
}
break;
case 3949: // Arathi Basin Horde Exit.
if (source->GetTeam() != HORDE)
@ -245,7 +249,9 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
}
else
{ source->LeaveBattleground(); }
{
source->LeaveBattleground();
}
break;
default:
return false;
@ -327,7 +333,9 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count)
++ally;
}
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
{ ++horde; }
{
++horde;
}
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
@ -356,7 +364,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], WORLD_STATE_REMOVE);
}
else
{ UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE); }
{
UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE);
}
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], WORLD_STATE_ADD);
@ -368,7 +378,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
++ally;
}
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
{ ++horde; }
{
++horde;
}
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
@ -448,7 +460,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY);
}
else
{ SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE); }
{
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE);
}
sound = BG_AB_SOUND_NODE_CLAIMED;
}
@ -471,7 +485,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
}
else
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
{
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
}
}
// If contested, change back to occupied
else
@ -490,7 +506,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
}
else
{ SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
{
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
}
}
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
@ -510,7 +528,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
}
else
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
{
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
}
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
@ -523,7 +543,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node));
}
else
{ SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node)); }
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node));
}
}
PlaySoundToAll(sound);
}

View file

@ -294,7 +294,9 @@ void BattleGroundAV::Update(uint32 diff)
m_Mine_Reclaim_Timer[mine] -= diff;
}
else
{ ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL); }
{
ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL);
}
}
}
@ -308,7 +310,9 @@ void BattleGroundAV::Update(uint32 diff)
m_Nodes[i].Timer -= diff;
}
else
{ EventPlayerDestroyedPoint(i); }
{
EventPlayerDestroyedPoint(i);
}
}
}
}
@ -412,7 +416,9 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
}
else
{ source->LeaveBattleground(); }
{
source->LeaveBattleground();
}
break;
case 2606:
if (source->GetTeam() != HORDE)
@ -420,7 +426,9 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
}
else
{ source->LeaveBattleground(); }
{
source->LeaveBattleground();
}
break;
default:
return false;
@ -545,18 +553,26 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
graveDefenderType = 0;
}
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
{ graveDefenderType = 1; }
{
graveDefenderType = 1;
}
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
{ graveDefenderType = 2; }
{
graveDefenderType = 2;
}
else
{ graveDefenderType = 3; }
{
graveDefenderType = 3;
}
if (m_Nodes[node].State == POINT_CONTROLLED) // we can spawn the current owner event
{
SpawnEvent(BG_AV_NODES_MAX + node, teamIdx * BG_AV_MAX_GRAVETYPES + graveDefenderType, true);
}
else // we despawn the event from the prevowner
{ SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false); }
{
SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false);
}
}
SpawnEvent(node, (teamIdx * BG_AV_MAX_STATES) + m_Nodes[node].State, true);
}
@ -724,7 +740,9 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE);
}
else
{ UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE); }
{
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE);
}
}
void BattleGroundAV::SendMineWorldStates(uint32 mine)

View file

@ -45,7 +45,9 @@ void BattleGroundEY::Update(uint32 diff)
BattleGround::Update(diff);
if (GetStatus() != STATUS_IN_PROGRESS)
{
return;
}
// resource counter
if (m_resourceUpdateTimer < diff)
@ -299,10 +301,14 @@ void BattleGroundEY::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team te
bool BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
return false;
}
if (!source->IsAlive()) // hack code, must be removed later
{
return false;
}
switch (trigger)
{
@ -394,7 +400,9 @@ void BattleGroundEY::RespawnDroppedFlag()
void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
return;
}
BattleGround::HandleKillPlayer(player, killer);
EventPlayerDroppedFlag(player);
@ -403,10 +411,14 @@ void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
{
if (!IsFlagPickedUp())
{
return;
}
if (GetFlagCarrierGuid() != source->GetObjectGuid())
{
return;
}
ClearFlagCarrier();
source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
@ -437,7 +449,9 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedUp() || !source->IsWithinDistInMap(target_obj, 10))
{
return;
}
if (m_flagState == EY_FLAG_STATE_ON_BASE)
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
@ -474,7 +488,9 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
{
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagCarrierGuid() != source->GetObjectGuid())
{
return;
}
ClearFlagCarrier();
@ -512,7 +528,9 @@ void BattleGroundEY::UpdatePlayerScore(Player* source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found
{
return;
}
switch (type)
{
@ -617,7 +635,9 @@ bool BattleGroundEY::IsAllNodesControlledByTeam(Team team) const
{
for (uint8 i = 0; i < EY_NODES_MAX; ++i)
if (m_towerOwner[i] != team)
{
return false;
}
return true;
}
@ -628,9 +648,13 @@ Team BattleGroundEY::GetPrematureWinner()
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
if (hordeScore > allianceScore)
{
return HORDE;
}
if (allianceScore > hordeScore)
{
return ALLIANCE;
}
// If the values are equal, fall back to number of players on each team
return BattleGround::GetPrematureWinner();

View file

@ -147,7 +147,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
// expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
{
return;
}
GroupJoinBattlegroundResult err = ERR_BATTLEGROUND_NONE;
@ -319,7 +321,9 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
// arena finish version will send in BattleGround::EndBattleGround directly
if (bg->isArena())
{
return;
}
WorldPacket data;
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
@ -422,7 +426,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
// expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
{
return;
}
// some checks if player isn't cheating - it is not exactly cheating, but we can not allow it
if (action == 1 && ginfo.arenaType == ARENA_TYPE_NONE)
@ -670,7 +676,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
// ignore if we already in BG or BG queue
if (_player->InBattleGround())
{
return;
}
ArenaType arenatype = ArenaTeam::GetTypeBySlot(arenaslot);
uint32 arenaRating = 0;
@ -693,14 +701,20 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
{
return;
}
Group* grp = _player->GetGroup();
// no group found, error
if (!grp)
{
return;
}
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
{
return;
}
uint32 ateamId = _player->GetArenaTeamId(arenaslot);
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
@ -720,7 +734,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
{
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
if (!at_member) // group member joining to arena must be in leader arena team
{
return;
}
// calc avg personal rating
avg_pers_rating += at_member->personal_rating;

View file

@ -117,7 +117,9 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
found = true;
}
else if (!found && (*itr)->Players.size() >= (*groupToKick)->Players.size())
{ groupToKick = itr; }
{
groupToKick = itr;
}
}
// if pool is empty, do nothing
if (GetPlayerCount())
@ -743,7 +745,9 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam)
{
if (m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() < minPlayersPerTeam)
{
return false;
}
PvpTeamIndex teamIdx = TEAM_INDEX_ALLIANCE;
PvpTeamIndex otherTeamIdx = TEAM_INDEX_HORDE;
Team otherTeamId = HORDE;
@ -763,7 +767,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
if (ginfo == *itr_team)
break;
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
{
return false;
}
GroupsQueueType::iterator itr_team2 = itr_team;
++itr_team2;
// invite players to other selection pool
@ -774,7 +780,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
break;
}
if (m_SelectionPools[otherTeamIdx].GetPlayerCount() != minPlayersPerTeam)
{
return false;
}
// here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue
for (GroupsQueueType::iterator itr = m_SelectionPools[otherTeamIdx].SelectedGroups.begin(); itr != m_SelectionPools[otherTeamIdx].SelectedGroups.end(); ++itr)
@ -1724,7 +1732,9 @@ BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 insta
}
if (bg->isArena())
{
return GetBattleGround(instanceId, bgTypeId);
}
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
{
@ -2307,7 +2317,9 @@ void BattleGroundMgr::ToggleTesting()
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
}
else
{ sWorld.SendWorldText(LANG_DEBUG_BG_OFF); }
{
sWorld.SendWorldText(LANG_DEBUG_BG_OFF);
}
}
void BattleGroundMgr::ToggleArenaTesting()
@ -2543,7 +2555,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events;
}
else
{ m_CreatureBattleEventIndexMap[dbTableGuidLow] = events; }
{
m_CreatureBattleEventIndexMap[dbTableGuidLow] = events;
}
++count;
}

View file

@ -172,7 +172,9 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
else
{ SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
{
SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
@ -182,7 +184,9 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
obj->Delete();
}
else
{ sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str()); }
{
sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str());
}
ClearDroppedFlagGuid(team);
}
@ -245,7 +249,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
}
else
{ SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source); }
{
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source);
}
UpdateFlagState(source->GetTeam(), 1); // flag state none
UpdateTeamScore(source->GetTeam());
@ -258,7 +264,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
winner = ALLIANCE;
}
else if (m_TeamScores[TEAM_INDEX_HORDE] == BG_WS_MAX_TEAM_SCORE)
{ winner = HORDE; }
{
winner = HORDE;
}
if (winner)
{
@ -482,7 +490,9 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
RespawnFlag(ALLIANCE, false);
}
else
{ EventPlayerDroppedFlag(plr); }
{
EventPlayerDroppedFlag(plr);
}
}
if (IsHordeFlagPickedUp() && m_flagCarrierHorde == guid)
{
@ -493,7 +503,9 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
RespawnFlag(HORDE, false);
}
else
{ EventPlayerDroppedFlag(plr); }
{
EventPlayerDroppedFlag(plr);
}
}
}
@ -504,7 +516,9 @@ void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
}
else
{ UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); }
{
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
}
}
void BattleGroundWS::UpdateTeamScore(Team team)
@ -636,7 +650,9 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
}
else
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE); }
{
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
}
}
else
{
@ -645,7 +661,9 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
}
else
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE); }
{
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
}
}
}
@ -659,18 +677,26 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, -1);
}
else if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1); }
{
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1);
}
else
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0); }
{
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0);
}
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
{
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, -1);
}
else if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1); }
{
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1);
}
else
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0); }
{
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0);
}
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
@ -679,14 +705,18 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2);
}
else
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1); }
{
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1);
}
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
{
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2);
}
else
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); }
{
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1);
}
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, WORLD_STATE_ADD);
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());

View file

@ -116,10 +116,14 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
PSendSysMessage(LANG_USING_SCRIPT_LIB, ver);
}
else
{ SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN); }
{
SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN);
}
}
else
{ SendSysMessage(LANG_USING_SCRIPT_LIB_NONE); }
{
SendSysMessage(LANG_USING_SCRIPT_LIB_NONE);
}
PSendSysMessage(LANG_USING_WORLD_DB, sWorld.GetDBVersion());
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
@ -201,7 +205,9 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
{ PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept); }
}
else
{ SendSysMessage(LANG_GMS_NOT_LOGGED); }
{
SendSysMessage(LANG_GMS_NOT_LOGGED);
}
return true;
}

View file

@ -221,7 +221,9 @@ bool ChatHandler::HandleGMChatCommand(char* args)
m_session->SendNotification(LANG_GM_CHAT_ON);
}
else
{ m_session->SendNotification(LANG_GM_CHAT_OFF); }
{
m_session->SendNotification(LANG_GM_CHAT_OFF);
}
return true;
}
@ -361,7 +363,9 @@ bool ChatHandler::HandleGPSCommand(char* args)
PSendSysMessage("You are OUTdoor");
}
else
{ PSendSysMessage("You are INdoor"); }
{
PSendSysMessage("You are INdoor");
}
}
else
{
@ -512,7 +516,9 @@ bool ChatHandler::HandleSummonCommand(char* args)
}
// save only in non-flight case
else
{ target->SaveRecallPosition(); }
{
target->SaveRecallPosition();
}
// before GM
float x, y, z;
@ -644,7 +650,9 @@ bool ChatHandler::HandleAppearCommand(char* args)
group->BindToInstance(save, !save->CanReset());
}
else
{ _player->BindToInstance(save, !save->CanReset()); }
{
_player->BindToInstance(save, !save->CanReset());
}
}
}
@ -668,7 +676,9 @@ bool ChatHandler::HandleAppearCommand(char* args)
}
// save only in non-flight case
else
{ _player->SaveRecallPosition(); }
{
_player->SaveRecallPosition();
}
// to point to see at target with same orientation
float x, y, z;
@ -731,7 +741,9 @@ bool ChatHandler::HandleRecallCommand(char* args)
bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
{
if (!*args)
{
return false;
}
int32 power = atoi(args);
@ -752,7 +764,9 @@ bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
// check online security
if (HasLowerSecurity(chr))
{
return false;
}
int32 maxPower = int32(chr->GetMaxPower(POWER_HOLY_POWER));
if (power > maxPower)
@ -953,7 +967,9 @@ bool ChatHandler::HandleModifyRageCommand(char* args)
bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
{
if (!*args)
{
return false;
}
int32 rune = atoi(args) * 10;
int32 runem = atoi(args) * 10;
@ -1096,7 +1112,9 @@ bool ChatHandler::HandleModifyTalentCommand(char* args)
{
// check online security
if (HasLowerSecurity((Player*)owner))
{
return false;
}
((Pet*)target)->SetFreeTalentPoints(tp);
((Player*)owner)->SendTalentsInfoData(true);
@ -1127,7 +1145,9 @@ bool ChatHandler::HandleTaxiCheatCommand(char* args)
}
// check online security
else if (HasLowerSecurity(chr))
{ return false; }
{
return false;
}
if (value)
{
@ -1362,7 +1382,9 @@ bool ChatHandler::HandleModifyBWalkCommand(char* args)
bool ChatHandler::HandleModifyFlyCommand(char* args)
{
if (!*args)
{
return false;
}
float modSpeed = (float)atof(args);
@ -1383,7 +1405,9 @@ bool ChatHandler::HandleModifyFlyCommand(char* args)
// check online security
if (HasLowerSecurity(chr))
{
return false;
}
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, GetNameLink(chr).c_str());
if (needReportToTarget(chr))
@ -1734,7 +1758,9 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
int64 addmoney;
if (!ExtractInt64(&args, addmoney))
{
return false;
}
uint64 moneyuser = chr->GetMoney();
@ -1780,7 +1806,9 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
chr->SetMoney(MAX_MONEY_AMOUNT);
}
else
{ chr->ModifyMoney(addmoney); }
{
chr->ModifyMoney(addmoney);
}
}
DETAIL_LOG("USER2: %s, ADD: %s, RESULT: %s\n",
@ -1876,7 +1904,9 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
}
else
{ ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; }
{
ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
}
SendSysMessage(ss.str().c_str());
@ -1931,7 +1961,9 @@ bool ChatHandler::HandleLookupTeleCommand(char* args)
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
}
else
{ reply << " " << itr->first << " " << tele->name << "\n"; }
{
reply << " " << itr->first << " " << tele->name << "\n";
}
}
if (reply.str().empty())
@ -1939,7 +1971,9 @@ bool ChatHandler::HandleLookupTeleCommand(char* args)
SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
}
else
{ PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str()); }
{
PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
}
return true;
}
@ -2159,7 +2193,9 @@ bool ChatHandler::HandleTeleGroupCommand(char* args)
}
// save only in non-flight case
else
{ pl->SaveRecallPosition(); }
{
pl->SaveRecallPosition();
}
pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
}
@ -2259,7 +2295,9 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
}
// save only in non-flight case
else
{ pl->SaveRecallPosition(); }
{
pl->SaveRecallPosition();
}
// before GM
float x, y, z;
@ -2314,7 +2352,9 @@ bool ChatHandler::HandleGoHelper(Player* player, uint32 mapid, float x, float y,
}
// save only in non-flight case
else
{ player->SaveRecallPosition(); }
{
player->SaveRecallPosition();
}
player->TeleportTo(mapid, x, y, z, ort);
@ -2381,7 +2421,9 @@ bool ChatHandler::HandleGoCommand(char* args)
}
// link case
else if (!ExtractLocationFromLink(&args, mapid, x, y, z))
{ return false; }
{
return false;
}
return HandleGoHelper(_player, mapid, x, y, &z);
}
@ -2472,7 +2514,9 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args)
}
}
else
{ areaid = _player->GetZoneId(); }
{
areaid = _player->GetZoneId();
}
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
@ -2540,7 +2584,9 @@ bool ChatHandler::HandleGoGridCommand(char* args)
bool ChatHandler::HandleModifyDrunkCommand(char* args)
{
if (!*args)
{
return false;
}
uint8 drunkValue = (uint8)atoi(args);
if (drunkValue > 100)

View file

@ -189,7 +189,9 @@ void ChatHandler::ShowTriggerTargetListHelper(uint32 id, AreaTrigger const* at,
snprintf(dist_buf, 50, GetMangosString(LANG_TRIGGER_DIST), dist);
}
else
{ dist_buf[0] = '\0'; }
{
dist_buf[0] = '\0';
}
PSendSysMessage(LANG_TRIGGER_TARGET_LIST_CHAT,
subpart ? " -> " : "", id, id, at->target_mapId, at->target_X, at->target_Y, at->target_Z, dist_buf);
@ -526,7 +528,9 @@ bool ChatHandler::HandleGoTriggerCommand(char* args)
return HandleGoHelper(_player, at->target_mapId, at->target_X, at->target_Y, &at->target_Z);
}
else
{ return HandleGoHelper(_player, atEntry->mapid, atEntry->x, atEntry->y, &atEntry->z); }
{
return HandleGoHelper(_player, atEntry->mapid, atEntry->x, atEntry->y, &atEntry->z);
}
}
bool ChatHandler::HandleGoGraveyardCommand(char* args)
@ -927,7 +931,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
initString = false;
}
else
{ eventFilter << "," << *itr; }
{
eventFilter << "," << *itr;
}
}
if (!initString)
@ -935,7 +941,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
eventFilter << "))";
}
else
{ eventFilter << ")"; }
{
eventFilter << ")";
}
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, "
"(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
@ -1012,7 +1020,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
PSendSysMessage(LANG_COMMAND_GO_STATUS_DOOR, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled()), goI->door.startOpen ? "open" : "closed");
}
else
{ PSendSysMessage(LANG_COMMAND_GO_STATUS, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled())); }
{
PSendSysMessage(LANG_COMMAND_GO_STATUS, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled()));
}
}
return true;
}
@ -1288,10 +1298,14 @@ bool ChatHandler::HandleGameObjectPhaseCommand(char* args)
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
uint32 lowguid;
if (!ExtractUint32KeyFromLink(&args, "Hgameobject", lowguid))
{
return false;
}
if (!lowguid)
{
return false;
}
GameObject* obj = NULL;
@ -1440,7 +1454,9 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
bool ChatHandler::HandleLookupAchievementCommand(char* args)
{
if (!*args)
{
return false;
}
// Can be NULL at console call
Player* target = getSelectedPlayer();
@ -1449,7 +1465,9 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
std::wstring wnamepart;
if (!Utf8toWStr(namepart, wnamepart))
{
return false;
}
// converting string that we try to find to lower case
wstrToLower(wnamepart);
@ -1501,7 +1519,9 @@ bool ChatHandler::HandleCharacterAchievementsCommand(char* args)
{
Player* target;
if (!ExtractPlayerTarget(&args, &target))
{
return false;
}
LocaleConstant loc = GetSessionDbcLocale();
@ -1526,7 +1546,9 @@ void ChatHandler::ShowFactionListHelper(FactionEntry const* factionEntry, Locale
ss << factionEntry->ID << " - |cffffffff|Hfaction:" << factionEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
}
else
{ ss << factionEntry->ID << " - " << name << " " << localeNames[loc]; }
{
ss << factionEntry->ID << " - " << name << " " << localeNames[loc];
}
if (repState) // and then target!=NULL also
{
@ -1561,7 +1583,9 @@ void ChatHandler::ShowFactionListHelper(FactionEntry const* factionEntry, Locale
}
}
else if (target)
{ ss << GetMangosString(LANG_FACTION_NOREPUTATION); }
{
ss << GetMangosString(LANG_FACTION_NOREPUTATION);
}
SendSysMessage(ss.str().c_str());
}
@ -1821,15 +1845,21 @@ bool ChatHandler::HandleNpcAddVendorCurrencyCommand(char* args)
uint32 maxcount;
if (!ExtractUInt32(&args, maxcount))
{
return false;
}
uint32 incrtime;
if (!ExtractOptUInt32(&args, incrtime, 0))
{
return false;
}
uint32 extendedcost;
if (!ExtractUInt32(&args, extendedcost))
{
return false;
}
Creature* vendor = getSelectedCreature();
@ -1874,7 +1904,9 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(char* args)
uint32 extendedcost;
if (!ExtractOptUInt32(&args, extendedcost, 0))
{
return false;
}
Creature* vendor = getSelectedCreature();
@ -1898,7 +1930,9 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(char* args)
bool ChatHandler::HandleNpcDelVendorCurrencyCommand(char* args)
{
if (!*args)
{
return false;
}
Creature* vendor = getSelectedCreature();
if (!vendor || !vendor->IsVendor())
@ -2092,7 +2126,9 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
}
}
else
{ unit = getSelectedCreature(); }
{
unit = getSelectedCreature();
}
if (!unit)
{
@ -2112,7 +2148,9 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
Creature::DeleteFromDB(unit->GetGUIDLow(), data);
}
else
{ unit->AddObjectToRemoveList(); }
{
unit->AddObjectToRemoveList();
}
break;
}
case CREATURE_SUBTYPE_PET:
@ -2167,7 +2205,9 @@ bool ChatHandler::HandleNpcMoveCommand(char* args)
pCreature = player->GetMap()->GetCreature(data->GetObjectGuid(lowguid));
}
else
{ lowguid = pCreature->GetGUIDLow(); }
{
lowguid = pCreature->GetGUIDLow();
}
float x = player->GetPositionX();
float y = player->GetPositionY();
@ -2264,11 +2304,17 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
move_type = IDLE_MOTION_TYPE;
}
else if (strncmp(type_str, "random", strlen(type_str)) == 0)
{ move_type = RANDOM_MOTION_TYPE; }
{
move_type = RANDOM_MOTION_TYPE;
}
else if (strncmp(type_str, "way", strlen(type_str)) == 0)
{ move_type = WAYPOINT_MOTION_TYPE; }
{
move_type = WAYPOINT_MOTION_TYPE;
}
else
{ return false; }
{
return false;
}
bool doNotDelete = ExtractLiteralArg(&args, "NODEL") != NULL;
if (!doNotDelete && *args) // need fail if false in result wrong literal
@ -2302,7 +2348,9 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
PSendSysMessage(LANG_MOVE_TYPE_SET_NODEL, type_str);
}
else
{ PSendSysMessage(LANG_MOVE_TYPE_SET, type_str); }
{
PSendSysMessage(LANG_MOVE_TYPE_SET, type_str);
}
return true;
}
@ -2407,7 +2455,9 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
u_guidlow = pCreature->GetGUIDLow();
}
else
{ return false; }
{
return false;
}
pCreature->SetRespawnRadius((float)option);
pCreature->SetDefaultMovementType(mtype);
@ -2532,7 +2582,9 @@ bool ChatHandler::HandleNpcTameCommand(char* /*args*/)
bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
{
if (!*args)
{
return false;
}
uint32 phasemask = (uint32) atoi(args);
if (phasemask == 0)
@ -2581,7 +2633,9 @@ bool ChatHandler::HandleNpcSetDeathStateCommand(char* args)
pCreature->SetDeadByDefault(true);
}
else
{ pCreature->SetDeadByDefault(false); }
{
pCreature->SetDeadByDefault(false);
}
pCreature->SaveToDB();
pCreature->Respawn();
@ -2595,7 +2649,9 @@ bool ChatHandler::HandleNpcNameCommand(char* /*args*/)
{
/* Temp. disabled
if (!*args)
{
return false;
}
if (strlen((char*)args)>75)
{
@ -2742,7 +2798,9 @@ bool ChatHandler::HandleDeMorphCommand(char* /*args*/)
// check online security
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
{ return false; }
{
return false;
}
target->DeMorph();
@ -2775,7 +2833,9 @@ bool ChatHandler::HandleModifyMorphCommand(char* args)
// check online security
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
{ return false; }
{
return false;
}
target->SetDisplayId(display_id);
@ -2814,7 +2874,9 @@ bool ChatHandler::HandleKickPlayerCommand(char* args)
bool ChatHandler::HandleModifyPhaseCommand(char* args)
{
if (!*args)
{
return false;
}
uint32 phasemask = (uint32)atoi(args);
@ -2824,7 +2886,9 @@ bool ChatHandler::HandleModifyPhaseCommand(char* args)
// check online security
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
{
return false;
}
target->SetPhaseMask(phasemask, true);
@ -2962,7 +3026,9 @@ bool ChatHandler::HandleTicketCommand(char* args)
PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(accept));
}
else
{ PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count); }
{
PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count);
}
return true;
}
@ -3146,7 +3212,9 @@ bool ChatHandler::HandleDelTicketCommand(char* args)
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, GetNameLink(pl).c_str());
}
else
{ PSendSysMessage(LANG_COMMAND_TICKETDEL); }
{
PSendSysMessage(LANG_COMMAND_TICKETDEL);
}
return true;
}
@ -3591,7 +3659,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
{
uint32 waittime;
if (!ExtractUInt32(&args, waittime))
{
return false;
}
sWaypointMgr.SetNodeWaittime(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, waittime);
}
@ -3599,7 +3669,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
{
uint32 scriptId;
if (!ExtractUInt32(&args, scriptId))
{
return false;
}
if (!sWaypointMgr.SetNodeScriptId(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, scriptId))
PSendSysMessage(LANG_WAYPOINT_INFO_UNK_SCRIPTID, scriptId);
@ -3608,7 +3680,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
{
float ori;
if (!ExtractFloat(&args, ori))
{
return false;
}
sWaypointMgr.SetNodeOrientation(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, ori);
}
@ -3649,7 +3723,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
char* subCmd_str = ExtractLiteralArg(&args);
if (!subCmd_str)
{
return false;
}
std::string subCmd = subCmd_str; ///< info, on, off, first, last
uint32 dbGuid = 0;
@ -3670,7 +3746,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
else // Guid must be provided
{
if (!ExtractUInt32(&args, dbGuid)) // No creature selected and no dbGuid provided
{
return false;
}
if (ExtractOptInt32(&args, wpPathId, 0)) // Fill path-id and source
{
@ -3846,7 +3924,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
bool ChatHandler::HandleWpExportCommand(char* args)
{
if (!*args)
{
return false;
}
Creature* wpOwner = NULL;
WaypointPathOrigin wpOrigin = PATH_NO_PATH;
@ -4047,7 +4127,9 @@ bool ChatHandler::HandleCharacterCustomizeCommand(char* args)
ObjectGuid target_guid;
std::string target_name;
if (!ExtractPlayerTarget(&args, &target, &target_guid, &target_name))
{
return false;
}
if (target)
{
@ -4163,7 +4245,9 @@ bool ChatHandler::HandleHonorKillsUpdateCommand(char* /*args*/)
// check online security
if (HasLowerSecurity(target))
{
return false;
}
target->UpdateHonorKills();
return true;
@ -4215,7 +4299,9 @@ bool ChatHandler::HandleLookupEventCommand(char* args)
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
}
else
{ PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active); }
{
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
}
++counter;
}
@ -4261,7 +4347,9 @@ bool ChatHandler::HandleEventListCommand(char* args)
state = inactive;
}
else
{ state = active; }
{
state = active;
}
GameEventData const& eventData = events[event_id];
@ -4270,7 +4358,9 @@ bool ChatHandler::HandleEventListCommand(char* args)
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, event_id, event_id, eventData.description.c_str(), state);
}
else
{ PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), state); }
{
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), state);
}
++counter;
}
@ -4831,7 +4921,9 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, uint32* limit)
ShowPlayerListHelper(chars, limit, true, false);
}
else
{ delete chars; }
{
delete chars;
}
}
}
while (result->NextRow());
@ -5220,7 +5312,9 @@ bool ChatHandler::HandleWaterwalkCommand(char* args)
bool ChatHandler::HandleLookupTitleCommand(char* args)
{
if (!*args)
{
return false;
}
// can be NULL in console call
Player* target = getSelectedPlayer();
@ -5232,7 +5326,9 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
std::wstring wnamepart;
if (!Utf8toWStr(namepart, wnamepart))
{
return false;
}
// converting string that we try to find to lower case
wstrToLower(wnamepart);
@ -5298,7 +5394,9 @@ bool ChatHandler::HandleTitlesAddCommand(char* args)
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
uint32 id;
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
{
return false;
}
if (id <= 0)
{
@ -5317,7 +5415,9 @@ bool ChatHandler::HandleTitlesAddCommand(char* args)
// check online security
if (HasLowerSecurity(target))
{
return false;
}
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if (!titleInfo)
@ -5344,7 +5444,9 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args)
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
uint32 id;
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
{
return false;
}
if (id <= 0)
{
@ -5363,7 +5465,9 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args)
// check online security
if (HasLowerSecurity(target))
{
return false;
}
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if (!titleInfo)
@ -5396,7 +5500,9 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args)
bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
{
if (!*args)
{
return false;
}
uint64 titles = 0;
@ -5412,7 +5518,9 @@ bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
// check online security
if (HasLowerSecurity(target))
{
return false;
}
uint64 titles2 = titles;
@ -5438,7 +5546,9 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args)
{
Player* target;
if (!ExtractPlayerTarget(&args, &target))
{
return false;
}
LocaleConstant loc = GetSessionDbcLocale();
char const* targetName = target->GetName();
@ -5476,7 +5586,9 @@ bool ChatHandler::HandleTitlesCurrentCommand(char* args)
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
uint32 id;
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
{
return false;
}
if (id <= 0)
{
@ -5495,7 +5607,9 @@ bool ChatHandler::HandleTitlesCurrentCommand(char* args)
// check online security
if (HasLowerSecurity(target))
{
return false;
}
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
if (!titleInfo)
@ -5669,7 +5783,9 @@ bool ChatHandler::HandleMmapLocCommand(char* /*args*/)
PSendSysMessage("Dt [%02i,%02i]", tile->header->x, tile->header->y);
}
else
{ PSendSysMessage("Dt [??,??] (no tile loaded)"); }
{
PSendSysMessage("Dt [??,??] (no tile loaded)");
}
}
return true;

View file

@ -198,7 +198,9 @@ bool ChatHandler::HandleAHBotStatusCommand(char* args)
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
}
else
{ SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CHAT); }
{
SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CHAT);
}
uint32 fmtId = m_session ? LANG_AHBOT_STATUS_FORMAT_CHAT : LANG_AHBOT_STATUS_FORMAT_CONSOLE;
@ -227,7 +229,9 @@ bool ChatHandler::HandleAHBotStatusCommand(char* args)
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
}
else
{ SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CHAT); }
{
SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CHAT);
}
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
PSendSysMessage(fmtId, GetMangosString(ahbotQualityIds[i]),
@ -1367,14 +1371,18 @@ bool ChatHandler::HandleAchievementCommand(char* args)
if (nameStr)
{
if (!ExtractPlayerTarget(&nameStr, &target))
{
return false;
}
}
else
target = getSelectedPlayer();
uint32 achId;
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
{
return false;
}
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
if (!achEntry)
@ -1406,11 +1414,15 @@ bool ChatHandler::HandleAchievementAddCommand(char* args)
Player* target;
if (!ExtractPlayerTarget(&nameStr, &target))
{
return false;
}
uint32 achId;
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
{
return false;
}
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
if (!achEntry || achEntry->flags & ACHIEVEMENT_FLAG_COUNTER)
@ -1448,11 +1460,15 @@ bool ChatHandler::HandleAchievementRemoveCommand(char* args)
Player* target;
if (!ExtractPlayerTarget(&nameStr, &target))
{
return false;
}
uint32 achId;
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
{
return false;
}
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
if (!achEntry)
@ -1484,11 +1500,15 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
// maybe player first
char* nameStr = ExtractArg(&args);
if (!ExtractPlayerTarget(&nameStr, &target))
{
return false;
}
if (!ExtractUint32KeyFromLink(&args, "Hachievement_criteria", criId))
{
return false;
}
}
else
target = getSelectedPlayer();
@ -1502,7 +1522,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(criEntry->referredAchievement);
if (!achEntry)
{
return false;
}
LocaleConstant loc = GetSessionDbcLocale();
@ -1523,7 +1545,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
uint32 val;
if (!ExtractOptUInt32(&args, val, maxValue ? maxValue : 1))
{
return false;
}
uint32 new_val;
@ -1551,11 +1575,15 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
// maybe player first
char* nameStr = ExtractArg(&args);
if (!ExtractPlayerTarget(&nameStr, &target))
{
return false;
}
if (!ExtractUint32KeyFromLink(&args, "Hachievement_criteria", criId))
{
return false;
}
}
else
target = getSelectedPlayer();
@ -1569,7 +1597,9 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(criEntry->referredAchievement);
if (!achEntry)
{
return false;
}
LocaleConstant loc = GetSessionDbcLocale();
@ -1590,7 +1620,9 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
uint32 change;
if (!ExtractOptUInt32(&args, change, maxValue ? maxValue : 1))
{
return false;
}
uint32 newval = change < progress ? progress - change : 0;
@ -1723,7 +1755,9 @@ bool ChatHandler::HandleUnLearnCommand(char* args)
target->removeSpell(spell_id, false, !allRanks);
}
else
{ SendSysMessage(LANG_FORGET_SPELL); }
{
SendSysMessage(LANG_FORGET_SPELL);
}
if (GetTalentSpellCost(spell_id))
target->SendTalentsInfoData(false);
@ -2721,7 +2755,9 @@ bool ChatHandler::HandleLearnCommand(char* args)
targetPlayer->learnSpellHighRank(spell);
}
else
{ targetPlayer->learnSpell(spell, false); }
{
targetPlayer->learnSpell(spell, false);
}
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell);
if (GetTalentSpellCost(first_spell))
@ -2969,11 +3005,17 @@ bool ChatHandler::HandleListItemCommand(char* args)
item_pos = "[equipped]";
}
else if (Player::IsInventoryPos(item_bag, item_slot))
{ item_pos = "[in inventory]"; }
{
item_pos = "[in inventory]";
}
else if (Player::IsBankPos(item_bag, item_slot))
{ item_pos = "[in bank]"; }
{
item_pos = "[in bank]";
}
else
{ item_pos = ""; }
{
item_pos = "";
}
PSendSysMessage(LANG_ITEMLIST_SLOT,
item_guid, owner_name.c_str(), owner_guid, owner_acc, item_pos);
@ -2989,7 +3031,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
count -= res_count;
}
else if (count)
{ count = 0; }
{
count = 0;
}
}
// mail case
@ -3011,7 +3055,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
item_id, uint32(count));
}
else
{ result = NULL; }
{
result = NULL;
}
if (result)
{
@ -3042,7 +3088,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
count -= res_count;
}
else if (count)
{ count = 0; }
{
count = 0;
}
}
// auction case
@ -3063,7 +3111,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
item_id, uint32(count));
}
else
{ result = NULL; }
{
result = NULL;
}
if (result)
{
@ -3202,7 +3252,9 @@ bool ChatHandler::HandleListObjectCommand(char* args)
PSendSysMessage(LANG_GO_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), guid, gInfo->name, x, y, z, mapid);
}
else
{ PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), gInfo->name, x, y, z, mapid); }
{
PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), gInfo->name, x, y, z, mapid);
}
}
while (result->NextRow());
@ -3279,7 +3331,9 @@ bool ChatHandler::HandleListCreatureCommand(char* args)
PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), guid, cInfo->Name, x, y, z, mapid);
}
else
{ PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), cInfo->Name, x, y, z, mapid); }
{
PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), cInfo->Name, x, y, z, mapid);
}
}
while (result->NextRow());
@ -3317,7 +3371,9 @@ void ChatHandler::ShowItemListHelper(uint32 itemId, int loc_idx, Player* target
PSendSysMessage(LANG_ITEM_LIST_CHAT, itemId, itemId, name.c_str(), usableStr);
}
else
{ PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemId, name.c_str(), usableStr); }
{
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemId, name.c_str(), usableStr);
}
}
bool ChatHandler::HandleLookupItemCommand(char* args)
@ -3436,7 +3492,9 @@ bool ChatHandler::HandleLookupItemSetCommand(char* args)
PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]);
}
else
{ PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]); }
{
PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]);
}
++counter;
}
}
@ -3529,7 +3587,9 @@ bool ChatHandler::HandleLookupSkillCommand(char* args)
PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr);
}
else
{ PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr); }
{
PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr);
}
++counter;
}
@ -3593,7 +3653,9 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << spellInfo->SpellName[loc];
}
else
{ ss << id << " - " << spellInfo->SpellName[loc]; }
{
ss << id << " - " << spellInfo->SpellName[loc];
}
// include rank in link name
if (rank)
@ -3606,7 +3668,9 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf
ss << " " << localeNames[loc] << "]|h|r";
}
else
{ ss << " " << localeNames[loc]; }
{
ss << " " << localeNames[loc];
}
if (talent)
{
@ -3635,7 +3699,9 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf
bool ChatHandler::HandleLookupCurrencyCommand(char* args)
{
if (!*args)
{
return false;
}
// can be NULL at console call
Player* target = getSelectedPlayer();
@ -3644,7 +3710,9 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
std::wstring wnamepart;
if (!Utf8toWStr(namepart, wnamepart))
{
return false;
}
// converting string that we try to find to lower case
wstrToLower(wnamepart);
@ -3792,10 +3860,14 @@ void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* tar
statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED);
}
else
{ statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); }
{
statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE);
}
}
else if (status == QUEST_STATUS_INCOMPLETE)
{ statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); }
{
statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE);
}
}
if (m_session)
@ -3803,7 +3875,9 @@ void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* tar
PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
}
else
{ PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr); }
{
PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
}
}
bool ChatHandler::HandleLookupQuestCommand(char* args)
@ -3902,7 +3976,9 @@ bool ChatHandler::HandleLookupCreatureCommand(char* args)
PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name);
}
else
{ PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name); }
{
PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name);
}
++counter;
}
@ -3954,7 +4030,9 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
}
else
{ PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str()); }
{
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str());
}
++counter;
continue;
}
@ -3975,7 +4053,9 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
}
else
{ PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str()); }
{
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str());
}
++counter;
}
}
@ -4417,19 +4497,27 @@ bool ChatHandler::HandleDamageCommand(char* args)
bool ChatHandler::HandleModifyCurrencyCommand(char* args)
{
if (!*args)
{
return false;
}
uint32 currencyId;
if (!ExtractUint32KeyFromLink(&args, "Hcurrency", currencyId))
{
return false;
}
CurrencyTypesEntry const * entry = sCurrencyTypesStore.LookupEntry(currencyId);
if (!entry)
{
return false;
}
int32 amount;
if (!ExtractInt32(&args, amount))
{
return false;
}
Player* target = getSelectedPlayer();
if (!target)
@ -4565,11 +4653,17 @@ bool ChatHandler::HandleLinkGraveCommand(char* args)
g_team = TEAM_BOTH_ALLOWED;
}
else if (strncmp(teamStr, "horde", strlen(teamStr)) == 0)
{ g_team = HORDE; }
{
g_team = HORDE;
}
else if (strncmp(teamStr, "alliance", strlen(teamStr)) == 0)
{ g_team = ALLIANCE; }
{
g_team = ALLIANCE;
}
else
{ return false; }
{
return false;
}
WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
if (!graveyard)
@ -4596,7 +4690,9 @@ bool ChatHandler::HandleLinkGraveCommand(char* args)
PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id, zoneId);
}
else
{ PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId); }
{
PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId);
}
return true;
}
@ -4612,11 +4708,17 @@ bool ChatHandler::HandleNearGraveCommand(char* args)
g_team = TEAM_BOTH_ALLOWED;
}
else if (strncmp(args, "horde", argslen) == 0)
{ g_team = HORDE; }
{
g_team = HORDE;
}
else if (strncmp(args, "alliance", argslen) == 0)
{ g_team = ALLIANCE; }
{
g_team = ALLIANCE;
}
else
{ return false; }
{
return false;
}
Player* player = m_session->GetPlayer();
uint32 zone_id = player->GetZoneId();
@ -4642,11 +4744,17 @@ bool ChatHandler::HandleNearGraveCommand(char* args)
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY);
}
else if (data->team == HORDE)
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE); }
{
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE);
}
else if (data->team == ALLIANCE)
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE); }
{
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
}
else // Actually, this case can not happen
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_NOTEAM); }
{
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_NOTEAM);
}
PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id, team_name.c_str(), zone_id);
}
@ -4659,16 +4767,22 @@ bool ChatHandler::HandleNearGraveCommand(char* args)
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY);
}
else if (g_team == HORDE)
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE); }
{
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE);
}
else if (g_team == ALLIANCE)
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE); }
{
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
}
if (g_team == TEAM_BOTH_ALLOWED)
{
PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
}
else
{ PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); }
{
PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
}
}
return true;
@ -4716,7 +4830,9 @@ bool ChatHandler::HandleNpcChangeEntryCommand(char* args)
SendSysMessage(LANG_DONE);
}
else
{ SendSysMessage(LANG_ERROR); }
{
SendSysMessage(LANG_ERROR);
}
return true;
}
@ -4823,11 +4939,15 @@ bool ChatHandler::HandleNpcAddWeaponCommand(char* /*args*/)
char* pSlotID = strtok((char*)args, " ");
if (!pSlotID)
{
return false;
}
char* pItemID = strtok(NULL, " ");
if (!pItemID)
{
return false;
}
uint32 ItemID = atoi(pItemID);
uint32 SlotID = atoi(pSlotID);
@ -4934,9 +5054,13 @@ void ChatHandler::HandleCharacterLevel(Player* player, ObjectGuid player_guid, u
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str());
}
else if (oldlevel < newlevel)
{ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newlevel); }
{
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newlevel);
}
else // if(oldlevel > newlevel)
{ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newlevel); }
{
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newlevel);
}
}
}
else
@ -4966,7 +5090,9 @@ bool ChatHandler::HandleCharacterLevelCommand(char* args)
nolevel = true;
}
else
{ return false; }
{
return false;
}
}
Player* target;
@ -5019,7 +5145,9 @@ bool ChatHandler::HandleLevelUpCommand(char* args)
nameStr = ExtractArg(&args);
}
else
{ return false; }
{
return false;
}
}
}
@ -5192,11 +5320,17 @@ bool ChatHandler::HandleAuctionItemCommand(char* args)
houseid = 1;
}
else if (strncmp(typeStr, "horde", strlen(typeStr)) == 0)
{ houseid = 6; }
{
houseid = 6;
}
else if (strncmp(typeStr, "goblin", strlen(typeStr)) == 0)
{ houseid = 7; }
{
houseid = 7;
}
else
{ return false; }
{
return false;
}
// parse item str
char* itemStr = ExtractArg(&args);
@ -5233,11 +5367,17 @@ bool ChatHandler::HandleAuctionItemCommand(char* args)
etime = 1 * MIN_AUCTION_TIME;
}
else if (strncmp(timeStr, "long", strlen(timeStr)) == 0)
{ etime = 2 * MIN_AUCTION_TIME; }
{
etime = 2 * MIN_AUCTION_TIME;
}
else if (strncmp(timeStr, "verylong", strlen(timeStr)) == 0)
{ etime = 4 * MIN_AUCTION_TIME; }
{
etime = 4 * MIN_AUCTION_TIME;
}
else
{ return false; }
{
return false;
}
}
AuctionHouseEntry const* auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid);
@ -5543,7 +5683,9 @@ bool ChatHandler::HandleResetAchievementsCommand(char* args)
Player* target;
ObjectGuid target_guid;
if (!ExtractPlayerTarget(&args, &target, &target_guid))
{
return false;
}
if (target)
target->GetAchievementMgr().Reset();
@ -5844,7 +5986,9 @@ bool ChatHandler::HandleServerShutDownCommand(char* args)
{
uint32 delay;
if (!ExtractUInt32(&args, delay))
{
return false;
}
uint32 exitcode;
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
@ -6232,7 +6376,9 @@ bool ChatHandler::HandleBanHelper(BanMode mode, char* args)
PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(duration_secs, true).c_str(), reason);
}
else
{ PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason); }
{
PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason);
}
break;
case BAN_SYNTAX_ERROR:
return false;
@ -6317,7 +6463,9 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, char* args)
PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
}
else
{ PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str()); }
{
PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
}
return true;
}
@ -6524,7 +6672,9 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
}
// "character" case, name need extract from another DB
else
{ sAccountMgr.GetName(account_id, account_name); }
{
sAccountMgr.GetName(account_id, account_name);
}
// No SQL injection. id is uint32.
QueryResult* banInfo = LoginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
@ -6817,7 +6967,9 @@ bool ChatHandler::HandlePDumpWriteCommand(char* args)
lowguid = guid.GetCounter();
}
else
{ guid = ObjectGuid(HIGHGUID_PLAYER, lowguid); }
{
guid = ObjectGuid(HIGHGUID_PLAYER, lowguid);
}
if (!sObjectMgr.GetPlayerAccountIdByGUID(guid))
{
@ -6876,16 +7028,22 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
target = static_cast<ChaseMovementGenerator<Player> const*>(*itr)->GetTarget();
}
else
{ target = static_cast<ChaseMovementGenerator<Creature> const*>(*itr)->GetTarget(); }
{
target = static_cast<ChaseMovementGenerator<Creature> const*>(*itr)->GetTarget();
}
if (!target)
{
SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
}
else if (target->GetTypeId() == TYPEID_PLAYER)
{ PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); }
{
PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
}
else
{ PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); }
{
PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
}
break;
}
case FOLLOW_MOTION_TYPE:
@ -6896,16 +7054,22 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
target = static_cast<FollowMovementGenerator<Player> const*>(*itr)->GetTarget();
}
else
{ target = static_cast<FollowMovementGenerator<Creature> const*>(*itr)->GetTarget(); }
{
target = static_cast<FollowMovementGenerator<Creature> const*>(*itr)->GetTarget();
}
if (!target)
{
SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
}
else if (target->GetTypeId() == TYPEID_PLAYER)
{ PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); }
{
PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
}
else
{ PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); }
{
PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
}
break;
}
case HOME_MOTION_TYPE:
@ -6914,7 +7078,9 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
}
else
{ SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); }
{
SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
}
break;
case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break;
case POINT_MOTION_TYPE:
@ -6951,13 +7117,21 @@ bool ChatHandler::HandleServerPLimitCommand(char* args)
sWorld.SetPlayerLimit(-SEC_PLAYER);
}
else if (strncmp(param, "moderator", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_MODERATOR); }
{
sWorld.SetPlayerLimit(-SEC_MODERATOR);
}
else if (strncmp(param, "gamemaster", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_GAMEMASTER); }
{
sWorld.SetPlayerLimit(-SEC_GAMEMASTER);
}
else if (strncmp(param, "administrator", l) == 0)
{ sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR); }
{
sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR);
}
else if (strncmp(param, "reset", l) == 0)
{ sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT)); }
{
sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT));
}
else if (ExtractInt32(&param, val))
{
if (val < -SEC_ADMINISTRATOR)
@ -6968,7 +7142,9 @@ bool ChatHandler::HandleServerPLimitCommand(char* args)
sWorld.SetPlayerLimit(val);
}
else
{ return false; }
{
return false;
}
// kick all low security level players
if (sWorld.GetPlayerAmountLimit() > SEC_PLAYER)
@ -7398,7 +7574,9 @@ bool ChatHandler::HandleGMListFullCommand(char* /*args*/)
delete result;
}
else
{ PSendSysMessage(LANG_GMLIST_EMPTY); }
{
PSendSysMessage(LANG_GMLIST_EMPTY);
}
return true;
}
@ -7462,7 +7640,9 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CONSOLE, guid, name.c_str(), race_name, class_name, level);
}
else
{ PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level); }
{
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level);
}
}
while (result->NextRow());
@ -7941,10 +8121,14 @@ bool ChatHandler::HandleShowGearScoreCommand(char* args)
uint32 withBags, withBank;
if (!ExtractOptUInt32(&args, withBags, 1))
{
return false;
}
if (!ExtractOptUInt32(&args, withBank, 0))
{
return false;
}
// always recalculate gear score for display
player->ResetCachedGearScore();

View file

@ -115,7 +115,9 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s
}
}
else
{ resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL"); }
{
resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL");
}
if (resultChar)
{
@ -344,7 +346,9 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(char* args)
HandleCharacterDeletedRestoreHelper(delInfo);
}
else
{ SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME); }
{
SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
}
return true;
}
@ -442,7 +446,9 @@ bool ChatHandler::HandleCharacterEraseCommand(char* args)
target->GetSession()->KickPlayer();
}
else
{ account_id = sObjectMgr.GetPlayerAccountIdByGUID(target_guid); }
{
account_id = sObjectMgr.GetPlayerAccountIdByGUID(target_guid);
}
std::string account_name;
sAccountMgr.GetName(account_id, account_name);

View file

@ -278,7 +278,9 @@ bool ChatHandler::HandleDebugPlayMovieCommand(char* args)
// #movieid - ID decimal number from Movie.dbc (1st column)
uint32 dwId;
if (!ExtractUInt32(&args, dwId))
{
return false;
}
if (!sMovieStore.LookupEntry(dwId))
{
@ -322,7 +324,9 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer());
}
else
{ unit->PlayDirectSound(dwSoundId, m_session->GetPlayer()); }
{
unit->PlayDirectSound(dwSoundId, m_session->GetPlayer());
}
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
return true;
@ -395,7 +399,9 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(char* /*args*/)
target->GetLootRecipientGuid().GetString().c_str(),
target->GetLootGroupRecipientId());
else
{ SendSysMessage("loot recipient: offline "); }
{
SendSysMessage("loot recipient: offline ");
}
return true;
}
@ -440,11 +446,17 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
state_str = "removed";
}
else if (strncmp(args, "queue", strlen(args)) == 0)
{ list_queue = true; }
{
list_queue = true;
}
else if (strncmp(args, "all", strlen(args)) == 0)
{ check_all = true; }
{
check_all = true;
}
else
{ return false; }
{
return false;
}
Player* player = getSelectedPlayer();
if (!player)
@ -755,7 +767,9 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(char* /*args*/)
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(char* args)
{
if (!*args)
{
return false;
}
char* m = strtok((char*)args, " ");
char* p = strtok(NULL, " ");
@ -836,15 +850,25 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
base = 10;
}
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
{ base = 10; }
{
base = 10;
}
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
{ base = 16; }
{
base = 16;
}
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
{ base = 2; }
{
base = 2;
}
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
{ base = 0; }
{
base = 0;
}
else
{ return false; }
{
return false;
}
if (base)
{
@ -956,15 +980,25 @@ bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeS
base = 10;
}
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
{ base = 10; }
{
base = 10;
}
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
{ base = 16; }
{
base = 16;
}
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
{ base = 2; }
{
base = 2;
}
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
{ base = 0; }
{
base = 0;
}
else
{ return false; }
{
return false;
}
if (base)
{
@ -1075,15 +1109,25 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
type = 1;
}
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
{ type = 0; }
{
type = 0;
}
else if (strncmp(typeStr, "|=", strlen("|=") + 1) == 0) // exactly copy
{ type = 2; }
{
type = 2;
}
else if (strncmp(typeStr, "&=", strlen("&=") + 1) == 0) // exactly copy
{ type = 3; }
{
type = 3;
}
else if (strncmp(typeStr, "&=~", strlen("&=~") + 1) == 0) // exactly copy
{ type = 4; }
{
type = 4;
}
else
{ return false; }
{
return false;
}
if (type)
{
@ -1285,9 +1329,13 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
opcode = SMSG_SET_FLAT_SPELL_MODIFIER;
}
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
{ opcode = SMSG_SET_PCT_SPELL_MODIFIER; }
{
opcode = SMSG_SET_PCT_SPELL_MODIFIER;
}
else
{ return false; }
{
return false;
}
uint32 effidx;
if (!ExtractUInt32(&args, effidx) || effidx >= 64 + 32)

View file

@ -82,7 +82,9 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
angle_to_caster = fright->GetAngle(&owner);
}
else
{ angle_to_caster = frand(0, 2 * M_PI_F); }
{
angle_to_caster = frand(0, 2 * M_PI_F);
}
}
else
{
@ -116,7 +118,9 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
// try to fix z
if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z))
{
return false;
}
if (owner.GetTypeId() == TYPEID_PLAYER)
{
@ -126,9 +130,11 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
{
z = testZ;
if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z))
{
return false;
}
}
}
return true;
}

View file

@ -65,7 +65,9 @@ void MotionMaster::Initialize()
(static_cast<WaypointMovementGenerator<Creature>*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0);
}
else
{ push(&si_idleMovement); }
{
push(&si_idleMovement);
}
}
MotionMaster::~MotionMaster()
@ -98,7 +100,9 @@ void MotionMaster::UpdateMotion(uint32 diff)
MovementExpired();
}
else
{ m_cleanFlag &= ~MMCF_UPDATE; }
{
m_cleanFlag &= ~MMCF_UPDATE;
}
if (m_expList)
{
@ -155,7 +159,9 @@ void MotionMaster::DelayedClean(bool reset, bool all)
m_cleanFlag |= MMCF_RESET;
}
else
{ m_cleanFlag &= ~MMCF_RESET; }
{
m_cleanFlag &= ~MMCF_RESET;
}
if (empty() || (!all && size() == 1))
{
@ -228,7 +234,9 @@ void MotionMaster::DelayedExpire(bool reset)
m_cleanFlag |= MMCF_RESET;
}
else
{ m_cleanFlag &= ~MMCF_RESET; }
{
m_cleanFlag &= ~MMCF_RESET;
}
if (empty() || size() == 1)
{
@ -316,7 +324,9 @@ void MotionMaster::MoveTargetedHome()
}
}
else
{ sLog.outError("%s attempt targeted home", m_owner->GetGuidStr().c_str()); }
{
sLog.outError("%s attempt targeted home", m_owner->GetGuidStr().c_str());
}
}
void MotionMaster::MoveConfused()
@ -328,7 +338,9 @@ void MotionMaster::MoveConfused()
Mutate(new ConfusedMovementGenerator<Player>());
}
else
{ Mutate(new ConfusedMovementGenerator<Creature>()); }
{
Mutate(new ConfusedMovementGenerator<Creature>());
}
}
void MotionMaster::MoveChase(Unit* target, float dist, float angle)
@ -346,7 +358,9 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
Mutate(new ChaseMovementGenerator<Player>(*target, dist, angle));
}
else
{ Mutate(new ChaseMovementGenerator<Creature>(*target, dist, angle)); }
{
Mutate(new ChaseMovementGenerator<Creature>(*target, dist, angle));
}
}
void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
@ -371,7 +385,9 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
Mutate(new FollowMovementGenerator<Player>(*target, dist, angle));
}
else
{ Mutate(new FollowMovementGenerator<Creature>(*target, dist, angle)); }
{
Mutate(new FollowMovementGenerator<Creature>(*target, dist, angle));
}
}
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath)
@ -383,7 +399,9 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath));
}
else
{ Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath)); }
{
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath));
}
}
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
@ -434,7 +452,9 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time));
}
else
{ Mutate(new FleeingMovementGenerator<Creature>(enemy->GetObjectGuid())); }
{
Mutate(new FleeingMovementGenerator<Creature>(enemy->GetObjectGuid()));
}
}
}
@ -542,8 +562,10 @@ bool MotionMaster::SetNextWaypoint(uint32 pointId)
for (Impl::container_type::reverse_iterator rItr = Impl::c.rbegin(); rItr != Impl::c.rend(); ++rItr)
{
if ((*rItr)->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
return (static_cast<WaypointMovementGenerator<Creature>*>(*rItr))->SetNextWaypoint(pointId);
}
}
return false;
}

View file

@ -99,7 +99,9 @@ class MotionMaster : private std::stack<MovementGenerator*>
DelayedClean(reset, all);
}
else
{ DirectClean(reset, all); }
{
DirectClean(reset, all);
}
}
void MovementExpired(bool reset = true)
{
@ -108,7 +110,9 @@ class MotionMaster : private std::stack<MovementGenerator*>
DelayedExpire(reset);
}
else
{ DirectExpire(reset); }
{
DirectExpire(reset);
}
}
void MoveIdle();

View file

@ -189,10 +189,14 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
(endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z)))
{ m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
else
{ m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
{
m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH;
}
}
else
{ m_type = PATHFIND_NOPATH; }
{
m_type = PATHFIND_NOPATH;
}
return;
}
@ -407,7 +411,9 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
m_type = PATHFIND_NORMAL;
}
else
{ m_type = PATHFIND_INCOMPLETE; }
{
m_type = PATHFIND_INCOMPLETE;
}
// generate the point-path out of our up-to-date poly-path
BuildPointPath(startPoint, endPoint);
@ -719,7 +725,9 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
len = 1.0f;
}
else
{ len = SMOOTH_PATH_STEP_SIZE / len; }
{
len = SMOOTH_PATH_STEP_SIZE / len;
}
float moveTgt[VERTEX_SIZE];
dtVmad(moveTgt, iterPos, delta, len);

View file

@ -162,7 +162,9 @@ void EffectMovementGenerator::Finalize(Unit& unit)
unit.GetMotionMaster()->MoveChase(victim);
}
else
{ unit.GetMotionMaster()->Initialize(); }
{
unit.GetMotionMaster()->Initialize();
}
}
}

View file

@ -194,7 +194,9 @@ bool TargetedMovementGeneratorMedium<T, D>::RequiresNewPosition(T& owner, float
return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true));
}
else
{ return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true)); }
{
return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true));
}
}
//-----------------------------------------------//

View file

@ -175,7 +175,9 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
creature.MonsterText(textData, NULL);
}
else
{ sLog.outErrorDb("%s reached waypoint %u, attempted to do text %i, but required text-data could not be found", creature.GetGuidStr().c_str(), i_currentNode, textId); }
{
sLog.outErrorDb("%s reached waypoint %u, attempted to do text %i, but required text-data could not be found", creature.GetGuidStr().c_str(), i_currentNode, textId);
}
}
}
@ -240,8 +242,10 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first);
if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls
{
return;
}
}
i_currentNode = currPoint->first;
}
@ -382,11 +386,15 @@ void WaypointMovementGenerator<Creature>::AddToWaypointPauseTime(int32 waitTimeD
bool WaypointMovementGenerator<Creature>::SetNextWaypoint(uint32 pointId)
{
if (!i_path || i_path->empty())
{
return false;
}
WaypointPath::const_iterator currPoint = i_path->find(pointId);
if (currPoint == i_path->end())
{
return false;
}
// Allow Moving with next tick
// Handle allow movement this way to not interact with PAUSED state.

View file

@ -74,11 +74,17 @@ ArenaTeam::~ArenaTeam()
bool ArenaTeam::Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName)
{
if (!IsArenaTypeValid(type))
{
return false;
}
if (!sObjectMgr.GetPlayer(captainGuid)) // player not exist
{
return false;
}
if (sObjectMgr.GetArenaTeamByName(arenaTeamName)) // arena team with this name already exist
{
return false;
}
DEBUG_LOG("GUILD: creating arena team %s to leader: %s", arenaTeamName.c_str(), captainGuid.GetString().c_str());
@ -113,7 +119,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
// arena team is full (can't have more than type * 2 players!)
if (GetMembersSize() >= GetMaxMembersSize())
{
return false;
}
Player* pl = sObjectMgr.GetPlayer(playerGuid);
if (pl)
@ -132,7 +140,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
// 0 1
QueryResult* result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", playerGuid.GetCounter());
if (!result)
{
return false;
}
plName = (*result)[0].GetCppString();
plClass = (*result)[1].GetUInt8();
@ -193,7 +203,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
{
if (!arenaTeamDataResult)
{
return false;
}
Field* fields = arenaTeamDataResult->Fetch();
@ -203,7 +215,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
m_Type = ArenaType(fields[3].GetUInt32());
if (!IsArenaTypeValid(m_Type))
{
return false;
}
m_BackgroundColor = fields[4].GetUInt32();
m_EmblemStyle = fields[5].GetUInt32();
@ -224,7 +238,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
{
if (!arenaTeamMembersResult)
{
return false;
}
bool captainPresentInTeam = false;
@ -267,7 +283,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
// arena team can't be > 2 * arenatype (2 for 2x2, 3 for 3x3, 5 for 5x5)
if (GetMembersSize() >= GetMaxMembersSize())
{
return false;
}
if (newmember.guid == GetCaptainGuid())
captainPresentInTeam = true;
@ -429,7 +447,9 @@ void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
{
ArenaTeamMember* member = GetMember(guid);
if (!member)
{
return;
}
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8 + 1 + 4 * 6);
data << guid; // player guid
@ -587,7 +607,9 @@ bool ArenaTeam::HaveMember(ObjectGuid guid) const
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if (itr->guid == guid)
{
return true;
}
return false;
}
@ -734,7 +756,9 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
// helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
// 10 played games per week is a minimum
if (m_stats.games_week < 10)
{
return;
}
// to get points, a player has to participate in at least 30% of the matches
uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3);
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
@ -788,9 +812,11 @@ bool ArenaTeam::IsFighting() const
if (Player* p = sObjectMgr.GetPlayer(itr->guid))
{
if (p->GetMap()->IsBattleArena())
{
return true;
}
}
}
return false;
}

View file

@ -141,7 +141,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
if (auction_owner)
owner_name = auction_owner->GetName();
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
{ owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); }
{
owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
}
uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid);
@ -150,7 +152,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
}
}
else if (!bidder)
{ bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); }
{
bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
}
if (auction_owner)
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
@ -679,11 +683,17 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
if (!itemProto2 || !itemProto1)
{
return 0;
}
if (itemProto1->RequiredLevel < itemProto2->RequiredLevel)
{
return -1;
}
else if (itemProto1->RequiredLevel > itemProto2->RequiredLevel)
{
return +1;
}
break;
}
case 1: // quality = 1
@ -691,47 +701,71 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
if (!itemProto2 || !itemProto1)
{
return 0;
}
if (itemProto1->Quality < itemProto2->Quality)
{
return -1;
}
else if (itemProto1->Quality > itemProto2->Quality)
{
return +1;
}
break;
}
case 2: // buyoutthenbid = 2
if (buyout != auc->buyout)
{
if (buyout < auc->buyout)
{
return -1;
}
else if (buyout > auc->buyout)
{
return +1;
}
}
else
{
if (bid < auc->bid)
{
return -1;
}
else if (bid > auc->bid)
{
return +1;
}
}
break;
case 3: // duration = 3
if (expireTime < auc->expireTime)
{
return -1;
}
else if (expireTime > auc->expireTime)
{
return +1;
}
break;
case 4: // status = 4
if (bidder < auc->bidder)
{
return -1;
}
else if (bidder > auc->bidder)
{
return +1;
}
break;
case 5: // name = 5
{
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
if (!itemProto2 || !itemProto1)
{
return 0;
}
int32 loc_idx = viewPlayer->GetSession()->GetSessionDbLocaleIndex();
@ -754,17 +788,25 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
if (bid1 != bid2)
{
if (bid1 < bid2)
{
return -1;
}
else if (bid1 > bid2)
{
return +1;
}
}
else
{
if (buyout < auc->buyout)
{
return -1;
}
else if (buyout > auc->buyout)
{
return +1;
}
}
break;
}
@ -776,24 +818,36 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
uint64 bid2 = auc->bid ? auc->bid : auc->startbid;
if (bid1 < bid2)
{
return -1;
}
else if (bid1 > bid2)
{
return +1;
}
break;
}
case 9: // quantity = 9
{
if (itemCount < auc->itemCount)
{
return -1;
}
else if (itemCount > auc->itemCount)
{
return +1;
}
break;
}
case 10: // buyout = 10
if (buyout < auc->buyout)
{
return -1;
}
else if (buyout > auc->buyout)
{
return +1;
}
break;
case 11: // unused = 11
default:
@ -806,12 +860,16 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
bool AuctionSorter::operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const
{
if (m_sort[0] == MAX_AUCTION_SORT) // not sorted
{
return false;
}
for (uint32 i = 0; i < MAX_AUCTION_SORT; ++i)
{
if (m_sort[i] == MAX_AUCTION_SORT) // end of sort
{
return false;
}
int res = auc1->CompareAuctionEntry(m_sort[i] & ~AUCTION_SORT_REVERSED, auc2, m_viewPlayer);
// "equal" by used column

View file

@ -212,7 +212,9 @@ Item* Bag::GetItemByLimitedCategory(uint32 limitedCategory) const
{
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] && m_bagslot[i]->GetProto()->ItemLimitCategory == limitedCategory)
{
return m_bagslot[i];
}
return NULL;
}

View file

@ -42,7 +42,9 @@ CalendarEvent::~CalendarEvent()
bool CalendarEvent::AddInvite(CalendarInvite* invite)
{
if (!invite)
{
return false;
}
return m_Invitee.insert(CalendarInviteMap::value_type(invite->InviteId, invite)).second;
}
@ -51,7 +53,9 @@ CalendarInvite* CalendarEvent::GetInviteById(uint64 inviteId)
{
CalendarInviteMap::iterator itr = m_Invitee.find(inviteId);
if (itr != m_Invitee.end())
{
return itr->second;
}
return NULL;
}
@ -61,7 +65,9 @@ CalendarInvite* CalendarEvent::GetInviteByGuid(ObjectGuid const& guid)
while (inviteItr != m_Invitee.end())
{
if (inviteItr->second->InviteeGuid == guid)
{
return inviteItr->second;
}
++inviteItr;
}
@ -249,7 +255,9 @@ CalendarEvent* CalendarMgr::AddEvent(ObjectGuid const& guid, std::string title,
{
Player* player = sObjectMgr.GetPlayer(guid);
if (!player)
{
return NULL;
}
if (title.empty())
{
@ -356,7 +364,9 @@ CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& s
{
Player* sender = sObjectMgr.GetPlayer(senderGuid);
if (!event || !sender)
{
return NULL;
}
std::string name;
sObjectMgr.GetPlayerNameByGUID(inviteeGuid, name);
@ -477,7 +487,9 @@ void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& gu
CALENDAR_MAX_INVITES, event->DungeonId, newTime, event->UnknownTime, event->Flags);
if (!newEvent)
{
return;
}
if (newEvent->IsGuildAnnouncement())
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
@ -686,7 +698,9 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
// count all event created by guid
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
if ((itr->second.CreatorGuid == guid) && (++totalEvents >= CALENDAR_MAX_EVENTS))
{
return false;
}
return true;
}
@ -694,13 +708,17 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
bool CalendarMgr::CanAddGuildEvent(uint32 guildId)
{
if (!guildId)
{
return false;
}
uint32 totalEvents = 0;
// count all guild events in a guild
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
if ((itr->second.GuildId == guildId) && (++totalEvents >= CALENDAR_MAX_GUILD_EVENTS))
{
return false;
}
return true;
}
@ -721,7 +739,9 @@ bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
while (ci_itr != cInvMap->end())
{
if ((ci_itr->second->InviteeGuid == guid) && (++totalInvites >= CALENDAR_MAX_INVITES))
{
return false;
}
++ci_itr;
}
}

View file

@ -277,7 +277,9 @@ bool Corpse::IsHostileTo(Unit const* unit) const
return owner->IsHostileTo(unit);
}
else
{ return false; }
{
return false;
}
}
bool Corpse::IsFriendlyTo(Unit const* unit) const
@ -287,7 +289,9 @@ bool Corpse::IsFriendlyTo(Unit const* unit) const
return owner->IsFriendlyTo(unit);
}
else
{ return true; }
{
return true;
}
}
bool Corpse::IsExpired(time_t t) const
@ -297,5 +301,7 @@ bool Corpse::IsExpired(time_t t) const
return m_time < t - 60 * MINUTE;
}
else
{ return m_time < t - 3 * DAY; }
{
return m_time < t - 3 * DAY;
}
}

View file

@ -143,7 +143,9 @@ void CreatureCreatePos::SelectFinalPoint(Creature* cr)
m_pos.z = m_closeObject->GetPositionZ();
}
else
{ m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle); }
{
m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle);
}
}
}
@ -638,7 +640,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
LoadCreatureAddon(true);
}
else
{ SetDeathState(JUST_ALIVED); }
{
SetDeathState(JUST_ALIVED);
}
// Call AI respawn virtual function
if (AI())
@ -679,7 +683,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
StopGroupLoot();
}
else
{ m_groupLootTimer -= update_diff; }
{
m_groupLootTimer -= update_diff;
}
}
break;
@ -767,7 +773,9 @@ void Creature::RegenerateAll(uint32 update_diff)
m_regenTimer = 0;
}
else
{ m_regenTimer -= update_diff; }
{
m_regenTimer -= update_diff;
}
}
if (m_regenTimer != 0)
{
@ -787,7 +795,9 @@ void Creature::RegenerateAll(uint32 update_diff)
void Creature::RegeneratePower()
{
if (!IsRegeneratingPower())
{
return;
}
Powers powerType = GetPowerType();
uint32 curValue = GetPower(powerType);
@ -877,10 +887,14 @@ void Creature::RegenerateHealth()
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
}
else
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
{
addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
}
}
else
{ addvalue = maxValue / 3; }
{
addvalue = maxValue / 3;
}
ModifyHealth(addvalue);
}
@ -1318,7 +1332,9 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
}
}
else
{ displayId = 0; }
{
displayId = 0;
}
}
// data->guid = guid don't must be update at save
@ -1378,7 +1394,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
{
CreatureInfo const* cinfo = GetCreatureInfo();
if (!cinfo)
{
return;
}
uint32 rank = IsPet() ? 0 : cinfo->Rank; // TODO :: IsPet probably not needed here
@ -1555,7 +1573,9 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10
SetHealth(health);
}
else
{ SetHealthPercent(percentHealth); }
{
SetHealthPercent(percentHealth);
}
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
@ -1812,7 +1832,9 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
EquipmentInfo const* einfo = sObjectMgr.GetEquipmentInfo(equip_entry);
if (!einfo)
{
return;
}
m_equipmentId = equip_entry;
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
@ -2060,7 +2082,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
{
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
if (!spellEffect)
{
return false;
}
if (!castOnSelf && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellEffect->EffectMechanic - 1)))
{
@ -2080,7 +2104,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
}
// Spell effect taunt check
else if (spellEffect->Effect == SPELL_EFFECT_ATTACK_ME)
{ return true; }
{
return true;
}
}
return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf);
@ -2090,7 +2116,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
void Creature::SetLootStatus(CreatureLootStatus status)
{
if (status <= m_lootStatus)
{
return;
}
m_lootStatus = status;
switch (status)
@ -2122,16 +2150,20 @@ bool Creature::IsTappedBy(Player* plr) const
if (Player* recipient = GetLootRecipient())
{
if (recipient == plr)
{
return true;
}
if (Group* grp = recipient->GetGroup())
{
if (Group* plrGroup = plr->GetGroup())
{
if (plrGroup == grp)
{
return true;
}
}
}
return false;
}
return false;
@ -2334,7 +2366,9 @@ void Creature::CallAssistance()
SetNoCallAssistance(true);
if (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_CALL_ASSIST)
{
return;
}
AI()->SendAIEventAround(AI_EVENT_CALL_ASSISTANCE, getVictim(), sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY), sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_ASSISTANCE_RADIUS));
}
@ -2507,8 +2541,10 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
{
// If CreatureTemplateAddon for difficulty_entry_N exist, it's there for a reason
if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureTemplateAddon(GetCreatureInfo()->Entry))
{
return addon;
}
}
// Return CreatureTemplateAddon when nothing else exist
return ObjectMgr::GetCreatureTemplateAddon(GetEntry());
@ -2649,11 +2685,17 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const*
return false;
}
else if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->GetPowerType() != POWER_RAGE)
{ return false; }
{
return false;
}
else if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->GetPowerType() != POWER_ENERGY)
{ return false; }
{
return false;
}
else if (selectFlags & SELECT_FLAG_POWER_RUNIC && pTarget->GetPowerType() != POWER_RUNIC_POWER)
{ return false; }
{
return false;
}
if (selectFlags & SELECT_FLAG_IN_MELEE_RANGE && !CanReachWithMeleeAttack(pTarget))
{
@ -2844,9 +2886,13 @@ time_t Creature::GetRespawnTimeEx() const
return m_respawnTime;
}
else if (m_corpseDecayTimer > 0) // dead (corpse)
{
return now + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS;
}
else
{ return now; }
{
return now;
}
}
void Creature::GetRespawnCoord(float& x, float& y, float& z, float* ori, float* dist) const
@ -3051,7 +3097,9 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
vCount->count += diff * pProto->BuyCount;
}
else
{ vCount->count = vItem->maxcount; }
{
vCount->count = vItem->maxcount;
}
}
vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
@ -3258,7 +3306,9 @@ void Creature::SetWalk(bool enable, bool asDefault)
clearUnitState(UNIT_STAT_RUNNING);
}
else
{ addUnitState(UNIT_STAT_RUNNING); }
{
addUnitState(UNIT_STAT_RUNNING);
}
}
// Nothing changed?
@ -3272,7 +3322,9 @@ void Creature::SetWalk(bool enable, bool asDefault)
m_movementInfo.AddMovementFlag(MOVEFLAG_WALK_MODE);
}
else
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE); }
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE);
}
if (IsInWorld())
{
@ -3299,7 +3351,9 @@ void Creature::SetLevitate(bool enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING);
}
else
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING); }
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING);
}
if (IsInWorld())
{
@ -3374,7 +3428,9 @@ void Creature::SetRoot(bool enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
}
else
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT); }
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT);
}
if (IsInWorld())
{

View file

@ -170,9 +170,13 @@ struct CreatureInfo
return SKILL_HERBALISM;
}
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT)
{ return SKILL_MINING; }
{
return SKILL_MINING;
}
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
{
return SKILL_ENGINEERING;
}
else
{ return SKILL_SKINNING; } // normal case
}
@ -185,7 +189,9 @@ struct CreatureInfo
bool isTameable(bool exotic) const
{
if (CreatureType != CREATURE_TYPE_BEAST || Family == 0 || (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
{
return false;
}
// if can tame exotic then can tame any temable
return exotic || !IsExotic();
@ -798,7 +804,9 @@ class Creature : public Unit
return 0;
}
else
{ return m_charmInfo->GetCharmSpell(pos)->GetAction(); }
{
return m_charmInfo->GetCharmSpell(pos)->GetAction();
}
}
void SetCombatStartPosition(float x, float y, float z) { m_combatStartX = x; m_combatStartY = y; m_combatStartZ = z; }

View file

@ -73,8 +73,10 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
}
if (!pSpell->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !m_creature->IsWithinLOSInMap(pTarget) && m_creature != pTarget)
{
return CAST_FAIL_NOT_IN_LOS;
}
}
if (const SpellRangeEntry* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
{
@ -99,7 +101,9 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
return CAST_OK;
}
else
{ return CAST_FAIL_OTHER; }
{
return CAST_FAIL_OTHER;
}
}
CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, ObjectGuid uiOriginalCasterGUID)
@ -162,7 +166,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
}
}
else
{ return CAST_FAIL_IS_CASTING; }
{
return CAST_FAIL_IS_CASTING;
}
}
bool CreatureAI::DoMeleeAttackIfReady()
@ -179,7 +185,9 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
}
else
{ m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); }
{
m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
}
if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat
{
@ -188,7 +196,9 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle);
}
else if (!enable && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
{ m_creature->StopMoving(); }
{
m_creature->StopMoving();
}
}
}

View file

@ -44,7 +44,9 @@ namespace FactorySelector
{
// charmed creature may have some script even if its not supposed to be that way (ex: Eye of Acherus)
if (creature->IsCharmed())
{
return scriptedAI;
}
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
@ -71,7 +73,9 @@ namespace FactorySelector
}
}
else if (creature->IsTotem())
{ ai_factory = ai_registry.GetRegistryItem("TotemAI"); }
{
ai_factory = ai_registry.GetRegistryItem("TotemAI");
}
// select by script name
if (!ai_factory && !ainame.empty())

View file

@ -44,7 +44,9 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM
Time = repeatMin;
}
else if (repeatMax > repeatMin)
{ Time = urand(repeatMin, repeatMax); }
{
Time = urand(repeatMin, repeatMax);
}
else
{
sLog.outErrorEventAI("Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
@ -83,9 +85,13 @@ void CreatureEventAI::GetAIInformation(ChatHandler& reader)
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1, itr->Event.action[2].type, itr->Event.action[2].raw.param1);
}
else if (itr->Event.action[1].type != ACTION_T_NONE)
{ reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1); }
{
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1);
}
else
{ reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1); }
{
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1);
}
}
}
@ -130,7 +136,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
}
}
else if (IsEventFlagsFitForNormalMap(i->event_flags))
{ ++events_count; }
{
++events_count;
}
}
// EventMap had events but they were not added because they must be for instance
if (events_count == 0)
@ -158,7 +166,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
}
}
else if (IsEventFlagsFitForNormalMap(i->event_flags))
{ storeEvent = true; }
{
storeEvent = true;
}
if (storeEvent)
{
@ -313,11 +323,15 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
break;
case EVENT_T_RANGE:
if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->IsInMap(m_creature->getVictim()))
{
return false;
}
// DISCUSS TODO - Likely replace IsInRange check with CombatReach checks (as used rather for such checks)
if (!m_creature->IsInRange(m_creature->getVictim(), (float)event.range.minDist, (float)event.range.maxDist))
{
return false;
}
// Repeat Timers
pHolder.UpdateRepeatTimer(m_creature, event.range.repeatMin, event.range.repeatMax);
@ -645,9 +659,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
textId = action.text.TextId[rnd % 3];
}
else if (action.text.TextId[1] && (rnd % 2))
{ textId = action.text.TextId[1]; }
{
textId = action.text.TextId[1];
}
else
{ textId = action.text.TextId[0]; }
{
textId = action.text.TextId[0];
}
}
// ACTION_T_CHANCED_TEXT, chance hits
else if ((rnd % 100) < action.chanced_text.chance)
@ -657,7 +675,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
textId = action.chanced_text.TextId[rnd % 2];
}
else
{ textId = action.chanced_text.TextId[0]; }
{
textId = action.chanced_text.TextId[0];
}
}
if (textId)
@ -702,7 +722,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags);
}
else // no id provided, assume reset and then use default
{ m_creature->ClearTemporaryFaction(); }
{
m_creature->ClearTemporaryFaction();
}
break;
}
@ -721,10 +743,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
// if no param1, then use value from param2 (modelId)
else
{ m_creature->SetDisplayId(action.morph.modelId); }
{
m_creature->SetDisplayId(action.morph.modelId);
}
}
else
{ m_creature->DeMorph(); }
{
m_creature->DeMorph();
}
break;
}
case ACTION_T_SOUND: //4
@ -842,14 +868,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, action.summon.duration);
}
else
{ pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
{
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
}
if (!pCreature)
{
sLog.outErrorEventAI("failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
}
else if (action.summon.target != TARGET_T_SELF && target)
{ pCreature->AI()->AttackStart(target); }
{
pCreature->AI()->AttackStart(target);
}
break;
}
case ACTION_T_THREAT_SINGLE_PCT: //13
@ -858,7 +888,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target);
}
break;
case ACTION_T_THREAT_ALL_PCT: //14
{
@ -879,7 +911,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target);
}
break;
case ACTION_T_CAST_EVENT: //16
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
@ -890,7 +924,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target);
}
break;
case ACTION_T_SET_UNIT_FIELD: //17
{
@ -903,7 +939,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target);
}
break;
}
@ -913,7 +951,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target);
}
break;
case ACTION_T_REMOVE_UNIT_FLAG: //19
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
@ -921,7 +961,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target);
}
case ACTION_T_AUTO_ATTACK: //20
m_MeleeEnabled = action.auto_attack.state != 0;
break;
@ -939,7 +981,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->SendMeleeAttackStart(m_creature->getVictim());
}
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
{
m_creature->SendMeleeAttackStop(m_creature->getVictim());
}
break;
case ACTION_T_SET_PHASE: //22
m_Phase = action.set_phase.phase;
@ -959,7 +1003,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_Phase = MAX_PHASE - 1;
}
else
{ m_Phase = new_phase; }
{
m_Phase = new_phase;
}
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
break;
@ -979,7 +1025,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
}
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
{
((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature);
}
break;
case ACTION_T_CAST_EVENT_ALL: //27
{
@ -997,7 +1045,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target->RemoveAurasDueToSpell(action.remove_aura.spellId);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target);
}
break;
case ACTION_T_RANGED_MOVEMENT: //29
m_attackDistance = (float)action.ranged_movement.distance;
@ -1023,7 +1073,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin));
}
else
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
{
sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
}
break;
case ACTION_T_SUMMON_ID: //32
{
@ -1046,14 +1098,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs);
}
else
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
{
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
}
if (!pCreature)
{
sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
}
else if (action.summon_id.target != TARGET_T_SELF && target)
{ pCreature->AI()->AttackStart(target); }
{
pCreature->AI()->AttackStart(target);
}
break;
}
@ -1074,7 +1130,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target);
}
}
break;
case ACTION_T_SET_INST_DATA: //34
@ -1155,7 +1213,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100;
}
else
{ m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; }
{
m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
}
break;
}
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: //43
@ -1173,10 +1233,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
// if no param1, then use value from param2 (modelId)
else
{ m_creature->Mount(action.mount.modelId); }
{
m_creature->Mount(action.mount.modelId);
}
}
else
{ m_creature->Unmount(); }
{
m_creature->Unmount();
}
break;
}
@ -1242,7 +1306,9 @@ void CreatureEventAI::JustRespawned() // NOTE that this is
}
// Handle Spawned Events
else if (SpawnedEventConditionsCheck((*i).Event))
{ ProcessEvent(*i); }
{
ProcessEvent(*i);
}
}
}
@ -1763,7 +1829,9 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
damage = 0;
}
else
{ damage = m_creature->GetHealth() - m_InvinceabilityHpLevel; }
{
damage = m_creature->GetHealth() - m_InvinceabilityHpLevel;
}
}
uint32 step = m_throwAIEventStep != 100 ? m_throwAIEventStep : 0;

View file

@ -598,7 +598,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorEventAI("Event %u Action %u has not set chance param1. Text will not be displayed", i, j + 1);
}
else if (action.chanced_text.chance >= 100)
{ sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1); }
{
sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1);
}
// no break here to check texts
case ACTION_T_TEXT:
{
@ -629,7 +631,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
action.text.TextId[k] = 0;
}
else
{ usedTextIds.insert(action.text.TextId[k]); }
{
usedTextIds.insert(action.text.TextId[k]);
}
}
}
break;
@ -786,7 +790,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
}
else
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId); }
{
sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId);
}
IsValidTargetType(temp.event_type, action.type, action.quest_event.target, i, j + 1);
break;
@ -824,7 +830,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorEventAI("Event %u Action %u is incrementing phase by 0. Was this intended?", i, j + 1);
}
else if (std::abs(action.set_inc_phase.step) > MAX_PHASE - 1)
{ sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step); }
{
sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step);
}
break;
case ACTION_T_QUEST_EVENT_ALL:
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
@ -835,7 +843,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
}
else
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); }
{
sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId);
}
break;
case ACTION_T_CAST_EVENT_ALL:
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
@ -1047,7 +1057,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName);
}
else if (!ainame && hasevent)
{ sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); }
{
sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName);
}
}
}

View file

@ -140,7 +140,9 @@ void DynamicObject::Update(uint32 /*update_diff*/, uint32 p_time)
m_aliveDuration -= p_time;
}
else
{ deleteThis = true; }
{
deleteThis = true;
}
// have radius and work as persistent effect
if (m_radius)
@ -201,7 +203,9 @@ void DynamicObject::Delay(int32 delaytime)
++iter;
}
else
{ m_affected.erase(iter++); }
{
m_affected.erase(iter++);
}
}
}
@ -229,7 +233,9 @@ bool DynamicObject::IsHostileTo(Unit const* unit) const
return owner->IsHostileTo(unit);
}
else
{ return false; }
{
return false;
}
}
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
@ -239,5 +245,7 @@ bool DynamicObject::IsFriendlyTo(Unit const* unit) const
return owner->IsFriendlyTo(unit);
}
else
{ return true; }
{
return true;
}
}

View file

@ -49,12 +49,18 @@ namespace MaNGOS
return 0;
}
else if (pl_level <= 39)
{ return pl_level - 5 - pl_level / 10; }
{
return pl_level - 5 - pl_level / 10;
}
else if (pl_level <= 59)
{
return pl_level - 1 - pl_level / 5;
}
else
{
return pl_level - 9;
}
}
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
{
@ -63,13 +69,21 @@ namespace MaNGOS
return RED;
}
else if (mob_level >= pl_level + 3)
{ return ORANGE; }
{
return ORANGE;
}
else if (mob_level >= pl_level - 2)
{ return YELLOW; }
{
return YELLOW;
}
else if (mob_level > GetGrayLevel(pl_level))
{ return GREEN; }
{
return GREEN;
}
else
{ return GRAY; }
{
return GRAY;
}
}
inline uint32 GetZeroDifference(uint32 pl_level)

View file

@ -253,7 +253,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
}
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
{ outdoorPvP->HandleGameObjectCreate(this); }
{
outdoorPvP->HandleGameObjectCreate(this);
}
// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
@ -539,7 +541,9 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
SetUInt32Value(GAMEOBJECT_FLAGS, (GetGOInfo()->flags & ~(GO_FLAG_LOCKED | GO_FLAG_INTERACT_COND | GO_FLAG_NO_INTERACT)) | currentLockOrInteractFlags);
}
else
{ SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); }
{
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
}
}
loot.clear();
@ -615,7 +619,9 @@ void GameObject::Delete()
sPoolMgr.UpdatePool<GameObject>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow());
}
else
{ AddObjectToRemoveList(); }
{
AddObjectToRemoveList();
}
}
void GameObject::SaveToDB()
@ -845,7 +851,9 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
// invisible at client always
if (!GetGOInfo()->displayId)
{
return false;
}
// Transport always visible at this step implementation
if (IsTransport() && IsInMap(u))
@ -881,14 +889,18 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
else
{
if (u->IsFriendlyTo(owner))
{
return true;
}
}
}
// handle environment traps (spawned by DB)
else
{
if (this->IsFriendlyTo(u))
{
return true;
}
else
trapNotVisible = true;
}
@ -897,13 +909,17 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
{
if (roll_chance_i(aura->GetModifier()->m_amount) && u->IsInFront(this, 15.0f))
{
return true;
}
}
if (trapNotVisible)
{
return false;
}
}
}
// check distance
return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() +
@ -1156,14 +1172,18 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false *
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
else
{ RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); }
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
if (GetGoState() == GO_STATE_READY) // if closed -> open
{
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
}
else // if open -> close
{ SetGoState(GO_STATE_READY); }
{
SetGoState(GO_STATE_READY);
}
}
void GameObject::Use(Unit* user)
@ -1412,7 +1432,9 @@ void GameObject::Use(Unit* user)
SendGameObjectCustomAnim(GetObjectGuid());
}
else
{ SetGoState(GO_STATE_ACTIVE); }
{
SetGoState(GO_STATE_ACTIVE);
}
m_cooldownTime = time(NULL) + info->GetAutoCloseTime();
@ -1460,7 +1482,9 @@ void GameObject::Use(Unit* user)
GetMap()->ScriptsStart(DBS_ON_GO_USE, GetGUIDLow(), spellCaster, this);
}
else
{ return; }
{
return;
}
// cast this spell later if provided
spellId = info->goober.spellId;
@ -1587,7 +1611,9 @@ void GameObject::Use(Unit* user)
SetLootState(GO_JUST_DEACTIVATED);
}
else
{ player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL); }
{
player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL);
}
}
else
{
@ -1661,7 +1687,9 @@ void GameObject::Use(Unit* user)
}
}
else
{ return; }
{
return;
}
}
spellCaster = player;
@ -1712,7 +1740,9 @@ void GameObject::Use(Unit* user)
}
// reset ritual for this GO
else
{ ClearAllUsesData(); }
{
ClearAllUsesData();
}
// go to end function to spell casting
break;
@ -1879,10 +1909,14 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
if (!info)
{
return;
}
if (user->GetTypeId() != TYPEID_PLAYER)
{
return;
}
Player* player = (Player*)user;
@ -2379,13 +2413,21 @@ void GameObject::SetCapturePointSlider(float value, bool isLocked)
m_captureState = CAPTURE_STATE_WIN_ALLIANCE;
}
else if ((int)m_captureSlider == CAPTURE_SLIDER_HORDE)
{ m_captureState = CAPTURE_STATE_WIN_HORDE; }
{
m_captureState = CAPTURE_STATE_WIN_HORDE;
}
else if (m_captureSlider > CAPTURE_SLIDER_MIDDLE + info->capturePoint.neutralPercent * 0.5f)
{ m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE; }
{
m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE;
}
else if (m_captureSlider < CAPTURE_SLIDER_MIDDLE - info->capturePoint.neutralPercent * 0.5f)
{ m_captureState = CAPTURE_STATE_PROGRESS_HORDE; }
{
m_captureState = CAPTURE_STATE_PROGRESS_HORDE;
}
else
{ m_captureState = CAPTURE_STATE_NEUTRAL; }
{
m_captureState = CAPTURE_STATE_NEUTRAL;
}
}
void GameObject::TickCapturePoint()
@ -2413,7 +2455,9 @@ void GameObject::TickCapturePoint()
++rangePlayers;
}
else
{ --rangePlayers; }
{
--rangePlayers;
}
ObjectGuid guid = (*itr)->GetObjectGuid();
if (!tempUsers.erase(guid))
@ -2462,7 +2506,9 @@ void GameObject::TickCapturePoint()
rangePlayers = maxSuperiority;
}
else if (rangePlayers < -maxSuperiority)
{ rangePlayers = -maxSuperiority; }
{
rangePlayers = -maxSuperiority;
}
// time to capture from 0% to 100% is maxTime for minSuperiority amount of players and minTime for maxSuperiority amount of players (linear function: y = dy/dx*x+d)
float deltaSlider = info->capturePoint.minTime;
@ -2597,7 +2643,9 @@ void GameObject::DealGameObjectDamage(uint32 damage, uint32 spell, Unit* caster)
MANGOS_ASSERT(spell && sSpellStore.LookupEntry(spell) && caster);
if (!damage)
{
return;
}
ForceGameObjectHealth(-int32(damage), caster);

View file

@ -694,7 +694,9 @@ class GameObject : public WorldObject
return m_respawnTime;
}
else
{ return now; }
{
return now;
}
}
void SetRespawnTime(time_t respawn)

View file

@ -350,7 +350,9 @@ bool Guild::CheckGuildStructure()
{ return false; } // guild will disbanded and deleted in caller
}
else if (GM_rights != GR_GUILDMASTER)
{ SetLeader(m_LeaderGuid); }
{
SetLeader(m_LeaderGuid);
}
// Allow only 1 guildmaster, set other to officer
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
@ -825,7 +827,9 @@ void Guild::AddRank(const std::string& name_, uint32 rights, uint32 money)
void Guild::DelRank(uint32 rankId)
{
if (rankId >= m_Ranks.size())
{
return;
}
// client won't allow to have less than GUILD_RANKS_MIN_COUNT ranks in guild
if (m_Ranks.size() <= GUILD_RANKS_MIN_COUNT || rankId < GUILD_RANKS_MIN_COUNT)
@ -846,10 +850,14 @@ void Guild::DelRank(uint32 rankId)
void Guild::SwitchRank(uint32 rankId, bool up)
{
if (rankId >= m_Ranks.size())
{
return;
}
if ((rankId == GR_GUILDMASTER && up) || (rankId == GetLowestRank() && !up))
{
return;
}
uint32 otherRankId = rankId + (up ? -1 : 1);
DEBUG_LOG("rank: %u otherrank %u", rankId, otherRankId);
@ -1048,7 +1056,9 @@ void Guild::Roster(WorldSession* session /*= NULL*/)
session->SendPacket(&data);
}
else
{ BroadcastPacket(&data); }
{
BroadcastPacket(&data);
}
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)");
}
@ -1254,12 +1264,16 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl
void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
{
if (TabId >= GetPurchasedTabs())
{
return;
}
GuildBankTab const* tab = m_TabListMap[TabId];
if (!IsMemberHaveRights(session->GetPlayer()->GetGUIDLow(), TabId, GUILD_BANK_RIGHT_VIEW_TAB))
{
return;
}
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
ByteBuffer buffer;
@ -1395,7 +1409,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
Item* Guild::GetItem(uint8 TabId, uint8 SlotId)
{
if (TabId >= GetPurchasedTabs() || SlotId >= GUILD_BANK_MAX_SLOTS)
{
return NULL;
}
return m_TabListMap[TabId]->Slots[SlotId];
}
@ -1436,7 +1452,9 @@ void Guild::DisplayGuildBankTabsInfo(WorldSession* session)
void Guild::CreateNewBankTab()
{
if (GetPurchasedTabs() >= GUILD_BANK_MAX_TABS)
{
return;
}
uint32 tabId = GetPurchasedTabs(); // next free id
m_TabListMap.push_back(new GuildBankTab);
@ -1450,7 +1468,9 @@ void Guild::CreateNewBankTab()
void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
{
if (m_TabListMap[TabId]->Name == Name && m_TabListMap[TabId]->Icon == Icon)
{
return;
}
m_TabListMap[TabId]->Name = Name;
m_TabListMap[TabId]->Icon = Icon;
@ -1463,7 +1483,9 @@ void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
uint32 Guild::GetBankRights(uint32 rankId, uint8 TabId) const
{
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
{
return 0;
}
return m_Ranks[rankId].TabRight[TabId];
}
@ -1508,7 +1530,9 @@ void Guild::LoadGuildBankFromDB()
// 0 1 2 3 4 5
result = CharacterDatabase.PQuery("SELECT data, text, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", m_Id);
if (!result)
{
return;
}
do
{
@ -1571,7 +1595,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
uint64 MoneyWithDrawRight = GetMemberMoneyWithdrawRem(LowGuid);
if (MoneyWithDrawRight < amount || GetGuildBankMoney() < amount)
{
return false;
}
SetBankMoney(GetGuildBankMoney() - amount);
@ -1579,7 +1605,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return false;
}
itr->second.BankRemMoney -= amount;
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
itr->second.BankRemMoney, m_Id, LowGuid);
@ -1610,13 +1638,17 @@ bool Guild::MemberItemWithdraw(uint8 TabId, uint32 LowGuid)
uint32 SlotsWithDrawRight = GetMemberSlotWithdrawRem(LowGuid, TabId);
if (SlotsWithDrawRight == 0)
{
return false;
}
if (SlotsWithDrawRight < WITHDRAW_SLOT_UNLIMITED)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return false;
}
--itr->second.BankRemSlotsTab[TabId];
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
uint32(TabId), itr->second.BankRemSlotsTab[TabId], m_Id, LowGuid);
@ -1628,10 +1660,14 @@ bool Guild::IsMemberHaveRights(uint32 LowGuid, uint8 TabId, uint32 rights) const
{
MemberList::const_iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return false;
}
if (itr->second.RankId == GR_GUILDMASTER)
{
return true;
}
return (GetBankRights(itr->second.RankId, TabId) & rights) == rights;
}
@ -1640,14 +1676,20 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return 0;
}
MemberSlot& member = itr->second;
if (member.RankId == GR_GUILDMASTER)
{
return WITHDRAW_SLOT_UNLIMITED;
}
if ((GetBankRights(member.RankId, TabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
{
return 0;
}
uint32 curTime = uint32(time(NULL) / MINUTE);
if (curTime - member.BankResetTimeTab[TabId] >= 24 * HOUR / MINUTE)
@ -1664,11 +1706,15 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return 0;
}
MemberSlot& member = itr->second;
if (member.RankId == GR_GUILDMASTER)
{
return WITHDRAW_MONEY_UNLIMITED;
}
uint32 curTime = uint32(time(NULL) / MINUTE); // minutes
// 24 hours
@ -1685,7 +1731,9 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
{
if (rankId >= m_Ranks.size())
{
return;
}
if (rankId == GR_GUILDMASTER)
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
@ -1738,20 +1786,28 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint
uint32 Guild::GetBankMoneyPerDay(uint32 rankId)
{
if (rankId >= m_Ranks.size())
{
return 0;
}
if (rankId == GR_GUILDMASTER)
{
return (uint32)WITHDRAW_MONEY_UNLIMITED;
}
return m_Ranks[rankId].BankMoneyPerDay;
}
uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
{
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
{
return 0;
}
if (rankId == GR_GUILDMASTER)
{
return WITHDRAW_SLOT_UNLIMITED;
}
return m_Ranks[rankId].TabSlotPerDay[TabId];
}
@ -1761,7 +1817,9 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
{
if (!guildBankTabRightsResult)
{
return true;
}
do
{
@ -1850,7 +1908,9 @@ void Guild::LoadGuildBankEventLogFromDB()
// 0 1 2 3 4 5 6
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
if (!result)
{
return;
}
bool isNextMoneyLogGuidSet = false;
do
@ -1886,7 +1946,9 @@ void Guild::LoadGuildBankEventLogFromDB()
void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
{
if (TabId > GUILD_BANK_MAX_TABS)
{
return;
}
ByteBuffer buffer;
bool hasCashFlow = GetLevel() >= 5 && TabId == GUILD_BANK_MAX_TABS; // has Cash Flow perk
@ -2013,7 +2075,9 @@ void Guild::AppendDisplayGuildBankSlot(WorldPacket& data, ByteBuffer& buffer, Gu
Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem)
{
if (!pItem)
{
return NULL;
}
Item* lastItem = pItem;
@ -2040,7 +2104,9 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte
Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool clone)
{
if (!pItem)
{
return NULL;
}
DEBUG_LOG("GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
@ -2054,7 +2120,9 @@ Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool c
pItem->SetCount(count);
if (!pItem)
{
return NULL;
}
m_TabListMap[tab]->Slots[slot] = pItem;
@ -2111,11 +2179,15 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, Guild
{
// check item type
if (pItem2->GetEntry() != pSrcItem->GetEntry())
{
return EQUIP_ERR_ITEM_CANT_STACK;
}
// check free space
if (pItem2->GetCount() >= pSrcItem->GetMaxStackCount())
{
return EQUIP_ERR_ITEM_CANT_STACK;
}
need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
}
@ -2166,10 +2238,12 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
count -= need_space;
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
}
}
else
{
uint32 need_space = pSrcItem->GetMaxStackCount();
@ -2183,10 +2257,12 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
count -= need_space;
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
}
}
return EQUIP_ERR_OK;
}
@ -2195,21 +2271,29 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
DEBUG_LOG("GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
if (count > pItem->GetCount())
{
return EQUIP_ERR_COULDNT_SPLIT_ITEMS;
}
if (pItem->IsSoulBound())
{
return EQUIP_ERR_CANT_DROP_SOULBOUND;
}
// in specific slot
if (slot != NULL_SLOT)
{
InventoryResult res = _CanStoreItem_InSpecificSlot(tab, slot, dest, count, swap, pItem);
if (res != EQUIP_ERR_OK)
{
return res;
}
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
// not specific slot or have space for partly store only in specific slot
@ -2218,19 +2302,27 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
{
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, true, pItem, slot);
if (res != EQUIP_ERR_OK)
{
return res;
}
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
// search free slot in bag for place to
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, false, pItem, slot);
if (res != EQUIP_ERR_OK)
{
return res;
}
if (count == 0)
{
return EQUIP_ERR_OK;
}
return EQUIP_ERR_BANK_FULL;
}
@ -2238,13 +2330,19 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
void Guild::SetGuildBankTabText(uint8 TabId, std::string text)
{
if (TabId >= GetPurchasedTabs())
{
return;
}
if (!m_TabListMap[TabId])
{
return;
}
if (m_TabListMap[TabId]->Text == text)
{
return;
}
utf8truncate(text, 500); // DB and client size limitation
@ -2276,11 +2374,15 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
{
// empty operation
if (BankTab == BankTabDst && BankTabSlot == BankTabSlotDst)
{
return;
}
Item* pItemSrc = GetItem(BankTab, BankTabSlot);
if (!pItemSrc) // may prevent crash
{
return;
}
if (SplitedAmount > pItemSrc->GetCount())
return; // cheating?
@ -2293,13 +2395,17 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
{
// check dest pos rights (if different tabs)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTabDst, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
// check source pos rights (if different tabs)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
}
if (SplitedAmount)
{
@ -2368,13 +2474,17 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
{
// check source pos rights (item swapped to src)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
// check dest pos rights (item swapped to src)
uint32 remRightDst = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTabDst);
if (remRightDst <= 0)
{
return;
}
}
CharacterDatabase.BeginTransaction();
@ -2403,7 +2513,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
if (!pItemBank) // Problem to get bank item
{
return;
}
if (SplitedAmount > pItemBank->GetCount())
return; // cheating?
@ -2458,7 +2570,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
// check source pos rights (item moved to inventory)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
CharacterDatabase.BeginTransaction();
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
@ -2474,7 +2588,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
{
// check source pos rights (item swapped to bank)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
if (pItemChar)
{
@ -2507,7 +2623,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
// check source pos rights (item moved to inventory)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
if (pItemChar)
{
@ -2551,7 +2669,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
if (!pItemChar) // Problem to get item from player
{
return;
}
if (!pItemChar->CanBeTraded())
{
@ -2561,7 +2681,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
// check source pos rights (item moved to bank)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
if (SplitedAmount > pItemChar->GetCount())
return; // cheating?
@ -2659,8 +2781,10 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
// check bank pos rights (item swapped with inventory)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
}
// logging item move to bank
if (pl->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
@ -2714,7 +2838,9 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
data << str2;
}
else if (str1)
{ data << str1; }
{
data << str1;
}
if (guid)
data << ObjectGuid(guid);
@ -2749,7 +2875,9 @@ bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const& vec) const
{
for (GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
if (itr->Slot == this->Slot)
{
return true;
}
return false;
}

View file

@ -424,7 +424,9 @@ class Guild
{
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
if (itr->second.RankId == rankId)
{
return true;
}
return false;
}

View file

@ -80,7 +80,9 @@ void AddItemsSetItem(Player* player, Item* item)
player->ItemSetEff[x] = eff;
}
else
{ player->ItemSetEff.push_back(eff); }
{
player->ItemSetEff.push_back(eff);
}
}
++eff->item_count;
@ -228,7 +230,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
return true;
case ITEM_SUBCLASS_MINING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MINING_SUPP))
{
return false;
}
return true;
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_ENGINEERING_SUPP))
@ -238,19 +242,27 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
return true;
case ITEM_SUBCLASS_GEM_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_GEMS))
{
return false;
}
return true;
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_LEATHERWORKING_SUPP))
{
return false;
}
return true;
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_INSCRIPTION_SUPP))
{
return false;
}
return true;
case ITEM_SUBCLASS_FISHING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_FISHING_SUPP))
{
return false;
}
return true;
default:
return false;
@ -280,7 +292,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
uint32 ItemPrototype::GetArmor() const
{
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
{
return 0;
}
if (Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD)
{
@ -295,7 +309,9 @@ uint32 ItemPrototype::GetArmor() const
ItemArmorTotalEntry const* iat = sItemArmorTotalStore.LookupEntry(ItemLevel);
if (!iaq || !iat)
{
return 0;
}
if (InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS &&
InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS &&
@ -311,7 +327,9 @@ uint32 ItemPrototype::GetArmor() const
al = sArmorLocationStore.LookupEntry(InventoryType);
if (!al)
{
return 0;
}
float iatMult, alMult;
@ -347,7 +365,9 @@ float ItemPrototype::getDPS() const
if (Class == ITEM_CLASS_WEAPON)
{
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
{
return damage;
}
ItemDamageEntry const* id = NULL;
@ -395,7 +415,9 @@ float ItemPrototype::getDPS() const
}
if (!id)
{
return damage;
}
return id->Value[Quality];
}
@ -455,7 +477,9 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
bool Item::IsNotEmptyBag() const
{
if (Bag const* bag = ToBag())
{
return !bag->IsEmpty();
}
return false;
}
@ -820,7 +844,9 @@ uint32 Item::GetSkill()
return 0;
}
else
{ return item_weapon_skills[proto->SubClass]; }
{
return item_weapon_skills[proto->SubClass];
}
case ITEM_CLASS_ARMOR:
if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
@ -828,7 +854,9 @@ uint32 Item::GetSkill()
return 0;
}
else
{ return item_armor_skills[proto->SubClass]; }
{
return item_armor_skills[proto->SubClass];
}
default:
return 0;
@ -846,7 +874,9 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
// item must have one from this field values not null if it can have random enchantments
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
{
return 0;
}
// Random Property case
if (itemProto->RandomProperty)
@ -920,7 +950,9 @@ bool Item::UpdateItemSuffixFactor()
{
uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
if (GetItemSuffixFactor() == suffixFactor)
{
return false;
}
SetUInt32Value(ITEM_FIELD_PROPERTY_SEED, suffixFactor);
return true;
}
@ -1086,7 +1118,9 @@ bool Item::IsBoundByEnchant() const
}
if (enchant_slot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
{
return true;
}
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
continue;
@ -1118,7 +1152,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
{
// EffectItemType[0] is the associated scroll itemID, if a scroll can be made
if (spellEffect_0->EffectItemType == 0)
{
return false;
}
// Other checks do not apply to vellum enchants, so return final result
int32 eqItemClass = spellInfo->GetEquippedItemClass();
return proto->SubClass == ITEM_SUBCLASS_VELLUM && (eqItemClass == ITEM_CLASS_WEAPON || eqItemClass == ITEM_CLASS_ARMOR);
@ -1127,7 +1163,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
SpellEquippedItemsEntry const* equippedItems = spellInfo->GetSpellEquippedItems();
if (!equippedItems)
{
return true;
}
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
{
@ -1339,7 +1377,9 @@ void Item::SendTimeUpdate(Player* owner)
{
#ifdef ENABLE_PLAYERBOTS
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
{
return;
}
#endif
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
@ -1380,7 +1420,9 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 r
return pItem;
}
else
{ delete pItem; }
{
delete pItem;
}
}
return NULL;
}
@ -1422,7 +1464,9 @@ bool Item::IsBindedNotWith(Player const* player) const
// not BOA item case
if (!IsBoundAccountWide())
{
return true;
}
// online
if (Player* owner = GetOwner())
@ -1514,7 +1558,9 @@ bool Item::HasMaxCharges() const
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
{
return false;
}
return true;
}
@ -1563,7 +1609,9 @@ void Item::SetLootState(ItemLootUpdateState state)
}
// temporary must stay until remove (ignore any changes)
else if (m_lootState != ITEM_LOOT_TEMPORARY)
{ m_lootState = ITEM_LOOT_UNCHANGED; }
{
m_lootState = ITEM_LOOT_UNCHANGED;
}
break;
case ITEM_LOOT_REMOVED:
// if loot not saved then it existence in past can be just ignored
@ -1628,17 +1676,23 @@ int32 Item::GetReforgableStat(ItemModType statType) const
ItemPrototype const* proto = GetProto();
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
if (proto->ItemStat[i].ItemStatType == statType)
{
return proto->ItemStat[i].ItemStatValue;
}
int32 randomPropId = GetItemRandomPropertyId();
if (!randomPropId)
{
return 0;
}
if (randomPropId < 0)
{
ItemRandomSuffixEntry const* randomSuffix = sItemRandomSuffixStore.LookupEntry(-randomPropId);
if (!randomSuffix)
{
return 0;
}
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
{
@ -1651,6 +1705,7 @@ int32 Item::GetReforgableStat(ItemModType statType) const
for (int k = 0; k < 5; ++k)
{
if (randomSuffix->enchant_id[k] == enchant->ID)
{
return int32((randomSuffix->prefix[k] * GetItemSuffixFactor()) / 10000);
}
}
@ -1658,11 +1713,14 @@ int32 Item::GetReforgableStat(ItemModType statType) const
}
}
}
}
else
{
ItemRandomPropertiesEntry const* randomProp = sItemRandomPropertiesStore.LookupEntry(randomPropId);
if (!randomProp)
{
return 0;
}
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
{
@ -1675,12 +1733,14 @@ int32 Item::GetReforgableStat(ItemModType statType) const
for (int k = 0; k < 3; ++k)
{
if (randomProp->enchant_id[k] == enchant->ID)
{
return int32(enchant->amount[k]);
}
}
}
}
}
}
}
return 0;

View file

@ -168,13 +168,19 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id);
if (!itemProto)
{
return 0;
}
if (!itemProto->RandomSuffix)
{
return 0;
}
RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
if (!randomProperty)
{
return 0;
}
uint32 suffixFactor;
switch (itemProto->InventoryType)

View file

@ -274,11 +274,15 @@ bool LootStoreItem::Roll(bool rate) const
}
if (type == LOOTITEM_TYPE_CURRENCY)
{
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_CURRENCY) : 1.0f));
}
else
{
if (needs_quest)
{
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_QUEST) : 1.0f));
}
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
@ -436,7 +440,9 @@ bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTar
{
// DB conditions check
if (conditionId && !sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), lootTarget, CONDITION_FROM_LOOT))
{
return false;
}
if (type == LOOT_ITEM_TYPE_ITEM)
{
@ -592,7 +598,9 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
}
// ... for personal loot
else
{ FillNotNormalLootFor(loot_owner); }
{
FillNotNormalLootFor(loot_owner);
}
return true;
}
@ -753,7 +761,9 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
pl->SendNotifyLootItemRemoved(lootIndex);
}
else
{ m_playersLooting.erase(i); }
{
m_playersLooting.erase(i);
}
}
}
@ -770,7 +780,9 @@ void Loot::NotifyMoneyRemoved()
pl->SendNotifyLootMoneyRemoved();
}
else
{ m_playersLooting.erase(i); }
{
m_playersLooting.erase(i);
}
}
}
@ -808,7 +820,9 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
}
}
else
{ m_playersLooting.erase(i); }
{
m_playersLooting.erase(i);
}
}
}
@ -821,9 +835,13 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
gold = uint32(maxAmount * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
}
else if ((maxAmount - minAmount) < 32700)
{ gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); }
{
gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
}
else
{ gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8; }
{
gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8;
}
}
}
@ -1071,7 +1089,9 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
ExplicitlyChanced.push_back(item);
}
else
{ EqualChanced.push_back(item); }
{
EqualChanced.push_back(item);
}
}
// Rolls an item from the group, returns NULL if all miss their chances
@ -1197,7 +1217,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
}
else if (ref_set)
{ ref_set->erase(-ieItr->mincountOrRef); }
{
ref_set->erase(-ieItr->mincountOrRef);
}
}
}
@ -1210,7 +1232,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
}
else if (ref_set)
{ ref_set->erase(-ieItr->mincountOrRef); }
{
ref_set->erase(-ieItr->mincountOrRef);
}
}
}
}
@ -1229,7 +1253,9 @@ void LootTemplate::AddEntry(LootStoreItem& item)
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
}
else // Non-grouped entries and references are stored together
{ Entries.push_back(item); }
{
Entries.push_back(item);
}
}
// Rolls for every item in the template and adds the rolled items the the loot
@ -1369,7 +1395,9 @@ void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
}
else if (ref_set)
{ ref_set->erase(-ieItr->mincountOrRef); }
{
ref_set->erase(-ieItr->mincountOrRef);
}
}
}
@ -1394,7 +1422,9 @@ void LoadLootTemplates_Creature()
LootTemplates_Creature.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}
@ -1426,7 +1456,9 @@ void LoadLootTemplates_Disenchant()
LootTemplates_Disenchant.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}
@ -1473,7 +1505,9 @@ void LoadLootTemplates_Gameobject()
LootTemplates_Gameobject.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
@ -1504,7 +1538,9 @@ void LoadLootTemplates_Item()
}
// wdb have wrong data cases, so skip by default
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
{ LootTemplates_Item.ReportNotExistedId(proto->ItemId); }
{
LootTemplates_Item.ReportNotExistedId(proto->ItemId);
}
}
}
@ -1554,7 +1590,9 @@ void LoadLootTemplates_Pickpocketing()
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}
@ -1624,7 +1662,9 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}

View file

@ -1574,7 +1574,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
z = max_z;
}
else if (z < ground_z)
{ z = ground_z; }
{
z = ground_z;
}
}
}
else
@ -1601,7 +1603,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
z = max_z;
}
else if (z < ground_z)
{ z = ground_z; }
{
z = ground_z;
}
}
}
else
@ -1681,7 +1685,9 @@ namespace MaNGOS
text = i_textData->Content[loc_idx + 1].c_str();
}
else
{ text = i_textData->Content[0].c_str(); }
{
text = i_textData->Content[0].c_str();
}
ChatHandler::BuildChatPacket(data, i_msgtype, text, i_language, CHAT_TAG_NONE, i_object.GetObjectGuid(), i_object.GetNameForLocaleIdx(loc_idx),
i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
@ -1906,7 +1912,9 @@ GameObject* WorldObject::SummonGameObject(uint32 id, float x, float y, float z,
Map *map = GetMap();
if (!map)
{
return NULL;
}
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), id, map, GetPhaseMask(), x, y, z, angle))
{
@ -2001,7 +2009,9 @@ namespace MaNGOS
angle -= 2.0f * M_PI_F;
}
else if (angle < -M_PI_F)
{ angle += 2.0f * M_PI_F; }
{
angle += 2.0f * M_PI_F;
}
i_selector.AddUsedArea(u, angle, dist2d);
}
@ -2035,7 +2045,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
return;
}
@ -2063,7 +2075,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
{
@ -2087,7 +2101,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
{
@ -2105,7 +2121,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
return;
}
@ -2121,7 +2139,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
{
@ -2136,7 +2156,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
}
void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
@ -2158,7 +2180,9 @@ void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NU
target->SendDirectMessage(&data);
}
else
{ SendMessageToSet(&data, true); }
{
SendMessageToSet(&data, true);
}
}
void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL*/) const
@ -2171,7 +2195,9 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL
target->SendDirectMessage(&data);
}
else
{ SendMessageToSet(&data, true); }
{
SendMessageToSet(&data, true);
}
}
void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) const
@ -2183,7 +2209,9 @@ void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) co
target->SendDirectMessage(&data);
}
else
{ SendMessageToSet(&data, true); }
{
SendMessageToSet(&data, true);
}
}
void WorldObject::UpdateVisibilityAndView()
@ -2288,7 +2316,9 @@ void WorldObject::SetActiveObjectState(bool active)
GetMap()->RemoveFromActive(this);
}
else if (!IsActiveObject() && active)
{ GetMap()->AddToActive(this); }
{
GetMap()->AddToActive(this);
}
}
m_isActiveObject = active;
}

View file

@ -292,7 +292,9 @@ class Object
RemoveFlag(index, flag);
}
else
{ SetFlag(index, flag); }
{
SetFlag(index, flag);
}
}
/**
@ -316,7 +318,9 @@ class Object
SetFlag(index, flag);
}
else
{ RemoveFlag(index, flag); }
{
RemoveFlag(index, flag);
}
}
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
@ -329,7 +333,9 @@ class Object
RemoveByteFlag(index, offset, flag);
}
else
{ SetByteFlag(index, offset, flag); }
{
SetByteFlag(index, offset, flag);
}
}
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
@ -346,7 +352,9 @@ class Object
SetByteFlag(index, offset, flag);
}
else
{ RemoveByteFlag(index, offset, flag); }
{
RemoveByteFlag(index, offset, flag);
}
}
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
@ -359,7 +367,9 @@ class Object
RemoveShortFlag(index, highpart, flag);
}
else
{ SetShortFlag(index, highpart, flag); }
{
SetShortFlag(index, highpart, flag);
}
}
bool HasShortFlag(uint16 index, bool highpart, uint8 flag) const
@ -375,7 +385,9 @@ class Object
SetShortFlag(index, highpart, flag);
}
else
{ RemoveShortFlag(index, highpart, flag); }
{
RemoveShortFlag(index, highpart, flag);
}
}
void SetFlag64(uint16 index, uint64 newFlag)
@ -399,7 +411,9 @@ class Object
RemoveFlag64(index, flag);
}
else
{ SetFlag64(index, flag); }
{
SetFlag64(index, flag);
}
}
bool HasFlag64(uint16 index, uint64 flag) const
@ -415,7 +429,9 @@ class Object
SetFlag64(index, flag);
}
else
{ RemoveFlag64(index, flag); }
{
RemoveFlag64(index, flag);
}
}
void ClearUpdateMask(bool remove);

View file

@ -130,21 +130,27 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const* clickedCreature) const
{
if (conditionId)
{
return sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), clickedCreature, CONDITION_FROM_SPELLCLICK);
}
if (questStart)
{
// not in expected required quest state
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
{
return false;
}
}
if (questEnd)
{
// not in expected forbidden quest state
if (!player || player->GetQuestRewardStatus(questEnd))
{
return false;
}
}
return true;
}
@ -220,7 +226,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
{
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
if (itr != mArenaTeamMap.end())
{
return itr->second;
}
return NULL;
}
@ -229,7 +237,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
{
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
if (itr->second->GetName() == arenateamname)
{
return itr->second;
}
return NULL;
}
@ -238,7 +248,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
{
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
if (itr->second->GetCaptainGuid() == guid)
{
return itr->second;
}
return NULL;
}
@ -641,7 +653,9 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->ModelId[i] = 0;
}
else if (!displayScaleEntry)
{ displayScaleEntry = displayEntry; }
{
displayScaleEntry = displayEntry;
}
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->ModelId[i]);
if (!minfo)
@ -791,7 +805,9 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->Scale = displayScaleEntry->Scale;
}
else
{ const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE; }
{
const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE;
}
}
}
}
@ -1021,12 +1037,16 @@ void ObjectMgr::LoadCreatureClassLvlStats()
CreatureClassLvlStats const* ObjectMgr::GetCreatureClassLvlStats(uint32 level, uint32 unitClass, int32 expansion) const
{
if (expansion < 0)
{
return NULL;
}
CreatureClassLvlStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]][expansion];
if (cCLS->BaseHealth != 0 && cCLS->BaseDamage > 0.1f)
{
return cCLS;
}
return NULL;
}
@ -1084,7 +1104,9 @@ void ObjectMgr::LoadEquipmentTemplates()
uint32 ObjectMgr::GetCreatureModelAlternativeModel(uint32 modelId) const
{
if (const CreatureModelInfo* modelInfo = GetCreatureModelInfo(modelId))
{
return modelInfo->modelid_alternative;
}
return 0;
}
@ -1107,10 +1129,14 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_
return minfo; // not fatal, just use the previous one
}
else
{ return minfo_tmp; }
{
return minfo_tmp;
}
}
else
{ return minfo; }
{
return minfo;
}
}
uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
@ -1230,7 +1256,9 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
else
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); }
{
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f);
}
if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m))
{
@ -1257,7 +1285,9 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
else
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); }
{
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m);
}
}
sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount());
@ -3565,7 +3595,9 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, Pla
*info = pInfo->levelInfo[level - 1];
}
else
{ BuildPlayerLevelInfo(race, class_, level, info); }
{
BuildPlayerLevelInfo(race, class_, level, info);
}
}
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
@ -3816,7 +3848,9 @@ void ObjectMgr::LoadGroups()
mGroupMap.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
// -- loading instances --
@ -4368,7 +4402,9 @@ void ObjectMgr::LoadQuests()
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
}
else
{ choice_found = true; }
{
choice_found = true;
}
if (!qinfo->RewChoiceItemCount[j])
{
@ -4507,7 +4543,9 @@ void ObjectMgr::LoadQuests()
qinfo->RewMailDelaySecs = 0; // no mail will send to player
}
else
{ usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); }
{
usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId();
}
}
if (qinfo->NextQuestInChain)
@ -4520,7 +4558,9 @@ void ObjectMgr::LoadQuests()
qinfo->NextQuestInChain = 0;
}
else
{ qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); }
{
qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
}
}
// fill additional data stores
@ -6906,7 +6946,9 @@ void ObjectMgr::LoadPetNames()
PetHalfName1[entry].push_back(word);
}
else
{ PetHalfName0[entry].push_back(word); }
{
PetHalfName0[entry].push_back(word);
}
++count;
}
while (result->NextRow());
@ -7702,7 +7744,9 @@ void ObjectMgr::GetConditions(uint32 conditionId, std::vector<PlayerCondition co
{
const PlayerCondition* condition = sConditionStorage.LookupEntry<PlayerCondition>(conditionId);
if (!condition)
{
return;
}
if (condition->m_condition == CONDITION_OR || condition->m_condition == CONDITION_AND)
{
@ -7869,7 +7913,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7885,7 +7931,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7901,7 +7949,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7917,7 +7967,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -8287,11 +8339,17 @@ inline void _DoStringError(int32 entry, char const* text, ...)
sLog.outErrorScriptLib("%s", buf);
}
else if (entry <= MIN_CREATURE_AI_TEXT_STRING_ID) // eventAI error
{ sLog.outErrorEventAI("%s", buf); }
{
sLog.outErrorEventAI("%s", buf);
}
else if (entry < MIN_DB_SCRIPT_STRING_ID) // mangos string error
{ sLog.outError("%s", buf); }
{
sLog.outError("%s", buf);
}
else // if (entry > MIN_DB_SCRIPT_STRING_ID) // DB script text error
{ sLog.outErrorDb("DB-SCRIPTS: %s", buf); }
{
sLog.outErrorDb("DB-SCRIPTS: %s", buf);
}
}
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content)
@ -8329,7 +8387,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
mMangosStringLocaleMap.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
@ -8349,7 +8409,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Can not continue.", table);
}
else
{ sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); }
{
sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
}
return false;
}
@ -8450,7 +8512,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table);
}
else
{ sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table); }
{
sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table);
}
sLog.outString();
m_loadedStringCount[min_value] = count;
@ -8469,7 +8533,9 @@ const char* ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
return msl->Content[locale_idx + 1].c_str();
}
else
{ return msl->Content[0].c_str(); }
{
return msl->Content[0].c_str();
}
}
_DoStringError(entry, "Entry %i not found but requested", entry);
@ -8537,11 +8603,15 @@ bool ObjectMgr::CheckDeclinedNames(const std::wstring& mainpart, DeclinedName co
{
std::wstring wname;
if (!Utf8toWStr(names.name[i], wname))
{
return false;
}
if (mainpart != GetMainPartOfName(wname, i + 1))
{
return false;
}
}
return true;
}
@ -8609,7 +8679,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return true;
}
else
{ return uint32(player->GetTeam()) == m_value1; }
{
return uint32(player->GetTeam()) == m_value1;
}
}
case CONDITION_SKILL:
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) >= m_value2;
@ -8799,7 +8871,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return !player->HasSkill(m_value1);
}
else
{ return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; }
{
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2;
}
}
case CONDITION_REPUTATION_RANK_MAX:
{
@ -8892,7 +8966,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return true;
}
else
{ return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2)); }
{
return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2));
}
case 2: // All players in instance dead or out of range
for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr)
{
@ -9456,9 +9532,13 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
return SKILL_RANGE_RANK;
}
else if (racial)
{ return SKILL_RANGE_NONE; }
{
return SKILL_RANGE_NONE;
}
else
{ return SKILL_RANGE_MONO; }
{
return SKILL_RANGE_MONO;
}
default:
case SKILL_CATEGORY_ATTRIBUTES: // not found in dbc
case SKILL_CATEGORY_GENERIC: // only GENERIC(DND)
@ -9546,7 +9626,9 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
return &itr->second;
}
else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
{ alt = &itr->second; }
{
alt = &itr->second;
}
return alt;
}
@ -10208,7 +10290,9 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id);
}
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
{ menu_ids.erase(gMenuItem.action_menu_id); }
{
menu_ids.erase(gMenuItem.action_menu_id);
}
}
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
@ -10306,7 +10390,9 @@ void ObjectMgr::LoadGossipMenus()
{
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
if (!scm)
{
return;
}
// Check which script-ids in db_scripts type DBS_ON_GOSSIP are not used
std::set<uint32> gossipScriptSet;
@ -10894,7 +10980,9 @@ bool FindCreatureData::operator()(CreatureDataPair const& dataPair)
// skip not spawned (in any state),
uint16 pool_id = sPoolMgr.IsPartOfAPool<Creature>(dataPair.first);
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<Creature>(dataPair.first))
{
return false;
}
if (!i_spawnedData || new_dist < i_spawnedDist)
{
@ -10930,7 +11018,9 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
}
}
else
{ source->PlayDirectSound(data->SoundId); }
{
source->PlayDirectSound(data->SoundId);
}
}
if (data->Emote)
@ -10959,10 +11049,14 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
CreatureDataPair const* FindCreatureData::GetResult() const
{
if (i_spawnedData)
{
return i_spawnedData;
}
if (i_mapData)
{
return i_mapData;
}
return i_anyData;
}
@ -10971,18 +11065,24 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
{
// skip wrong entry ids
if (i_id && dataPair.second.id != i_id)
{
return false;
}
if (!i_anyData)
i_anyData = &dataPair;
// without player we can't find more stricted cases, so use fouded
if (!i_player)
{
return true;
}
// skip diff. map cases
if (dataPair.second.mapid != i_player->GetMapId())
{
return false;
}
float new_dist = i_player->GetDistance2d(dataPair.second.posX, dataPair.second.posY);
@ -10995,7 +11095,9 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
// skip not spawned (in any state)
uint16 pool_id = sPoolMgr.IsPartOfAPool<GameObject>(dataPair.first);
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<GameObject>(dataPair.first))
{
return false;
}
if (!i_spawnedData || new_dist < i_spawnedDist)
{
@ -11009,10 +11111,14 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
GameObjectDataPair const* FindGOData::GetResult() const
{
if (i_mapData)
{
return i_mapData;
}
if (i_spawnedData)
{
return i_spawnedData;
}
return i_anyData;
}

View file

@ -740,7 +740,9 @@ class ObjectMgr
{
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
if (itr != mQuestPOIMap.end())
{
return &itr->second;
}
return NULL;
}
@ -748,7 +750,9 @@ class ObjectMgr
{
DungeonFinderRequirementsMap::const_iterator itr = mDungeonFinderRequirementsMap.find(MAKE_PAIR32(mapId, difficulty));
if (itr != mDungeonFinderRequirementsMap.end())
{
return &itr->second;
}
return NULL;
}
@ -960,11 +964,15 @@ class ObjectMgr
{
MailLevelRewardMap::const_iterator map_itr = m_mailLevelRewardMap.find(level);
if (map_itr == m_mailLevelRewardMap.end())
{
return NULL;
}
for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
if (set_itr->raceMask & raceMask)
{
return &*set_itr;
}
return NULL;
}
@ -1277,7 +1285,9 @@ class ObjectMgr
{
ItemConvertMap::const_iterator iter = m_ItemConvert.find(itemEntry);
if (iter == m_ItemConvert.end())
{
return 0;
}
ItemPrototype const* proto = GetItemPrototype(iter->second);
return (proto && proto->AllowableRace & raceMask) ? iter->second : 0;

View file

@ -80,7 +80,9 @@ void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float d
m_UsedAreaLists[USED_POS_PLUS].insert(UsedArea(angle, OccupiedArea(sr_angle, obj)));
}
else
{ m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj))); }
{
m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj)));
}
}
/**
@ -135,7 +137,9 @@ void ObjectPosSelector::InitializeAngle(UsedAreaSide side)
m_stepAngle[side] = std::max(m_searchedForReqHAngle + otherArea.second.angleOffset - otherArea.first, 0.0f);
}
else // Other side empty. start from 0
{ m_stepAngle[side] = 0.0f; }
{
m_stepAngle[side] = 0.0f;
}
// As m_stepAngle will be incremented first in ::NextSideAngle
m_stepAngle[side] -= m_searchedForReqHAngle;
@ -171,7 +175,9 @@ bool ObjectPosSelector::NextAngle(float& angle)
}
// both sides finishes
else
{ break; }
{
break;
}
}
// no angles

View file

@ -116,7 +116,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
if (!result)
{
return false;
}
Field* fields = result->Fetch();
@ -601,7 +603,9 @@ void Pet::RegenerateAll(uint32 update_diff)
m_regenTimer = 4000;
}
else
{ m_regenTimer -= update_diff; }
{
m_regenTimer -= update_diff;
}
}
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
@ -842,7 +846,9 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
}
else
{ SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex())); }
{
SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex()));
}
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
@ -1195,10 +1201,14 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
}
// -10..-6
else if (getLevel() <= itemlevel + 10) // pure guess, but sounds good
{ return 17000; }
{
return 17000;
}
// -14..-11
else if (getLevel() <= itemlevel + 14) // level 55 food gets green on 70, makes sense to me
{ return 8000; }
{
return 8000;
}
// -15 or less
else
{ return 0; } // food too low level
@ -1407,7 +1417,9 @@ void Pet::_LoadAuras(uint32 timediff)
remaincharges = procCharges;
}
else
{ remaincharges = 0; }
{
remaincharges = 0;
}
uint32 defstackamount = spellproto->GetStackAmount();
if (!defstackamount)
@ -1417,7 +1429,9 @@ void Pet::_LoadAuras(uint32 timediff)
else if (defstackamount < stackcount)
stackcount = defstackamount;
else if (!stackcount)
{ stackcount = 1; }
{
stackcount = 1;
}
SpellAuraHolder* holder = CreateSpellAuraHolder(spellproto, this, NULL);
holder->SetLoadedState(casterGuid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime);
@ -1444,7 +1458,9 @@ void Pet::_LoadAuras(uint32 timediff)
AddSpellAuraHolder(holder);
}
else
{ delete holder; }
{
delete holder;
}
}
while (result->NextRow());
@ -1557,7 +1573,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id);
}
else
{ sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id); }
{
sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id);
}
return false;
}
@ -1580,12 +1598,16 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
ToggleAutocast(spell_id, true);
}
else if (active == ACT_DISABLED)
{ ToggleAutocast(spell_id, false); }
{
ToggleAutocast(spell_id, false);
}
return false;
}
else
{ return false; }
{
return false;
}
}
uint32 oldspell_id = 0;
@ -1601,10 +1623,14 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
newspell.active = ACT_PASSIVE;
}
else
{ newspell.active = ACT_DISABLED; }
{
newspell.active = ACT_DISABLED;
}
}
else
{ newspell.active = active; }
{
newspell.active = active;
}
// talent: unlearn all other talent ranks (high and low)
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
@ -1647,7 +1673,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
}
// ignore new lesser rank
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id))
{ return false; }
{
return false;
}
}
}
}
@ -1659,7 +1687,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
CastSpell(this, spell_id, true);
}
else
{ m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); }
{
m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active));
}
if (newspell.active == ACT_ENABLED)
{
@ -1776,7 +1806,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
m_spells.erase(itr);
}
else
{ itr->second.state = PETSPELL_REMOVED; }
{
itr->second.state = PETSPELL_REMOVED;
}
RemoveAurasDueToSpell(spell_id);
@ -1798,7 +1830,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
learnSpell(prev_id);
}
else
{ learn_prev = false; }
{
learn_prev = false;
}
}
// if remove last rank or non-ranked then update action bar at server and client if need
@ -1843,7 +1877,9 @@ bool Pet::resetTalents(bool no_cost)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
{
return false;
}
// not need after this call
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
@ -1851,11 +1887,15 @@ bool Pet::resetTalents(bool no_cost)
CreatureInfo const* ci = GetCreatureInfo();
if (!ci)
{
return false;
}
// Check pet talent type
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->Family);
if (!pet_family || pet_family->petTalentType < 0)
{
return false;
}
Player* player = (Player*)owner;
@ -1930,7 +1970,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
// no offline pets
if (!resultPets)
{
return;
}
QueryResult* result = CharacterDatabase.PQuery(
"SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet "
@ -1988,7 +2030,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
delete result;
if (!need_execute)
{
return;
}
ss << ")";
@ -2024,7 +2068,9 @@ void Pet::InitTalentForLevel()
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
{
return;
}
if (!m_loading)
((Player*)owner)->SendTalentsInfoData(true);
@ -2041,13 +2087,19 @@ uint32 Pet::resetTalentsCost() const
}
// then 50 silver
else if (m_resetTalentsCost < 50 * SILVER)
{ return 50 * SILVER; }
{
return 50 * SILVER;
}
// then 1 gold
else if (m_resetTalentsCost < 1 * GOLD)
{ return 1 * GOLD; }
{
return 1 * GOLD;
}
// then increasing at a rate of 1 gold; cap 10 gold
else
{ return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD); }
{
return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD);
}
}
uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
@ -2174,7 +2226,9 @@ void Pet::LearnPetPassives()
void Pet::CastPetAuras(bool current)
{
if (!isControlled())
{
return;
}
Unit* owner = GetOwner();
@ -2188,14 +2242,18 @@ void Pet::CastPetAuras(bool current)
owner->RemovePetAura(pa);
}
else
{ CastPetAura(pa); }
{
CastPetAura(pa);
}
}
}
void Pet::CastOwnerTalentAuras()
{
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
{
return;
}
Player* pOwner = static_cast<Player *>(GetOwner());
@ -2244,7 +2302,9 @@ void Pet::CastPetAura(PetAura const* aura)
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
}
else
{ CastSpell(this, auraId, true); }
{
CastSpell(this, auraId, true);
}
}
struct DoPetLearnSpell
@ -2335,7 +2395,9 @@ void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
{
return;
}
WorldPacket data(SMSG_PET_MODE, 12);
data << GetObjectGuid();

View file

@ -54,7 +54,9 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
{
if (Unit* victim = m_creature->getVictim())
if (victim->IsAlive())
{
return;
}
if (CharmInfo* charmInfo = m_creature->GetCharmInfo())
{
@ -154,7 +156,9 @@ void PetAI::UpdateAI(const uint32 diff)
// UpdateAllies self set update timer
{ UpdateAllies(); }
else
{ m_updateAlliesTimer -= diff; }
{
m_updateAlliesTimer -= diff;
}
if (inCombat && !victim)
{
@ -214,8 +218,10 @@ void PetAI::UpdateAI(const uint32 diff)
((Pet*)m_creature)->SetSpellOpener();
}
else
{
return;
}
}
// Autocast (casted only in combat or persistent spells in any state)
else if (!m_creature->IsNonMeleeSpellCasted(false))
{
@ -357,7 +363,9 @@ void PetAI::UpdateAI(const uint32 diff)
// Stop here if casting spell (No melee and no movement)
if (m_creature->IsNonMeleeSpellCasted(false))
{
return;
}
if (victim)
{
@ -465,7 +473,9 @@ void PetAI::UpdateAllies()
return;
}
else if (owner->GetTypeId() == TYPEID_PLAYER)
{ pGroup = ((Player*)owner)->GetGroup(); }
{
pGroup = ((Player*)owner)->GetGroup();
}
// only pet and owner/not in group->ok
if (m_AllySet.size() == 2 && !pGroup)
@ -499,7 +509,9 @@ void PetAI::UpdateAllies()
}
}
else // remove group
{ m_AllySet.insert(owner->GetObjectGuid()); }
{
m_AllySet.insert(owner->GetObjectGuid());
}
}
void PetAI::AttackedBy(Unit* attacker)

File diff suppressed because it is too large Load diff

View file

@ -246,7 +246,9 @@ struct Glyph
void SetId(uint32 newId)
{
if (newId == id)
{
return;
}
if (id == 0 && uState == GLYPH_UNCHANGED) // not exist yet in db and already saved
{
@ -925,7 +927,9 @@ class PlayerTaxi
return true;
}
else
{ return false; }
{
return false;
}
}
void AppendTaximaskTo(ByteBuffer& data, bool all);
@ -1197,7 +1201,9 @@ class Player : public Unit
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY;
}
else if (state > 0)
{ m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL; }
{
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL;
}
}
@ -2307,7 +2313,9 @@ class Player : public Unit
{
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
{
return m_bgBattleGroundQueueID[i].bgQueueTypeId;
}
return BATTLEGROUND_QUEUE_NONE;
}
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const

View file

@ -35,7 +35,9 @@ int
ReactorAI::Permissible(const Creature* creature)
{
if (creature->IsCivilian() || creature->IsNeutralToAll())
{
return PERMIT_BASE_REACTIVE;
}
return PERMIT_BASE_NO;
}
@ -49,7 +51,9 @@ void
ReactorAI::AttackStart(Unit* p)
{
if (!p || !m_creature->CanAttackByItself())
{
return;
}
if (m_creature->Attack(p, true))
{
@ -75,7 +79,9 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{
// update i_victimGuid if i_creature.getVictim() !=0 and changed
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
return;
}
i_victimGuid = m_creature->getVictim()->GetObjectGuid();

View file

@ -40,8 +40,10 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing)
{
limit -= PointsInRank[i];
if (standing >= limit)
{
return ReputationRank(i);
}
}
return MIN_REPUTATION_RANK;
}
@ -61,7 +63,9 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
{
if (!factionEntry)
{
return 0;
}
uint32 raceMask = m_player->getRaceMask();
uint32 classMask = m_player->getClassMask();
@ -75,10 +79,14 @@ int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
{
// Faction without recorded reputation. Just ignore.
if (!factionEntry)
{
return 0;
}
if (FactionState const* state = GetState(factionEntry))
{
return GetBaseReputation(factionEntry) + state->Standing;
}
return 0;
}
@ -106,7 +114,9 @@ void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, b
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
{
if (!factionEntry)
{
return 0;
}
uint32 raceMask = m_player->getRaceMask();
uint32 classMask = m_player->getClassMask();
@ -201,7 +211,9 @@ void ReputationMgr::SendInitialReputations()
void ReputationMgr::SendVisible(FactionState const* faction) const
{
if (m_player->GetSession()->PlayerLoading())
{
return;
}
// make faction visible in reputation list at client
WorldPacket data(SMSG_SET_FACTION_VISIBLE, 4);
@ -361,15 +373,19 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
if (new_rank > old_rank)
{
return true;
}
}
return false;
}
void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
{
if (!factionTemplateEntry->faction)
{
return;
}
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
SetVisible(factionEntry);
@ -378,11 +394,15 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
{
if (factionEntry->reputationListID < 0)
{
return;
}
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
if (itr == m_factions.end())
{
return;
}
SetVisible(&itr->second);
}
@ -391,11 +411,15 @@ void ReputationMgr::SetVisible(FactionState* faction)
{
// always invisible or hidden faction can't be make visible
if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
{
return;
}
// already set
if (faction->Flags & FACTION_FLAG_VISIBLE)
{
return;
}
faction->Flags |= FACTION_FLAG_VISIBLE;
faction->needSend = true;
@ -410,11 +434,15 @@ void ReputationMgr::SetAtWar(RepListID repListID, bool on)
{
FactionStateList::iterator itr = m_factions.find(repListID);
if (itr == m_factions.end())
{
return;
}
// always invisible or hidden faction can't change war state
if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
{
return;
}
SetAtWar(&itr->second, on);
}
@ -423,11 +451,15 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
{
// not allow declare war to faction unless already hated or less
if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) && ReputationToRank(faction->Standing) > REP_HATED)
{
return;
}
// already set
if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
{
return;
}
if (atWar)
faction->Flags |= FACTION_FLAG_AT_WAR;
@ -442,7 +474,9 @@ void ReputationMgr::SetInactive(RepListID repListID, bool on)
{
FactionStateList::iterator itr = m_factions.find(repListID);
if (itr == m_factions.end())
{
return;
}
SetInactive(&itr->second, on);
}
@ -451,11 +485,15 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
{
// always invisible or hidden faction can't be inactive
if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE)))
{
return;
}
// already set
if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
{
return;
}
if (inactive)
faction->Flags |= FACTION_FLAG_INACTIVE;

View file

@ -60,13 +60,17 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
if (ignore)
{
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
{
return false;
}
}
else
{
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
{
return false;
}
}
uint32 flag = SOCIAL_FLAG_FRIEND;
if (ignore)
@ -92,7 +96,9 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
{
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
if (itr == m_playerSocialMap.end()) // not exist
{
return;
}
uint32 flag = SOCIAL_FLAG_FRIEND;
if (ignore)
@ -114,7 +120,9 @@ void PlayerSocial::SetFriendNote(ObjectGuid friend_guid, std::string note)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
if (itr == m_playerSocialMap.end()) // not exist
{
return;
}
utf8truncate(note, 48); // DB and client size limitation
@ -128,7 +136,9 @@ void PlayerSocial::SendSocialList()
{
Player* plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, m_playerLowGuid));
if (!plr)
{
return;
}
uint32 size = m_playerSocialMap.size();
@ -164,7 +174,9 @@ bool PlayerSocial::HasFriend(ObjectGuid friend_guid)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
if (itr != m_playerSocialMap.end())
{
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
}
return false;
}
@ -172,7 +184,9 @@ bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid.GetCounter());
if (itr != m_playerSocialMap.end())
{
return itr->second.Flags & SOCIAL_FLAG_IGNORED;
}
return false;
}
@ -187,7 +201,9 @@ SocialMgr::~SocialMgr()
void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo& friendInfo)
{
if (!player)
{
return;
}
Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friend_lowguid));
@ -273,7 +289,9 @@ void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGui
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
{
if (!player)
{
return;
}
Team team = player->GetTeam();
AccountTypes security = player->GetSession()->GetSecurity();
@ -307,7 +325,9 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
social->SetPlayerGuid(guid);
if (!result)
{
return social;
}
uint32 friend_guid = 0;
uint32 flags = 0;

File diff suppressed because it is too large Load diff

View file

@ -89,19 +89,25 @@ float CalculateDefaultCoefficient(SpellEntry const* spellProto, DamageEffectType
inline float GetSpellMinRange(SpellRangeEntry const* range, bool friendly = false)
{
if (!range)
{
return 0;
}
return (friendly ? range->minRangeFriendly : range->minRange);
}
inline float GetSpellMaxRange(SpellRangeEntry const* range, bool friendly = false)
{
if (!range)
{
return 0;
}
return (friendly ? range->maxRangeFriendly : range->maxRange);
}
inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
{
if(SpellCooldownsEntry const* cooldowns = spellInfo->GetSpellCooldowns())
{
return cooldowns->RecoveryTime > cooldowns->CategoryRecoveryTime ? cooldowns->RecoveryTime : cooldowns->CategoryRecoveryTime;
}
return 0;
}
int32 GetSpellDuration(SpellEntry const *spellInfo);
@ -117,8 +123,10 @@ inline bool IsSpellHaveEffect(SpellEntry const* spellInfo, SpellEffects effect)
{
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
if(SpellEffects(effectEntry->Effect) == effect)
{
return true;
}
}
return false;
}
@ -126,7 +134,9 @@ inline bool IsAuraApplyEffect(SpellEntry const* spellInfo, SpellEffectIndex effe
{
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(effecIdx));
if (!spellEffect)
{
return false;
}
switch (spellEffect->Effect)
{
@ -147,7 +157,9 @@ inline bool IsSpellAppliesAura(SpellEntry const* spellInfo, uint32 effectMask =
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
if (effectMask & (1 << i))
if (IsAuraApplyEffect(spellInfo, SpellEffectIndex(i)))
{
return true;
}
return false;
}
@ -156,7 +168,9 @@ inline bool IsEffectHandledOnDelayedSpellLaunch(SpellEntry const* spellInfo, Spe
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
if(!effectEntry)
{
return false;
}
switch (effectEntry->Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
@ -174,7 +188,9 @@ inline bool IsPeriodicRegenerateEffect(SpellEntry const* spellInfo, SpellEffectI
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
if(!effectEntry)
{
return false;
}
switch (AuraType(effectEntry->EffectApplyAuraName))
{
@ -195,7 +211,9 @@ inline bool IsSpellHaveAura(SpellEntry const* spellInfo, AuraType aura, uint32 e
if (effectMask & (1 << i))
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
if(AuraType(effectEntry->EffectApplyAuraName) == aura)
{
return true;
}
return false;
}
@ -205,8 +223,10 @@ inline bool IsSpellLastAuraEffect(SpellEntry const* spellInfo, SpellEffectIndex
{
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
if(effectEntry->EffectApplyAuraName)
{
return false;
}
}
return true;
}
@ -243,7 +263,9 @@ inline bool IsLootCraftingSpell(SpellEntry const* spellInfo)
{
SpellEffectEntry const* spellEffect0 = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
if (!spellEffect0)
{
return false;
}
SpellTotemsEntry const* totems = spellInfo->GetSpellTotems();
@ -273,7 +295,9 @@ inline bool IsSpellRemoveAllMovementAndControlLossEffects(SpellEntry const* spel
{
SpellEffectEntry const* spellEffect0 = spellProto->GetSpellEffect(EFFECT_INDEX_0);
if (!spellEffect0)
{
return false;
}
return spellEffect0->EffectApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY &&
spellEffect0->EffectMiscValue == 1 &&
@ -351,15 +375,21 @@ inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
uint32 targetA = effectEntry->EffectImplicitTargetA;
if(targetA && !IsCasterSourceTarget(targetA))
{
return false;
}
uint32 targetB = effectEntry->EffectImplicitTargetB;
if(targetB && !IsCasterSourceTarget(targetB))
{
return false;
}
if (!targetA && !targetB)
{
return false;
}
}
return true;
}
@ -439,13 +469,19 @@ inline bool IsAreaOfEffectSpell(SpellEntry const* spellInfo)
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
{
return true;
}
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_1);
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
{
return true;
}
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_2);
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
{
return true;
}
return false;
}
@ -470,8 +506,10 @@ inline bool HasAreaAuraEffect(SpellEntry const* spellInfo)
if(!effectEntry)
continue;
if (IsAreaAuraEffect(effectEntry->Effect))
{
return true;
}
}
return false;
}
@ -554,11 +592,15 @@ inline bool IsChanneledSpell(SpellEntry const* spellInfo)
inline bool IsNeedCastSpellAtFormApply(SpellEntry const* spellInfo, ShapeshiftForm form)
{
if ((!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR_UNK7)) || !form)
{
return false;
}
SpellShapeshiftEntry const* shapeShift = spellInfo->GetSpellShapeshift();
if (!shapeShift)
{
return false;
}
// passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast!
return (shapeShift->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
@ -623,10 +665,14 @@ inline Mechanics GetEffectMechanic(SpellEntry const* spellInfo, SpellEffectIndex
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(effect));
if (effectEntry && effectEntry->EffectMechanic)
{
return Mechanics(effectEntry->EffectMechanic);
}
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
if (spellCategory && spellCategory->Mechanic)
{
return Mechanics(spellCategory->Mechanic);
}
return MECHANIC_NONE;
}
@ -634,9 +680,13 @@ inline uint32 GetDispellMask(DispelType dispel)
{
// If dispell all
if (dispel == DISPEL_ALL)
{
return DISPEL_ALL_MASK;
}
else
{
return (1 << dispel);
}
}
// Diminishing Returns interaction with spells
@ -850,16 +900,22 @@ class PetAura
{
std::map<uint32, uint32>::const_iterator itr = auras.find(petEntry);
if (itr != auras.end())
{
return itr->second;
}
else
{
std::map<uint32, uint32>::const_iterator itr2 = auras.find(0);
if (itr2 != auras.end())
{
return itr2->second;
}
else
{
return 0;
}
}
}
void AddAura(uint32 petEntry, uint32 aura)
{
@ -996,7 +1052,9 @@ class SpellMgr
{
SpellElixirMap::const_iterator itr = mSpellElixirs.find(spellid);
if (itr == mSpellElixirs.end())
{
return 0x0;
}
return itr->second;
}
@ -1007,22 +1065,34 @@ class SpellMgr
// flasks must have all bits set from ELIXIR_FLASK_MASK
if ((mask & ELIXIR_FLASK_MASK) == ELIXIR_FLASK_MASK)
{
return SPELL_FLASK_ELIXIR;
}
else if (mask & ELIXIR_BATTLE_MASK)
{
return SPELL_BATTLE_ELIXIR;
}
else if (mask & ELIXIR_GUARDIAN_MASK)
{
return SPELL_GUARDIAN_ELIXIR;
}
else if (mask & ELIXIR_WELL_FED)
{
return SPELL_WELL_FED;
}
else
{
return SPELL_NORMAL;
}
}
SpellThreatEntry const* GetSpellThreatEntry(uint32 spellid) const
{
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
if (itr != mSpellThreatMap.end())
{
return &itr->second;
}
return NULL;
}
@ -1030,10 +1100,14 @@ class SpellMgr
float GetSpellThreatMultiplier(SpellEntry const* spellInfo) const
{
if (!spellInfo)
{
return 1.0f;
}
if (SpellThreatEntry const* entry = GetSpellThreatEntry(spellInfo->Id))
{
return entry->multiplier;
}
return 1.0f;
}
@ -1043,7 +1117,9 @@ class SpellMgr
{
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
if (itr != mSpellProcEventMap.end())
{
return &itr->second;
}
return NULL;
}
@ -1052,7 +1128,9 @@ class SpellMgr
{
SpellProcItemEnchantMap::const_iterator itr = mSpellProcItemEnchantMap.find(spellid);
if (itr == mSpellProcItemEnchantMap.end())
{
return 0.0f;
}
return itr->second;
}
@ -1065,7 +1143,9 @@ class SpellMgr
// Lookup data
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
if (itr != mSpellBonusMap.end())
{
return &itr->second;
}
return NULL;
}
@ -1075,7 +1155,9 @@ class SpellMgr
{
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
if (itr != mSpellTargetPositions.end())
{
return &itr->second;
}
return NULL;
}
@ -1084,7 +1166,9 @@ class SpellMgr
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
if (itr == mSpellChains.end())
{
return NULL;
}
return &itr->second;
}
@ -1092,7 +1176,9 @@ class SpellMgr
uint32 GetFirstSpellInChain(uint32 spell_id) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
return node->first;
}
return spell_id;
}
@ -1100,7 +1186,9 @@ class SpellMgr
uint32 GetPrevSpellInChain(uint32 spell_id) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
return node->prev;
}
return 0;
}
@ -1123,7 +1211,9 @@ class SpellMgr
uint8 GetSpellRank(uint32 spell_id) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
return node->rank;
}
return 0;
}
@ -1136,12 +1226,16 @@ class SpellMgr
// not ordered correctly by rank value
if (itr == mSpellChains.end() || !rank2 || itr->second.rank <= rank2)
{
return false;
}
// check present in same rank chain
for (; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev))
if (itr->second.prev == spell2)
{
return true;
}
return false;
}
@ -1164,10 +1258,14 @@ class SpellMgr
{
SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
if (itr != mSpellLearnSkills.end())
{
return &itr->second;
}
else
{
return NULL;
}
}
bool IsSpellLearnSpell(uint32 spell_id) const
{
@ -1184,7 +1282,9 @@ class SpellMgr
SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
if (i->second.spell == spell_id2)
{
return true;
}
return false;
}
@ -1213,26 +1313,36 @@ class SpellMgr
{
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id << 8) + eff);
if (itr != mSpellPetAuraMap.end())
{
return &itr->second;
}
else
{
return NULL;
}
}
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const
{
PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
if (itr != mPetLevelupSpellMap.end())
{
return &itr->second;
}
else
{
return NULL;
}
}
// < 0 for petspelldata id, > 0 for creature_id
PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const
{
PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
if (itr != mPetDefaultSpellsMap.end())
{
return &itr->second;
}
return NULL;
}

View file

@ -169,7 +169,9 @@ void Player::UpdateResistances(uint32 school)
pet->UpdateResistances(school);
}
else
{ UpdateArmor(); }
{
UpdateArmor();
}
}
void Player::UpdateArmor()
@ -648,7 +650,9 @@ void Player::UpdateAllSpellCritChances()
void Player::UpdateExpertise(WeaponAttackType attack)
{
if (attack == RANGED_ATTACK)
{
return;
}
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
@ -736,7 +740,9 @@ void Player::UpdateMasteryAuras()
std::vector<uint32> const* masterySpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]);
if (!masterySpells)
{
return;
}
for (uint32 i = 0; i < masterySpells->size(); ++i)
{
@ -825,7 +831,9 @@ void Creature::UpdateResistances(uint32 school)
SetResistance(SpellSchools(school), int32(value));
}
else
{ UpdateArmor(); }
{
UpdateArmor();
}
}
void Creature::UpdateArmor()
@ -983,7 +991,9 @@ void Pet::UpdateResistances(uint32 school)
SetResistance(SpellSchools(school), int32(value));
}
else
{ UpdateArmor(); }
{
UpdateArmor();
}
}
void Pet::UpdateArmor()
@ -1051,7 +1061,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
val = GetStat(STAT_STRENGTH) - 10.0f;
}
else
{ val = 2 * GetStat(STAT_STRENGTH) - 20.0f; }
{
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
}
Unit* owner = GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)

View file

@ -61,7 +61,9 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
m_timer -= update_diff;
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
{
m_timer = m_lifetime;
}
break;
}
@ -122,10 +124,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
return;
}
else
{ m_timer -= update_diff; }
{
m_timer -= update_diff;
}
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
{
m_timer = m_lifetime;
}
break;
}
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
@ -145,10 +151,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
return;
}
else
{ m_timer -= update_diff; }
{
m_timer -= update_diff;
}
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
{
m_timer = m_lifetime;
}
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:

View file

@ -49,7 +49,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
Team team = owner->GetTypeId() == TYPEID_PLAYER ? ((Player*)owner)->GetTeam() : TEAM_NONE;
if (!CreateFromProto(guidlow, cinfo, team))
{
return false;
}
// special model selection case for totems
if (owner->GetTypeId() == TYPEID_PLAYER)
@ -65,7 +67,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
cPos.m_pos.z = owner->GetPositionZ();
if (!cPos.Relocate(this))
{
return false;
}
// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
@ -111,7 +115,9 @@ void Totem::Summon(Unit* owner)
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
{
return;
}
switch (m_type)
{
@ -174,7 +180,9 @@ void Totem::SetOwner(Unit* owner)
Unit* Totem::GetOwner()
{
if (ObjectGuid ownerGuid = GetOwnerGuid())
{
return ObjectAccessor::GetUnit(*this, ownerGuid);
}
return NULL;
}
@ -199,7 +207,9 @@ bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex
// Mana Spring, Healing stream, Mana tide
// Flags : 0x00000002000 | 0x00000004000 | 0x00004000000 -> 0x00004006000
if (spellInfo->GetSpellFamilyName() == SPELLFAMILY_SHAMAN && spellInfo->IsFitToFamilyMask(UI64LIT(0x00004006000)))
{
return false;
}
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
if (spellEffect)
{

View file

@ -36,7 +36,9 @@ int
TotemAI::Permissible(const Creature* creature)
{
if (creature->IsTotem())
{
return PERMIT_BASE_PROACTIVE;
}
return PERMIT_BASE_NO;
}
@ -59,15 +61,21 @@ void
TotemAI::UpdateAI(const uint32 /*diff*/)
{
if (getTotem().GetTotemType() != TOTEM_ACTIVE)
{
return;
}
if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false))
{
return;
}
// Search spell
SpellEntry const* spellInfo = sSpellStore.LookupEntry(getTotem().GetSpell());
if (!spellInfo)
{
return;
}
// Get spell rangy
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);

File diff suppressed because it is too large Load diff

View file

@ -1385,7 +1385,9 @@ class Unit : public WorldObject
bool CanUseEquippedWeapon(WeaponAttackType attackType) const
{
if (IsInFeralForm())
{
return false;
}
switch (attackType)
{
@ -1456,10 +1458,14 @@ class Unit : public WorldObject
Unit* getAttackerForHelper() // If someone wants to help, who to give them
{
if (getVictim() != NULL)
{
return getVictim();
}
if (!m_attackers.empty())
{
return *(m_attackers.begin());
}
return NULL;
}
@ -1900,7 +1906,9 @@ class Unit : public WorldObject
bool IsContestedGuard() const
{
if (FactionTemplateEntry const* entry = getFactionTemplateEntry())
{
return entry->IsContestedGuardFaction();
}
return false;
}
@ -3296,7 +3304,9 @@ class Unit : public WorldObject
{
VisibleAuraMap::const_iterator itr = m_visibleAuras.find(slot);
if (itr != m_visibleAuras.end())
{
return itr->second;
}
return NULL;
}
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)

View file

@ -189,12 +189,16 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
// This check is also called in Spell::CheckCast()
if (!CanBoard(passenger))
{
return;
}
// Use the planned seat only if the seat is valid, possible to choose and empty
if (!IsSeatAvailableFor(passenger, seat))
if (!GetUsableSeatFor(passenger, seat))
{
return;
}
VehicleSeatEntry const* seatEntry = GetSeatEntry(seat);
MANGOS_ASSERT(seatEntry);
@ -259,25 +263,33 @@ void VehicleInfo::SwitchSeat(Unit* passenger, uint8 seat)
// Switching seats is not possible
if (m_vehicleEntry->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
{
return;
}
PassengerMap::const_iterator itr = m_passengers.find(passenger);
MANGOS_ASSERT(itr != m_passengers.end());
// We are already boarded to this seat
if (itr->second->GetTransportSeat() == seat)
{
return;
}
// Check if it's a valid seat
if (!IsSeatAvailableFor(passenger, seat))
{
return;
}
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
MANGOS_ASSERT(seatEntry);
// Switching seats is only allowed if this flag is set
if (~seatEntry->m_flags & SEAT_FLAG_CAN_SWITCH)
{
return;
}
// Remove passenger modifications of the old seat
RemoveSeatMods(passenger, seatEntry->m_flags);
@ -379,31 +391,45 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
bool VehicleInfo::CanBoard(Unit* passenger) const
{
if (!passenger)
{
return false;
}
// Passenger is this vehicle
if (passenger == m_owner)
{
return false;
}
// Passenger is already on this vehicle (in this case switching seats is required)
if (passenger->IsBoarded() && passenger->GetTransportInfo()->GetTransport() == m_owner)
{
return false;
}
// Prevent circular boarding: passenger (could only be vehicle) must not have m_owner on board
if (passenger->IsVehicle() && passenger->GetVehicleInfo()->HasOnBoard(m_owner))
{
return false;
}
// Check if we have at least one empty seat
if (!GetEmptySeats())
{
return false;
}
// Passenger is already boarded
if (m_passengers.find(passenger) != m_passengers.end())
{
return false;
}
// Check for empty player seats
if (passenger->GetTypeId() == TYPEID_PLAYER)
{
return GetEmptySeatsMask() & m_playerSeats;
}
// Check for empty creature seats
return GetEmptySeatsMask() & m_creatureSeats;
@ -413,7 +439,9 @@ Unit* VehicleInfo::GetPassenger(uint8 seat) const
{
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
if (itr->second->GetTransportSeat() == seat)
{
return (Unit*)itr->first;
}
return NULL;
}
@ -468,14 +496,18 @@ bool VehicleInfo::GetUsableSeatFor(Unit* passenger, uint8& seat) const
// No usable seats available
if (!possibleSeats)
{
return false;
}
// Start with 0
seat = 0;
for (uint8 i = 1; seat < MAX_VEHICLE_SEAT; i <<= 1, ++seat)
if (possibleSeats & i)
{
return true;
}
return false;
}

View file

@ -164,7 +164,9 @@ void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/)
player->RemoveAurasDueToSpell(spellId);
}
else
{ player->CastSpell(player, spellId, true); }
{
player->CastSpell(player, spellId, true);
}
}
}
}
@ -208,6 +210,8 @@ void OutdoorPvP::RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool re
go->Refresh();
}
else if (go->isSpawned())
{ go->SetLootState(GO_JUST_DEACTIVATED); }
{
go->SetLootState(GO_JUST_DEACTIVATED);
}
}
}

View file

@ -142,11 +142,17 @@ void OutdoorPvPEP::HandleGameObjectCreate(GameObject* go)
InitBanner(go, TOWER_ID_NORTHPASS);
}
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][0], plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][1], 50.0f))
{ InitBanner(go, TOWER_ID_CROWNGUARD); }
{
InitBanner(go, TOWER_ID_CROWNGUARD);
}
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_EASTWALL][0], plaguelandsTowerLocations[TOWER_ID_EASTWALL][1], 50.0f))
{ InitBanner(go, TOWER_ID_EASTWALL); }
{
InitBanner(go, TOWER_ID_EASTWALL);
}
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][0], plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][1], 50.0f))
{ InitBanner(go, TOWER_ID_PLAGUEWOOD); }
{
InitBanner(go, TOWER_ID_PLAGUEWOOD);
}
break;
case GO_LORDAERON_SHRINE_ALLIANCE:
m_lordaeronShrineAlliance = go->GetObjectGuid();

View file

@ -34,7 +34,9 @@ void OutdoorPvPGH::HandleCreatureCreate(Creature* creature)
{
// only handle summoned creatures
if (!creature->IsTemporarySummon())
{
return;
}
switch (creature->GetEntry())
{
@ -80,7 +82,9 @@ bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
{
// If we are not using the lighthouse return
if (go->GetEntry() != GO_VENTURE_BAY_LIGHTHOUSE)
{
return false;
}
bool eventHandled = true;
@ -89,7 +93,9 @@ bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
case EVENT_LIGHTHOUSE_WIN_ALLIANCE:
// Ignore the event if the zone is already in alliance control
if (m_zoneOwner == ALLIANCE)
{
return true;
}
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
m_zoneOwner = ALLIANCE;
@ -100,7 +106,9 @@ bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
case EVENT_LIGHTHOUSE_WIN_HORDE:
// Ignore the event if the zone is already in horde control
if (m_zoneOwner == HORDE)
{
return true;
}
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
m_zoneOwner = HORDE;

View file

@ -138,7 +138,9 @@ void OutdoorPvPNA::HandleCreatureCreate(Creature* creature)
case NPC_ALLIANCE_HANAANI_GUARD:
// prevent updating guard counter on owner take over
if (m_guardsLeft == MAX_NA_GUARDS)
{
return;
}
if (m_guardsLeft == 0)
{
@ -159,7 +161,9 @@ void OutdoorPvPNA::HandleCreatureCreate(Creature* creature)
void OutdoorPvPNA::HandleCreatureDeath(Creature* creature)
{
if (creature->GetEntry() != NPC_HORDE_HALAANI_GUARD && creature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD)
{
return;
}
// get the location of the dead guard for future respawn
float x, y, z, o;
@ -303,7 +307,9 @@ bool OutdoorPvPNA::HandleEvent(uint32 eventId, GameObject* go)
{
// If we are not using the Halaa banner return
if (go->GetEntry() != GO_HALAA_BANNER)
{
return false;
}
bool eventHandled = true;

View file

@ -307,11 +307,15 @@ bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
break;
case GO_ZANGA_BANNER_CENTER_ALLIANCE:
if (team == ALLIANCE || !player->HasAura(SPELL_BATTLE_STANDARD_HORDE))
{
return false;
}
break;
case GO_ZANGA_BANNER_CENTER_HORDE:
if (team == HORDE || !player->HasAura(SPELL_BATTLE_STANDARD_ALLIANCE))
{
return false;
}
break;
default:
return false;

View file

@ -172,7 +172,9 @@ void HostileReference::updateOnlineStatus()
{ online = true; } // not accessable but stays online
}
else
{ accessible = true; }
{
accessible = true;
}
}
setAccessibleState(accessible);
setOnlineOfflineState(online);
@ -283,7 +285,9 @@ void ThreatContainer::modifyThreatPercent(Unit* pVictim, int32 pPercent)
delete ref;
}
else
{ ref->addThreatPercent(pPercent); }
{
ref->addThreatPercent(pPercent);
}
}
}
@ -527,7 +531,9 @@ Unit* ThreatManager::getHostileTarget()
float ThreatManager::getThreat(Unit* pVictim, bool pAlsoSearchOfflineList)
{
if (!pVictim)
{
return 0.0f;
}
float threat = 0.0f;
@ -574,7 +580,9 @@ void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
{
// including NULL==NULL case
if (pHostileReference == iCurrentVictim)
{
return;
}
if (pHostileReference)
iOwner->SendHighestThreatUpdate(pHostileReference);
@ -637,7 +645,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
iUpdateNeed = true;
}
else
{ iThreatOfflineContainer.remove(hostileReference); }
{
iThreatOfflineContainer.remove(hostileReference);
}
break;
}
}
@ -645,7 +655,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
void ThreatManager::UpdateForClient(uint32 diff)
{
if (!iUpdateNeed || isThreatListEmpty())
{
return;
}
iUpdateTimer.Update(diff);
if (iUpdateTimer.Passed())

View file

@ -290,7 +290,9 @@ static bool ReadDBCBuildFileText(const std::string& dbc_path, char const* locale
return true;
}
else
{
return false;
}
}
int ReadDBCLocale(const std::string sDataPath)
@ -329,19 +331,25 @@ static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const*&loc
ReadDBCBuildFileText(dbc_path, localeNameStr->name, text);
if (text.empty())
{
return 0;
}
size_t pos = text.find("version=\"");
size_t pos1 = pos + strlen("version=\"");
size_t pos2 = text.find("\"", pos1);
if (pos == text.npos || pos2 == text.npos || pos1 >= pos2)
{
return 0;
}
std::string build_str = text.substr(pos1, pos2 - pos1);
int build = atoi(build_str.c_str());
if (build <= 0)
{
return 0;
}
return build;
}
@ -906,17 +914,23 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction)
{
FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction);
if (itr == sFactionTeamMap.end())
{
return NULL;
}
return &itr->second;
}
char const* GetPetName(uint32 petfamily, uint32 dbclang)
{
if (!petfamily)
{
return NULL;
}
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
if (!pet_family)
{
return NULL;
}
return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : NULL;
}
@ -924,7 +938,9 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
if (itr == sTalentSpellPosMap.end())
{
return NULL;
}
return &itr->second;
}
@ -933,7 +949,9 @@ SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, SpellEffectIndex eff
{
SpellEffectMap::const_iterator itr = sSpellEffectMap.find(spellId);
if(itr == sSpellEffectMap.end())
{
return NULL;
}
return itr->second.effects[effect];
}
@ -941,7 +959,9 @@ SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, SpellEffectIndex eff
uint32 GetTalentSpellCost(TalentSpellPos const* pos)
{
if (pos)
{
return pos->rank + 1;
}
return 0;
}
@ -955,7 +975,9 @@ int32 GetAreaFlagByAreaID(uint32 area_id)
{
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
if (i == sAreaFlagByAreaID.end())
{
return -1;
}
return i->second;
}
@ -964,7 +986,9 @@ WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid
{
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
if (i == sWMOAreaInfoByTripple.end())
{
return NULL;
}
return i->second;
}
@ -972,7 +996,9 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
{
int32 areaflag = GetAreaFlagByAreaID(area_id);
if (areaflag < 0)
{
return NULL;
}
return sAreaStore.LookupEntry(areaflag);
}
@ -980,10 +1006,14 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id)
{
if (area_flag)
{
return sAreaStore.LookupEntry(area_flag);
}
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
{
return GetAreaEntryByAreaID(mapEntry->linked_zone);
}
return NULL;
}
@ -992,18 +1022,26 @@ uint32 GetAreaFlagByMapId(uint32 mapid)
{
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
if (i == sAreaFlagByMapID.end())
{
return 0;
}
else
{
return i->second;
}
}
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
if (mapid != 530 && mapid != 571 && mapid != 732) // speed for most cases
{
return mapid;
}
if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
{
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
}
return mapid;
}
@ -1012,11 +1050,15 @@ ContentLevels GetContentLevelsForMap(uint32 mapid)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if (!mapEntry)
{
return CONTENT_1_60;
}
// exceptions for 648 - Goblin Starter area and 654 - Worgen Starter area
if (mapid == 648 || mapid == 654)
{
return CONTENT_1_60;
}
switch (mapEntry->Expansion())
{
@ -1034,27 +1076,39 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
{
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
if (ch && ch->ChannelID == channel_id)
{
return ch;
}
}
return NULL;
}
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
if (requiredTotemCategoryId == 0)
{
return true;
}
if (itemTotemCategoryId == 0)
{
return false;
}
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
if (!itemEntry)
{
return false;
}
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
if (!reqEntry)
{
return false;
}
if (itemEntry->categoryType != reqEntry->categoryType)
{
return false;
}
return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask;
}
@ -1065,7 +1119,9 @@ bool Zone2MapCoordinates(float& x, float& y, uint32 zone)
// if not listed then map coordinates (instance)
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
{
return false;
}
std::swap(x, y); // at client map coords swapped
x = x * ((maEntry->x2 - maEntry->x1) / 100) + maEntry->x1;
@ -1080,7 +1136,9 @@ bool Map2ZoneCoordinates(float& x, float& y, uint32 zone)
// if not listed then map coordinates (instance)
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
{
return false;
}
x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100);
y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down
@ -1093,7 +1151,9 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapId, uint32 zoneId)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry)
{
return CONTENT_1_60;
}
if (mapEntry->rootPhaseMap != -1)
mapId = mapEntry->rootPhaseMap;
@ -1146,7 +1206,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
// exactly fit
if (entry->maxLevel >= level)
{
return entry;
}
// remember for possible out-of-range case (search higher from existed)
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
@ -1162,7 +1224,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundB
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
if (entry->mapId == mapid && entry->GetBracketId() == id)
{
return entry;
}
return NULL;
}
@ -1176,7 +1240,9 @@ std::vector<uint32> const* GetTalentTreeMasterySpells(uint32 talentTree)
{
TalentTreeSpellsMap::const_iterator itr = sTalentTreeMasterySpellsMap.find(talentTree);
if (itr == sTalentTreeMasterySpellsMap.end())
{
return NULL;
}
return &itr->second;
}
@ -1185,7 +1251,9 @@ std::vector<uint32> const* GetTalentTreePrimarySpells(uint32 talentTree)
{
TalentTreeSpellsMap::const_iterator itr = sTalentTreePrimarySpellsMap.find(talentTree);
if (itr == sTalentTreePrimarySpellsMap.end())
{
return NULL;
}
return &itr->second;
}
@ -1194,7 +1262,9 @@ uint32 GetTalentTreeRolesMask(uint32 talentTree)
{
TalentTreeRolesMap::const_iterator itr = sTalentTreeRolesMap.find(talentTree);
if (itr == sTalentTreeRolesMap.end())
{
return 0;
}
return itr->second;
}
@ -1202,15 +1272,19 @@ uint32 GetTalentTreeRolesMask(uint32 talentTree)
bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta)
{
if (mapid != atEntry->mapid)
{
return false;
}
if (atEntry->radius > 0)
{
// if we have radius check it
float dist2 = (x - atEntry->x) * (x - atEntry->x) + (y - atEntry->y) * (y - atEntry->y) + (z - atEntry->z) * (z - atEntry->z);
if (dist2 > (atEntry->radius + delta) * (atEntry->radius + delta))
{
return false;
}
}
else
{
// we have only extent
@ -1248,7 +1322,9 @@ uint32 GetCreatureModelRace(uint32 model_id)
{
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(model_id);
if (!displayEntry)
{
return 0;
}
CreatureDisplayInfoExtraEntry const* extraEntry = sCreatureDisplayInfoExtraStore.LookupEntry(displayEntry->ExtendedDisplayInfoID);
return extraEntry ? extraEntry->Race : 0;
}

View file

@ -518,7 +518,9 @@ struct AchievementCriteriaEntry
bool IsExplicitlyStartedTimedCriteria() const
{
if (!timeLimit)
{
return false;
}
// in case raw.value == timedCriteriaMiscId in timedCriteriaMiscId stored spellid/itemids for cast/use, so repeating aura start at first cast/use until fails
return requiredType == ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST || raw.value != timedCriteriaMiscId;
@ -984,11 +986,15 @@ struct FactionTemplateEntry
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] == entry.faction)
{
return false;
}
for (int i = 0; i < 4; ++i)
if (friendFaction[i] == entry.faction)
{
return true;
}
}
return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
@ -997,11 +1003,15 @@ struct FactionTemplateEntry
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] == entry.faction)
{
return true;
}
for (int i = 0; i < 4; ++i)
if (friendFaction[i] == entry.faction)
{
return false;
}
}
return (hostileMask & entry.ourMask) != 0;
}
bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) != 0; }
@ -1009,7 +1019,9 @@ struct FactionTemplateEntry
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] != 0)
{
return false;
}
return hostileMask == 0 && friendlyMask == 0;
}
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; }
@ -1622,7 +1634,9 @@ struct ScalingStatValuesEntry
uint32 getSpellBonus(uint32 mask) const
{
if (mask & 0x00008000)
{
return spellBonus;
}
return 0;
}
};
@ -1879,7 +1893,9 @@ struct SpellEffectEntry
uint32 GetRadiusIndex() const
{
if (EffectRadiusIndex != 0)
{
return EffectRadiusIndex;
}
return EffectRadiusMaxIndex;
}

View file

@ -282,7 +282,9 @@ bool WorldSession::Update(PacketFilter& updater)
}
}
else if (_player->IsInWorld())
{ ExecuteOpcode(opHandle, packet); }
{
ExecuteOpcode(opHandle, packet);
}
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
@ -306,9 +308,13 @@ bool WorldSession::Update(PacketFilter& updater)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
}
else if (_player->IsInWorld())
{ LogUnexpectedOpcode(packet, "the player is still in world"); }
{
LogUnexpectedOpcode(packet, "the player is still in world");
}
else
{ ExecuteOpcode(opHandle, packet); }
{
ExecuteOpcode(opHandle, packet);
}
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
@ -471,7 +477,9 @@ void WorldSession::LogoutPlayer(bool Save)
}
}
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
{ aset.insert((Player*)(*itr)); }
{
aset.insert((Player*)(*itr));
}
}
_player->SetPvPDeath(!aset.empty());
@ -758,7 +766,9 @@ void WorldSession::SendSetPhaseShift(uint32 phaseMask, uint16 mapId)
void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps)
{
if (PlayerLoading())
{
return;
}
ObjectGuid guid = _player->GetObjectGuid();
@ -863,7 +873,9 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
m_accountData[i] = AccountData();
if (!result)
{
return;
}
do
{
@ -915,7 +927,9 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, const std:
{
// _player can be NULL and packet received after logout but m_GUID still store correct guid
if (!m_GUIDLow)
{
return;
}
static SqlStatementID delId;
static SqlStatementID insId;
@ -1038,12 +1052,16 @@ void WorldSession::SaveTutorialsData()
void WorldSession::ReadAddonsInfo(ByteBuffer &data)
{
if (data.rpos() + 4 > data.size())
{
return;
}
uint32 size;
data >> size;
if (!size)
{
return;
}
if (size > 0xFFFFF)
{
@ -1071,7 +1089,9 @@ void WorldSession::ReadAddonsInfo(ByteBuffer &data)
// check next addon data format correctness
if (addonInfo.rpos() + 1 > addonInfo.size())
{
return;
}
addonInfo >> addonName;
@ -1182,7 +1202,9 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
{
#ifdef ENABLE_ELUNA
if (!sEluna->OnPacketReceive(this, *packet))
{
return;
}
#endif /* ENABLE_ELUNA */
// need prevent do internal far teleports in handlers because some handlers do lot steps

View file

@ -272,7 +272,9 @@ int WorldSocket::open(void* a)
data << ServerToClient;
if (SendPacket(data) == -1)
{
return -1;
}
// Send startup packet.
WorldPacket packet (SMSG_AUTH_CHALLENGE, 37);
@ -368,7 +370,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
const size_t send_len = m_OutBuffer->length();
if (send_len == 0)
{
return handle_output_queue(Guard);
}
#ifdef MSG_NOSIGNAL
ssize_t n = peer().send(m_OutBuffer->rd_ptr(), send_len, MSG_NOSIGNAL);
@ -411,7 +415,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
int WorldSocket::handle_output_queue(GuardType& g)
{
if (msg_queue()->is_empty())
{
return cancel_wakeup_output(g);
}
ACE_Message_Block* mblk;
@ -746,7 +752,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
#ifdef ENABLE_ELUNA
if (!sEluna->OnPacketReceive(m_Session, *new_pct))
{
return 0;
}
#endif /* ENABLE_ELUNA */
return HandleAuthSession(*new_pct);
case CMSG_KEEP_ALIVE:
@ -795,7 +803,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
return -1;
}
else
{ return 0; }
{
return 0;
}
}
ACE_NOTREACHED(return 0);
@ -1101,7 +1111,9 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
}
}
else
{ m_OverSpeedPings = 0; }
{
m_OverSpeedPings = 0;
}
}
// critical section

View file

@ -82,7 +82,9 @@ int WorldSocketMgr::svc()
sockets_->erase(t);
}
else
{ ++i; }
{
++i;
}
}
}
@ -127,7 +129,9 @@ int WorldSocketMgr::StartNetwork(ACE_INET_Addr& addr)
}
if (activate(THR_NEW_LWP | THR_JOINABLE, num_threads) == -1)
{
return -1;
}
sLog.outString("Max allowed socket connections: %d", ACE::max_handles());
return 0;

View file

@ -92,7 +92,9 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
found = true;
}
else
{ ss << ","; }
{
ss << ",";
}
ss << id;
}
}
@ -140,7 +142,9 @@ bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id)
{
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talent_id);
if (!talentInfo)
{
return false;
}
return sTalentTabStore.LookupEntry(talentInfo->TalentTab);
}

View file

@ -161,7 +161,9 @@ bool changenth(std::string& str, int n, const char* with, bool insert = false, b
str.replace(s, e - s, with);
}
else
{ str.insert(s, with); }
{
str.insert(s, with);
}
return true;
}
@ -191,7 +193,9 @@ bool changetoknth(std::string& str, int n, const char* with, bool insert = false
str.replace(s, e - s, with);
}
else
{ str.insert(s, with); }
{
str.insert(s, with);
}
return true;
}
@ -359,7 +363,9 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con
wherestr = GenerateWhereStr(fieldname, *guids, guids_itr);
}
else // not set case, get single guid string
{ wherestr = GenerateWhereStr(fieldname, guid); }
{
wherestr = GenerateWhereStr(fieldname, guid);
}
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
if (!result)
@ -421,12 +427,16 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
dump += "UPDATE character_db_version SET " + reqName + " = 1 WHERE FALSE;\n\n";
}
else
{ sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump."); }
{
sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");
}
delete result;
}
else
{ sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump."); }
{
sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");
}
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
{ DumpTableContent(dump, guid, itr->name, itr->name, itr->type); }
@ -491,7 +501,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
}
}
else
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
{
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
}
// normalize the name if specified and check if it exists
if (!normalizePlayerName(name))

View file

@ -245,7 +245,9 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
{
if (!_warden || recvData.empty())
{
return;
}
_warden->DecryptData(const_cast<uint8*>(recvData.contents()), recvData.size());
uint8 opcode;
@ -290,10 +292,14 @@ void Warden::HandleData(ByteBuffer& /*buff*/)
void Warden::LogPositiveToDB(WardenCheck* check)
{
if (!check || !_session)
{
return;
}
if (uint32(check->Action) < sWorld.getConfig(CONFIG_UINT32_WARDEN_DB_LOGLEVEL))
{
return;
}
static SqlStatementID insWardenPositive;

View file

@ -287,8 +287,10 @@ WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 build, uint16 Id)
{
MultiCheckContainer::const_iterator it = MCheckStore.find(ComposeMultiCheckKey(build, Id));
if (it != MCheckStore.end())
{
return it->second;
}
}
return CheckStore[Id];
}
@ -301,12 +303,16 @@ WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 build, uint16 Id)
{
MultiResultContainer::const_iterator it = MCheckResultStore.find(ComposeMultiCheckKey(build, Id));
if (it != MCheckResultStore.end())
{
return it->second;
}
}
CheckResultContainer::const_iterator itr = CheckResultStore.find(Id);
if (itr != CheckResultStore.end())
{
return itr->second;
}
return NULL;
}

View file

@ -230,7 +230,9 @@ uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
return charcount;
}
else
{ return 0; }
{
return 0;
}
}
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)

View file

@ -277,23 +277,35 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return true;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE:
if (!target || target->GetTypeId() != TYPEID_UNIT)
{
return false;
}
return target->GetEntry() == creature.id;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_CLASS_RACE:
if (!target || target->GetTypeId() != TYPEID_PLAYER)
{
return false;
}
if (classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
{
return false;
}
if (classRace.race_id && classRace.race_id != ((Player*)target)->getRace())
{
return false;
}
return true;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_LESS_HEALTH:
if (!target || target->GetTypeId() != TYPEID_PLAYER)
{
return false;
}
return target->GetHealth() * 100 <= health.percent * target->GetMaxHealth();
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_DEAD:
if (!target || target->GetTypeId() != TYPEID_PLAYER || target->IsAlive() || ((Player*)target)->GetDeathTimer() == 0)
{
return false;
}
// flag set == must be same team, not set == different team
return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0);
case ACHIEVEMENT_CRITERIA_REQUIRE_S_AURA:
@ -310,11 +322,15 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return miscvalue1 >= value.minvalue;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL:
if (!target)
{
return false;
}
return target->getLevel() >= level.minlevel;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_GENDER:
if (!target)
{
return false;
}
return target->getGender() == gender.gender;
case ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED:
return false; // always fail
@ -324,7 +340,9 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_TEAM:
if (!target || target->GetTypeId() != TYPEID_PLAYER)
{
return false;
}
return ((Player*)target)->GetTeam() == Team(team.team);
case ACHIEVEMENT_CRITERIA_REQUIRE_S_DRUNK:
return (uint32)Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= drunk.state;
@ -334,13 +352,17 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
{
BattleGround* bg = source->GetBattleGround();
if (!bg)
{
return false;
}
return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE, bg_loss_team_score.min_score, bg_loss_team_score.max_score);
}
case ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT:
{
if (!source->IsInWorld())
{
return false;
}
InstanceData* data = source->GetInstanceData();
if (!data)
{
@ -354,7 +376,9 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
{
Item* item = source->GetItemByPos(INVENTORY_SLOT_BAG_0, miscvalue1);
if (!item)
{
return false;
}
ItemPrototype const* proto = item->GetProto();
return proto->ItemLevel >= equipped_item.item_level && proto->Quality >= equipped_item.item_quality;
}
@ -375,7 +399,9 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
case ACHIEVEMENT_CRITERIA_REQUIRE_KNOWN_TITLE:
{
if (CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(known_title.title_id))
{
return source && source->HasTitle(titleInfo->bit_index);
}
return false;
}
@ -387,7 +413,9 @@ bool AchievementCriteriaRequirementSet::Meets(Player const* source, Unit const*
{
for (Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr)
if (!itr->Meets(criteria_id, source, target, miscvalue))
{
return false;
}
return true;
}
@ -430,7 +458,9 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2);
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
{
return;
}
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
@ -614,7 +644,9 @@ void AchievementMgr::LoadFromDB(QueryResult* achievementResult, QueryResult* cri
void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
{
if (GetPlayer()->GetSession()->PlayerLoading())
{
return;
}
DEBUG_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
@ -705,7 +737,9 @@ void AchievementMgr::StartTimedAchievementCriteria(AchievementCriteriaTypes type
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::StartTimedAchievementCriteria(%u, %u)", type, timedRequirementId);
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
{
return;
}
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
@ -766,7 +800,9 @@ void AchievementMgr::StartTimedAchievementCriteria(AchievementCriteriaTypes type
void AchievementMgr::DoFailedTimedAchievementCriterias()
{
if (m_criteriaFailTimes.empty())
{
return;
}
time_t now = time(NULL);
for (AchievementCriteriaFailTimeMap::iterator iter = m_criteriaFailTimes.begin(); iter != m_criteriaFailTimes.end();)
@ -812,7 +848,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u, %u)", type, miscvalue1, miscvalue2, time);
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
{
return;
}
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
for (AchievementCriteriaEntryList::const_iterator itr = achievementCriteriaList.begin(); itr != achievementCriteriaList.end(); ++itr)
@ -1043,7 +1081,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_CURRENCY_EARNED:
{
if (!miscvalue1 || !miscvalue2 || miscvalue1 != achievementCriteria->currencyEarned.currencyId)
{
return;
}
change = miscvalue2;
progressType = PROGRESS_ACCUMULATE;
@ -1905,18 +1945,24 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
{
// counter can never complete
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
{
return false;
}
if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
{
// someone on this realm has already completed that achievement
if (sAchievementMgr.IsRealmCompleted(achievement))
{
return false;
}
}
CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID);
if (itr == m_criteriaProgress.end())
{
return false;
}
CriteriaProgress const* progress = &itr->second;
@ -1929,11 +1975,15 @@ void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement)
{
// counter can never complete
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
{
return;
}
// already completed and stored
if (m_completedAchievements.find(achievement->ID) != m_completedAchievements.end())
{
return;
}
if (IsCompletedAchievement(achievement))
CompletedAchievement(achievement);
@ -1943,7 +1993,9 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
{
// counter can never complete
if (entry->flags & ACHIEVEMENT_FLAG_COUNTER)
{
return false;
}
// for achievement with referenced achievement criterias get from referenced and counter from self
uint32 achievementForTestId = entry->refAchievement ? entry->refAchievement : entry->ID;
@ -1951,7 +2003,9 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
AchievementCriteriaEntryList const* cList = sAchievementMgr.GetAchievementCriteriaByAchievement(achievementForTestId);
if (!cList)
{
return false;
}
uint32 count = 0;
// For SUMM achievements, we have to count the progress of each criteria of the achievement.
@ -1971,8 +2025,10 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
// for counters, field4 contains the main count requirement
if (count >= criteria->raw.count)
{
return true;
}
}
return false;
}
@ -1992,12 +2048,16 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
// completed as have req. count of completed criterias
if (achievementForTestCount > 0 && achievementForTestCount <= count)
{
return true;
}
}
// all criterias completed requirement
if (completed_all && achievementForTestCount == 0)
{
return true;
}
return false;
}
@ -2021,11 +2081,15 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* criteri
{
// not create record for 0 counter
if (changeValue == 0)
{
return;
}
// not start manually started timed achievements
if (criteria->IsExplicitlyStartedTimedCriteria())
{
return;
}
progress = &m_criteriaProgress[criteria->ID];
@ -2065,8 +2129,10 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* criteri
// not update (not mark as changed) if counter will have same value
if (progress->counter == newValue)
{
return;
}
}
progress->counter = newValue;
progress->changed = true;
@ -2121,7 +2187,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
{
DETAIL_LOG("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER || m_completedAchievements.find(achievement->ID) != m_completedAchievements.end())
{
return;
}
SendAchievementEarned(achievement);
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
@ -2140,7 +2208,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
// no rewards
if (!reward)
{
return;
}
// titles
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 1 : 0])
@ -2189,11 +2259,15 @@ void AchievementMgr::IncompletedAchievement(AchievementEntry const* achievement)
{
DETAIL_LOG("AchievementMgr::IncompletedAchievement(%u)", achievement->ID);
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
{
return;
}
CompletedAchievementMap::iterator itr = m_completedAchievements.find(achievement->ID);
if (itr == m_completedAchievements.end())
{
return;
}
WorldPacket data(SMSG_ACHIEVEMENT_DELETED, 4);
data << uint32(achievement->ID);
@ -2210,7 +2284,9 @@ void AchievementMgr::IncompletedAchievement(AchievementEntry const* achievement)
// no rewards
if (!reward)
{
return;
}
// titles
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1])
@ -2394,7 +2470,9 @@ AchievementReward const* AchievementGlobalMgr::GetAchievementReward(AchievementE
AchievementRewardsMapBounds bounds = m_achievementRewards.equal_range(achievement->ID);
for (AchievementRewardsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
{
return &iter->second;
}
return NULL;
}
@ -2404,7 +2482,9 @@ AchievementRewardLocale const* AchievementGlobalMgr::GetAchievementRewardLocale(
AchievementRewardLocalesMapBounds bounds = m_achievementRewardLocales.equal_range(achievement->ID);
for (AchievementRewardLocalesMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
{
return &iter->second;
}
return NULL;
}

View file

@ -41,13 +41,19 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recv_data)
Player* player = sObjectMgr.GetPlayer(guid);
if (!player)
{
return;
}
if (!_player->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
{
return;
}
if (_player->IsHostileTo(player))
{
return;
}
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
{
@ -96,10 +102,14 @@ void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket& recv_data)
ArenaType type = ArenaTeam::GetTypeBySlot(slot);
if (!IsArenaTypeValid(type))
{
return;
}
if (!IsArenaTypeValid(ArenaType(type)))
{
return;
}
if (_player->GetArenaTeamId(slot))
{
@ -148,7 +158,9 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recv_data)
if (!Invitedname.empty())
{
if (!normalizePlayerName(Invitedname))
{
return;
}
player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
}
@ -180,7 +192,9 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recv_data)
// OK result but not send invite
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
{
return;
}
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
{
@ -224,7 +238,9 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
ArenaTeam* at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
if (!at)
{
return;
}
if (_player->GetArenaTeamId(at->GetSlot()))
{
@ -268,7 +284,9 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recv_data)
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at)
{
return;
}
if (_player->GetObjectGuid() == at->GetCaptainGuid() && at->GetMembersSize() > 1)
{
@ -304,10 +322,14 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recv_data)
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
{
if (at->GetCaptainGuid() != _player->GetObjectGuid())
{
return;
}
if (at->IsFighting())
{
return;
}
at->Disband(this);
delete at;
@ -326,7 +348,9 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recv_data)
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
{
return;
}
if (at->GetCaptainGuid() != _player->GetObjectGuid())
{
@ -335,7 +359,9 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recv_data)
}
if (!normalizePlayerName(name))
{
return;
}
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
@ -368,7 +394,9 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
{
return;
}
if (at->GetCaptainGuid() != _player->GetObjectGuid())
{
@ -377,7 +405,9 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
}
if (!normalizePlayerName(name))
{
return;
}
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
@ -387,7 +417,9 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
}
if (at->GetCaptainGuid() == member->guid) // target player already captain
{
return;
}
at->SetCaptain(member->guid);

View file

@ -274,7 +274,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
@ -392,7 +394,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
@ -444,7 +448,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
// cheating
if (price < auction->startbid)
{
return;
}
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
@ -467,7 +473,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
@ -494,7 +502,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data)
{
uint64 auctionCut = auction->GetAuctionCut();
if (pl->GetMoney() < auctionCut) // player doesn't have enough money, maybe message needed
{
return;
}
if (auction->bidder) // if auction have real existed bidder send mail
SendAuctionCancelledToBidderMail(auction);
@ -547,7 +557,9 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
@ -591,7 +603,9 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
@ -629,7 +643,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
recv_data >> usable >> isFull >> unk >> sortCount;
if (sortCount >= MAX_AUCTION_SORT)
{
return;
}
uint8 Sort[MAX_AUCTION_SORT];
memset(Sort, MAX_AUCTION_SORT, MAX_AUCTION_SORT);
@ -641,7 +657,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
recv_data >> column;
if (column >= MAX_AUCTION_SORT)
{
return;
}
recv_data >> reversed;
Sort[i] = (reversed > 0) ? (column |= AUCTION_SORT_REVERSED) : column;
@ -649,7 +667,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
@ -676,7 +696,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
// converting string that we try to find to lower case
std::wstring wsearchedname;
if (!Utf8toWStr(searchedname, wsearchedname))
{
return;
}
wstrToLower(wsearchedname);
@ -700,7 +722,9 @@ void WorldSession::HandleAuctionListPendingSales(WorldPacket& recv_data)
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
{
return;
}
uint32 count = 0;

View file

@ -749,7 +749,9 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarInvite const* invite)
CalendarEvent const* event = invite->GetCalendarEvent();
if (!event)
{
return;
}
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
data << uint64(event->EventId);
@ -821,7 +823,9 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
void CalendarMgr::SendCalendarCommandResult(Player* player, CalendarError err, char const* param /*= NULL*/)
{
if (!player)
{
return;
}
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SMSG_CALENDAR_COMMAND_RESULT (%u)", err);
WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
@ -858,7 +862,9 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const* event)
void CalendarMgr::SendCalendarEvent(Player* player, CalendarEvent const* event, uint32 sendType)
{
if (!player || !event)
{
return;
}
std::string timeStr = TimeToTimestampStr(event->EventTime);
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SendCalendarEvent> sendType[%u], CreatorGuid[%s], EventId[" UI64FMTD "], Type[%u], Flags[%u], Title[%s]",
@ -1017,7 +1023,9 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven
void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save)
{
if (!save || !player)
{
return;
}
DEBUG_LOG("SMSG_CALENDAR_RAID_LOCKOUT_REMOVED [%s]", player->GetObjectGuid().GetString().c_str());
time_t currTime = time(NULL);
@ -1034,7 +1042,9 @@ void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersisten
void CalendarMgr::SendCalendarRaidLockoutAdd(Player* player, DungeonPersistentState const* save)
{
if (!save || !player)
{
return;
}
DEBUG_LOG("SMSG_CALENDAR_RAID_LOCKOUT_ADDED [%s]", player->GetObjectGuid().GetString().c_str());
time_t currTime = time(NULL);

View file

@ -68,7 +68,9 @@ inline void
Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, float x, float y, float radius) const
{
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
{
return;
}
// no jokes here... Actually placing ASSERT() here was good idea, but
// we had some problems with DynamicObjects, which pass radius = 0.0f (DB issue?)
@ -149,7 +151,9 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, const Cel
// if x_shift == 0 then we have too small cell area, which were already
// visited at previous step, so just return from procedure...
if (x_shift == 0)
{
return;
}
uint32 y_start = end_cell.y_coord;
uint32 y_end = begin_cell.y_coord;

View file

@ -94,7 +94,9 @@ void Channel::Join(Player* player, const char* password)
}
if (player->GetGuildId() && (GetFlags() == 0x38))
{
return;
}
// join channel
player->JoinedChannel(this);
@ -343,7 +345,9 @@ void Channel::SetMode(Player* player, const char* targetName, bool moderator, bo
ObjectGuid targetGuid = target->GetObjectGuid();
if (moderator && guid == m_ownerGuid && targetGuid == m_ownerGuid)
{
return;
}
if (!IsOn(targetGuid))
{
@ -588,7 +592,9 @@ void Channel::Moderate(Player* player)
void Channel::Say(Player* player, const char* text, uint32 lang)
{
if (!text)
{
return;
}
ObjectGuid guid = player->GetObjectGuid();

View file

@ -239,7 +239,9 @@ private:
{
PlayerList::const_iterator p_itr = m_players.find(guid);
if (p_itr == m_players.end())
{
return 0;
}
return p_itr->second.flags;
}

View file

@ -42,7 +42,9 @@ void WorldSession::HandleJoinChannelOpcode(WorldPacket& recvPacket)
pass = recvPacket.ReadString(passwordLength);
if (channelname.empty())
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
@ -60,7 +62,9 @@ void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
if (channelname.empty())
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
@ -112,7 +116,9 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(newp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -143,7 +149,9 @@ void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -163,7 +171,9 @@ void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -183,7 +193,9 @@ void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -203,7 +215,9 @@ void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -223,7 +237,9 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -243,7 +259,9 @@ void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
otp = recvPacket.ReadString(nameLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -263,7 +281,9 @@ void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
@ -283,7 +303,9 @@ void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
channelname = recvPacket.ReadString(channelLen);
if (!normalizePlayerName(otp))
{
return;
}
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))

View file

@ -567,7 +567,9 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recv_data)
// can't delete loaded character
if (sObjectMgr.GetPlayer(guid))
{
return;
}
uint32 accountId = 0;
std::string name;
@ -603,7 +605,9 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recv_data)
// prevent deleting other players' characters using cheating tools
if (accountId != GetAccountId())
{
return;
}
std::string IP_str = GetRemoteAddress();
BASIC_LOG("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), lowguid);
@ -1198,19 +1202,25 @@ void WorldSession::HandleAlterAppearanceOpcode(WorldPacket& recv_data)
{
BarberShopStyleEntry const* bs_skinTone = sBarberShopStyleStore.LookupEntry(skinTone);
if (!bs_skinTone || bs_skinTone->type != 3 || bs_skinTone->race != _player->getRace() || bs_skinTone->gender != _player->getGender())
{
return;
}
skinTone_id = bs_skinTone->hair_id;
}
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
if (!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
{
return;
}
BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair);
if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
{
return;
}
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, skinTone_id);
@ -1371,7 +1381,9 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket& recv_data)
recv_data >> iconName;
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
{
return;
}
EquipmentSet eqSet;
@ -1397,10 +1409,14 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket& recv_data)
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item && itemGuid) // cheating check 1
{
return;
}
if (item && item->GetObjectGuid() != itemGuid) // cheating check 2
{
return;
}
eqSet.Items[i] = itemGuid.GetCounter();
}

File diff suppressed because it is too large Load diff

View file

@ -128,8 +128,10 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
// Disabled addon channel?
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
{
return;
}
}
// LANG_ADDON should not be changed nor be affected by flood control
else
{
@ -203,7 +205,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
break;
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -212,7 +216,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
{
return;
}
#endif /* ENABLE_ELUNA */
GetPlayer()->Say(msg, lang);
}
@ -220,7 +226,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, LANG_UNIVERSAL, msg))
{
return;
}
#endif /* ENABLE_ELUNA */
GetPlayer()->TextEmote(msg);
}
@ -228,7 +236,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
{
return;
}
#endif /* ENABLE_ELUNA */
GetPlayer()->Yell(msg, lang);
}
@ -284,7 +294,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, player))
{
return;
}
#endif /* ENABLE_ELUNA */
GetPlayer()->Whisper(msg, lang, player->GetObjectGuid());
} break;
@ -302,7 +314,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
break;
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -313,15 +327,21 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
group = _player->GetGroup();
if (!group || group->isBGGroup())
{
return;
}
}
if ((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetObjectGuid()))
{
return;
}
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
{
return;
}
#endif /* ENABLE_ELUNA */
WorldPacket data;
@ -342,7 +362,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
break;
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -353,7 +375,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
{
return;
}
#endif /* ENABLE_ELUNA */
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
@ -373,7 +397,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
break;
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -384,7 +410,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
{
return;
}
#endif /* ENABLE_ELUNA */
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
@ -404,7 +432,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
break;
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -415,13 +445,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
group = GetPlayer()->GetGroup();
if (!group || group->isBGGroup() || !group->isRaidGroup())
{
return;
}
}
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
{
return;
}
#endif /* ENABLE_ELUNA */
WorldPacket data;
@ -440,7 +474,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
break;
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -451,13 +487,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
group = GetPlayer()->GetGroup();
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetObjectGuid()))
{
return;
}
}
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
{
return;
}
#endif /* ENABLE_ELUNA */
WorldPacket data;
@ -471,7 +511,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
msg = recv_data.ReadString(recv_data.ReadBits(9));
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -484,7 +526,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
{
return;
}
#endif /* ENABLE_ELUNA */
WorldPacket data;
@ -499,7 +543,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
msg = recv_data.ReadString(recv_data.ReadBits(9));
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -507,12 +553,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group* group = GetPlayer()->GetGroup();
if (!group || !group->isBGGroup())
{
return;
}
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
{
return;
}
#endif /* ENABLE_ELUNA */
WorldPacket data;
@ -526,7 +576,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
msg = recv_data.ReadString(recv_data.ReadBits(9));
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -534,12 +586,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group* group = GetPlayer()->GetGroup();
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetObjectGuid()))
{
return;
}
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
{
return;
}
#endif /* ENABLE_ELUNA */
WorldPacket data;
@ -556,7 +612,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
channel = recv_data.ReadString(channelLength);
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
{
return;
}
if (msg.empty())
break;
@ -568,7 +626,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, chn))
{
return;
}
#endif /* ENABLE_ELUNA */
chn->Say(_player, msg.c_str(), lang);
}
@ -602,7 +662,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
{
return;
}
#endif /* ENABLE_ELUNA */
}
break;
@ -631,7 +693,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
// Used by Eluna
#ifdef ENABLE_ELUNA
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
{
return;
}
#endif /* ENABLE_ELUNA */
break;
@ -663,7 +727,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
// Disabled addon channel?
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
{
return;
}
switch (type)
{
@ -676,7 +742,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
Group* group = _player->GetGroup();
if (!group || !group->isBGGroup())
{
return;
}
WorldPacket data;
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_ADDON);
@ -758,7 +826,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data)
{
if (!GetPlayer()->IsAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
{
return;
}
uint32 emote;
recv_data >> emote;
@ -808,7 +878,9 @@ namespace MaNGOS
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
{
if (!GetPlayer()->IsAlive())
{
return;
}
if (!GetPlayer()->CanSpeak())
{
@ -831,7 +903,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote);
if (!em)
{
return;
}
uint32 emote_id = em->textid;
@ -882,7 +956,9 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
Player* player = sObjectMgr.GetPlayer(iguid);
if (!player || !player->GetSession())
{
return;
}
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_IGNORED, _player->GetName(), LANG_UNIVERSAL, CHAT_TAG_NONE, _player->GetObjectGuid());

View file

@ -284,15 +284,21 @@ bool CreatureLinkingMgr::IsLinkedEventTrigger(Creature* pCreature) const
{
// Entry case
if (m_eventTriggers.find(pCreature->GetEntry()) != m_eventTriggers.end())
{
return true;
}
// Guid case
if (m_eventGuidTriggers.find(pCreature->GetGUIDLow()) != m_eventGuidTriggers.end())
{
return true;
}
// Also return true for npcs that trigger reverse actions, or for followers(needed in respawn)
if (CreatureLinkingInfo const* pInfo = GetLinkedTriggerInformation(pCreature))
{
return pInfo->linkingFlag & EVENT_MASK_TRIGGER_TO;
}
return false;
}
@ -332,8 +338,10 @@ CreatureLinkingInfo const* CreatureLinkingMgr::GetLinkedTriggerInformation(uint3
for (CreatureLinkingMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
{
if (iter->second.mapId == mapId)
{
return &(iter->second);
}
}
return NULL;
}
@ -343,7 +351,9 @@ void CreatureLinkingHolder::AddSlaveToHolder(Creature* pCreature)
{
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
if (!pInfo)
{
return;
}
if (pInfo->mapId == INVALID_MAP_ID) // Guid case, store master->slaves for fast access
{
@ -397,11 +407,15 @@ void CreatureLinkingHolder::AddSlaveToHolder(Creature* pCreature)
void CreatureLinkingHolder::AddMasterToHolder(Creature* pCreature)
{
if (pCreature->IsPet())
{
return;
}
// Only add master NPCs (by entry)
if (!sCreatureLinkingMgr.IsLinkedMaster(pCreature))
{
return;
}
// Check, if already stored
BossGuidMapBounds bounds = m_masterGuid.equal_range(pCreature->GetEntry());
@ -417,14 +431,20 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
{
// This check will be needed in reload case
if (!sCreatureLinkingMgr.IsLinkedEventTrigger(pSource))
{
return;
}
// Ignore atypic behaviour
if (pSource->IsControlledByPlayer())
{
return;
}
if (eventType == LINKING_EVENT_AGGRO && !pEnemy)
{
return;
}
uint32 eventFlagFilter = 0;
uint32 reverseEventFlagFilter = 0;
@ -477,7 +497,9 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
{
case LINKING_EVENT_AGGRO:
if (pMaster->IsControlledByPlayer())
{
return;
}
if (pMaster->IsInCombat())
pMaster->SetInCombatWith(pEnemy);
@ -505,7 +527,9 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
void CreatureLinkingHolder::ProcessSlaveGuidList(CreatureLinkingEvent eventType, Creature* pSource, uint32 flag, uint16 searchRange, GuidList& slaveGuidList, Unit* pEnemy)
{
if (!flag)
{
return;
}
for (GuidList::iterator slave_itr = slaveGuidList.begin(); slave_itr != slaveGuidList.end();)
{
@ -538,7 +562,9 @@ void CreatureLinkingHolder::ProcessSlave(CreatureLinkingEvent eventType, Creatur
if (flag & FLAG_AGGRO_ON_AGGRO)
{
if (pSlave->IsControlledByPlayer())
{
return;
}
if (pSlave->IsInCombat())
pSlave->SetInCombatWith(pEnemy);
@ -619,7 +645,9 @@ bool CreatureLinkingHolder::IsSlaveInRangeOfBoss(Creature const* pSlave, Creatur
bool CreatureLinkingHolder::IsSlaveInRangeOfBoss(Creature const* pBoss, float sX, float sY, uint16 searchRange) const
{
if (!searchRange)
{
return true;
}
// Do some calculations
float mX, mY, mZ, dx, dy;
@ -643,7 +671,9 @@ bool CreatureLinkingHolder::CanSpawn(Creature* pCreature) const
{
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
if (!pInfo)
{
return true;
}
float sx, sy, sz;
pCreature->GetRespawnCoord(sx, sy, sz);
@ -666,13 +696,19 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI
{
CreatureData const* data = sObjectMgr.GetCreatureData(lowGuid);
if (!data)
{
return true;
}
pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(data->id, lowGuid, data->mapid);
if (!pInfo)
{
return true;
}
// Has lowGuid npc actually spawning linked?
if (!sCreatureLinkingMgr.IsSpawnedByLinkedMob(pInfo))
{
return true;
}
sx = data->posX; // Fill position data
sy = data->posY;
@ -684,12 +720,18 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI
return false; // This should never happen
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
{
return IsRespawnReady(pInfo->masterDBGuid, _map);
}
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
{
return !IsRespawnReady(pInfo->masterDBGuid, _map);
}
else
{
return true;
}
}
// Search for nearby master
BossGuidMapBounds finds = m_masterGuid.equal_range(pInfo->masterId);
@ -699,13 +741,19 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI
if (pMaster && IsSlaveInRangeOfBoss(pMaster, sx, sy, pInfo->searchRange))
{
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
{
return pMaster->IsAlive();
}
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
{
return !pMaster->IsAlive();
}
else
{
return true;
}
}
}
return true; // local boss does not exist - spawn
}
@ -715,7 +763,9 @@ bool CreatureLinkingHolder::TryFollowMaster(Creature* pCreature)
{
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
if (!pInfo || !(pInfo->linkingFlag & FLAG_FOLLOW))
{
return false;
}
Creature* pMaster = NULL;
if (pInfo->mapId != INVALID_MAP_ID) // entry case

View file

@ -282,11 +282,15 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
{
MANGOS_ASSERT(type < MAX_DISABLE_TYPES);
if (m_DisableMap[type].empty())
{
return false;
}
DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
if (itr == m_DisableMap[type].end()) // not disabled
{
return false;
}
switch (type)
{
@ -324,9 +328,13 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
return false;
}
else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
{
return true;
}
else if (flags & SPELL_DISABLE_LOS)
{
return (spellFlags & SPELL_DISABLE_LOS) != 0;
}
break;
}
@ -358,9 +366,13 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
return false;
case DISABLE_TYPE_QUEST:
if (!unit)
{
return true;
}
if (Player const* player = unit->ToPlayer())
{
return !player->isGameMaster();
}
return true;
case DISABLE_TYPE_BATTLEGROUND:
case DISABLE_TYPE_OUTDOORPVP:

View file

@ -36,13 +36,17 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
recvPacket >> guid;
if (!GetPlayer()->duel) // ignore accept from duel-sender
{
return;
}
Player* pl = GetPlayer();
Player* plTarget = pl->duel->opponent;
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
{
return;
}
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: received CMSG_DUEL_ACCEPTED");
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
@ -62,7 +66,9 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
// no duel requested
if (!GetPlayer()->duel)
{
return;
}
// player surrendered in a duel using /forfeit
if (GetPlayer()->duel->startTime != 0)

View file

@ -49,7 +49,9 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry, time_t currenttime) const
((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)) < (mGameEvent[entry].length * MINUTE))
return true;
else
{
return false;
}
}
uint32 GameEventMgr::NextCheck(uint16 entry) const
@ -58,11 +60,15 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
// outdated event: we return max
if (currenttime > mGameEvent[entry].end)
{
return max_ge_check_delay;
}
// never started event, we return delay before start
if (mGameEvent[entry].start > currenttime)
{
return uint32(mGameEvent[entry].start - currenttime);
}
uint32 delay;
// in event, we return the end of it
@ -73,9 +79,13 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
delay = (mGameEvent[entry].occurence * MINUTE) - ((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE));
// In case the end is before next check
if (mGameEvent[entry].end < time_t(currenttime + delay))
{
return uint32(mGameEvent[entry].end - currenttime);
}
else
{
return delay;
}
}
void GameEventMgr::StartEvent(uint16 event_id, bool overwrite /*=false*/, bool resume /*=false*/)
@ -884,11 +894,15 @@ GameEventCreatureData const* GameEventMgr::GetCreatureUpdateDataForActiveEvent(u
}
if (!event_id)
{
return NULL;
}
for (GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr)
if (itr->first == lowguid)
{
return &itr->second;
}
return NULL;
}
@ -1020,7 +1034,9 @@ int16 GameEventMgr::GetGameEventId<Pool>(uint32 guid_or_poolid)
for (uint16 i = 0; i < mGameEventSpawnPoolIds.size(); ++i)
for (IdList::const_iterator itr = mGameEventSpawnPoolIds[i].begin(); itr != mGameEventSpawnPoolIds[i].end(); ++itr)
if (*itr == guid_or_poolid)
{
return i;
}
return 0;
}
@ -1032,11 +1048,15 @@ GameEventMgr::GameEventMgr()
bool GameEventMgr::IsActiveHoliday(HolidayIds id)
{
if (id == HOLIDAY_NONE)
{
return false;
}
for (GameEventMgr::ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr)
if (mGameEvent[*itr].holiday_id == id)
{
return true;
}
return false;
}

View file

@ -97,7 +97,9 @@ void GossipMenu::AddMenuItem(uint8 Icon, int32 itemText, uint32 dtSender, uint32
uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
{
if (ItemId >= m_gItems.size())
{
return 0;
}
return m_gItems[ ItemId ].m_gSender;
}
@ -105,7 +107,9 @@ uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
{
if (ItemId >= m_gItems.size())
{
return 0;
}
return m_gItems[ ItemId ].m_gOptionId;
}
@ -113,7 +117,9 @@ uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
bool GossipMenu::MenuItemCoded(unsigned int ItemId)
{
if (ItemId >= m_gItems.size())
{
return 0;
}
return m_gItems[ ItemId ].m_gCoded;
}
@ -356,7 +362,9 @@ void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon)
{
Quest const* qinfo = sObjectMgr.GetQuestTemplate(QuestId);
if (!qinfo)
{
return;
}
MANGOS_ASSERT(m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS);
@ -372,7 +380,9 @@ bool QuestMenu::HasItem(uint32 questid)
{
for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
if (i->m_qId == questid)
{
return true;
}
return false;
}

View file

@ -101,7 +101,9 @@ struct CoordPair
x_coord -= val;
}
else
{ x_coord = 0; }
{
x_coord = 0;
}
}
void operator>>(const uint32 val)
@ -111,7 +113,9 @@ struct CoordPair
x_coord += val;
}
else
{ x_coord = LIMIT - 1; }
{
x_coord = LIMIT - 1;
}
}
void operator-=(const uint32 val)
@ -121,7 +125,9 @@ struct CoordPair
y_coord -= val;
}
else
{ y_coord = 0; }
{
y_coord = 0;
}
}
void operator+=(const uint32 val)
@ -131,7 +137,9 @@ struct CoordPair
y_coord += val;
}
else
{ y_coord = LIMIT - 1; }
{
y_coord = LIMIT - 1;
}
}
CoordPair& normalize()
@ -179,7 +187,9 @@ namespace MaNGOS
c = MAP_HALFSIZE - 0.5;
}
else if (c < -(MAP_HALFSIZE - 0.5))
{ c = -(MAP_HALFSIZE - 0.5); }
{
c = -(MAP_HALFSIZE - 0.5);
}
}
inline bool IsValidMapCoord(float c)

View file

@ -88,7 +88,9 @@ bool GridMap::loadData(char* filename)
// Not return error if file not found
FILE* in = fopen(filename, "rb");
if (!in)
{
return true;
}
fread(&header, sizeof(header), 1, in);
if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) &&
@ -152,7 +154,9 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
fseek(in, offset, SEEK_SET);
fread(&header, sizeof(header), 1, in);
if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC)))
{
return false;
}
m_gridArea = header.gridArea;
if (!(header.flags & MAP_AREA_NO_AREA))
@ -170,7 +174,9 @@ bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
fseek(in, offset, SEEK_SET);
fread(&header, sizeof(header), 1, in);
if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC)))
{
return false;
}
m_gridHeight = header.gridHeight;
if (!(header.flags & MAP_HEIGHT_NO_HEIGHT))
@ -211,10 +217,14 @@ bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
bool GridMap::loadHolesData(FILE* in, uint32 offset, uint32 size)
{
if (fseek(in, offset, SEEK_SET) != 0)
{
return false;
}
if (fread(&m_holes, sizeof(m_holes), 1, in) != 1)
{
return false;
}
return true;
}
@ -224,7 +234,9 @@ bool GridMap::loadGridMapLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
fseek(in, offset, SEEK_SET);
fread(&header, sizeof(header), 1, in);
if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC)))
{
return false;
}
m_liquidType = header.liquidType;
m_liquid_offX = header.offsetX;
@ -254,7 +266,9 @@ bool GridMap::loadGridMapLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
uint16 GridMap::getArea(float x, float y)
{
if (!m_area_map)
{
return m_gridArea;
}
x = 16 * (32 - x / SIZE_OF_GRIDS);
y = 16 * (32 - y / SIZE_OF_GRIDS);
@ -283,7 +297,9 @@ bool GridMap::isHole(int row, int col) const
float GridMap::getHeightFromFloat(float x, float y) const
{
if (!m_V8 || !m_V9)
{
return INVALID_HEIGHT_VALUE;
}
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
@ -296,7 +312,9 @@ float GridMap::getHeightFromFloat(float x, float y) const
y_int &= (MAP_RESOLUTION - 1);
if (isHole(x_int, y_int))
{
return INVALID_HEIGHT_VALUE;
}
// Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid
// +--------------> X
@ -368,7 +386,9 @@ float GridMap::getHeightFromFloat(float x, float y) const
float GridMap::getHeightFromUint8(float x, float y) const
{
if (!m_uint8_V8 || !m_uint8_V9)
{
return m_gridHeight;
}
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
@ -436,7 +456,9 @@ float GridMap::getHeightFromUint8(float x, float y) const
float GridMap::getHeightFromUint16(float x, float y) const
{
if (!m_uint16_V8 || !m_uint16_V9)
{
return m_gridHeight;
}
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
@ -504,7 +526,9 @@ float GridMap::getHeightFromUint16(float x, float y) const
float GridMap::getLiquidLevel(float x, float y)
{
if (!m_liquid_map)
{
return m_liquidLevel;
}
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
@ -513,10 +537,14 @@ float GridMap::getLiquidLevel(float x, float y)
int cy_int = ((int)y & (MAP_RESOLUTION - 1)) - m_liquid_offX;
if (cx_int < 0 || cx_int >= m_liquid_height)
{
return INVALID_HEIGHT_VALUE;
}
if (cy_int < 0 || cy_int >= m_liquid_width)
{
return INVALID_HEIGHT_VALUE;
}
return m_liquid_map[cx_int * m_liquid_width + cy_int];
}
@ -524,7 +552,9 @@ float GridMap::getLiquidLevel(float x, float y)
uint8 GridMap::getTerrainType(float x, float y)
{
if (!m_liquidFlags)
{
return (uint8)m_liquidType;
}
x = 16 * (32 - x / SIZE_OF_GRIDS);
y = 16 * (32 - y / SIZE_OF_GRIDS);
@ -538,7 +568,9 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
{
// Check water type (if no water return)
if (!m_liquidFlags && !m_liquidType)
{
return LIQUID_MAP_NO_WATER;
}
// Get cell
float cx = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
@ -585,21 +617,29 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
}
if (type == 0)
{
return LIQUID_MAP_NO_WATER;
}
// Check req liquid type mask
if (ReqLiquidType && !(ReqLiquidType & type))
{
return LIQUID_MAP_NO_WATER;
}
// Check water level:
// Check water height map
int lx_int = x_int - m_liquid_offY;
if (lx_int < 0 || lx_int >= m_liquid_height)
{
return LIQUID_MAP_NO_WATER;
}
int ly_int = y_int - m_liquid_offX;
if (ly_int < 0 || ly_int >= m_liquid_width)
{
return LIQUID_MAP_NO_WATER;
}
// Get water level
float liquid_level = m_liquid_map ? m_liquid_map[lx_int * m_liquid_width + ly_int] : m_liquidLevel;
@ -609,7 +649,9 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
// Check water level and ground level
if (liquid_level < ground_level || z < ground_level - 2)
{
return LIQUID_MAP_NO_WATER;
}
// All ok in water -> store data
if (data)
@ -625,13 +667,19 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
// Get position delta
if (delta > 20) // Under water
{
return LIQUID_MAP_UNDER_WATER;
}
if (delta > 0) // In water
{
return LIQUID_MAP_IN_WATER;
}
if (delta > -1) // Walk on water
{
return LIQUID_MAP_WATER_WALK;
}
// Above water
return LIQUID_MAP_ABOVE_WATER;
}
@ -756,7 +804,9 @@ void TerrainInfo::CleanUpGrids(const uint32 diff)
{
i_timer.Update(diff);
if (!i_timer.Passed())
{
return;
}
for (int y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)
{
@ -803,7 +853,9 @@ int TerrainInfo::UnrefGrid(const uint32& x, const uint32& y)
LOCK_GUARD _lock(m_refMutex);
if (iRef > 0)
{
return (iRef -= 1);
}
return 0;
}
@ -853,7 +905,9 @@ float TerrainInfo::GetHeightStatic(float x, float y, float z, bool useVmaps/*=tr
// we are already under the surface or vmap height above map heigt
if (z < mapHeight || vmapHeight > mapHeight)
{
return vmapHeight;
}
else
return mapHeight; // better use .map surface height
}
@ -872,17 +926,23 @@ inline bool IsOutdoorWMO(uint32 mogpFlags, int32 adtId, int32 rootId, int32 grou
if (wmoEntry && atEntry)
{
if (atEntry->flags & AREA_FLAG_OUTSIDE)
{
return true;
}
if (atEntry->flags & AREA_FLAG_INSIDE)
{
return false;
}
}
outdoor = mogpFlags & 0x8;
if (wmoEntry)
{
if (wmoEntry->Flags & 4)
{
return true;
}
if ((wmoEntry->Flags & 2) != 0)
outdoor = false;
@ -897,7 +957,9 @@ bool TerrainInfo::IsOutdoors(float x, float y, float z) const
// no wmo found? -> outside by default
if (!GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
{
return true;
}
AreaTableEntry const* atEntry = 0;
WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
@ -923,8 +985,10 @@ bool TerrainInfo::GetAreaInfo(float x, float y, float z, uint32& flags, int32& a
float _mapheight = gmap->getHeight(x, y);
// z + 2.0f condition taken from GetHeightStatic(), not sure if it's such a great choice...
if (z + 2.0f > _mapheight && _mapheight > vmap_z)
{
return false;
}
}
return true;
}
return false;
@ -971,9 +1035,13 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool* isOutdoors) con
uint8 TerrainInfo::GetTerrainType(float x, float y) const
{
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
{
return gmap->getTerrainType(x, y);
}
else
{
return 0;
}
}
uint32 TerrainInfo::GetAreaId(float x, float y, float z) const
@ -1048,11 +1116,17 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
// Get position delta
if (delta > 20) // Under water
{
return LIQUID_MAP_UNDER_WATER;
}
if (delta > 0) // In water
{
return LIQUID_MAP_IN_WATER;
}
if (delta > -1) // Walk on water
{
return LIQUID_MAP_WATER_WALK;
}
result = LIQUID_MAP_ABOVE_WATER;
}
}
@ -1103,9 +1177,11 @@ bool TerrainInfo::IsSwimmable(float x, float y, float pZ, float radius /*= 1.5f*
if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr))
{
if (liquid_ptr->level - liquid_ptr->depth_level > radius) // is unit have enough space to swim
{
return true;
}
}
}
return false;
}
@ -1114,8 +1190,10 @@ bool TerrainInfo::IsUnderWater(float x, float y, float z) const
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
{
if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER)
{
return true;
}
}
return false;
}
@ -1228,7 +1306,9 @@ float TerrainInfo::GetWaterLevel(float x, float y, float z, float* pGround /*= N
GridMapLiquidStatus res = getLiquidStatus(x, y, ground_z, MAP_ALL_LIQUIDS, &liquid_status);
if (!res)
{
return VMAP_INVALID_HEIGHT_VALUE;
}
return liquid_status.level;
}
@ -1272,7 +1352,9 @@ TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
void TerrainManager::UnloadTerrain(const uint32 mapId)
{
if (sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
{
return;
}
Guard _guard(*this);
@ -1309,9 +1391,13 @@ uint32 TerrainManager::GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id)
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
if (entry)
{
return entry->ID;
}
else
{
return 0;
}
}
uint32 TerrainManager::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id)
@ -1319,9 +1405,13 @@ uint32 TerrainManager::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id)
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
if (entry)
{
return (entry->zone != 0) ? entry->zone : entry->ID;
}
else
{
return 0;
}
}
void TerrainManager::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag, uint32 map_id)

View file

@ -193,15 +193,21 @@ bool CannibalizeObjectCheck::operator()(Corpse* u)
{
// ignore bones
if (u->GetType() == CORPSE_BONES)
{
return false;
}
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGuid());
if (!owner || i_fobj->IsFriendlyTo(owner))
{
return false;
}
if (i_fobj->IsWithinDistInMap(u, i_range))
{
return true;
}
return false;
}
@ -214,8 +220,10 @@ void MaNGOS::RespawnDo::operator()(Creature* u) const
{
BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(u->GetGUIDLow());
if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2))
{
return;
}
}
u->Respawn();
}
@ -228,8 +236,10 @@ void MaNGOS::RespawnDo::operator()(GameObject* u) const
{
BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(u->GetGUIDLow());
if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2))
{
return;
}
}
u->Respawn();
}
@ -237,18 +247,26 @@ void MaNGOS::RespawnDo::operator()(GameObject* u) const
void MaNGOS::CallOfHelpCreatureInRangeDo::operator()(Creature* u)
{
if (u == i_funit)
{
return;
}
if (!u->CanAssistTo(i_funit, i_enemy, false))
{
return;
}
// too far
if (!i_funit->IsWithinDistInMap(u, i_range))
{
return;
}
// only if see assisted creature
if (!i_funit->IsWithinLOSInMap(u))
{
return;
}
if (u->AI())
u->AI()->AttackStart(i_enemy);
@ -257,18 +275,26 @@ void MaNGOS::CallOfHelpCreatureInRangeDo::operator()(Creature* u)
bool MaNGOS::AnyAssistCreatureInRangeCheck::operator()(Creature* u)
{
if (u == i_funit)
{
return false;
}
if (!u->CanAssistTo(i_funit, i_enemy))
{
return false;
}
// too far
if (!i_funit->IsWithinDistInMap(u, i_range))
{
return false;
}
// only if see assisted creature
if (!i_funit->IsWithinLOSInMap(u))
{
return false;
}
return true;
}

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