Code style (game + scripts only):

"if(" --> "if ("

--HG--
branch : trunk
This commit is contained in:
Spp
2010-04-07 19:14:10 +02:00
parent 2e127f7a30
commit d19e127080
254 changed files with 9517 additions and 9517 deletions
+18 -18
View File
@@ -39,18 +39,18 @@ AccountMgr::~AccountMgr()
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
{
if(utf8length(username) > MAX_ACCOUNT_STR)
if (utf8length(username) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG; // username's too long
normalizeString(username);
normalizeString(password);
if(GetId(username))
if (GetId(username))
{
return AOR_NAME_ALREDY_EXIST; // username does already exist
}
if(!loginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
if (!loginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
return AOR_DB_INTERNAL_ERROR; // unexpected error
loginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL");
@@ -60,7 +60,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
if(!result)
if (!result)
return AOR_NAME_NOT_EXIST; // account doesn't exist
result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'",accid);
@@ -73,7 +73,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER);
// kick if player currently
if(Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL))
if (Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL))
{
WorldSession* s = p->GetSession();
s->KickPlayer(); // mark session to remove at next session list update
@@ -97,7 +97,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
loginDatabase.CommitTransaction();
if(!res)
if (!res)
return AOR_DB_INTERNAL_ERROR; // unexpected error;
return AOR_OK;
@@ -106,13 +106,13 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
if(!result)
if (!result)
return AOR_NAME_NOT_EXIST; // account doesn't exist
if(utf8length(new_uname) > MAX_ACCOUNT_STR)
if (utf8length(new_uname) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG;
if(utf8length(new_passwd) > MAX_ACCOUNT_STR)
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
return AOR_PASS_TOO_LONG;
normalizeString(new_uname);
@@ -121,7 +121,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
std::string safe_new_uname = new_uname;
loginDatabase.escape_string(safe_new_uname);
if(!loginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(),
if (!loginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(),
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
return AOR_DB_INTERNAL_ERROR; // unexpected error
@@ -132,7 +132,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
{
std::string username;
if(!GetName(accid, username))
if (!GetName(accid, username))
return AOR_NAME_NOT_EXIST; // account doesn't exist
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
@@ -142,7 +142,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
normalizeString(new_passwd);
// also reset s and v to force update at next realmd login
if(!loginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'",
if (!loginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'",
CalculateShaPassHash(username, new_passwd).c_str(), accid))
return AOR_DB_INTERNAL_ERROR; // unexpected error
@@ -153,7 +153,7 @@ uint32 AccountMgr::GetId(std::string username)
{
loginDatabase.escape_string(username);
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
if(!result)
if (!result)
return 0;
else
{
@@ -165,7 +165,7 @@ uint32 AccountMgr::GetId(std::string username)
uint32 AccountMgr::GetSecurity(uint32 acc_id)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", acc_id);
if(result)
if (result)
{
uint32 sec = (*result)[0].GetUInt32();
return sec;
@@ -179,7 +179,7 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id)
QueryResult_AutoPtr result = (realm_id == -1)
? loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", acc_id, realm_id)
: loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", acc_id, realm_id);
if(result)
if (result)
{
uint32 sec = (*result)[0].GetUInt32();
return sec;
@@ -191,7 +191,7 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id)
bool AccountMgr::GetName(uint32 acc_id, std::string &name)
{
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
if(result)
if (result)
{
name = (*result)[0].GetCppString();
return true;
@@ -203,7 +203,7 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name)
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
{
std::string username;
if(!GetName(accid, username))
if (!GetName(accid, username))
return false;
normalizeString(username);
@@ -221,7 +221,7 @@ bool AccountMgr::normalizeString(std::string& utf8str)
wchar_t wstr_buf[MAX_ACCOUNT_STR+1];
size_t wstr_len = MAX_ACCOUNT_STR;
if(!Utf8toWStr(utf8str,wstr_buf,wstr_len))
if (!Utf8toWStr(utf8str,wstr_buf,wstr_len))
return false;
std::transform( &wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin );
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -43,7 +43,7 @@ AddonMgr::~AddonMgr()
void AddonMgr::LoadFromDB()
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, crc FROM addons");
if(!result)
if (!result)
{
sLog.outErrorDb("The table `addons` is empty");
return;
+25 -25
View File
@@ -28,7 +28,7 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
personal_rating = 0;
else
personal_rating += mod;
if(plr)
if (plr)
plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, personal_rating);
}
@@ -62,9 +62,9 @@ ArenaTeam::~ArenaTeam()
bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName)
{
if(!objmgr.GetPlayer(captainGuid)) // player not exist
if (!objmgr.GetPlayer(captainGuid)) // player not exist
return false;
if(objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist
if (objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist
return false;
sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid));
@@ -100,13 +100,13 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
uint8 plClass;
// arena team is full (can't have more than type * 2 players!)
if(GetMembersSize() >= GetType() * 2)
if (GetMembersSize() >= GetType() * 2)
return false;
Player *pl = objmgr.GetPlayer(PlayerGuid);
if(pl)
if (pl)
{
if(pl->GetArenaTeamId(GetSlot()))
if (pl->GetArenaTeamId(GetSlot()))
{
sLog.outError("Arena::AddMember() : player already in this sized team");
return false;
@@ -119,14 +119,14 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
{
// 0 1
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid));
if(!result)
if (!result)
return false;
plName = (*result)[0].GetCppString();
plClass = (*result)[1].GetUInt8();
// check if player already in arenateam of that size
if(Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0)
if (Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0)
{
sLog.outError("Arena::AddMember() : player already in this sized team");
return false;
@@ -162,14 +162,14 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, GUID_LOPART(newmember.guid), newmember.personal_rating );
if(pl)
if (pl)
{
pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType());
pl->SetArenaTeamIdInvited(0);
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating );
// hide promote/remove buttons
if(m_CaptainGuid != PlayerGuid)
if (m_CaptainGuid != PlayerGuid)
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
sLog.outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", pl->GetName(), pl->GetGUIDLow(), GetType(), GetId());
}
@@ -178,7 +178,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult)
{
if(!arenaTeamDataResult)
if (!arenaTeamDataResult)
return false;
Field *fields = arenaTeamDataResult->Fetch();
@@ -205,7 +205,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult)
bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult)
{
if(!arenaTeamMembersResult)
if (!arenaTeamMembersResult)
return false;
bool captainPresentInTeam = false;
@@ -253,7 +253,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult)
m_members.push_back(newmember);
}while (arenaTeamMembersResult->NextRow());
if(Empty() || !captainPresentInTeam)
if (Empty() || !captainPresentInTeam)
{
// arena team is empty or captain is not in team, delete from db
sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId);
@@ -267,7 +267,7 @@ void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
Player *oldcaptain = objmgr.GetPlayer(GetCaptain());
if(oldcaptain)
if (oldcaptain)
oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
// set new captain
@@ -278,7 +278,7 @@ void ArenaTeam::SetCaptain(const uint64& guid)
// enable remove/promote buttons
Player *newcaptain = objmgr.GetPlayer(guid);
if(newcaptain)
if (newcaptain)
{
newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0);
sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUIDLow(), GetId(), GetType());
@@ -296,7 +296,7 @@ void ArenaTeam::DelMember(uint64 guid)
}
}
if(Player *player = objmgr.GetPlayer(guid))
if (Player *player = objmgr.GetPlayer(guid))
{
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
// delete all info regarding this team
@@ -325,7 +325,7 @@ void ArenaTeam::Disband(WorldSession *session)
if (session)
{
if(Player *player = session->GetPlayer())
if (Player *player = session->GetPlayer())
sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
@@ -364,7 +364,7 @@ void ArenaTeam::Roster(WorldSession *session)
data << uint32(itr->games_season); // played this season
data << uint32(itr->wins_season); // wins this season
data << uint32(itr->personal_rating); // personal rating
if(unk308)
if (unk308)
{
data << float(0.0); // 308 unk
data << float(0.0); // 308 unk
@@ -410,7 +410,7 @@ void ArenaTeam::NotifyStatsChanged()
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player * plr = objmgr.GetPlayer(itr->guid);
if(plr)
if (plr)
Stats(plr->GetSession());
}
}
@@ -418,7 +418,7 @@ void ArenaTeam::NotifyStatsChanged()
void ArenaTeam::InspectStats(WorldSession *session, uint64 guid)
{
ArenaTeamMember* member = GetMember(guid);
if(!member)
if (!member)
return;
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6);
@@ -483,7 +483,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket *packet)
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player *player = objmgr.GetPlayer(itr->guid);
if(player)
if (player)
player->GetSession()->SendPacket(packet);
}
}
@@ -505,7 +505,7 @@ uint8 ArenaTeam::GetSlotByType( uint32 type )
bool ArenaTeam::HaveMember( const uint64& guid ) const
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if(itr->guid == guid)
if (itr->guid == guid)
return true;
return false;
@@ -605,7 +605,7 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
// called for each participant of a match after losing
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->guid == plr->GetGUID())
if (itr->guid == plr->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
@@ -629,7 +629,7 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating)
// called for offline player after ending rated arena match!
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->guid == guid)
if (itr->guid == guid)
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
@@ -653,7 +653,7 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
// called for each participant after winning a match
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->guid == plr->GetGUID())
if (itr->guid == plr->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
+2 -2
View File
@@ -156,7 +156,7 @@ class ArenaTeam
ArenaTeamMember* GetMember(const uint64& guid)
{
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if(itr->guid == guid)
if (itr->guid == guid)
return &(*itr);
return NULL;
@@ -165,7 +165,7 @@ class ArenaTeam
ArenaTeamMember* GetMember(const std::string& name)
{
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if(itr->name == name)
if (itr->name == name)
return &(*itr);
return NULL;
+34 -34
View File
@@ -37,13 +37,13 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
recv_data >> guid;
sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
if(Player *plr = objmgr.GetPlayer(guid))
if (Player *plr = objmgr.GetPlayer(guid))
{
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
{
if(uint32 a_id = plr->GetArenaTeamId(i))
if (uint32 a_id = plr->GetArenaTeamId(i))
{
if(ArenaTeam *at = objmgr.GetArenaTeamById(a_id))
if (ArenaTeam *at = objmgr.GetArenaTeamById(a_id))
at->InspectStats(this, plr->GetGUID());
}
}
@@ -57,7 +57,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data)
uint32 ArenaTeamId;
recv_data >> ArenaTeamId;
if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
if (ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
{
arenateam->Query(this);
arenateam->Stats(this);
@@ -71,7 +71,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data)
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
if(ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
if (ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId))
arenateam->Roster(this);
}
@@ -86,35 +86,35 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
recv_data >> ArenaTeamId >> Invitedname;
if(!Invitedname.empty())
if (!Invitedname.empty())
{
if(!normalizePlayerName(Invitedname))
if (!normalizePlayerName(Invitedname))
return;
player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str());
}
if(!player)
if (!player)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", Invitedname, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
if (player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW);
return;
}
ArenaTeam *arenateam = objmgr.GetArenaTeamById(ArenaTeamId);
if(!arenateam)
if (!arenateam)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM);
return;
}
// OK result but not send invite
if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
return;
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
@@ -123,19 +123,19 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
return;
}
if(player->GetArenaTeamId(arenateam->GetSlot()))
if (player->GetArenaTeamId(arenateam->GetSlot()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
if(player->GetArenaTeamIdInvited())
if (player->GetArenaTeamIdInvited())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
}
if(arenateam->GetMembersSize() >= arenateam->GetType() * 2)
if (arenateam->GetMembersSize() >= arenateam->GetType() * 2)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,arenateam->GetName(),"",ERR_ARENA_TEAM_FULL);
return;
@@ -158,10 +158,10 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
sLog.outDebug("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
if(!at)
if (!at)
return;
if(_player->GetArenaTeamId(at->GetSlot()))
if (_player->GetArenaTeamId(at->GetSlot()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
return;
@@ -173,7 +173,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
return;
}
if(!at->AddMember(_player->GetGUID()))
if (!at->AddMember(_player->GetGUID()))
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ARENA_TEAM_INTERNAL);// arena team not found
return;
@@ -200,10 +200,10 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
recv_data >> ArenaTeamId;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
if(!at)
if (!at)
return;
if(_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
if (_player->GetGUID() == at->GetCaptain() && at->GetMembersSize() > 1)
{
// check for correctness
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
@@ -211,7 +211,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
}
// arena team has only one member (=captain)
if(_player->GetGUID() == at->GetCaptain())
if (_player->GetGUID() == at->GetCaptain())
{
at->Disband(this);
delete at;
@@ -236,12 +236,12 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
uint32 ArenaTeamId; // arena team id
recv_data >> ArenaTeamId;
if(ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId))
if (ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId))
{
if(at->GetCaptain() != _player->GetGUID())
if (at->GetCaptain() != _player->GetGUID())
return;
if(at->IsFighting())
if (at->IsFighting())
return;
at->Disband(this);
@@ -260,26 +260,26 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
recv_data >> name;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
if(!at) // arena team not found
if (!at) // arena team not found
return;
if(at->GetCaptain() != _player->GetGUID())
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if(!normalizePlayerName(name))
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if(!member) // member not found
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if(at->GetCaptain() == member->guid)
if (at->GetCaptain() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
@@ -304,26 +304,26 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
recv_data >> name;
ArenaTeam *at = objmgr.GetArenaTeamById(ArenaTeamId);
if(!at) // arena team not found
if (!at) // arena team not found
return;
if(at->GetCaptain() != _player->GetGUID())
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if(!normalizePlayerName(name))
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if(!member) // member not found
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if(at->GetCaptain() == member->guid) // target player already captain
if (at->GetCaptain() == member->guid) // target player already captain
return;
at->SetCaptain(member->guid);
@@ -374,7 +374,7 @@ void WorldSession::SendNotInArenaTeamPacket(uint8 type)
WorldPacket data(SMSG_ARENA_ERROR, 4+1); // 886 - You are not in a %uv%u arena team
uint32 unk = 0;
data << uint32(unk); // unk(0)
if(!unk)
if (!unk)
data << uint8(type); // team type (2=2v2,3=3v3,5=5v5), can be used for custom types...
SendPacket(&data);
}
+12 -12
View File
@@ -41,7 +41,7 @@ Bag::~Bag()
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
if (Item *item = m_bagslot[i])
{
if(item->IsInWorld())
if (item->IsInWorld())
{
sLog.outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
@@ -57,14 +57,14 @@ void Bag::AddToWorld()
Item::AddToWorld();
for (uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i])
if (m_bagslot[i])
m_bagslot[i]->AddToWorld();
}
void Bag::RemoveFromWorld()
{
for (uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i])
if (m_bagslot[i])
m_bagslot[i]->RemoveFromWorld();
Item::RemoveFromWorld();
@@ -74,7 +74,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
{
ItemPrototype const * itemProto = objmgr.GetItemPrototype(itemid);
if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
return false;
Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
@@ -110,7 +110,7 @@ void Bag::SaveToDB()
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result)
{
if(!Item::LoadFromDB(guid, owner_guid, result))
if (!Item::LoadFromDB(guid, owner_guid, result))
return false;
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
@@ -177,7 +177,7 @@ void Bag::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) co
Item::BuildCreateUpdateBlockForPlayer( data, target );
for (uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i])
if (m_bagslot[i])
m_bagslot[i]->BuildCreateUpdateBlockForPlayer( data, target );
}
@@ -198,16 +198,16 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const
for (uint32 i=0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
if( pItem && pItem != eItem && pItem->GetEntry() == item )
if ( pItem && pItem != eItem && pItem->GetEntry() == item )
count += pItem->GetCount();
}
if(eItem && eItem->GetProto()->GemProperties)
if (eItem && eItem->GetProto()->GemProperties)
{
for (uint32 i=0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
if( pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color )
if ( pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color )
count += pItem->GetGemCountWithID(item);
}
}
@@ -218,8 +218,8 @@ uint32 Bag::GetItemCount( uint32 item, Item* eItem ) const
uint8 Bag::GetSlotByItemGUID(uint64 guid) const
{
for (uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i] != 0)
if(m_bagslot[i]->GetGUID() == guid)
if (m_bagslot[i] != 0)
if (m_bagslot[i]->GetGUID() == guid)
return i;
return NULL_SLOT;
@@ -227,7 +227,7 @@ uint8 Bag::GetSlotByItemGUID(uint64 guid) const
Item* Bag::GetItemByPos( uint8 slot ) const
{
if( slot < GetBagSize() )
if ( slot < GetBagSize() )
return m_bagslot[slot];
return NULL;
+32 -32
View File
@@ -530,7 +530,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
continue;
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if (!team) team = plr->GetTeam();
if (team == TeamID)
plr->GetSession()->SendPacket(packet);
@@ -561,7 +561,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
}
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if (!team) team = plr->GetTeam();
if (team == TeamID)
{
@@ -586,7 +586,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
}
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if (!team) team = plr->GetTeam();
if (team == TeamID)
plr->CastSpell(plr, SpellID, true);
@@ -599,7 +599,7 @@ void BattleGround::YellToAll(Creature* creature, const char* text, uint32 langua
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
Player *plr = objmgr.GetPlayer(itr->first);
if(!plr)
if (!plr)
{
sLog.outError("BattleGround: Player " UI64FMTD " not found!", itr->first);
continue;
@@ -624,7 +624,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
}
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if (!team) team = plr->GetTeam();
if (team == TeamID)
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
@@ -651,7 +651,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
}
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
if (!team) team = plr->GetTeam();
if (team == TeamID)
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
@@ -755,7 +755,7 @@ void BattleGround::EndBattleGround(uint32 winner)
}
// should remove spirit of redemption
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive())
@@ -771,7 +771,7 @@ void BattleGround::EndBattleGround(uint32 winner)
}
//this line is obsolete - team is set ALWAYS
//if(!team) team = plr->GetTeam();
//if (!team) team = plr->GetTeam();
// per player calculation
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
@@ -800,7 +800,7 @@ void BattleGround::EndBattleGround(uint32 winner)
RewardQuestComplete(plr);
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
}
else if(winner)
else if (winner)
RewardMark(plr,ITEM_LOSER_COUNT);
plr->SetHealth(plr->GetMaxHealth());
@@ -892,7 +892,7 @@ void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id)
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
if(!spellInfo)
if (!spellInfo)
{
sLog.outError("Battleground reward casting spell %u not exist.",spell_id);
return;
@@ -911,16 +911,16 @@ void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count)
uint32 no_space_count = 0;
uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count );
if( msg == EQUIP_ERR_ITEM_NOT_FOUND)
if ( msg == EQUIP_ERR_ITEM_NOT_FOUND)
{
sLog.outErrorDb("Battleground reward item (Entry %u) not exist in `item_template`.",item_id);
return;
}
if( msg != EQUIP_ERR_OK ) // convert to possible store amount
if ( msg != EQUIP_ERR_OK ) // convert to possible store amount
count -= no_space_count;
if( count != 0 && !dest.empty()) // can add some
if ( count != 0 && !dest.empty()) // can add some
if (Item* item = plr->StoreNewItem( dest, item_id, true, 0))
plr->SendNewItem(item,count,true,false);
@@ -1021,10 +1021,10 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
Player *plr = objmgr.GetPlayer(guid);
// should remove spirit of redemption
if(plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if(plr && !plr->isAlive()) // resurrect on exit
if (plr && !plr->isAlive()) // resurrect on exit
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
@@ -1032,7 +1032,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
RemovePlayer(plr, guid); // BG subclass specific code
if(participant) // if the player was a match participant, remove auras, calc rating, update queue
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
{
BattleGroundTypeId bgTypeId = GetTypeID();
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
@@ -1040,7 +1040,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
{
plr->ClearAfkReports();
if(!team) team = plr->GetTeam();
if (!team) team = plr->GetTeam();
// if arena, remove the specific arena auras
if (isArena())
@@ -1087,7 +1087,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
// remove from raid group if player is member
if (Group *group = GetBgRaid(team))
{
if( !group->RemoveMember(guid, 0) ) // group was disbanded
if ( !group->RemoveMember(guid, 0) ) // group was disbanded
{
SetBgRaid(team, NULL);
delete group;
@@ -1163,7 +1163,7 @@ void BattleGround::StartBattleGround()
// This must be done here, because we need to have already invited some players when first BG::Update() method is executed
// and it doesn't matter if we call StartBattleGround() more times, because m_BattleGrounds is a map and instance id never changes
sBattleGroundMgr.AddBattleGround(GetInstanceID(), GetTypeID(), this);
if(m_IsRated)
if (m_IsRated)
sLog.outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
@@ -1204,7 +1204,7 @@ void BattleGround::AddPlayer(Player *plr)
plr->RemoveArenaSpellCooldowns();
plr->RemoveArenaAuras();
plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT);
if(team == ALLIANCE) // gold
if (team == ALLIANCE) // gold
{
if (plr->GetTeam() == HORDE)
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true);
@@ -1222,7 +1222,7 @@ void BattleGround::AddPlayer(Player *plr)
plr->DestroyConjuredItems(true);
plr->UnsummonPetTemporaryIfAny();
if(GetStatus() == STATUS_WAIT_JOIN) // not started yet
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
@@ -1232,7 +1232,7 @@ void BattleGround::AddPlayer(Player *plr)
}
else
{
if(GetStatus() == STATUS_WAIT_JOIN) // not started yet
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
@@ -1251,7 +1251,7 @@ void BattleGround::AddPlayer(Player *plr)
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team)
{
Group* group = GetBgRaid(team);
if(!group) // first player joined
if (!group) // first player joined
{
group = new Group;
SetBgRaid(team, group);
@@ -1368,7 +1368,7 @@ uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const
if (otherTeam == GetInvitedCount(Team))
diff = 1;
// allow join more ppl if the other side has more players
else if(otherTeam > GetInvitedCount(Team))
else if (otherTeam > GetInvitedCount(Team))
diff = otherTeam - GetInvitedCount(Team);
// difference based on max players per team (don't allow inviting more)
@@ -1406,7 +1406,7 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
//this procedure is called from virtual function implemented in bg subclass
BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
@@ -1484,7 +1484,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
// so we must create it specific for this instance
GameObject * go = new GameObject;
if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
{
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
@@ -1559,7 +1559,7 @@ void BattleGround::DoorOpen(uint32 type)
GameObject* BattleGround::GetBGObject(uint32 type)
{
GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
if(!obj)
if (!obj)
sLog.outError("couldn't get gameobject %i",type);
return obj;
}
@@ -1567,7 +1567,7 @@ GameObject* BattleGround::GetBGObject(uint32 type)
Creature* BattleGround::GetBGCreature(uint32 type)
{
Creature *creature = GetBgMap()->GetCreature(m_BgCreatures[type]);
if(!creature)
if (!creature)
sLog.outError("couldn't get creature %i",type);
return creature;
}
@@ -1887,7 +1887,7 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
void BattleGround::SetHoliday(bool is_holiday)
{
if(is_holiday)
if (is_holiday)
m_HonorMode = BG_HOLIDAY;
else
m_HonorMode = BG_NORMAL;
@@ -1896,7 +1896,7 @@ void BattleGround::SetHoliday(bool is_holiday)
int32 BattleGround::GetObjectType(uint64 guid)
{
for (uint32 i = 0; i < m_BgObjects.size(); ++i)
if(m_BgObjects[i] == guid)
if (m_BgObjects[i] == guid)
return i;
sLog.outError("BattleGround: cheating? a player used a gameobject which isnt supposed to be a usable object!");
return -1;
@@ -1923,8 +1923,8 @@ void BattleGround::UpdateArenaWorldState()
void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid )
{
Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
if(old_raid) old_raid->SetBattlegroundGroup(NULL);
if(bg_raid) bg_raid->SetBattlegroundGroup(this);
if (old_raid) old_raid->SetBattlegroundGroup(NULL);
if (bg_raid) bg_raid->SetBattlegroundGroup(this);
old_raid = bg_raid;
}
+1 -1
View File
@@ -668,7 +668,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if( itr == m_PlayerScores.end() ) // player not found...
if ( itr == m_PlayerScores.end() ) // player not found...
return;
switch(type)
+1 -1
View File
@@ -74,7 +74,7 @@ void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 valu
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source,type,value);
+149 -149
View File
@@ -51,7 +51,7 @@ const uint16 BattleGroundAV::GetBonusHonor(uint8 kills) //TODO: move this functi
void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
{
if(GetStatus() != STATUS_IN_PROGRESS)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
BattleGround::HandleKillPlayer(player, killer);
@@ -61,10 +61,10 @@ void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
{
sLog.outDebug("bg_av HandleKillUnit %i",unit->GetEntry());
if(GetStatus() != STATUS_IN_PROGRESS)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 entry = unit->GetEntry();
if(entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
{
CastSpellOnTeam(23658,HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729,BG_AV_REP_BOSS,HORDE);
@@ -78,9 +78,9 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),ALLIANCE);
EndBattleGround(ALLIANCE);
}
else if(entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
{
if(!m_CaptainAlive[0])
if (!m_CaptainAlive[0])
{
sLog.outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
@@ -93,13 +93,13 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
for (uint8 i=0; i<=9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+i,RESPAWN_IMMEDIATELY);
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if(creature)
if (creature)
YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL);
}
else if ( entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0] )
{
if(!m_CaptainAlive[1])
if (!m_CaptainAlive[1])
{
sLog.outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
@@ -112,7 +112,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
for (uint8 i=0; i<=9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_HORDE+i,RESPAWN_IMMEDIATELY);
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if(creature)
if (creature)
YellToAll(creature,GetTrinityString(LANG_BG_AV_H_CAPTAIN_DEAD),LANG_UNIVERSAL);
}
else if ( entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4][0])
@@ -135,7 +135,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
case AV_QUEST_H_SCRAPS1:
case AV_QUEST_H_SCRAPS2:
m_Team_QuestStatus[team][0]+=20;
if(m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25,50,75 turn ins
if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25,50,75 turn ins
{
sLog.outDebug("BG_AV Quest %i completed starting with unit upgrading..",questid);
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
@@ -151,21 +151,21 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
case AV_QUEST_H_COMMANDER1:
m_Team_QuestStatus[team][1]++;
RewardReputationToTeam(team,1,player->GetTeam());
if(m_Team_QuestStatus[team][1] == 30)
if (m_Team_QuestStatus[team][1] == 30)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_COMMANDER2:
case AV_QUEST_H_COMMANDER2:
m_Team_QuestStatus[team][2]++;
RewardReputationToTeam(team,1,player->GetTeam());
if(m_Team_QuestStatus[team][2] == 60)
if (m_Team_QuestStatus[team][2] == 60)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_COMMANDER3:
case AV_QUEST_H_COMMANDER3:
m_Team_QuestStatus[team][3]++;
RewardReputationToTeam(team,1,player->GetTeam());
if(m_Team_QuestStatus[team][1] == 120)
if (m_Team_QuestStatus[team][1] == 120)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_BOSS1:
@@ -174,46 +174,46 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
case AV_QUEST_A_BOSS2:
case AV_QUEST_H_BOSS2:
m_Team_QuestStatus[team][4]++;
if(m_Team_QuestStatus[team][4] >= 200)
if (m_Team_QuestStatus[team][4] >= 200)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
break;
case AV_QUEST_A_NEAR_MINE:
case AV_QUEST_H_NEAR_MINE:
m_Team_QuestStatus[team][5]++;
if(m_Team_QuestStatus[team][5] == 28)
if (m_Team_QuestStatus[team][5] == 28)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
if(m_Team_QuestStatus[team][6] == 7)
if (m_Team_QuestStatus[team][6] == 7)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - ground assault ready",questid);
}
break;
case AV_QUEST_A_OTHER_MINE:
case AV_QUEST_H_OTHER_MINE:
m_Team_QuestStatus[team][6]++;
if(m_Team_QuestStatus[team][6] == 7)
if (m_Team_QuestStatus[team][6] == 7)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
if(m_Team_QuestStatus[team][5] == 20)
if (m_Team_QuestStatus[team][5] == 20)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - ground assault ready",questid);
}
break;
case AV_QUEST_A_RIDER_HIDE:
case AV_QUEST_H_RIDER_HIDE:
m_Team_QuestStatus[team][7]++;
if(m_Team_QuestStatus[team][7] == 25)
if (m_Team_QuestStatus[team][7] == 25)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
if(m_Team_QuestStatus[team][8] == 25)
if (m_Team_QuestStatus[team][8] == 25)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - rider assault ready",questid);
}
break;
case AV_QUEST_A_RIDER_TAME:
case AV_QUEST_H_RIDER_TAME:
m_Team_QuestStatus[team][8]++;
if(m_Team_QuestStatus[team][8] == 25)
if (m_Team_QuestStatus[team][8] == 25)
{
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid);
if(m_Team_QuestStatus[team][7] == 25)
if (m_Team_QuestStatus[team][7] == 25)
sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - rider assault ready",questid);
}
break;
@@ -231,14 +231,14 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points )
m_Team_Scores[teamindex] += points;
UpdateWorldState(((teamindex==BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
if( points < 0)
if ( points < 0)
{
if( m_Team_Scores[teamindex] < 1)
if ( m_Team_Scores[teamindex] < 1)
{
m_Team_Scores[teamindex]=0;
EndBattleGround(((teamindex==BG_TEAM_HORDE)?ALLIANCE:HORDE));
}
else if(!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
{
SendMessageToAll(teamindex==BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex==BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
@@ -274,7 +274,7 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
if ((isStatic && cinfoid>=10 && cinfoid<=14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3) ||
(cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
{
if(!isStatic && ((cinfoid>=AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3)
if (!isStatic && ((cinfoid>=AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3)
|| (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
{
CreatureData &data = objmgr.NewOrExistCreatureData(creature->GetDBTableGUIDLow());
@@ -299,28 +299,28 @@ void BattleGroundAV::Update(uint32 diff)
{
BattleGround::Update(diff);
if(GetStatus() == STATUS_IN_PROGRESS)
if (GetStatus() == STATUS_IN_PROGRESS)
{
for (uint8 i=0; i<=1; i++)//0=alliance, 1=horde
{
if(!m_CaptainAlive[i])
if (!m_CaptainAlive[i])
continue;
if(m_CaptainBuffTimer[i] > diff)
if (m_CaptainBuffTimer[i] > diff)
m_CaptainBuffTimer[i] -= diff;
else
{
if(i==0)
if (i==0)
{
CastSpellOnTeam(AV_BUFF_A_CAPTAIN,ALLIANCE);
Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61);
if(creature)
if (creature)
YellToAll(creature,LANG_BG_AV_A_CAPTAIN_BUFF,LANG_COMMON);
}
else
{
CastSpellOnTeam(AV_BUFF_H_CAPTAIN,HORDE);
Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature
if(creature)
if (creature)
YellToAll(creature,LANG_BG_AV_H_CAPTAIN_BUFF,LANG_ORCISH);
}
m_CaptainBuffTimer[i] = 120000 + urand(0,4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
@@ -330,26 +330,26 @@ void BattleGroundAV::Update(uint32 diff)
m_Mine_Timer -=diff;
for (uint8 mine=0; mine <2; mine++)
{
if(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE)
if (m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE)
{
if( m_Mine_Timer <= 0)
if ( m_Mine_Timer <= 0)
UpdateScore(m_Mine_Owner[mine],1);
if(m_Mine_Reclaim_Timer[mine] > diff)
if (m_Mine_Reclaim_Timer[mine] > diff)
m_Mine_Reclaim_Timer[mine] -= diff;
else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
ChangeMineOwner(mine,AV_NEUTRAL_TEAM);
}
}
}
if( m_Mine_Timer <= 0)
if ( m_Mine_Timer <= 0)
m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
//looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
if(m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
{
if(m_Nodes[i].Timer > diff)
if (m_Nodes[i].Timer > diff)
m_Nodes[i].Timer -= diff;
else
EventPlayerDestroyedPoint( i);
@@ -386,7 +386,7 @@ void BattleGroundAV::AddPlayer(Player *plr)
//create score and add it to map, default values are set in constructor
BattleGroundAVScore* sc = new BattleGroundAVScore;
m_PlayerScores[plr->GetGUID()] = sc;
if(m_MaxLevel==0)
if (m_MaxLevel==0)
m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
}
@@ -399,9 +399,9 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
uint8 rep[2]={0,0}; //0=ally 1=horde
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
{
if(m_Nodes[i].State == POINT_CONTROLED)
if (m_Nodes[i].State == POINT_CONTROLED)
{
if(m_Nodes[i].Owner == ALLIANCE)
if (m_Nodes[i].Owner == ALLIANCE)
{
rep[0] += BG_AV_REP_SURVIVING_TOWER;
kills[0] += BG_AV_KILL_SURVIVING_TOWER;
@@ -416,14 +416,14 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
for (int i=0; i<=1; i++) //0=ally 1=horde
{
if(m_CaptainAlive[i])
if (m_CaptainAlive[i])
{
kills[i] += BG_AV_KILL_SURVIVING_CAPTAIN;
rep[i] += BG_AV_REP_SURVIVING_CAPTAIN;
}
if(rep[i] != 0)
if (rep[i] != 0)
RewardReputationToTeam((i == 0)?730:729,rep[i],(i == 0)?ALLIANCE:HORDE);
if(kills[i] != 0)
if (kills[i] != 0)
RewardHonorToTeam(GetBonusHonor(kills[i]),(i == 0)?ALLIANCE:HORDE);
}
@@ -433,7 +433,7 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
{
if(!plr)
if (!plr)
{
sLog.outError("bg_AV no player at remove");
return;
@@ -455,13 +455,13 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
case 95:
case 2608:
if(Source->GetTeam() != ALLIANCE)
if (Source->GetTeam() != ALLIANCE)
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
else
Source->LeaveBattleground();
break;
case 2606:
if(Source->GetTeam() != HORDE)
if (Source->GetTeam() != HORDE)
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
else
Source->LeaveBattleground();
@@ -488,7 +488,7 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
@@ -532,11 +532,11 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
UpdateNodeWorldState(node);
uint32 owner = m_Nodes[node].Owner;
if( IsTower(node) )
if ( IsTower(node) )
{
uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH;
//despawn marshal
if(m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
if (m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else
sLog.outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist",AV_CPLACE_A_MARSHAL_SOUTH + tmp);
@@ -553,14 +553,14 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
}
else
{
if( owner == ALLIANCE )
if ( owner == ALLIANCE )
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_IMMEDIATELY);
PopulateNode(node);
if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
for (uint8 i = 0; i < 4; i++)
{
@@ -571,13 +571,13 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
}
//send a nice message to all :)
char buf[256];
if(IsTower(node))
if (IsTower(node))
sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE) );
else
sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE) );
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if(creature)
if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
}
@@ -585,25 +585,25 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
{ //mine=0 northmine mine=1 southmin
//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
assert(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
if(team != ALLIANCE && team != HORDE)
if (team != ALLIANCE && team != HORDE)
team = AV_NEUTRAL_TEAM;
else
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
if(m_Mine_Owner[mine] == team && !initial)
if (m_Mine_Owner[mine] == team && !initial)
return;
m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
m_Mine_Owner[mine] = team;
if(!initial)
if (!initial)
{
sLog.outDebug("bg_av depopulating mine %i (0=north,1=south)",mine);
if(mine==AV_SOUTH_MINE)
if (mine==AV_SOUTH_MINE)
for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
if( m_BgCreatures[i] )
if ( m_BgCreatures[i] )
DelCreature(i); //TODO just set the respawntime to 999999
for (uint16 i=((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine==AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++)
if( m_BgCreatures[i] )
if ( m_BgCreatures[i] )
DelCreature(i); //TODO here also
}
SendMineWorldStates(mine);
@@ -611,9 +611,9 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
sLog.outDebug("bg_av populating mine %i (0=north,1=south)",mine);
uint16 miner;
//also neutral team exists.. after a big time, the neutral team tries to conquer the mine
if(mine==AV_NORTH_MINE)
if (mine==AV_NORTH_MINE)
{
if(team == ALLIANCE)
if (team == ALLIANCE)
miner = AV_NPC_N_MINE_A_1;
else if (team == HORDE)
miner = AV_NPC_N_MINE_H_1;
@@ -623,7 +623,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
else
{
uint16 cinfo;
if(team == ALLIANCE)
if (team == ALLIANCE)
miner = AV_NPC_S_MINE_A_1;
else if (team == HORDE)
miner = AV_NPC_S_MINE_H_1;
@@ -631,7 +631,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
miner = AV_NPC_S_MINE_N_1;
//vermin
sLog.outDebug("spawning vermin");
if(team == ALLIANCE)
if (team == ALLIANCE)
cinfo = AV_NPC_S_MINE_A_3;
else if (team == HORDE)
cinfo = AV_NPC_S_MINE_H_3;
@@ -651,18 +651,18 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
// {
//TODO: add gameobject-update code
// }
if(team == ALLIANCE || team == HORDE)
if (team == ALLIANCE || team == HORDE)
{
m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER;
char buf[256];
sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString(( mine == AV_NORTH_MINE ) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if(creature)
if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
}
else
{
if(mine==AV_SOUTH_MINE) //i think this gets called all the time
if (mine==AV_SOUTH_MINE) //i think this gets called all the time
{
Creature* creature = GetBGCreature(AV_CPLACE_MINE_S_3);
YellToAll(creature,LANG_BG_AV_S_MINE_BOSS_CLAIMS,LANG_UNIVERSAL);
@@ -673,9 +673,9 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
{
if(GOId == BG_AV_OBJECTID_MINE_N)
if (GOId == BG_AV_OBJECTID_MINE_N)
return (m_Mine_Owner[AV_NORTH_MINE]==team);
if(GOId == BG_AV_OBJECTID_MINE_S)
if (GOId == BG_AV_OBJECTID_MINE_S)
return (m_Mine_Owner[AV_SOUTH_MINE]==team);
return true; //cause it's no mine'object it is ok if this is true
}
@@ -687,7 +687,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node );
uint32 creatureid;
if(IsTower(node))
if (IsTower(node))
creatureid=(owner==ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
else
{
@@ -701,9 +701,9 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
else
creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
//spiritguide
if( m_BgCreatures[node] )
if ( m_BgCreatures[node] )
DelCreature(node);
if( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
if ( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
sLog.outError("AV: couldn't spawn spiritguide at node %i",node);
}
@@ -716,29 +716,29 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
{
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node );
for (uint8 i=0; i<4; i++)
if( m_BgCreatures[c_place+i] )
if ( m_BgCreatures[c_place+i] )
DelCreature(c_place+i);
//spiritguide
if( !IsTower(node) && m_BgCreatures[node] )
if ( !IsTower(node) && m_BgCreatures[node] )
DelCreature(node);
}
const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
{
sLog.outDebug("bg_AV getnodethroughobject %i",object);
if( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER )
if ( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER )
return BG_AV_Nodes(object);
if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT )
if ( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT )
return BG_AV_Nodes(object - 11);
if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER )
if ( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER )
return BG_AV_Nodes(object - 7);
if( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER )
if ( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER )
return BG_AV_Nodes(object -22);
if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT )
if ( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT )
return BG_AV_Nodes(object - 33);
if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER )
if ( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER )
return BG_AV_Nodes(object - 29);
if( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE )
if ( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE )
return BG_AV_NODES_SNOWFALL_GRAVE;
sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :(");
assert(false);
@@ -748,29 +748,29 @@ const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
{ //this function is the counterpart to GetNodeThroughObject()
sLog.outDebug("bg_AV GetObjectThroughNode %i",node);
if( m_Nodes[node].Owner == ALLIANCE )
if ( m_Nodes[node].Owner == ALLIANCE )
{
if( m_Nodes[node].State == POINT_ASSAULTED )
if ( m_Nodes[node].State == POINT_ASSAULTED )
{
if( node <= BG_AV_NODES_FROSTWOLF_HUT )
if ( node <= BG_AV_NODES_FROSTWOLF_HUT )
return node+11;
if( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
if ( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
return node+7;
}
else if ( m_Nodes[node].State == POINT_CONTROLED )
if( node <= BG_AV_NODES_STONEHEART_BUNKER )
if ( node <= BG_AV_NODES_STONEHEART_BUNKER )
return node;
}
else if ( m_Nodes[node].Owner == HORDE )
{
if( m_Nodes[node].State == POINT_ASSAULTED )
if( node <= BG_AV_NODES_STONEHEART_BUNKER )
if ( m_Nodes[node].State == POINT_ASSAULTED )
if ( node <= BG_AV_NODES_STONEHEART_BUNKER )
return node+22;
else if ( m_Nodes[node].State == POINT_CONTROLED )
{
if( node <= BG_AV_NODES_FROSTWOLF_HUT )
if ( node <= BG_AV_NODES_FROSTWOLF_HUT )
return node+33;
if( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
if ( node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER)
return node+29;
}
}
@@ -785,11 +785,11 @@ const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
{
if(GetStatus() != STATUS_IN_PROGRESS)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
int32 object = GetObjectType(target_obj->GetGUID());
sLog.outDebug("BG_AV using gameobject %i with type %i",target_obj->GetEntry(),object);
if(object < 0)
if (object < 0)
return;
switch(target_obj->GetEntry())
{
@@ -819,28 +819,28 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner
uint32 team = player->GetTeam();
if(owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
if (owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
return;
if(m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
{ //until snowfall doesn't belong to anyone it is better handled in assault-code
assert(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
EventPlayerAssaultsPoint(player,object);
return;
}
sLog.outDebug("player defends point object: %i node: %i",object,node);
if(m_Nodes[node].PrevOwner != team)
if (m_Nodes[node].PrevOwner != team)
{
sLog.outError("BG_AV: player defends point which doesn't belong to his team %i",node);
return;
}
//spawn new go :)
if(m_Nodes[node].Owner == ALLIANCE)
if (m_Nodes[node].Owner == ALLIANCE)
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner
else
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner
if(!IsTower(node))
if (!IsTower(node))
{
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(team)+3*node,RESPAWN_IMMEDIATELY);
@@ -852,7 +852,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
PopulateNode(node);
UpdateNodeWorldState(node);
if(IsTower(node))
if (IsTower(node))
{
//spawn big flag+aura on top of tower
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
@@ -860,7 +860,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
}
else if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
{
for (uint8 i = 0; i < 4; i++)
{
@@ -872,11 +872,11 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
char buf[256];
sprintf(buf, GetTrinityString(( IsTower(node) ) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if(creature)
if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
//update the statistic for the defending player
UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1);
if(IsTower(node))
if (IsTower(node))
PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND);
else
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
@@ -890,31 +890,31 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner
uint32 team = player->GetTeam();
sLog.outDebug("bg_av: player assaults point object %i node %i",object,node);
if(owner == team || team == m_Nodes[node].TotalOwner)
if (owner == team || team == m_Nodes[node].TotalOwner)
return; //surely a gm used this object
if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
{
if(object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
{
assert(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM);
if( team == ALLIANCE )
if ( team == ALLIANCE )
SpawnBGObject(BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_IMMEDIATELY); //neutral aura spawn
}
else if(m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
else if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
{
assert(m_Nodes[node].State != POINT_CONTROLED);
if(team == ALLIANCE)
if (team == ALLIANCE)
SpawnBGObject(object-11, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+11, RESPAWN_IMMEDIATELY);
}
//eyecandy
uint32 spawn,despawn;
if(team == ALLIANCE)
if (team == ALLIANCE)
{
despawn = ( m_Nodes[node].State == POINT_ASSAULTED )?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H;
spawn = BG_AV_OBJECT_SNOW_EYECANDY_PA;
@@ -932,14 +932,14 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
}
//if snowfall gots capped it can be handled like all other graveyards
if( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
if ( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
{
assert(m_Nodes[node].Owner != AV_NEUTRAL_TEAM);
if(team == ALLIANCE)
if (team == ALLIANCE)
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY);
if(IsTower(node))
if (IsTower(node))
{ //spawning/despawning of bigflag+aura
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team==ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team==HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
@@ -953,16 +953,16 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_ONE_DAY); //teeamaura despawn
// Those who are waiting to resurrect at this object are taken to the closest own object's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
if( !ghost_list.empty() )
if ( !ghost_list.empty() )
{
Player *plr;
WorldSafeLocsEntry const *ClosestGrave = NULL;
for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
plr = objmgr.GetPlayer(*ghost_list.begin());
if( !plr )
if ( !plr )
continue;
if(!ClosestGrave)
if (!ClosestGrave)
ClosestGrave = GetClosestGraveYard(plr);
else
plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
@@ -981,7 +981,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
char buf[256];
sprintf(buf, ( IsTower(node) ) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE ));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if(creature)
if (creature)
YellToAll(creature,buf,LANG_UNIVERSAL);
//update the statistic for the assaulting player
UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
@@ -1010,11 +1010,11 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,ALLIANCE)]) << uint32((m_Nodes[i].Owner == ALLIANCE && stateok)?1:0);
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0);
}
if(m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic
data << uint32(AV_SNOWFALL_N) << uint32(1);
data << uint32(AV_Alliance_Score) << uint32(m_Team_Scores[0]);
data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]);
if(GetStatus() == STATUS_IN_PROGRESS){ //only if game started the teamscores are displayed
if (GetStatus() == STATUS_IN_PROGRESS){ //only if game started the teamscores are displayed
data << uint32(AV_SHOW_A_SCORE) << uint32(1);
data << uint32(AV_SHOW_H_SCORE) << uint32(1);
}
@@ -1032,18 +1032,18 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i
//neutral stuff cant get handled (currently its only snowfall)
assert(team != AV_NEUTRAL_TEAM);
//a_c a_a h_c h_a the positions in worldstate-array
if(team == ALLIANCE)
if (team == ALLIANCE)
{
if(state==POINT_CONTROLED || state==POINT_DESTROYED)
if (state==POINT_CONTROLED || state==POINT_DESTROYED)
return 0;
if(state==POINT_ASSAULTED)
if (state==POINT_ASSAULTED)
return 1;
}
if(team == HORDE)
if (team == HORDE)
{
if(state==POINT_DESTROYED || state==POINT_CONTROLED)
if (state==POINT_DESTROYED || state==POINT_CONTROLED)
return 2;
if(state==POINT_ASSAULTED)
if (state==POINT_ASSAULTED)
return 3;
}
sLog.outError("BG_AV: should update a strange worldstate state:%i team:%i",state,team);
@@ -1053,7 +1053,7 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
{
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)],1);
if(m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
if (m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
UpdateWorldState(AV_SNOWFALL_N,0);
else
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)],0);
@@ -1068,28 +1068,28 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
uint8 owner,prevowner,mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array
mine2 = (mine==AV_NORTH_MINE)?0:1;
if(m_Mine_PrevOwner[mine] == ALLIANCE)
if (m_Mine_PrevOwner[mine] == ALLIANCE)
prevowner = 0;
else if(m_Mine_PrevOwner[mine] == HORDE)
else if (m_Mine_PrevOwner[mine] == HORDE)
prevowner = 2;
else
prevowner = 1;
if(m_Mine_Owner[mine] == ALLIANCE)
if (m_Mine_Owner[mine] == ALLIANCE)
owner = 0;
else if(m_Mine_Owner[mine] == HORDE)
else if (m_Mine_Owner[mine] == HORDE)
owner = 2;
else
owner = 1;
UpdateWorldState(BG_AV_MineWorldStates[mine2][owner],1);
if( prevowner != owner)
if ( prevowner != owner)
UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0);
}
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
{
WorldSafeLocsEntry const* good_entry = NULL;
if( GetStatus() == STATUS_IN_PROGRESS)
if ( GetStatus() == STATUS_IN_PROGRESS)
{
// Is there any occupied node for this team?
float mindist = 9999999.0f;
@@ -1098,10 +1098,10 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
if (m_Nodes[i].Owner != player->GetTeam() || m_Nodes[i].State != POINT_CONTROLED)
continue;
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] );
if( !entry )
if ( !entry )
continue;
float dist = (entry->x - player->GetPositionX())*(entry->x - player->GetPositionX())+(entry->y - player->GetPositionY())*(entry->y - player->GetPositionY());
if( mindist > dist )
if ( mindist > dist )
{
mindist = dist;
good_entry = entry;
@@ -1109,7 +1109,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
}
}
// If not, place ghost on starting location
if( !good_entry )
if ( !good_entry )
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7] );
return good_entry;
@@ -1118,7 +1118,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
bool BattleGroundAV::SetupBattleGround()
{
// Create starting objects
if(
if (
// alliance gates
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0],BG_AV_DoorPositons[0][1],BG_AV_DoorPositons[0][2],BG_AV_DoorPositons[0][3],0,0,sin(BG_AV_DoorPositons[0][3]/2),cos(BG_AV_DoorPositons[0][3]/2),RESPAWN_IMMEDIATELY)
// horde gates
@@ -1131,9 +1131,9 @@ bool BattleGroundAV::SetupBattleGround()
//spawn node-objects
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i)
{
if( i <= BG_AV_NODES_FROSTWOLF_HUT )
if ( i <= BG_AV_NODES_FROSTWOLF_HUT )
{
if( !AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
if ( !AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+11,BG_AV_OBJECTID_BANNER_CONT_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+33,BG_AV_OBJECTID_BANNER_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
@@ -1148,9 +1148,9 @@ bool BattleGroundAV::SetupBattleGround()
}
else //towers
{
if( i <= BG_AV_NODES_STONEHEART_BUNKER ) //alliance towers
if ( i <= BG_AV_NODES_STONEHEART_BUNKER ) //alliance towers
{
if( !AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
if ( !AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_A,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
@@ -1163,7 +1163,7 @@ bool BattleGroundAV::SetupBattleGround()
}
else //horde towers
{
if( !AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
if ( !AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(i+29,BG_AV_OBJECTID_BANNER_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_H,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
@@ -1176,7 +1176,7 @@ bool BattleGroundAV::SetupBattleGround()
}
for (uint8 j=0; j<=9; j++) //burning aura
{
if(!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!5.%i",i);
return false;
@@ -1188,9 +1188,9 @@ bool BattleGroundAV::SetupBattleGround()
{
for (uint8 j=0; j<=9; j++)
{
if(j<5)
if (j<5)
{
if(!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_SMOKE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_SMOKE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!6.%i",i);
return false;
@@ -1198,7 +1198,7 @@ bool BattleGroundAV::SetupBattleGround()
}
else
{
if(!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!7.%i",i);
return false;
@@ -1208,7 +1208,7 @@ bool BattleGroundAV::SetupBattleGround()
}
for (uint16 i= 0; i<=(BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
{
if(!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,BG_AV_OBJECTID_MINE_N,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,BG_AV_OBJECTID_MINE_N,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.5.%i",i);
return false;
@@ -1216,21 +1216,21 @@ bool BattleGroundAV::SetupBattleGround()
}
for (uint16 i= 0 ; i<=(BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
{
if(!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,BG_AV_OBJECTID_MINE_S,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,BG_AV_OBJECTID_MINE_S,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.6.%i",i);
return false;
}
}
if(!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
{
if(!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
@@ -1253,7 +1253,7 @@ bool BattleGroundAV::SetupBattleGround()
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ; i++){
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
if(i<=BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
if (i<=BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i),RESPAWN_IMMEDIATELY);
}
for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2)
@@ -1275,7 +1275,7 @@ bool BattleGroundAV::SetupBattleGround()
sLog.outDebug("BG_AV start poputlating nodes");
for (BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i )
{
if(m_Nodes[i].Owner)
if (m_Nodes[i].Owner)
PopulateNode(i);
}
//all creatures which don't get despawned through the script are static
@@ -1413,7 +1413,7 @@ void BattleGroundAV::ResetBGSubclass()
m_Mine_Timer=AV_MINE_TICK_TIMER;
for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
if(m_BgCreatures[i])
if (m_BgCreatures[i])
DelCreature(i);
}
+1 -1
View File
@@ -177,7 +177,7 @@ void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
if (itr == m_PlayerScores.end()) // player not found...
return;
//there is nothing special in this score
+2 -2
View File
@@ -374,7 +374,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if(!Source->isAlive()) //hack code, must be removed later
if (!Source->isAlive()) //hack code, must be removed later
return;
switch(Trigger)
@@ -789,7 +789,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found
if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
+7 -7
View File
@@ -45,7 +45,7 @@ void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data )
if (!unit)
return;
if(!unit->isBattleMaster()) // it's not battlemaster
if (!unit->isBattleMaster()) // it's not battlemaster
return;
// Stop the npc if moving
@@ -162,7 +162,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
if(!member) continue; // this should never happen
if (!member) continue; // this should never happen
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
@@ -198,7 +198,7 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
sLog.outDebug("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
BattleGround *bg = _player->GetBattleGround();
if(!bg) // can't be received if player not in battleground
if (!bg) // can't be received if player not in battleground
return;
switch( bg->GetTypeID() )
@@ -543,7 +543,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
if (!unit)
return;
if(!unit->isSpiritService()) // it's not spirit service
if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
@@ -564,7 +564,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
if (!unit)
return;
if(!unit->isSpiritService()) // it's not spirit service
if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
@@ -593,7 +593,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
if (!unit)
return;
if(!unit->isBattleMaster()) // it's not battle master
if (!unit->isBattleMaster()) // it's not battle master
return;
uint8 arenatype = 0;
@@ -710,7 +710,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
if(!member) continue;
if (!member) continue;
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);// add to queue
+1 -1
View File
@@ -76,7 +76,7 @@ void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source,type,value);
+17 -17
View File
@@ -183,7 +183,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
if (isRated && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
{
ArenaTeam *Team = objmgr.GetArenaTeamById(arenateamid);
if(Team)
if (Team)
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, Team->GetName().c_str(), ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
}
@@ -195,7 +195,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();
if(!member)
if (!member)
continue; // this should never happen
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
pl_info.LastOnlineTime = lastOnlineTime;
@@ -378,7 +378,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
{
ArenaTeam *Team = objmgr.GetArenaTeamById(group->ArenaTeamId);
if(Team)
if (Team)
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, Team->GetName().c_str(), group->ArenaType, group->ArenaType, group->ArenaTeamRating);
}
@@ -668,7 +668,7 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
uint32 j = BG_TEAM_ALLIANCE;
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
j = BG_TEAM_HORDE;
if( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
if ( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers )
{
//we will try to invite more groups to team with less players indexed by j
@@ -757,7 +757,7 @@ should be called from BattleGround::RemovePlayer function in some cases
void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
{
//if no players in queue - do nothing
if( m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
if ( m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty() )
@@ -771,7 +771,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
next = itr;
++next;
// DO NOT allow queue manager to invite new player to arena
if( (*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
if ( (*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE )
{
BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
@@ -949,7 +949,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
for (; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i]))
{
// if group match conditions, then add it to pool
if( !(*itr_team[i])->IsInvitedToBGInstanceGUID
if ( !(*itr_team[i])->IsInvitedToBGInstanceGUID
&& (((*itr_team[i])->ArenaTeamRating >= arenaMinRating && (*itr_team[i])->ArenaTeamRating <= arenaMaxRating)
|| (*itr_team[i])->JoinTime < discardTime) )
{
@@ -969,7 +969,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
++itr_team[BG_TEAM_ALLIANCE];
for (; itr_team[BG_TEAM_ALLIANCE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++(itr_team[BG_TEAM_ALLIANCE]))
{
if( !(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
if ( !(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID
&& (((*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating <= arenaMaxRating)
|| (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime) )
{
@@ -985,7 +985,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
++itr_team[BG_TEAM_HORDE];
for (; itr_team[BG_TEAM_HORDE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++(itr_team[BG_TEAM_HORDE]))
{
if( !(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
if ( !(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID
&& (((*itr_team[BG_TEAM_HORDE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_HORDE])->ArenaTeamRating <= arenaMaxRating)
|| (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime) )
{
@@ -1236,7 +1236,7 @@ void BattleGroundMgr::Update(uint32 diff)
{
if (m_AutoDistributionTimeChecker < diff)
{
if(time(NULL) > m_NextAutoDistributionTime)
if (time(NULL) > m_NextAutoDistributionTime)
{
DistributeArenaPoints();
m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
@@ -1307,7 +1307,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize()));
*data << uint8(type); // type (battleground=0/arena=1)
if(type) // arena
if (type) // arena
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
for (int i = 1; i >= 0; --i)
@@ -1510,7 +1510,7 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
uint32 lastId = 0;
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();)
{
if( (++lastId) != *itr) //if there is a gap between the ids, we will break..
if ( (++lastId) != *itr) //if there is a gap between the ids, we will break..
break;
lastId = *itr;
}
@@ -1850,7 +1850,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
*data << uint64(guid); // battlemaster guid
*data << uint8(fromWhere); // from where you joined
*data << uint32(bgTypeId); // battleground id
if(bgTypeId == BATTLEGROUND_AA) // arena
if (bgTypeId == BATTLEGROUND_AA) // arena
{
*data << uint8(4); // unk
*data << uint8(0); // unk
@@ -1865,10 +1865,10 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
uint32 count = 0;
*data << uint32(0); // number of bg instances
if(BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))
if (BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))
{
// expected bracket entry
if(PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel()))
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel()))
{
BattleGroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracketId].end();++itr)
@@ -2026,7 +2026,7 @@ void BattleGroundMgr::SetHolidayWeekends(uint32 mask)
{
for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
{
if(BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype)))
if (BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype)))
{
bg->SetHoliday(mask & (1 << bgtype));
}
@@ -2133,7 +2133,7 @@ void BattleGroundMgr::DoCompleteAchievement(uint32 achievement, Player * player)
{
AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement);
if(!player)
if (!player)
{
//Map::PlayerList const &PlayerList = this->GetPlayers();
//GroupsQueueType::iterator group = SelectedGroups.begin();
+47 -47
View File
@@ -75,7 +75,7 @@ bool BattleGroundSA::ResetObjs()
for (uint8 i = 0; i < BG_SA_CENTRAL_FLAG; i++)
{
if(!AddObject(i,BG_SA_ObjEntries[i],
if (!AddObject(i,BG_SA_ObjEntries[i],
BG_SA_ObjSpawnlocs[i][0],BG_SA_ObjSpawnlocs[i][1],
BG_SA_ObjSpawnlocs[i][2],BG_SA_ObjSpawnlocs[i][3],
0,0,0,0,RESPAWN_ONE_DAY))
@@ -86,7 +86,7 @@ bool BattleGroundSA::ResetObjs()
//By capturing GYs.
for (uint8 i = 0; i < BG_SA_NPC_SPARKLIGHT; i++)
{
if(!AddCreature(BG_SA_NpcEntries[i], i, (attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
if (!AddCreature(BG_SA_NpcEntries[i], i, (attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
BG_SA_NpcSpawnlocs[i][0],BG_SA_NpcSpawnlocs[i][1],
BG_SA_NpcSpawnlocs[i][2],BG_SA_NpcSpawnlocs[i][3]))
return false;
@@ -121,13 +121,13 @@ bool BattleGroundSA::ResetObjs()
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
if(!sg)
if (!sg)
{
sLog.outError("SOTA: Can't find GY entry %u",BG_SA_GYEntries[i]);
return false;
}
if(i == BG_SA_BEACH_GY)
if (i == BG_SA_BEACH_GY)
{
GraveyardStatus[i] = attackers;
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? HORDE : ALLIANCE));
@@ -135,7 +135,7 @@ bool BattleGroundSA::ResetObjs()
else
{
GraveyardStatus[i] = ((attackers == TEAM_HORDE )? TEAM_ALLIANCE : TEAM_HORDE);
if(!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) ))
if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) ))
sLog.outError("SOTA: couldn't spawn GY: %u",i);
}
}
@@ -159,7 +159,7 @@ bool BattleGroundSA::ResetObjs()
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 );
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0 );
if(attackers == TEAM_ALLIANCE)
if (attackers == TEAM_ALLIANCE)
{
UpdateWorldState(BG_SA_ALLY_ATTACKS, 1);
UpdateWorldState(BG_SA_HORDE_ATTACKS, 0);
@@ -199,7 +199,7 @@ bool BattleGroundSA::ResetObjs()
void BattleGroundSA::StartShips()
{
if(ShipsStarted)
if (ShipsStarted)
return;
DoorOpen(BG_SA_BOAT_ONE);
@@ -209,9 +209,9 @@ void BattleGroundSA::StartShips()
{
for ( BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
{
if(Player* p = objmgr.GetPlayer(itr->first))
if (Player* p = objmgr.GetPlayer(itr->first))
{
if(p->GetTeamId() != attackers)
if (p->GetTeamId() != attackers)
continue;
UpdateData data;
@@ -230,23 +230,23 @@ void BattleGroundSA::Update(uint32 diff)
BattleGround::Update(diff);
TotalTime += diff;
if(status == BG_SA_WARMUP || status == BG_SA_SECOND_WARMUP)
if (status == BG_SA_WARMUP || status == BG_SA_SECOND_WARMUP)
{
if(TotalTime >= BG_SA_WARMUPLENGTH)
if (TotalTime >= BG_SA_WARMUPLENGTH)
{
TotalTime = 0;
ToggleTimer();
status = (status == BG_SA_WARMUP) ? BG_SA_ROUND_ONE : BG_SA_ROUND_TWO;
}
if(TotalTime >= BG_SA_BOAT_START)
if (TotalTime >= BG_SA_BOAT_START)
StartShips();
return;
}
else if (GetStatus() == STATUS_IN_PROGRESS)
{
if(status == BG_SA_ROUND_ONE)
if (status == BG_SA_ROUND_ONE)
{
if(TotalTime >= BG_SA_ROUNDLENGTH)
if (TotalTime >= BG_SA_ROUNDLENGTH)
{
RoundScores[0].time = TotalTime;
TotalTime = 0;
@@ -259,23 +259,23 @@ void BattleGroundSA::Update(uint32 diff)
return;
}
}
else if(status == BG_SA_ROUND_TWO)
else if (status == BG_SA_ROUND_TWO)
{
if(TotalTime >= BG_SA_ROUNDLENGTH)
if (TotalTime >= BG_SA_ROUNDLENGTH)
{
RoundScores[1].time = TotalTime;
RoundScores[1].winner = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
if (RoundScores[0].time == RoundScores[1].time)
EndBattleGround(NULL);
else if(RoundScores[0].time < RoundScores[1].time)
else if (RoundScores[0].time < RoundScores[1].time)
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
return;
}
}
if(status == BG_SA_ROUND_ONE || status == BG_SA_ROUND_TWO)
if (status == BG_SA_ROUND_ONE || status == BG_SA_ROUND_TWO)
SendTime();
}
}
@@ -334,13 +334,13 @@ void BattleGroundSA::AddPlayer(Player *plr)
//create score and add it to map, default values are set in constructor
BattleGroundSAScore* sc = new BattleGroundSAScore;
if(!ShipsStarted)
if (!ShipsStarted)
{
if(plr->GetTeamId() == attackers)
if (plr->GetTeamId() == attackers)
{
plr->CastSpell(plr,12438,true);//Without this player falls before boat loads...
if(urand(0,1))
if (urand(0,1))
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
@@ -351,7 +351,7 @@ void BattleGroundSA::AddPlayer(Player *plr)
}
else
{
if(plr->GetTeamId() == attackers)
if (plr->GetTeamId() == attackers)
plr->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
else
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
@@ -374,12 +374,12 @@ void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found...
if (itr == m_PlayerScores.end()) // player not found...
return;
if(type == SCORE_DESTROYED_DEMOLISHER)
if (type == SCORE_DESTROYED_DEMOLISHER)
((BattleGroundSAScore*)itr->second)->demolishers_destroyed += value;
else if(type == SCORE_DESTROYED_WALL)
else if (type == SCORE_DESTROYED_WALL)
((BattleGroundSAScore*)itr->second)->gates_destroyed += value;
else
BattleGround::UpdatePlayerScore(Source,type,value);
@@ -389,10 +389,10 @@ void BattleGroundSA::TeleportPlayers()
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if(Player *plr = objmgr.GetPlayer(itr->first))
if (Player *plr = objmgr.GetPlayer(itr->first))
{
// should remove spirit of redemption
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!plr->isAlive())
@@ -405,11 +405,11 @@ void BattleGroundSA::TeleportPlayers()
plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA));
plr->CombatStopWithPets(true);
if(plr->GetTeamId() == attackers)
if (plr->GetTeamId() == attackers)
{
plr->CastSpell(plr,12438,true); //Without this player falls before boat loads...
if(urand(0,1))
if (urand(0,1))
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
else
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
@@ -449,10 +449,10 @@ void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint32 ev
void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
{
if(!unit)
if (!unit)
return;
if(unit->GetEntry() == 28781) //Demolisher
if (unit->GetEntry() == 28781) //Demolisher
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
}
@@ -462,30 +462,30 @@ void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
*/
void BattleGroundSA::OverrideGunFaction()
{
if(!m_BgCreatures[0])
if (!m_BgCreatures[0])
return;
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
{
if(Creature* gun = GetBGCreature(i))
if (Creature* gun = GetBGCreature(i))
gun->setFaction(BG_SA_Factions[attackers? TEAM_ALLIANCE : TEAM_HORDE]);
}
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++)
{
if(Creature* dem = GetBGCreature(i))
if (Creature* dem = GetBGCreature(i))
dem->setFaction(BG_SA_Factions[attackers]);
}
}
void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
{
if(!GateStatus[i])
if (!GateStatus[i])
return;
if(GameObject* g = GetBGObject(i))
if (GameObject* g = GetBGObject(i))
{
if(g->GetGOValue()->building.health == 0)
if (g->GetGOValue()->building.health == 0)
{
GateStatus[i] = BG_SA_GATE_DESTROYED;
uint32 uws;
@@ -514,7 +514,7 @@ void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
break;
}
if(i < 5)
if (i < 5)
DelObject(i+9);
UpdateWorldState(uws, GateStatus[i]);
UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1);
@@ -531,7 +531,7 @@ WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
player->GetPosition(x,y,z);
if(player->GetTeamId() == attackers)
if (player->GetTeamId() == attackers)
safeloc = BG_SA_GYEntries[BG_SA_BEACH_GY];
else
safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY];
@@ -541,11 +541,11 @@ WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++)
{
if(GraveyardStatus[i] != player->GetTeamId())
if (GraveyardStatus[i] != player->GetTeamId())
continue;
dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y)+(ret->z - z)*(ret->z - z));
if(dist < nearest)
if (dist < nearest)
{
ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
nearest = dist;
@@ -626,11 +626,11 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i)
void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
{
if(object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
{
if(Source->GetTeamId() == attackers)
if (Source->GetTeamId() == attackers)
{
if(status == BG_SA_ROUND_ONE)
if (status == BG_SA_ROUND_ONE)
{
RoundScores[0].winner = attackers;
RoundScores[0].time = TotalTime;
@@ -640,13 +640,13 @@ void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
ToggleTimer();
ResetObjs();
}
else if(status == BG_SA_ROUND_TWO)
else if (status == BG_SA_ROUND_TWO)
{
RoundScores[1].winner = attackers;
RoundScores[1].time = TotalTime;ToggleTimer();
if(RoundScores[0].time == RoundScores[1].time)
if (RoundScores[0].time == RoundScores[1].time)
EndBattleGround(NULL);
else if(RoundScores[0].time < RoundScores[1].time)
else if (RoundScores[0].time < RoundScores[1].time)
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
+24 -24
View File
@@ -139,25 +139,25 @@ void BattleGroundWS::Update(uint32 diff)
m_BothFlagsKept = false;
}
}
if(m_BothFlagsKept)
if (m_BothFlagsKept)
{
m_FlagSpellForceTimer += diff;
if(m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
{
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
m_FlagDebuffState = 1;
}
else if(m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
}
if(Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
{
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
@@ -282,9 +282,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if(m_FlagDebuffState == 1)
if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if(m_FlagDebuffState == 2)
if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
@@ -300,9 +300,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if(m_FlagDebuffState == 1)
if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if(m_FlagDebuffState == 2)
if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
@@ -325,7 +325,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if(!m_FirstFlagCaptureTeam)
if (!m_FirstFlagCaptureTeam)
SetFirstFlagCapture(Source->GetTeam());
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
@@ -390,9 +390,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if(m_FlagDebuffState == 1)
if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if(m_FlagDebuffState == 2)
if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
@@ -407,9 +407,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if(m_FlagDebuffState == 1)
if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if(m_FlagDebuffState == 2)
if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
@@ -446,7 +446,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
ChatMsg type;
//alliance flag picked up from base
if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
{
message_id = LANG_BG_WS_PICKEDUP_AF;
@@ -459,7 +459,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
if(m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
m_BothFlagsKept = true;
}
@@ -477,7 +477,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
if(m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
m_BothFlagsKept = true;
}
@@ -505,9 +505,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
if(m_FlagDebuffState == 1)
if (m_FlagDebuffState == 1)
Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true);
if(m_FlagDebuffState == 2)
if (m_FlagDebuffState == 2)
Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
}
@@ -539,9 +539,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
if(m_FlagDebuffState == 1)
if (m_FlagDebuffState == 1)
Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true);
if(m_FlagDebuffState == 2)
if (m_FlagDebuffState == 2)
Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
}
@@ -758,7 +758,7 @@ void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if(itr == m_PlayerScores.end()) // player not found
if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
+5 -5
View File
@@ -79,29 +79,29 @@ struct Cell
Compute(x, y);
cell.Compute(old_x, old_y);
if( std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1)
if ( std::abs(int(x-old_x)) > 1 || std::abs(int(y-old_y)) > 1)
{
data.Part.reserved = ALL_DISTRICT;
cell.data.Part.reserved = ALL_DISTRICT;
return;
}
if( x < old_x )
if ( x < old_x )
{
data.Part.reserved |= LEFT_DISTRICT;
cell.data.Part.reserved |= RIGHT_DISTRICT;
}
else if( old_x < x )
else if ( old_x < x )
{
data.Part.reserved |= RIGHT_DISTRICT;
cell.data.Part.reserved |= LEFT_DISTRICT;
}
if( y < old_y )
if ( y < old_y )
{
data.Part.reserved |= UPPER_DISTRICT;
cell.data.Part.reserved |= LOWER_DISTRICT;
}
else if( old_y < y )
else if ( old_y < y )
{
data.Part.reserved |= LOWER_DISTRICT;
cell.data.Part.reserved |= UPPER_DISTRICT;
+5 -5
View File
@@ -45,7 +45,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
return;
uint16 district = (District)this->data.Part.reserved;
if(district == CENTER_DISTRICT)
if (district == CENTER_DISTRICT)
{
m.Visit(*this, visitor);
return;
@@ -132,7 +132,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
inline int CellHelper(const float radius)
{
if(radius < 1.0f)
if (radius < 1.0f)
return 0;
return (int)ceilf(radius/SIZE_OF_GRID_CELL);
@@ -145,7 +145,7 @@ inline CellArea Cell::CalculateCellArea(const WorldObject &obj, float radius)
inline CellArea Cell::CalculateCellArea(float x, float y, float radius)
{
if(radius <= 0.0f)
if (radius <= 0.0f)
return CellArea();
//lets calculate object coord offsets from cell borders.
@@ -222,7 +222,7 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
{
CellPair cell_pair(x,y);
//lets skip standing cell since we already visited it
if(cell_pair != standing_cell)
if (cell_pair != standing_cell)
{
Cell r_zone(cell_pair);
r_zone.data.Part.nocreate = this->data.Part.nocreate;
@@ -265,7 +265,7 @@ 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)
if (x_shift == 0)
return;
uint32 y_start = end_cell.y_coord;
+78 -78
View File
@@ -29,20 +29,20 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
{
// set special flags if built-in channel
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
if(ch) // it's built-in channel
if (ch) // it's built-in channel
{
channel_id = ch->ChannelID; // built-in channel
m_announce = false; // no join/leave announces
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
if(ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
m_flags |= CHANNEL_FLAG_TRADE;
if(ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
m_flags |= CHANNEL_FLAG_CITY;
if(ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
m_flags |= CHANNEL_FLAG_LFG;
else // for all other channels
m_flags |= CHANNEL_FLAG_NOT_LFG;
@@ -75,7 +75,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint64 banned_guid = atol((*iter).c_str());
if(banned_guid)
if (banned_guid)
{
sLog.outDebug("Channel(%s) loaded banned guid: %u",name.c_str(), banned_guid);
banned.insert(banned_guid);
@@ -134,9 +134,9 @@ void Channel::_UpdateBanListInDB() const
void Channel::Join(uint64 p, const char *pass)
{
WorldPacket data;
if(IsOn(p))
if (IsOn(p))
{
if(!IsConstant()) // non send error message for built-in channels
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
@@ -144,14 +144,14 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
if(IsBanned(p))
if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
if(m_password.length() > 0 && strcmp(pass, m_password.c_str()))
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
@@ -160,9 +160,9 @@ void Channel::Join(uint64 p, const char *pass)
Player *plr = objmgr.GetPlayer(p);
if(plr)
if (plr)
{
if(HasFlag(CHANNEL_FLAG_LFG) &&
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER &&
(plr->GetGroup() || plr->m_lookingForGroup.Empty()) )
{
@@ -171,13 +171,13 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
if(plr->GetGuildId() && (GetFlags() == 0x38))
if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->JoinedChannel(this);
}
if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
MakeJoined(&data, p);
SendToAll(&data);
@@ -196,13 +196,13 @@ void Channel::Join(uint64 p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
if(!IsConstant() && !m_ownerGUID)
if (!IsConstant() && !m_ownerGUID)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
/*
else if(!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() ))
else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() ))
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
@@ -211,9 +211,9 @@ void Channel::Join(uint64 p, const char *pass)
void Channel::Leave(uint64 p, bool send)
{
if(!IsOn(p))
if (!IsOn(p))
{
if(send)
if (send)
{
WorldPacket data;
MakeNotMember(&data);
@@ -224,12 +224,12 @@ void Channel::Leave(uint64 p, bool send)
{
Player *plr = objmgr.GetPlayer(p);
if(send)
if (send)
{
WorldPacket data;
MakeYouLeft(&data);
SendToOne(&data, p);
if(plr)
if (plr)
plr->LeftChannel(this);
data.clear();
}
@@ -237,7 +237,7 @@ void Channel::Leave(uint64 p, bool send)
bool changeowner = players[p].IsOwner();
players.erase(p);
if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
WorldPacket data;
MakeLeft(&data, p);
@@ -246,7 +246,7 @@ void Channel::Leave(uint64 p, bool send)
LeaveNotify(p);
if(changeowner)
if (changeowner)
{
uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
players[newowner].SetModerator(true);
@@ -259,16 +259,16 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
{
AccountTypes sec = SEC_PLAYER;
Player *gplr = objmgr.GetPlayer(good);
if(gplr)
if (gplr)
sec = gplr->GetSession()->GetSecurity();
if(!IsOn(good))
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -277,13 +277,13 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
else
{
Player *bad = objmgr.GetPlayer(badname);
if(bad == NULL || !IsOn(bad->GetGUID()))
if (bad == NULL || !IsOn(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
}
else if(sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -295,7 +295,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
WorldPacket data;
if(ban && !IsBanned(bad->GetGUID()))
if (ban && !IsBanned(bad->GetGUID()))
{
banned.insert(bad->GetGUID());
MakePlayerBanned(&data, bad->GetGUID(), good);
@@ -309,7 +309,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
players.erase(bad->GetGUID());
bad->LeftChannel(this);
if(changeowner)
if (changeowner)
{
uint64 newowner = !players.empty() ? good : false;
players[newowner].SetModerator(true);
@@ -323,16 +323,16 @@ void Channel::UnBan(uint64 good, const char *badname)
{
uint32 sec = 0;
Player *gplr = objmgr.GetPlayer(good);
if(gplr)
if (gplr)
sec = gplr->GetSession()->GetSecurity();
if(!IsOn(good))
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -341,7 +341,7 @@ void Channel::UnBan(uint64 good, const char *badname)
else
{
Player *bad = objmgr.GetPlayer(badname);
if(bad == NULL || !IsBanned(bad->GetGUID()))
if (bad == NULL || !IsBanned(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
@@ -365,24 +365,24 @@ void Channel::Password(uint64 p, const char *pass)
std::string plName;
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
if(plr)
if (plr)
sec = plr->GetSession()->GetSecurity();
ChatHandler chat(plr);
if(!m_public && sec <= SEC_MODERATOR)
if (!m_public && sec <= SEC_MODERATOR)
{
chat.PSendSysMessage(LANG_CHANNEL_NOT_PUBLIC);
return;
}
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -408,13 +408,13 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
uint32 sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -423,7 +423,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
else
{
Player *newp = objmgr.GetPlayer(p2n);
if(!newp)
if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -432,10 +432,10 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
}
PlayerInfo inf = players[newp->GetGUID()];
if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
return;
if(!IsOn(newp->GetGUID()))
if (!IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -445,7 +445,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
// allow make moderator from another team only if both is GMs
// at this moment this only way to show channel post for GM from another team
if( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
if ( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) )
{
WorldPacket data;
@@ -454,7 +454,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -462,7 +462,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
if(mod)
if (mod)
SetModerator(newp->GetGUID(), set);
else
SetMute(newp->GetGUID(), set);
@@ -477,7 +477,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
uint32 sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -485,7 +485,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
if(sec < SEC_GAMEMASTER && p != m_ownerGUID)
if (sec < SEC_GAMEMASTER && p != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -494,7 +494,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
}
Player *newp = objmgr.GetPlayer(newname);
if(newp == NULL || !IsOn(newp->GetGUID()))
if (newp == NULL || !IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -502,7 +502,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
if(newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -516,7 +516,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
void Channel::SendWhoOwner(uint64 p)
{
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -534,7 +534,7 @@ void Channel::List(Player* player)
{
uint64 p = player->GetGUID();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -578,16 +578,16 @@ void Channel::Announce(uint64 p)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
if(plr)
if (plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -598,7 +598,7 @@ void Channel::Announce(uint64 p)
m_announce = !m_announce;
WorldPacket data;
if(m_announce)
if (m_announce)
MakeAnnouncementsOn(&data, p);
else
MakeAnnouncementsOff(&data, p);
@@ -613,16 +613,16 @@ void Channel::Moderate(uint64 p)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
if(plr)
if (plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -633,7 +633,7 @@ void Channel::Moderate(uint64 p)
m_moderate = !m_moderate;
WorldPacket data;
if(m_moderate)
if (m_moderate)
MakeModerationOn(&data, p);
else
MakeModerationOff(&data, p);
@@ -645,29 +645,29 @@ void Channel::Moderate(uint64 p)
void Channel::Say(uint64 p, const char *what, uint32 lang)
{
if(!what)
if (!what)
return;
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
if(plr)
if (plr)
sec = plr->GetSession()->GetSecurity();
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(players[p].IsMuted())
else if (players[p].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, p);
}
else if(m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -694,7 +694,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
void Channel::Invite(uint64 p, const char *newname)
{
if(!IsOn(p))
if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -703,7 +703,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
Player *newp = objmgr.GetPlayer(newname);
if(!newp)
if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -723,7 +723,7 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
if(IsOn(newp->GetGUID()))
if (IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetGUID());
@@ -732,7 +732,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
WorldPacket data;
if(!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
{
MakeInvite(&data, p);
SendToOne(&data, newp->GetGUID());
@@ -744,16 +744,16 @@ void Channel::Invite(uint64 p, const char *newname)
void Channel::SetOwner(uint64 guid, bool exclaim)
{
if(m_ownerGUID)
if (m_ownerGUID)
{
// [] will re-add player after it possible removed
PlayerList::iterator p_itr = players.find(m_ownerGUID);
if(p_itr != players.end())
if (p_itr != players.end())
p_itr->second.SetOwner(false);
}
m_ownerGUID = guid;
if(m_ownerGUID)
if (m_ownerGUID)
{
uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
players[m_ownerGUID].SetModerator(true);
@@ -763,7 +763,7 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
MakeModeChange(&data, m_ownerGUID, oldFlag);
SendToAll(&data);
if(exclaim)
if (exclaim)
{
MakeOwnerChanged(&data, m_ownerGUID);
SendToAll(&data);
@@ -779,9 +779,9 @@ void Channel::SendToAll(WorldPacket *data, uint64 p)
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
Player *plr = objmgr.GetPlayer(i->first);
if(plr)
if (plr)
{
if(!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
plr->GetSession()->SendPacket(data);
}
}
@@ -791,10 +791,10 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
{
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
if(i->first != who)
if (i->first != who)
{
Player *plr = objmgr.GetPlayer(i->first);
if(plr)
if (plr)
plr->GetSession()->SendPacket(data);
}
}
@@ -803,7 +803,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
void Channel::SendToOne(WorldPacket *data, uint64 who)
{
Player *plr = objmgr.GetPlayer(who);
if(plr)
if (plr)
plr->GetSession()->SendPacket(data);
}
@@ -906,7 +906,7 @@ void Channel::MakeChannelOwner(WorldPacket *data)
{
std::string name = "";
if(!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
if (!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
@@ -1081,7 +1081,7 @@ void Channel::JoinNotify(uint64 guid)
{
WorldPacket data;
if(IsConstant())
if (IsConstant())
data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1);
else
data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1);
+7 -7
View File
@@ -126,23 +126,23 @@ class Channel
uint8 flags;
bool HasFlag(uint8 flag) { return flags & flag; }
void SetFlag(uint8 flag) { if(!HasFlag(flag)) flags |= flag; }
void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; }
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
void SetOwner(bool state)
{
if(state) flags |= MEMBER_FLAG_OWNER;
if (state) flags |= MEMBER_FLAG_OWNER;
else flags &= ~MEMBER_FLAG_OWNER;
}
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
void SetModerator(bool state)
{
if(state) flags |= MEMBER_FLAG_MODERATOR;
if (state) flags |= MEMBER_FLAG_MODERATOR;
else flags &= ~MEMBER_FLAG_MODERATOR;
}
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
void SetMuted(bool state)
{
if(state) flags |= MEMBER_FLAG_MUTED;
if (state) flags |= MEMBER_FLAG_MUTED;
else flags &= ~MEMBER_FLAG_MUTED;
}
};
@@ -216,7 +216,7 @@ class Channel
uint8 GetPlayerFlags(uint64 p) const
{
PlayerList::const_iterator p_itr = players.find(p);
if(p_itr == players.end())
if (p_itr == players.end())
return 0;
return p_itr->second.flags;
@@ -224,7 +224,7 @@ class Channel
void SetModerator(uint64 p, bool set)
{
if(players[p].IsModerator() != set)
if (players[p].IsModerator() != set)
{
uint8 oldFlag = GetPlayerFlags(p);
players[p].SetModerator(set);
@@ -237,7 +237,7 @@ class Channel
void SetMute(uint64 p, bool set)
{
if(players[p].IsMuted() != set)
if (players[p].IsMuted() != set)
{
uint8 oldFlag = GetPlayerFlags(p);
players[p].SetMuted(set);
+49 -49
View File
@@ -34,14 +34,14 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
recvPacket >> channel_id >> unknown1 >> unknown2;
recvPacket >> channelname;
if(channelname.empty())
if (channelname.empty())
return;
recvPacket >> pass;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
cMgr->team = _player->GetTeam();
if(Channel *chn = cMgr->GetJoinChannel(channelname, channel_id))
if (Channel *chn = cMgr->GetJoinChannel(channelname, channel_id))
chn->Join(_player->GetGUID(), pass.c_str());
}
}
@@ -56,12 +56,12 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
recvPacket >> unk; // channel id?
recvPacket >> channelname;
if(channelname.empty())
if (channelname.empty())
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Leave(_player->GetGUID(), true);
cMgr->LeftChannel(channelname);
}
@@ -74,8 +74,8 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket)
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
}
@@ -88,8 +88,8 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket)
recvPacket >> pass;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Password(_player->GetGUID(), pass.c_str());
}
@@ -102,11 +102,11 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket)
recvPacket >> newp;
if(!normalizePlayerName(newp))
if (!normalizePlayerName(newp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetOwner(_player->GetGUID(), newp.c_str());
}
@@ -116,8 +116,8 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SendWhoOwner(_player->GetGUID());
}
@@ -130,11 +130,11 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetModerator(_player->GetGUID(), otp.c_str());
}
@@ -147,11 +147,11 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnsetModerator(_player->GetGUID(), otp.c_str());
}
@@ -164,11 +164,11 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->SetMute(_player->GetGUID(), otp.c_str());
}
@@ -182,11 +182,11 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnsetMute(_player->GetGUID(), otp.c_str());
}
@@ -199,11 +199,11 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Invite(_player->GetGUID(), otp.c_str());
}
@@ -215,11 +215,11 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket)
recvPacket >> channelname;
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Kick(_player->GetGUID(), otp.c_str());
}
@@ -232,11 +232,11 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Ban(_player->GetGUID(), otp.c_str());
}
@@ -250,11 +250,11 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->UnBan(_player->GetGUID(), otp.c_str());
}
@@ -264,8 +264,8 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Announce(_player->GetGUID());
}
@@ -275,8 +275,8 @@ void WorldSession::HandleChannelModerate(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->Moderate(_player->GetGUID());
}
@@ -286,8 +286,8 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
}
@@ -297,9 +297,9 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
{
WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4);
data << chn->GetName();
@@ -316,8 +316,8 @@ void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
/*if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
/*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel *chn = cMgr->GetChannel(channelname, _player))
chn->JoinNotify(_player->GetGUID());*/
}
+6 -6
View File
@@ -28,9 +28,9 @@ ChannelMgr* channelMgr(uint32 team)
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
return &Trinity::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
if(team == ALLIANCE)
if (team == ALLIANCE)
return &Trinity::Singleton<AllianceChannelMgr>::Instance();
if(team == HORDE)
if (team == HORDE)
return &Trinity::Singleton<HordeChannelMgr>::Instance();
return NULL;
@@ -68,9 +68,9 @@ Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt)
ChannelMap::const_iterator i = channels.find(wname);
if(i == channels.end())
if (i == channels.end())
{
if(pkt)
if (pkt)
{
WorldPacket data;
MakeNotOnPacket(&data,name);
@@ -91,12 +91,12 @@ void ChannelMgr::LeftChannel(std::string name)
ChannelMap::const_iterator i = channels.find(wname);
if(i == channels.end())
if (i == channels.end())
return;
Channel* channel = i->second;
if(channel->GetNumPlayers() == 0 && !channel->IsConstant())
if (channel->GetNumPlayers() == 0 && !channel->IsConstant())
{
channels.erase(wname);
delete channel;
+87 -87
View File
@@ -84,7 +84,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
if (sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
// in other case still be dummy query
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
@@ -111,7 +111,7 @@ class CharacterHandler
void HandleCharEnumCallback(QueryResult_AutoPtr result, uint32 account)
{
WorldSession * session = sWorld.FindSession(account);
if(!session)
if (!session)
return;
session->HandleCharEnum(result);
}
@@ -119,7 +119,7 @@ class CharacterHandler
{
if (!holder) return;
WorldSession *session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
if(!session)
if (!session)
{
delete holder;
return;
@@ -136,13 +136,13 @@ void WorldSession::HandleCharEnum(QueryResult_AutoPtr result)
data << num;
if( result )
if ( result )
{
do
{
uint32 guidlow = (*result)[0].GetUInt32();
sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId());
if(Player::BuildEnumData(result, &data))
if (Player::BuildEnumData(result, &data))
++num;
}
while ( result->NextRow() );
@@ -195,9 +195,9 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
if(GetSecurity() == SEC_PLAYER)
if (GetSecurity() == SEC_PLAYER)
{
if(uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
if (uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
{
bool disabled = false;
@@ -208,7 +208,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
case HORDE: disabled = mask & (1<<1); break;
}
if(disabled)
if (disabled)
{
data << (uint8)CHAR_CREATE_DISABLED;
SendPacket( &data );
@@ -220,7 +220,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
if( !classEntry || !raceEntry )
if ( !classEntry || !raceEntry )
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket( &data );
@@ -309,7 +309,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// speedup check for heroic class disabled case
uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
if (heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -318,7 +318,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// speedup check for heroic class disabled case
uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
SendPacket( &data );
@@ -333,26 +333,26 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// if 0 then allowed creating without any characters
bool have_req_level_for_heroic = (req_level_for_heroic==0);
if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
if (!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
{
QueryResult_AutoPtr result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
if(result2)
if (result2)
{
uint32 team_= Player::TeamForRace(race_);
Field* field = result2->Fetch();
uint8 acc_race = field[1].GetUInt32();
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
uint8 acc_class = field[2].GetUInt32();
if(acc_class == CLASS_DEATH_KNIGHT)
if (acc_class == CLASS_DEATH_KNIGHT)
{
if(heroic_free_slots > 0)
if (heroic_free_slots > 0)
--heroic_free_slots;
if(heroic_free_slots==0)
if (heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -360,10 +360,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
if(!have_req_level_for_heroic)
if (!have_req_level_for_heroic)
{
uint32 acc_level = field[0].GetUInt32();
if(acc_level >= req_level_for_heroic)
if (acc_level >= req_level_for_heroic)
have_req_level_for_heroic = true;
}
}
@@ -373,10 +373,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
if (!AllowTwoSideAccounts)
{
uint32 acc_team=0;
if(acc_race > 0)
if (acc_race > 0)
acc_team = Player::TeamForRace(acc_race);
if(acc_team != team_)
if (acc_team != team_)
{
data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION;
SendPacket( &data );
@@ -388,24 +388,24 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// TODO: check if cinematic already shown? (already logged in?; cinematic field)
while ((skipCinematics == 1 && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
{
if(!result2->NextRow())
if (!result2->NextRow())
break;
field = result2->Fetch();
acc_race = field[1].GetUInt32();
if(!have_same_race)
if (!have_same_race)
have_same_race = race_ == acc_race;
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
uint8 acc_class = field[2].GetUInt32();
if(acc_class == CLASS_DEATH_KNIGHT)
if (acc_class == CLASS_DEATH_KNIGHT)
{
if(heroic_free_slots > 0)
if (heroic_free_slots > 0)
--heroic_free_slots;
if(heroic_free_slots==0)
if (heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -413,10 +413,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
if(!have_req_level_for_heroic)
if (!have_req_level_for_heroic)
{
uint32 acc_level = field[0].GetUInt32();
if(acc_level >= req_level_for_heroic)
if (acc_level >= req_level_for_heroic)
have_req_level_for_heroic = true;
}
}
@@ -424,7 +424,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
SendPacket( &data );
@@ -436,7 +436,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
recv_data >> gender >> skin >> face;
recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
if(recv_data.rpos() < recv_data.wpos())
if (recv_data.rpos() < recv_data.wpos())
{
uint8 unk;
recv_data >> unk;
@@ -444,7 +444,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
Player * pNewChar = new Player(this);
if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
if (!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
{
// Player not create (race/class problem?)
pNewChar->CleanupsBeforeDelete();
@@ -485,14 +485,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
recv_data >> guid;
// can't delete loaded character
if(objmgr.GetPlayer(guid))
if (objmgr.GetPlayer(guid))
return;
uint32 accountId = 0;
std::string name;
// is guild leader
if(objmgr.GetGuildByLeader(guid))
if (objmgr.GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
@@ -501,7 +501,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
// is arena team captain
if(objmgr.GetArenaTeamByCaptain(guid))
if (objmgr.GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
@@ -510,7 +510,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid));
if(result)
if (result)
{
Field *fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -518,14 +518,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
// prevent deleting other players' characters using cheating tools
if(accountId != GetAccountId())
if (accountId != GetAccountId())
return;
std::string IP_str = GetRemoteAddress();
sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
if(sLog.IsOutCharDump()) // optimize GetPlayerDump call
if (sLog.IsOutCharDump()) // optimize GetPlayerDump call
{
std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid));
sLog.outCharDump(dump.c_str(),GetAccountId(),GUID_LOPART(guid),name.c_str());
@@ -540,7 +540,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
{
if(PlayerLoading() || GetPlayer() != NULL)
if (PlayerLoading() || GetPlayer() != NULL)
{
sLog.outError("Player tryes to login again, AccountId = %d",GetAccountId());
return;
@@ -554,7 +554,7 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
recv_data >> playerGuid;
LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid);
if(!holder->Initialize())
if (!holder->Initialize())
{
delete holder; // delete all unprocessed queries
m_playerLoading = false;
@@ -573,7 +573,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
ChatHandler chH = ChatHandler(pCurrChar);
// "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
{
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
delete pCurrChar; // delete it manually
@@ -637,7 +637,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" );
// send server info
if(sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
if (sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION);
DEBUG_LOG( "WORLD: Sent server info" );
@@ -646,22 +646,22 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
QueryResult_AutoPtr resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
if(resultGuild)
if (resultGuild)
{
Field *fields = resultGuild->Fetch();
pCurrChar->SetInGuild(fields[0].GetUInt32());
pCurrChar->SetRank(fields[1].GetUInt32());
}
else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
{
pCurrChar->SetInGuild(0);
pCurrChar->SetRank(0);
}
if(pCurrChar->GetGuildId() != 0)
if (pCurrChar->GetGuildId() != 0)
{
Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId());
if(guild)
if (guild)
{
data.Initialize(SMSG_GUILD_EVENT, (2+guild->GetMOTD().size()+1));
data << uint8(GE_MOTD);
@@ -696,11 +696,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SendInitialPacketsBeforeAddToMap();
//Show cinematic at the first time that player login
if( !pCurrChar->getCinematic() )
if ( !pCurrChar->getCinematic() )
{
pCurrChar->setCinematic(1);
if(ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
{
if (cEntry->CinematicSequence)
pCurrChar->SendCinematicStart(cEntry->CinematicSequence);
@@ -716,7 +716,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (!pCurrChar->GetMap()->Add(pCurrChar))
{
AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId());
if(at)
if (at)
pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation());
else
pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation());
@@ -732,7 +732,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SetInGameTime( getMSTime() );
// announce group about member online (must be after add to player list to receive announce to self)
if(Group *group = pCurrChar->GetGroup())
if (Group *group = pCurrChar->GetGroup())
{
//pCurrChar->groupInfo.group->SendInit(this); // useless
group->SendUpdate();
@@ -748,7 +748,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (pCurrChar->m_deathState != ALIVE)
{
// not blizz like, we must correctly save and load player instead...
if(pCurrChar->getRace() == RACE_NIGHTELF)
if (pCurrChar->getRace() == RACE_NIGHTELF)
pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
@@ -758,27 +758,27 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->ContinueTaxiFlight();
// reset for all pets before pet loading
if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
Pet::resetTalentsForAllPetsOf(pCurrChar);
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
pCurrChar->LoadPet();
// Set FFA PvP for non GM in non-rest mode
if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
pCurrChar->SetContestedPvP();
// Apply at_login requests
if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
{
pCurrChar->resetSpells();
SendNotification(LANG_RESET_SPELLS);
}
if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
{
pCurrChar->resetTalents(true);
pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state
@@ -789,20 +789,20 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
// show time before shutdown if shutdown planned.
if(sWorld.IsShutdowning())
if (sWorld.IsShutdowning())
sWorld.ShutdownMsg(true,pCurrChar);
if(sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
if (sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
pCurrChar->SetTaxiCheater(true);
if(pCurrChar->isGameMaster())
if (pCurrChar->isGameMaster())
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)",
GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUIDLow());
if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
m_playerLoading = false;
@@ -840,7 +840,7 @@ void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ )
for (itr = GetPlayer()->factions.begin(); itr != GetPlayer()->factions.end(); ++itr)
{
if(itr->ReputationListID == FactionID)
if (itr->ReputationListID == FactionID)
{
itr->Standing += Standing;
itr->Flags = (itr->Flags | 1);
@@ -970,7 +970,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname)
{
WorldSession * session = sWorld.FindSession(accountId);
if(!session)
if (!session)
return;
if (!result)
@@ -1005,7 +1005,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
// not accept declined names for unsupported languages
std::string name;
if(!objmgr.GetPlayerNameByGUID(guid, name))
if (!objmgr.GetPlayerNameByGUID(guid, name))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1015,7 +1015,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
}
std::wstring wname;
if(!Utf8toWStr(name, wname))
if (!Utf8toWStr(name, wname))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1024,7 +1024,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
return;
}
if(!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
if (!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1038,7 +1038,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
recv_data >> name2;
if(name2 != name) // character have different name
if (name2 != name) // character have different name
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1050,7 +1050,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
recv_data >> declinedname.name[i];
if(!normalizePlayerName(declinedname.name[i]))
if (!normalizePlayerName(declinedname.name[i]))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1060,7 +1060,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
}
}
if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1093,17 +1093,17 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
if(!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
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())
if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
return;
BarberShopStyleEntry const* bs_skinColor = sBarberShopStyleStore.LookupEntry(SkinColor);
if( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
if ( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
return;
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
@@ -1111,7 +1111,7 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
// 0 - ok
// 1,3 - not enough money
// 2 - you have to seat on barber chair
if(_player->GetMoney() < Cost)
if (_player->GetMoney() < Cost)
{
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
data << uint32(1); // no money
@@ -1144,15 +1144,15 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data )
uint32 slot;
recv_data >> slot;
if(slot >= MAX_GLYPH_SLOT_INDEX)
if (slot >= MAX_GLYPH_SLOT_INDEX)
{
sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot);
return;
}
if(uint32 glyph = _player->GetGlyph(slot))
if (uint32 glyph = _player->GetGlyph(slot))
{
if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
_player->RemoveAurasDueToSpell(gp->SpellId);
_player->SetGlyph(slot, 0);
@@ -1232,7 +1232,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
}
CharacterDatabase.escape_string(newname);
if(QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
{
std::string oldname = result->Fetch()[0].GetCppString();
std::string IP_str = GetRemoteAddress();
@@ -1260,12 +1260,12 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
sLog.outDebug("CMSG_EQUIPMENT_SET_SAVE");
uint64 setGuid;
if(!recv_data.readPackGUID(setGuid))
if (!recv_data.readPackGUID(setGuid))
return;
uint32 index;
recv_data >> index;
if(index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
return;
std::string name;
@@ -1284,15 +1284,15 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
if(!recv_data.readPackGUID(itemGuid))
if (!recv_data.readPackGUID(itemGuid))
return;
Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if(!item && itemGuid) // cheating check 1
if (!item && itemGuid) // cheating check 1
return;
if(item && item->GetGUID() != itemGuid) // cheating check 2
if (item && item->GetGUID() != itemGuid) // cheating check 2
return;
eqSet.Items[i] = GUID_LOPART(itemGuid);
@@ -1306,7 +1306,7 @@ void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
sLog.outDebug("CMSG_EQUIPMENT_SET_DELETE");
uint64 setGuid;
if(!recv_data.readPackGUID(setGuid))
if (!recv_data.readPackGUID(setGuid))
return;
_player->DeleteEquipmentSet(setGuid);
@@ -1320,7 +1320,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
if(!recv_data.readPackGUID(itemGuid))
if (!recv_data.readPackGUID(itemGuid))
return;
uint8 srcbag, srcslot;
@@ -1332,15 +1332,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
if(!item)
if (!item)
{
Item *uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if(!uItem)
if (!uItem)
continue;
ItemPosCountVec sDest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sDest, uItem, false );
if(msg == EQUIP_ERR_OK)
if (msg == EQUIP_ERR_OK)
{
_player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
_player->StoreItem( sDest, uItem, true );
@@ -1351,7 +1351,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
continue;
}
if(item->GetPos() == dstpos)
if (item->GetPos() == dstpos)
continue;
_player->SwapItem(item->GetPos(), dstpos);
+3 -3
View File
@@ -1320,11 +1320,11 @@ valid examples:
negativeNumber = false;
while ((c = reader.get())!=':')
{
if(c >='0' && c<='9')
if (c >='0' && c<='9')
{
propertyId*=10;
propertyId += c-'0';
} else if(c == '-')
} else if (c == '-')
negativeNumber = true;
else
return false;
@@ -1339,7 +1339,7 @@ valid examples:
if (!itemProperty)
return false;
}
else if(propertyId < 0)
else if (propertyId < 0)
{
itemSuffix = sItemRandomSuffixStore.LookupEntry(-propertyId);
if (!itemSuffix)
+69 -69
View File
@@ -45,7 +45,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
if (lang != LANG_ADDON)
{
// strip invisible characters for non-addon messages
if(sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
if (sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
stripLineInvisibleChars(msg);
if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
@@ -70,7 +70,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
recv_data >> type;
recv_data >> lang;
if(type >= MAX_CHAT_MSG_TYPE)
if (type >= MAX_CHAT_MSG_TYPE)
{
sLog.outError("CHAT: Wrong message type received: %u", type);
return;
@@ -80,39 +80,39 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// prevent talking at unknown language (cheating)
LanguageDesc const* langDesc = GetLanguageDescByID(lang);
if(!langDesc)
if (!langDesc)
{
SendNotification(LANG_UNKNOWN_LANGUAGE);
return;
}
if(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
if (langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
{
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
Unit::AuraEffectList const& langAuras = _player->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);
bool foundAura = false;
for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
{
if((*i)->GetMiscValue() == int32(lang))
if ((*i)->GetMiscValue() == int32(lang))
{
foundAura = true;
break;
}
}
if(!foundAura)
if (!foundAura)
{
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
return;
}
}
if(lang == LANG_ADDON)
if (lang == LANG_ADDON)
{
if(sWorld.getConfig(CONFIG_CHATLOG_ADDON))
if (sWorld.getConfig(CONFIG_CHATLOG_ADDON))
{
std::string msg = "";
recv_data >> msg;
if(msg.empty())
if (msg.empty())
{
sLog.outDebug("Player %s send empty addon msg", GetPlayer()->GetName());
return;
@@ -123,7 +123,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
}
// Disabled addon channel?
if(!sWorld.getConfig(CONFIG_ADDON_CHANNEL))
if (!sWorld.getConfig(CONFIG_ADDON_CHANNEL))
return;
}
// LANG_ADDON should not be changed nor be affected by flood control
@@ -146,13 +146,13 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
case CHAT_MSG_RAID_LEADER:
case CHAT_MSG_RAID_WARNING:
// allow two side chat at group channel if two side group allowed
if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
lang = LANG_UNIVERSAL;
break;
case CHAT_MSG_GUILD:
case CHAT_MSG_OFFICER:
// allow two side chat at guild channel if two side guild allowed
if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
lang = LANG_UNIVERSAL;
break;
}
@@ -160,7 +160,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
Unit::AuraEffectList const& ModLangAuras = _player->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);
if(!ModLangAuras.empty())
if (!ModLangAuras.empty())
lang = ModLangAuras.front()->GetMiscValue();
}
@@ -193,7 +193,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -208,14 +208,14 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if(type == CHAT_MSG_SAY)
if (type == CHAT_MSG_SAY)
GetPlayer()->Say(msg, lang);
else if(type == CHAT_MSG_EMOTE)
else if (type == CHAT_MSG_EMOTE)
GetPlayer()->TextEmote(msg);
else if(type == CHAT_MSG_YELL)
else if (type == CHAT_MSG_YELL)
GetPlayer()->Yell(msg, lang);
} break;
@@ -234,10 +234,10 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if(!normalizePlayerName(to))
if (!normalizePlayerName(to))
{
SendPlayerNotFoundNotice(to);
break;
@@ -256,7 +256,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
{
uint32 sidea = GetPlayer()->GetTeam();
uint32 sideb = player->GetTeam();
if( sidea != sideb )
if ( sidea != sideb )
{
SendPlayerNotFoundNotice(to);
return;
@@ -278,7 +278,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -287,26 +287,26 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /p
Group *group = GetPlayer()->GetOriginalGroup();
if(!group)
if (!group)
{
group = _player->GetGroup();
if(!group || group->isBGGroup())
if (!group || group->isBGGroup())
return;
}
if((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetGUID()))
if ((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetGUID()))
return;
WorldPacket data;
ChatHandler::FillMessageData(&data, this, type, lang, NULL, 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
if(sWorld.getConfig(CONFIG_CHATLOG_PARTY))
if (sWorld.getConfig(CONFIG_CHATLOG_PARTY))
sLog.outChat("[PARTY] Player %s tells group with leader %s: %s",
GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
@@ -316,7 +316,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -325,7 +325,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if (GetPlayer()->GetGuildId())
@@ -335,7 +335,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (guild)
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
if(lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHATLOG_GUILD))
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHATLOG_GUILD))
{
sLog.outChat("[GUILD] Player %s tells guild %s: %s",
GetPlayer()->GetName(), guild->GetName().c_str(), msg.c_str());
@@ -354,7 +354,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -363,7 +363,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if (GetPlayer()->GetGuildId())
@@ -373,7 +373,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (guild)
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
if(sWorld.getConfig(CONFIG_CHATLOG_GUILD))
if (sWorld.getConfig(CONFIG_CHATLOG_GUILD))
sLog.outChat("[OFFICER] Player %s tells guild %s officers: %s",
GetPlayer()->GetName(), guild->GetName().c_str(), msg.c_str());
}
@@ -384,7 +384,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -393,15 +393,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup();
if(!group)
if (!group)
{
group = GetPlayer()->GetGroup();
if(!group || group->isBGGroup() || !group->isRaidGroup())
if (!group || group->isBGGroup() || !group->isRaidGroup())
return;
}
@@ -409,7 +409,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
if (sWorld.getConfig(CONFIG_CHATLOG_RAID))
sLog.outChat("[RAID] Player %s tells raid with leader %s: %s",
GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
@@ -418,7 +418,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
@@ -427,15 +427,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup();
if(!group)
if (!group)
{
group = GetPlayer()->GetGroup();
if(!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetGUID()))
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetGUID()))
return;
}
@@ -443,7 +443,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_LEADER, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
if (sWorld.getConfig(CONFIG_CHATLOG_RAID))
sLog.outChat("[RAID] Leader player %s tells raid: %s",
GetPlayer()->GetName(), msg.c_str());
} break;
@@ -455,11 +455,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
if (!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
return;
WorldPacket data;
@@ -467,7 +467,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
ChatHandler::FillMessageData(&data, this, CHAT_MSG_RAID_WARNING, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
if(sWorld.getConfig(CONFIG_CHATLOG_RAID))
if (sWorld.getConfig(CONFIG_CHATLOG_RAID))
sLog.outChat("[RAID] Leader player %s warns raid with: %s",
GetPlayer()->GetName(), msg.c_str());
} break;
@@ -480,19 +480,19 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
//battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isBGGroup())
if (!group || !group->isBGGroup())
return;
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_BATTLEGROUND, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
if(sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
if (sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
sLog.outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
GetPlayer()->GetName(), group->GetLeaderName(), msg.c_str());
} break;
@@ -505,19 +505,19 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
return;
WorldPacket data;
ChatHandler::FillMessageData(&data, this, CHAT_MSG_BATTLEGROUND_LEADER, lang, "", 0, msg.c_str(), NULL);
group->BroadcastPacket(&data, false);
if(sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
if (sWorld.getConfig(CONFIG_CHATLOG_BGROUND))
sLog.outChat("[RAID] Leader player %s tells battleground: %s",
GetPlayer()->GetName(), msg.c_str());
} break;
@@ -537,24 +537,24 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
return;
}
if(msg.empty())
if (msg.empty())
break;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channel, _player))
if (Channel *chn = cMgr->GetChannel(channel, _player))
{
chn->Say(_player->GetGUID(), msg.c_str(), lang);
if((chn->HasFlag(CHANNEL_FLAG_TRADE) ||
if ((chn->HasFlag(CHANNEL_FLAG_TRADE) ||
chn->HasFlag(CHANNEL_FLAG_GENERAL) ||
chn->HasFlag(CHANNEL_FLAG_CITY) ||
chn->HasFlag(CHANNEL_FLAG_LFG)) &&
sWorld.getConfig(CONFIG_CHATLOG_SYSCHAN))
sLog.outChat("[SYSCHAN] Player %s tells channel %s: %s",
GetPlayer()->GetName(), chn->GetName().c_str(), msg.c_str());
else if(sWorld.getConfig(CONFIG_CHATLOG_CHANNEL))
else if (sWorld.getConfig(CONFIG_CHATLOG_CHANNEL))
sLog.outChat("[CHANNEL] Player %s tells channel %s: %s",
GetPlayer()->GetName(), chn->GetName().c_str(), msg.c_str());
}
@@ -566,16 +566,16 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if((msg.empty() || !_player->isAFK()) && !_player->isInCombat() )
if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat() )
{
if(!_player->isAFK())
if (!_player->isAFK())
{
if(msg.empty())
if (msg.empty())
msg = GetTrinityString(LANG_PLAYER_AFK_DEFAULT);
_player->afkMsg = msg;
}
_player->ToggleAFK();
if(_player->isAFK() && _player->isDND())
if (_player->isAFK() && _player->isDND())
_player->ToggleDND();
}
} break;
@@ -585,16 +585,16 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty() || !_player->isDND())
if (msg.empty() || !_player->isDND())
{
if(!_player->isDND())
if (!_player->isDND())
{
if(msg.empty())
if (msg.empty())
msg = GetTrinityString(LANG_PLAYER_DND_DEFAULT);
_player->dndMsg = msg;
}
_player->ToggleDND();
if(_player->isDND() && _player->isAFK())
if (_player->isDND() && _player->isAFK())
_player->ToggleAFK();
}
} break;
@@ -607,7 +607,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
void WorldSession::HandleEmoteOpcode( WorldPacket & recv_data )
{
if(!GetPlayer()->isAlive())
if (!GetPlayer()->isAlive())
return;
uint32 emote;
@@ -633,7 +633,7 @@ namespace Trinity
data << (uint32)i_text_emote;
data << i_emote_num;
data << (uint32)namlen;
if( namlen > 1 )
if ( namlen > 1 )
data.append(nam, namlen);
else
data << (uint8)0x00;
@@ -649,7 +649,7 @@ namespace Trinity
void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
{
if(!GetPlayer()->isAlive())
if (!GetPlayer()->isAlive())
return;
if (!GetPlayer()->CanSpeak())
@@ -715,7 +715,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
recv_data >> unk; // probably related to spam reporting
Player *player = objmgr.GetPlayer(iguid);
if(!player || !player->GetSession())
if (!player || !player->GetSession())
return;
WorldPacket data;
+27 -27
View File
@@ -24,7 +24,7 @@
int AggressorAI::Permissible(const Creature *creature)
{
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
if( !creature->isCivilian() && !creature->IsNeutralToAll() )
if ( !creature->isCivilian() && !creature->IsNeutralToAll() )
return PERMIT_BASE_PROACTIVE;
return PERMIT_BASE_NO;
@@ -32,7 +32,7 @@ int AggressorAI::Permissible(const Creature *creature)
void AggressorAI::UpdateAI(const uint32 /*diff*/)
{
if(!UpdateVictim())
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
@@ -62,7 +62,7 @@ int AOEAI::Permissible(const Creature *creature)
void CombatAI::InitializeAI()
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
if(me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i]))
if (me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i]))
spells.push_back(me->m_spells[i]);
CreatureAI::InitializeAI();
@@ -76,7 +76,7 @@ void CombatAI::Reset()
void CombatAI::JustDied(Unit *killer)
{
for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i)
if(AISpellInfo[*i].condition == AICOND_DIE)
if (AISpellInfo[*i].condition == AICOND_DIE)
me->CastSpell(killer, *i, true);
}
@@ -84,24 +84,24 @@ void CombatAI::EnterCombat(Unit *who)
{
for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i)
{
if(AISpellInfo[*i].condition == AICOND_AGGRO)
if (AISpellInfo[*i].condition == AICOND_AGGRO)
me->CastSpell(who, *i, false);
else if(AISpellInfo[*i].condition == AICOND_COMBAT)
else if (AISpellInfo[*i].condition == AICOND_COMBAT)
events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand()%AISpellInfo[*i].cooldown);
}
}
void CombatAI::UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
if (!UpdateVictim())
return;
events.Update(diff);
if(me->hasUnitState(UNIT_STAT_CASTING))
if (me->hasUnitState(UNIT_STAT_CASTING))
return;
if(uint32 spellId = events.ExecuteEvent())
if (uint32 spellId = events.ExecuteEvent())
{
DoCast(spellId);
events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand()%AISpellInfo[spellId].cooldown);
@@ -135,7 +135,7 @@ void CasterAI::EnterCombat(Unit *who)
uint32 count = 0;
for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr, ++count)
{
if(AISpellInfo[*itr].condition == AICOND_AGGRO)
if (AISpellInfo[*itr].condition == AICOND_AGGRO)
me->CastSpell(who, *itr, false);
else if (AISpellInfo[*itr].condition == AICOND_COMBAT)
{
@@ -152,15 +152,15 @@ void CasterAI::EnterCombat(Unit *who)
void CasterAI::UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
if (!UpdateVictim())
return;
events.Update(diff);
if(me->hasUnitState(UNIT_STAT_CASTING))
if (me->hasUnitState(UNIT_STAT_CASTING))
return;
if(uint32 spellId = events.ExecuteEvent())
if (uint32 spellId = events.ExecuteEvent())
{
DoCast(spellId);
uint32 casttime = me->GetCurrentSpellCastTime(spellId);
@@ -176,7 +176,7 @@ ArchorAI::ArchorAI(Creature *c) : CreatureAI(c)
{
ASSERT(me->m_spells[0]);
m_minRange = GetSpellMinRange(me->m_spells[0], false);
if(!m_minRange)
if (!m_minRange)
m_minRange = MELEE_RANGE;
me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false);
me->m_SightDistance = me->m_CombatDistance;
@@ -184,30 +184,30 @@ ArchorAI::ArchorAI(Creature *c) : CreatureAI(c)
void ArchorAI::AttackStart(Unit *who)
{
if(!who)
if (!who)
return;
if(me->IsWithinCombatRange(who, m_minRange))
if (me->IsWithinCombatRange(who, m_minRange))
{
if(me->Attack(who, true) && !who->IsFlying())
if (me->Attack(who, true) && !who->IsFlying())
me->GetMotionMaster()->MoveChase(who);
}
else
{
if(me->Attack(who, false) && !who->IsFlying())
if (me->Attack(who, false) && !who->IsFlying())
me->GetMotionMaster()->MoveChase(who, me->m_CombatDistance);
}
if(who->IsFlying())
if (who->IsFlying())
me->GetMotionMaster()->MoveIdle();
}
void ArchorAI::UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
if (!UpdateVictim())
return;
if(!me->IsWithinCombatRange(me->getVictim(), m_minRange))
if (!me->IsWithinCombatRange(me->getVictim(), m_minRange))
DoSpellAttackIfReady(me->m_spells[0]);
else
DoMeleeAttackIfReady();
@@ -228,7 +228,7 @@ TurretAI::TurretAI(Creature *c) : CreatureAI(c)
bool TurretAI::CanAIAttack(const Unit *who) const
{
// TODO: use one function to replace it
if(!me->IsWithinCombatRange(me->getVictim(), me->m_CombatDistance)
if (!me->IsWithinCombatRange(me->getVictim(), me->m_CombatDistance)
|| m_minRange && me->IsWithinCombatRange(me->getVictim(), m_minRange))
return false;
return true;
@@ -236,19 +236,19 @@ bool TurretAI::CanAIAttack(const Unit *who) const
void TurretAI::AttackStart(Unit *who)
{
if(who)
if (who)
me->Attack(who, false);
}
void TurretAI::UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
if (!UpdateVictim())
return;
DoSpellAttackIfReady(me->m_spells[0]);
//if(!DoSpellAttackIfReady(me->m_spells[0]))
//if(HostileReference *ref = me->getThreatManager().getCurrentVictim())
//if (!DoSpellAttackIfReady(me->m_spells[0]))
//if (HostileReference *ref = me->getThreatManager().getCurrentVictim())
//ref->removeReference();
}
@@ -277,6 +277,6 @@ void AOEAI::AttackStart(Unit *who)
void AOEAI::UpdateAI(const uint32 diff)
{
if(!me->HasAura(me->m_spells[0]))
if (!me->HasAura(me->m_spells[0]))
me->CastSpell(me, me->m_spells[0],false);
}
+4 -4
View File
@@ -35,9 +35,9 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid);
if(!pEnemy)
if (!pEnemy)
{
if(!IS_UNIT_GUID(guid))
if (!IS_UNIT_GUID(guid))
sLog.outError("WORLD: Object %u (TypeID: %u) isn't player, pet or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
else
sLog.outError( "WORLD: Enemy %s %u not found",GetLogNameForGuid(guid),GUID_LOPART(guid));
@@ -47,7 +47,7 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
return;
}
if(!_player->canAttack(pEnemy))
if (!_player->canAttack(pEnemy))
{
sLog.outError( "WORLD: Enemy %s %u is friendly",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid));
@@ -71,7 +71,7 @@ void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
//sLog.outDebug( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed );
if(sheathed >= MAX_SHEATH_STATE)
if (sheathed >= MAX_SHEATH_STATE)
{
sLog.outError("Unknown sheath state %u ??",sheathed);
return;
+7 -7
View File
@@ -119,19 +119,19 @@ template<class T>
bool
ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
if(!&unit)
if (!&unit)
return true;
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
return true;
if( i_nextMoveTime.Passed() )
if ( i_nextMoveTime.Passed() )
{
// currently moving, update location
Traveller<T> traveller(unit);
if( i_destinationHolder.UpdateTraveller(traveller, diff))
if ( i_destinationHolder.UpdateTraveller(traveller, diff))
{
if( i_destinationHolder.HasArrived())
if ( i_destinationHolder.HasArrived())
{
// arrived, stop and wait a bit
unit.clearUnitState(UNIT_STAT_MOVE);
@@ -145,7 +145,7 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
// waiting for next move
i_nextMoveTime.Update(diff);
if( i_nextMoveTime.Passed() )
if ( i_nextMoveTime.Passed() )
{
// start moving
assert( i_nextMove <= MAX_CONF_WAYPOINTS );
@@ -165,7 +165,7 @@ ConfusedMovementGenerator<T>::Finalize(T &unit)
{
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit.clearUnitState(UNIT_STAT_CONFUSED);
if(unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
if (unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
unit.SetUInt64Value(UNIT_FIELD_TARGET, unit.getVictim()->GetGUID());
}
+1 -1
View File
@@ -41,7 +41,7 @@ class ConfusedMovementGenerator
bool GetDestination(float &x, float &y, float &z) const
{
if(i_destinationHolder.HasArrived()) return false;
if (i_destinationHolder.HasArrived()) return false;
i_destinationHolder.GetDestination(x,y,z);
return true;
}
+10 -10
View File
@@ -53,7 +53,7 @@ Corpse::~Corpse()
void Corpse::AddToWorld()
{
///- Register the corpse for guid lookup
if(!IsInWorld())
if (!IsInWorld())
ObjectAccessor::Instance().AddObject(this);
Object::AddToWorld();
@@ -62,7 +62,7 @@ void Corpse::AddToWorld()
void Corpse::RemoveFromWorld()
{
///- Remove the corpse from the accessor
if(IsInWorld())
if (IsInWorld())
ObjectAccessor::Instance().RemoveObject(this);
Object::RemoveFromWorld();
@@ -81,7 +81,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
@@ -145,7 +145,7 @@ void Corpse::DeleteBonesFromWorld()
void Corpse::DeleteFromDB()
{
if(GetType() == CORPSE_BONES)
if (GetType() == CORPSE_BONES)
// only specific bones
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%d'", GetGUIDLow());
else
@@ -161,7 +161,7 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
// 0 1 2 3 4 5 6 7 8 9
result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance,phaseMask FROM corpse WHERE guid = '%u'",guid);
if( !result )
if ( !result )
{
sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid);
return false;
@@ -169,7 +169,7 @@ bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
Field *fields = result->Fetch();
if(!LoadFromDB(guid, fields))
if (!LoadFromDB(guid, fields))
{
if (!external)
delete result;
@@ -193,7 +193,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
Object::_Create(guid, 0, HIGHGUID_CORPSE);
if(!LoadValues( fields[5].GetString() ))
if (!LoadValues( fields[5].GetString() ))
{
sLog.outError("Corpse #%d have broken data in `data` field. Can't be loaded.",guid);
return false;
@@ -202,13 +202,13 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
m_time = time_t(fields[6].GetUInt64());
m_type = CorpseType(fields[7].GetUInt32());
if(m_type >= MAX_CORPSE_TYPE)
if (m_type >= MAX_CORPSE_TYPE)
{
sLog.outError("Corpse (guidlow %d, owner %d) have wrong corpse type, not load.",GetGUIDLow(),GUID_LOPART(GetOwnerGUID()));
return false;
}
if(m_type != CORPSE_BONES)
if (m_type != CORPSE_BONES)
m_isWorldObject = true;
uint32 instanceid = fields[8].GetUInt32();
@@ -224,7 +224,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
SetPhaseMask(phaseMask, false);
Relocate(positionX, positionY, positionZ, ort);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), GetPositionX(), GetPositionY());
+204 -204
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -146,11 +146,11 @@ struct CreatureInfo
// helpers
SkillType GetRequiredLootSkill() const
{
if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
if (type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
return SKILL_HERBALISM;
else if(type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
else if (type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
return SKILL_MINING;
else if(type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
else if (type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
return SKILL_ENGINERING;
else
return SKILL_SKINNING; // normal case
@@ -158,7 +158,7 @@ struct CreatureInfo
bool isTameable(bool exotic) const
{
if(type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE)==0)
if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE)==0)
return false;
// if can tame exotic then can tame any temable
@@ -323,7 +323,7 @@ struct VendorItemData
VendorItem* GetItem(uint32 slot) const
{
if(slot>=m_items.size()) return NULL;
if (slot>=m_items.size()) return NULL;
return m_items[slot];
}
bool Empty() const { return m_items.empty(); }
@@ -440,7 +440,7 @@ class Creature : public Unit, public GridObject<Creature>
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
{
if(isPet())
if (isPet())
return false;
uint32 rank = GetCreatureInfo()->rank;
@@ -449,7 +449,7 @@ class Creature : public Unit, public GridObject<Creature>
bool isWorldBoss() const
{
if(isPet())
if (isPet())
return false;
return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
@@ -641,7 +641,7 @@ class Creature : public Unit, public GridObject<Creature>
bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
void LowerPlayerDamageReq(uint32 unDamage)
{
if(m_PlayerDamageReq)
if (m_PlayerDamageReq)
m_PlayerDamageReq > unDamage ? m_PlayerDamageReq -= unDamage : m_PlayerDamageReq = 0;
}
void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
+22 -22
View File
@@ -41,7 +41,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
if (!creature)
creature = me;
if(!creature->CanHaveThreatList())
if (!creature->CanHaveThreatList())
return;
Map *map = creature->GetMap();
@@ -51,24 +51,24 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
return;
}
if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
if(Unit *target = creature->SelectNearestTarget(50))
if (Unit *target = creature->SelectNearestTarget(50))
creature->AI()->AttackStart(target);
else if(creature->isSummon())
else if (creature->isSummon())
{
if(Unit *summoner = creature->ToTempSummon()->GetSummoner())
if (Unit *summoner = creature->ToTempSummon()->GetSummoner())
{
Unit *target = summoner->getAttackerForHelper();
if(!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty())
if (!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty())
target = summoner->getThreatManager().getHostilTarget();
if(target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target)))
if (target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target)))
creature->AI()->AttackStart(target);
}
}
}
if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
sLog.outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
return;
@@ -76,17 +76,17 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
Map::PlayerList const &PlList = map->GetPlayers();
if(PlList.isEmpty())
if (PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
if(Player* pPlayer = i->getSource())
if (Player* pPlayer = i->getSource())
{
if(pPlayer->isGameMaster())
if (pPlayer->isGameMaster())
continue;
if(pPlayer->isAlive())
if (pPlayer->isAlive())
{
creature->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(creature);
@@ -108,7 +108,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
// MoveInLineOfSight can be called inside another MoveInLineOfSight and cause stack overflow
void CreatureAI::MoveInLineOfSight_Safe(Unit *who)
{
if(m_MoveInLineOfSight_locked == true)
if (m_MoveInLineOfSight_locked == true)
return;
m_MoveInLineOfSight_locked = true;
MoveInLineOfSight(who);
@@ -117,15 +117,15 @@ void CreatureAI::MoveInLineOfSight_Safe(Unit *who)
void CreatureAI::MoveInLineOfSight(Unit *who)
{
if(me->getVictim())
if (me->getVictim())
return;
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) // non-combat pets should just stand there and look good;)
return;
if(me->canStartAttack(who, false))
if (me->canStartAttack(who, false))
AttackStart(who);
//else if(who->getVictim() && me->IsFriendlyTo(who)
//else if (who->getVictim() && me->IsFriendlyTo(who)
// && me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
// && me->canStartAttack(who->getVictim(), true)) // TODO: if we use true, it will not attack it when it arrives
// me->GetMotionMaster()->MoveChase(who->getVictim());
@@ -133,7 +133,7 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
void CreatureAI::SelectNearestTarget(Unit *who)
{
if(me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who))
if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who))
{
me->getThreatManager().modifyThreatPercent(me->getVictim(), -100);
me->AddThreat(who, 1000000.0f);
@@ -142,14 +142,14 @@ void CreatureAI::SelectNearestTarget(Unit *who)
void CreatureAI::EnterEvadeMode()
{
if(!_EnterEvadeMode())
if (!_EnterEvadeMode())
return;
sLog.outDebug("Creature %u enters evade mode.", me->GetEntry());
if(!me->GetVehicle()) // otherwise me will be in evade mode forever
if (!me->GetVehicle()) // otherwise me will be in evade mode forever
{
if(Unit *owner = me->GetCharmerOrOwner())
if (Unit *owner = me->GetCharmerOrOwner())
{
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE);
@@ -160,12 +160,12 @@ void CreatureAI::EnterEvadeMode()
Reset();
if(me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
me->GetVehicleKit()->Reset();
}
/*void CreatureAI::AttackedBy( Unit* attacker )
{
if(!m_creature->getVictim())
if (!m_creature->getVictim())
AttackStart(attacker);
}*/
+1 -1
View File
@@ -532,7 +532,7 @@ inline bool CreatureAI::UpdateVictim()
if (!me->HasReactState(REACT_PASSIVE))
{
if(Unit *victim = me->SelectVictim())
if (Unit *victim = me->SelectVictim())
AttackStart(victim);
return me->getVictim();
}
+17 -17
View File
@@ -38,45 +38,45 @@ namespace FactorySelector
const CreatureAICreator *ai_factory = NULL;
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
if(creature->isPet())
if (creature->isPet())
ai_factory = ai_registry.GetRegistryItem("PetAI");
//scriptname in db
if(!ai_factory)
if(CreatureAI* scriptedAI = sScriptMgr.GetAI(creature))
if (!ai_factory)
if (CreatureAI* scriptedAI = sScriptMgr.GetAI(creature))
return scriptedAI;
// AIname in db
std::string ainame=creature->GetAIName();
if(!ai_factory && !ainame.empty())
if (!ai_factory && !ainame.empty())
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
// select by NPC flags
if(!ai_factory)
if (!ai_factory)
{
if(creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->IsVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
else if (creature->IsVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
else if(creature->isGuard())
else if (creature->isGuard())
ai_factory = ai_registry.GetRegistryItem("GuardAI");
else if(creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
else if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->isTotem())
else if (creature->isTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");
else if(creature->isTrigger())
else if (creature->isTrigger())
{
if(creature->m_spells[0])
if (creature->m_spells[0])
ai_factory = ai_registry.GetRegistryItem("TriggerAI");
else
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
}
else if(creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
else if (creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
ai_factory = ai_registry.GetRegistryItem("CritterAI");
}
// select by permit check
if(!ai_factory)
if (!ai_factory)
{
int best_val = -1;
typedef CreatureAIRegistry::RegistryMapType RMT;
@@ -87,7 +87,7 @@ namespace FactorySelector
const SelectableAI *p = dynamic_cast<const SelectableAI *>(factory);
assert( p != NULL );
int val = p->Permit(creature);
if( val > best_val )
if ( val > best_val )
{
best_val = val;
ai_factory = p;
@@ -108,7 +108,7 @@ namespace FactorySelector
assert( creature->GetCreatureInfo() != NULL );
const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem( creature->GetDefaultMovementType());
/* if( mv_factory == NULL )
/* if ( mv_factory == NULL )
{
int best_val = -1;
std::vector<std::string> l;
@@ -119,7 +119,7 @@ namespace FactorySelector
const SelectableMovement *p = dynamic_cast<const SelectableMovement *>(factory);
assert( p != NULL );
int val = p->Permit(creature);
if( val > best_val )
if ( val > best_val )
{
best_val = val;
mv_factory = p;
+14 -14
View File
@@ -71,7 +71,7 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
continue;
#endif
if(m_creature->GetMap()->IsDungeon())
if (m_creature->GetMap()->IsDungeon())
{
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
{
@@ -296,7 +296,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura const * aura = m_creature->GetAura(event.buffed.spellId);
if(!aura || aura->GetStackAmount() < event.buffed.amount)
if (!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
//Repeat Timers
@@ -312,7 +312,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura const * aura = pActionInvoker->GetAura(event.buffed.spellId);
if(!aura || aura->GetStackAmount() < event.buffed.amount)
if (!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
//Repeat Timers
@@ -457,9 +457,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if(action.cast.castFlags & CAST_AURA_NOT_PRESENT)
if (action.cast.castFlags & CAST_AURA_NOT_PRESENT)
{
if(target->HasAura(action.cast.spellId))
if (target->HasAura(action.cast.spellId))
return;
}
@@ -527,7 +527,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break;
}
@@ -567,7 +567,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_COMBAT_MOVEMENT:
// ignore no affect case
if(CombatMovementEnabled==(action.combat_movement.state!=0))
if (CombatMovementEnabled==(action.combat_movement.state!=0))
return;
CombatMovementEnabled = action.combat_movement.state != 0;
@@ -818,7 +818,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
if(action.invincibility_hp_level.is_percent)
if (action.invincibility_hp_level.is_percent)
InvinceabilityHpLevel = m_creature->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
else
InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
@@ -1003,7 +1003,7 @@ void CreatureEventAI::AttackStart(Unit *who)
void CreatureEventAI::MoveInLineOfSight(Unit *who)
{
if(me->getVictim())
if (me->getVictim())
return;
//Check for OOC LOS Event
@@ -1238,7 +1238,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
sLog.outDebug("CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote);
if((*i).second.SoundId)
if ((*i).second.SoundId)
{
if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId))
pSource->PlayDirectSound((*i).second.SoundId);
@@ -1246,7 +1246,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId);
}
if((*i).second.Emote)
if ((*i).second.Emote)
{
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
{
@@ -1341,9 +1341,9 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage )
{
if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
if (InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
{
if(m_creature->GetHealth() <= InvinceabilityHpLevel)
if (m_creature->GetHealth() <= InvinceabilityHpLevel)
damage = 0;
else
damage = m_creature->GetHealth() - InvinceabilityHpLevel;
@@ -1352,7 +1352,7 @@ void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage )
bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event)
{
if(event.event_type != EVENT_T_SPAWNED)
if (event.event_type != EVENT_T_SPAWNED)
return false;
switch (event.spawned.condition)
+9 -9
View File
@@ -136,7 +136,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
temp.orientation = fields[4].GetFloat();
temp.SpawnTimeSecs = fields[5].GetUInt32();
if(!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
if (!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation))
{
sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation);
continue;
@@ -286,11 +286,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case SPAWNED_EVENT_ALWAY:
break;
case SPAWNED_EVENT_MAP:
if(!sMapStore.LookupEntry(temp.spawned.conditionValue1))
if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
break;
case SPAWNED_EVENT_ZONE:
if(!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
default:
sLog.outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
@@ -659,9 +659,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
break;
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
if(action.invincibility_hp_level.is_percent)
if (action.invincibility_hp_level.is_percent)
{
if(action.invincibility_hp_level.hp_level > 100)
if (action.invincibility_hp_level.hp_level > 100)
{
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
action.invincibility_hp_level.hp_level = 100;
@@ -705,20 +705,20 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
++Count;
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id))
{
if(!cInfo->AIName || !cInfo->AIName[0])
if (!cInfo->AIName || !cInfo->AIName[0])
{
//sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but its AIName is empty. Set to EventAI as default.", cInfo->Entry);
size_t len = strlen("EventAI")+1;
const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
strncpy(const_cast<char*>(cInfo->AIName), "EventAI", len);
}
if(strcmp(cInfo->AIName, "EventAI"))
if (strcmp(cInfo->AIName, "EventAI"))
{
//sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName);
}
if(cInfo->ScriptID)
if (cInfo->ScriptID)
{
//sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry);
}
+22 -22
View File
@@ -34,13 +34,13 @@ CreatureGroupInfoType CreatureGroupMap;
void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member)
{
Map *map = member->FindMap();
if(!map)
if (!map)
return;
CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId);
//Add member to an existing group
if(itr != map->CreatureGroupHolder.end())
if (itr != map->CreatureGroupHolder.end())
{
sLog.outDebug("Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
itr->second->AddMember(member);
@@ -60,10 +60,10 @@ void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup *group, Creatur
sLog.outDebug("Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
group->RemoveMember(member);
if(group->isEmpty())
if (group->isEmpty())
{
Map *map = member->FindMap();
if(!map)
if (!map)
return;
sLog.outDebug("Deleting group with InstanceID %u", member->GetInstanceId());
@@ -80,7 +80,7 @@ void CreatureGroupManager::LoadCreatureFormations()
//Check Integrity of the table
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(leaderGUID) FROM creature_formations");
if(!result)
if (!result)
{
sLog.outErrorDb(" ...an error occured while loading the table creature_formations ( maybe it doesn't exist ?)\n");
return;
@@ -89,7 +89,7 @@ void CreatureGroupManager::LoadCreatureFormations()
//Get group data
result = WorldDatabase.PQuery("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID");
if(!result)
if (!result)
{
sLog.outErrorDb("The table creature_formations is empty or corrupted");
return;
@@ -112,7 +112,7 @@ void CreatureGroupManager::LoadCreatureFormations()
uint32 memberGUID = fields[1].GetUInt32();
group_member->groupAI = fields[4].GetUInt8();
//If creature is group leader we may skip loading of dist/angle
if(group_member->leaderGUID != memberGUID)
if (group_member->leaderGUID != memberGUID)
{
group_member->follow_dist = fields[2].GetFloat();
group_member->follow_angle = fields[3].GetFloat() * M_PI / 180;
@@ -126,7 +126,7 @@ void CreatureGroupManager::LoadCreatureFormations()
// check data correctness
{
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", group_member->leaderGUID);
if(!result)
if (!result)
{
sLog.outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
delete group_member;
@@ -134,7 +134,7 @@ void CreatureGroupManager::LoadCreatureFormations()
}
result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", memberGUID);
if(!result)
if (!result)
{
sLog.outErrorDb("creature_formations table member guid %u incorrect (not exist)", memberGUID);
delete group_member;
@@ -156,7 +156,7 @@ void CreatureGroup::AddMember(Creature *member)
sLog.outDebug("CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow());
//Check if it is a leader
if(member->GetDBTableGUIDLow() == m_groupID)
if (member->GetDBTableGUIDLow() == m_groupID)
{
sLog.outDebug("Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow());
m_leader = member;
@@ -168,7 +168,7 @@ void CreatureGroup::AddMember(Creature *member)
void CreatureGroup::RemoveMember(Creature *member)
{
if(m_leader == member)
if (m_leader == member)
m_leader = NULL;
m_members.erase(member);
@@ -178,10 +178,10 @@ void CreatureGroup::RemoveMember(Creature *member)
void CreatureGroup::MemberAttackStart(Creature *member, Unit *target)
{
uint8 groupAI = CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI;
if(!groupAI)
if (!groupAI)
return;
if(groupAI == 1 && member != m_leader)
if (groupAI == 1 && member != m_leader)
return;
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
@@ -190,16 +190,16 @@ void CreatureGroup::MemberAttackStart(Creature *member, Unit *target)
//sLog.outDebug("AI:%u:Group member found: %u, attacked by %s.", groupAI, itr->second->GetGUIDLow(), member->getVictim()->GetName());
//Skip one check
if(itr->first == member)
if (itr->first == member)
continue;
if(!itr->first->isAlive())
if (!itr->first->isAlive())
continue;
if(itr->first->getVictim())
if (itr->first->getVictim())
continue;
if(itr->first->canAttack(target))
if (itr->first->canAttack(target))
itr->first->AI()->AttackStart(target);
}
}
@@ -208,9 +208,9 @@ void CreatureGroup::FormationReset(bool dismiss)
{
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->first != m_leader && itr->first->isAlive())
if (itr->first != m_leader && itr->first->isAlive())
{
if(dismiss)
if (dismiss)
itr->first->GetMotionMaster()->Initialize();
else
itr->first->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
@@ -222,7 +222,7 @@ void CreatureGroup::FormationReset(bool dismiss)
void CreatureGroup::LeaderMoveTo(float x, float y, float z)
{
if(!m_leader)
if (!m_leader)
return;
float pathangle = atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x);
@@ -230,7 +230,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Creature *member = itr->first;
if(member == m_leader || !member->isAlive() || member->getVictim())
if (member == m_leader || !member->isAlive() || member->getVictim())
continue;
float angle = itr->second->follow_angle;
@@ -245,7 +245,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
member->UpdateGroundPositionZ(dx, dy, dz);
if(member->IsWithinDist(m_leader, dist + MAX_DESYNC))
if (member->IsWithinDist(m_leader, dist + MAX_DESYNC))
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
else
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+55 -55
View File
@@ -183,16 +183,16 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
if (custom_entries)
sql = new SqlDbc(&filename,custom_entries, idname,storage.GetFormat());
if(storage.Load(dbc_filename.c_str(), sql))
if (storage.Load(dbc_filename.c_str(), sql))
{
bar.step();
for (uint8 i = 0; i < MAX_LOCALE; ++i)
{
if(!(availableDbcLocales & (1 << i)))
if (!(availableDbcLocales & (1 << i)))
continue;
std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename;
if(!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
if (!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
}
}
@@ -200,7 +200,7 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
{
// sort problematic dbc to (1) non compatible and (2) non-existed
FILE * f=fopen(dbc_filename.c_str(),"rb");
if(f)
if (f)
{
char buf[100];
snprintf(buf,100," (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat()));
@@ -230,13 +230,13 @@ void LoadDBCStores(const std::string& dataPath)
// must be after sAreaStore loading
for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0
{
if(AreaTableEntry const* area = sAreaStore.LookupEntry(i))
if (AreaTableEntry const* area = sAreaStore.LookupEntry(i))
{
// fill AreaId->DBC records
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag));
// fill MapId->DBC records ( skip sub zones and continents )
if(area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
if (area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag));
}
}
@@ -280,13 +280,13 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGameObjectDisplayInfoStore, dbcPath,"GameObjectDisplayInfo.dbc");
for (uint32 i = 0; i < sGameObjectDisplayInfoStore.GetNumRows(); ++i)
{
if(GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i))
if (GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i))
{
if(info->maxX < info->minX)
if (info->maxX < info->minX)
std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
if(info->maxY < info->minY)
if (info->maxY < info->minY)
std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
if(info->maxZ < info->minZ)
if (info->maxZ < info->minZ)
std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
}
}
@@ -325,7 +325,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapDifficultyStore, dbcPath,"MapDifficulty.dbc");
// fill data
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
if(MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
sMapDifficultyMap[MAKE_PAIR32(entry->MapId,entry->Difficulty)] = MapDifficulty(entry->resetTime,entry->maxPlayers);
sMapDifficultyStore.Clear();
@@ -349,7 +349,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const * spell = sSpellStore.LookupEntry(i);
if(spell && spell->Category)
if (spell && spell->Category)
sSpellCategoryStore[spell->Category].insert(i);
}
@@ -357,25 +357,25 @@ void LoadDBCStores(const std::string& dataPath)
{
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);
if(!skillLine)
if (!skillLine)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
if(spellInfo && IsPassiveSpell(spellInfo->Id))
if (spellInfo && IsPassiveSpell(spellInfo->Id))
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
if(!cFamily)
if (!cFamily)
continue;
if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
continue;
if(spellInfo->spellLevel)
if (spellInfo->spellLevel)
continue;
if(skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
continue;
sPetFamilySpellsStore[i].insert(spellInfo->Id);
@@ -402,7 +402,7 @@ void LoadDBCStores(const std::string& dataPath)
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
if(talentInfo->RankID[j])
if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j);
}
@@ -414,7 +414,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId );
if(!talentTabInfo)
if (!talentTabInfo)
continue;
// prevent memory corruption; otherwise cls will become 12 below
@@ -433,7 +433,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc");
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if(TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price);
uint32 pathCount = sTaxiPathStore.GetNumRows();
@@ -443,7 +443,7 @@ void LoadDBCStores(const std::string& dataPath)
std::vector<uint32> pathLength;
pathLength.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
{
if (pathLength[entry->path] < entry->index + 1)
pathLength[entry->path] = entry->index + 1;
@@ -454,7 +454,7 @@ void LoadDBCStores(const std::string& dataPath)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
// fill data
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
sTaxiPathNodeStore.Clear();
@@ -463,9 +463,9 @@ void LoadDBCStores(const std::string& dataPath)
{
std::set<uint32> spellPaths;
for (uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
if (SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for (int j=0; j < 3; ++j)
if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
if (sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
spellPaths.insert(sInfo->EffectMiscValue[j]);
memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask));
@@ -473,24 +473,24 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
if(!node)
if (!node)
continue;
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
if(src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
if (src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
{
bool ok = false;
for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i)
{
// not spell path
if(spellPaths.find(dest_i->second.ID)==spellPaths.end())
if (spellPaths.find(dest_i->second.ID)==spellPaths.end())
{
ok = true;
break;
}
}
if(!ok)
if (!ok)
continue;
}
@@ -518,12 +518,12 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
// error checks
if(bad_dbc_files.size() >= DBCFilesCount )
if (bad_dbc_files.size() >= DBCFilesCount )
{
sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
exit(1);
}
else if(!bad_dbc_files.empty() )
else if (!bad_dbc_files.empty() )
{
std::string str;
for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
@@ -534,7 +534,7 @@ void LoadDBCStores(const std::string& dataPath)
}
// Check loaded DBC files proper version
if( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2
if ( !sSpellStore.LookupEntry(74445) || // last added spell in 3.3.2
!sMapStore.LookupEntry(718) || // last map added in 3.3.2
!sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.2
!sItemExtendedCostStore.LookupEntry(2982) || // last item extended cost added in 3.3.2
@@ -553,14 +553,14 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember)
{
for (FactionTeamMap::const_iterator itr = sFactionTeamMap.begin(); itr != sFactionTeamMap.end(); ++itr)
{
if(itr->first == faction)
if (itr->first == faction)
{
isTeamMember = false;
return &itr->second;
}
for (SimpleFactionsList::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
{
if((*itr2) == faction)
if ((*itr2) == faction)
{
isTeamMember = true;
return &itr->second;
@@ -572,10 +572,10 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember)
char* GetPetName(uint32 petfamily, uint32 dbclang)
{
if(!petfamily)
if (!petfamily)
return NULL;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
if(!pet_family)
if (!pet_family)
return NULL;
return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL;
}
@@ -583,7 +583,7 @@ char* GetPetName(uint32 petfamily, uint32 dbclang)
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
if(itr==sTalentSpellPosMap.end())
if (itr==sTalentSpellPosMap.end())
return NULL;
return &itr->second;
@@ -591,7 +591,7 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
uint32 GetTalentSpellCost(uint32 spellId)
{
if(TalentSpellPos const* pos = GetTalentSpellPos(spellId))
if (TalentSpellPos const* pos = GetTalentSpellPos(spellId))
return pos->rank+1;
return 0;
@@ -600,7 +600,7 @@ uint32 GetTalentSpellCost(uint32 spellId)
int32 GetAreaFlagByAreaID(uint32 area_id)
{
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
if(i == sAreaFlagByAreaID.end())
if (i == sAreaFlagByAreaID.end())
return -1;
return i->second;
@@ -609,7 +609,7 @@ int32 GetAreaFlagByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
{
int32 areaflag = GetAreaFlagByAreaID(area_id);
if(areaflag < 0)
if (areaflag < 0)
return NULL;
return sAreaStore.LookupEntry(areaflag);
@@ -617,10 +617,10 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id)
{
if(area_flag)
if (area_flag)
return sAreaStore.LookupEntry(area_flag);
if(MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
return GetAreaEntryByAreaID(mapEntry->linked_zone);
return NULL;
@@ -629,7 +629,7 @@ AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_i
uint32 GetAreaFlagByMapId(uint32 mapid)
{
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
if(i == sAreaFlagByMapID.end())
if (i == sAreaFlagByMapID.end())
return 0;
else
return i->second;
@@ -637,10 +637,10 @@ uint32 GetAreaFlagByMapId(uint32 mapid)
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
if(mapid != 530 && mapid != 571) // speed for most cases
if (mapid != 530 && mapid != 571) // speed for most cases
return mapid;
if(WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
return mapid;
@@ -649,11 +649,11 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
{
mapid = GetVirtualMapForMapAndZone(mapid,zoneId);
if(mapid < 2)
if (mapid < 2)
return CONTENT_1_60;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if(!mapEntry)
if (!mapEntry)
return CONTENT_1_60;
switch(mapEntry->Expansion())
@@ -670,7 +670,7 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
{
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
if(ch && ch->ChannelID == channel_id)
if (ch && ch->ChannelID == channel_id)
return ch;
}
return NULL;
@@ -678,19 +678,19 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
if(requiredTotemCategoryId==0)
if (requiredTotemCategoryId==0)
return true;
if(itemTotemCategoryId==0)
if (itemTotemCategoryId==0)
return false;
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
if(!itemEntry)
if (!itemEntry)
return false;
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
if(!reqEntry)
if (!reqEntry)
return false;
if(itemEntry->categoryType!=reqEntry->categoryType)
if (itemEntry->categoryType!=reqEntry->categoryType)
return false;
return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask;
@@ -701,7 +701,7 @@ void Zone2MapCoordinates(float& x,float& y,uint32 zone)
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
if(!maEntry)
if (!maEntry)
return;
std::swap(x,y); // at client map coords swapped
@@ -714,7 +714,7 @@ void Map2ZoneCoordinates(float& x,float& y,uint32 zone)
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
if(!maEntry)
if (!maEntry)
return;
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
+25 -25
View File
@@ -835,9 +835,9 @@ struct FactionTemplateEntry
// helpers
bool IsFriendlyTo(FactionTemplateEntry const& entry) const
{
if(ID == entry.ID)
if (ID == entry.ID)
return true;
if(entry.faction)
if (entry.faction)
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] == entry.faction)
@@ -850,9 +850,9 @@ struct FactionTemplateEntry
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
{
if(ID == entry.ID)
if (ID == entry.ID)
return false;
if(entry.faction)
if (entry.faction)
{
for (int i = 0; i < 4; ++i)
if (enemyFaction[i] == entry.faction)
@@ -1148,7 +1148,7 @@ struct MapEntry
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
{
if(entrance_map < 0)
if (entrance_map < 0)
return false;
mapid = entrance_map;
x = entrance_x;
@@ -1248,12 +1248,12 @@ struct ScalingStatValuesEntry
{
if (mask & 0x4001F)
{
if(mask & 0x00000001) return ssdMultiplier[0];
if(mask & 0x00000002) return ssdMultiplier[1];
if(mask & 0x00000004) return ssdMultiplier[2];
if(mask & 0x00000008) return ssdMultiplier2;
if(mask & 0x00000010) return ssdMultiplier[3];
if(mask & 0x00040000) return ssdMultiplier3;
if (mask & 0x00000001) return ssdMultiplier[0];
if (mask & 0x00000002) return ssdMultiplier[1];
if (mask & 0x00000004) return ssdMultiplier[2];
if (mask & 0x00000008) return ssdMultiplier2;
if (mask & 0x00000010) return ssdMultiplier[3];
if (mask & 0x00040000) return ssdMultiplier3;
}
return 0;
}
@@ -1262,15 +1262,15 @@ struct ScalingStatValuesEntry
{
if (mask & 0x00F001E0)
{
if(mask & 0x00000020) return armorMod[0];
if(mask & 0x00000040) return armorMod[1];
if(mask & 0x00000080) return armorMod[2];
if(mask & 0x00000100) return armorMod[3];
if (mask & 0x00000020) return armorMod[0];
if (mask & 0x00000040) return armorMod[1];
if (mask & 0x00000080) return armorMod[2];
if (mask & 0x00000100) return armorMod[3];
if(mask & 0x00100000) return armorMod2[0]; // cloth
if(mask & 0x00200000) return armorMod2[1]; // leather
if(mask & 0x00400000) return armorMod2[2]; // mail
if(mask & 0x00800000) return armorMod2[3]; // plate
if (mask & 0x00100000) return armorMod2[0]; // cloth
if (mask & 0x00200000) return armorMod2[1]; // leather
if (mask & 0x00400000) return armorMod2[2]; // mail
if (mask & 0x00800000) return armorMod2[3]; // plate
}
return 0;
}
@@ -1278,12 +1278,12 @@ struct ScalingStatValuesEntry
{
if (mask&0x7E00)
{
if(mask & 0x00000200) return dpsMod[0];
if(mask & 0x00000400) return dpsMod[1];
if(mask & 0x00000800) return dpsMod[2];
if(mask & 0x00001000) return dpsMod[3];
if(mask & 0x00002000) return dpsMod[4];
if(mask & 0x00004000) return dpsMod[5]; // not used?
if (mask & 0x00000200) return dpsMod[0];
if (mask & 0x00000400) return dpsMod[1];
if (mask & 0x00000800) return dpsMod[2];
if (mask & 0x00001000) return dpsMod[3];
if (mask & 0x00002000) return dpsMod[4];
if (mask & 0x00004000) return dpsMod[5]; // not used?
}
return 0;
}
+52 -52
View File
@@ -136,7 +136,7 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
player = m_session->GetPlayer();
else
player = (Player*)unit;
if(!unit) unit = player;
if (!unit) unit = player;
std::ifstream ifs("opcode.txt");
if (ifs.bad())
@@ -152,57 +152,57 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
std::string type;
ifs >> type;
if(type == "")
if (type == "")
break;
if(type == "uint8")
if (type == "uint8")
{
uint16 val1;
ifs >> val1;
data << uint8(val1);
}
else if(type == "uint16")
else if (type == "uint16")
{
uint16 val2;
ifs >> val2;
data << val2;
}
else if(type == "uint32")
else if (type == "uint32")
{
uint32 val3;
ifs >> val3;
data << val3;
}
else if(type == "uint64")
else if (type == "uint64")
{
uint64 val4;
ifs >> val4;
data << val4;
}
else if(type == "float")
else if (type == "float")
{
float val5;
ifs >> val5;
data << val5;
}
else if(type == "string")
else if (type == "string")
{
std::string val6;
ifs >> val6;
data << val6;
}
else if(type == "appitsguid")
else if (type == "appitsguid")
{
data.append(unit->GetPackGUID());
}
else if(type == "appmyguid")
else if (type == "appmyguid")
{
data.append(player->GetPackGUID());
}
else if(type == "appgoguid")
else if (type == "appgoguid")
{
GameObject *obj = GetNearbyGameObject();
if(!obj)
if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
SetSentErrorMessage(true);
@@ -211,10 +211,10 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
}
data.append(obj->GetPackGUID());
}
else if(type == "goguid")
else if (type == "goguid")
{
GameObject *obj = GetNearbyGameObject();
if(!obj)
if (!obj)
{
PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0);
SetSentErrorMessage(true);
@@ -223,21 +223,21 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
}
data << uint64(obj->GetGUID());
}
else if(type == "myguid")
else if (type == "myguid")
{
data << uint64(player->GetGUID());
}
else if(type == "itsguid")
else if (type == "itsguid")
{
data << uint64(unit->GetGUID());
}
else if(type == "pos")
else if (type == "pos")
{
data << unit->GetPositionX();
data << unit->GetPositionY();
data << unit->GetPositionZ();
}
else if(type == "mypos")
else if (type == "mypos")
{
data << player->GetPositionX();
data << player->GetPositionY();
@@ -439,7 +439,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
SendSysMessage(state_str.c_str());
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
{
if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
continue;
Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
@@ -468,7 +468,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
for (size_t i = 0; i < updateQueue.size(); ++i)
{
Item *item = updateQueue[i];
if(!item) continue;
if (!item) continue;
Bag *container = item->GetContainer();
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
@@ -494,7 +494,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
std::vector<Item *> &updateQueue = player->GetItemUpdateQueue();
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
{
if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
continue;
Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
@@ -545,7 +545,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
error = true; continue;
}
if(item->IsBag())
if (item->IsBag())
{
Bag *bag = (Bag*)item;
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
@@ -611,7 +611,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
for (size_t i = 0; i < updateQueue.size(); ++i)
{
Item *item = updateQueue[i];
if(!item) continue;
if (!item) continue;
if (item->GetOwnerGUID() != player->GetGUID())
{
@@ -662,7 +662,7 @@ bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/)
bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
{
Creature* target = getSelectedCreature();
if(!target || target->isTotem() || target->isPet())
if (!target || target->isTotem() || target->isPet())
return false;
std::list<HostileReference*>& tlist = target->getThreatManager().getThreatList();
@@ -672,7 +672,7 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
for (itr = tlist.begin(); itr != tlist.end(); ++itr)
{
Unit* unit = (*itr)->getTarget();
if(!unit)
if (!unit)
continue;
++cnt;
PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat());
@@ -684,14 +684,14 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/)
{
Unit* target = getSelectedUnit();
if(!target)
if (!target)
target = m_session->GetPlayer();
HostileReference* ref = target->getHostileRefManager().getFirst();
uint32 cnt = 0;
PSendSysMessage("Hostil reference list of %s (guid %u)",target->GetName(), target->GetGUIDLow());
while (ref)
{
if(Unit * unit = ref->getSource()->getOwner())
if (Unit * unit = ref->getSource()->getOwner())
{
++cnt;
PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), ref->getThreat());
@@ -705,14 +705,14 @@ bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/)
bool ChatHandler::HandleDebugSetVehicleId(const char *args)
{
Unit* target = getSelectedUnit();
if(!target || target->IsVehicle())
if (!target || target->IsVehicle())
return false;
if(!args)
if (!args)
return false;
char* i = strtok((char*)args, " ");
if(!i)
if (!i)
return false;
uint32 id = (uint32)atoi(i);
@@ -724,14 +724,14 @@ bool ChatHandler::HandleDebugSetVehicleId(const char *args)
bool ChatHandler::HandleDebugEnterVehicle(const char * args)
{
Unit* target = getSelectedUnit();
if(!target || !target->IsVehicle())
if (!target || !target->IsVehicle())
return false;
if(!args)
if (!args)
return false;
char* i = strtok((char*)args, " ");
if(!i)
if (!i)
return false;
char* j = strtok(NULL, " ");
@@ -739,7 +739,7 @@ bool ChatHandler::HandleDebugEnterVehicle(const char * args)
uint32 entry = (uint32)atoi(i);
int8 seatId = j ? (int8)atoi(j) : -1;
if(!entry)
if (!entry)
m_session->GetPlayer()->EnterVehicle(target, seatId);
else
{
@@ -747,7 +747,7 @@ bool ChatHandler::HandleDebugEnterVehicle(const char * args)
Trinity::AllCreaturesOfEntryInRange check(m_session->GetPlayer(), entry, 20.0f);
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(m_session->GetPlayer(), passenger, check);
m_session->GetPlayer()->VisitNearbyObject(30.0f, searcher);
if(!passenger || passenger == target)
if (!passenger || passenger == target)
return false;
passenger->EnterVehicle(target, seatId);
}
@@ -772,7 +772,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
float x, y, z, o = m_session->GetPlayer()->GetOrientation();
m_session->GetPlayer()->GetClosePoint(x, y, z, m_session->GetPlayer()->GetObjectSize());
if(!i)
if (!i)
return m_session->GetPlayer()->SummonCreature(entry, x, y, z, o);
uint32 id = (uint32)atoi(i);
@@ -791,7 +791,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
Map *map = m_session->GetPlayer()->GetMap();
if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
if (!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
{
delete v;
return false;
@@ -945,7 +945,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
bool ChatHandler::HandleDebugSetValueCommand(const char* args)
{
if(!*args)
if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -956,7 +956,7 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
return false;
WorldObject* target = getSelectedObject();
if(!target)
if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -966,7 +966,7 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
uint64 guid = target->GetGUID();
uint32 Opcode = (uint32)atoi(px);
if(Opcode >= target->GetValuesCount())
if (Opcode >= target->GetValuesCount())
{
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
@@ -974,9 +974,9 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
uint32 iValue;
float fValue;
bool isint32 = true;
if(pz)
if (pz)
isint32 = (bool)atoi(pz);
if(isint32)
if (isint32)
{
iValue = (uint32)atoi(py);
sLog.outDebug(GetTrinityString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue);
@@ -996,7 +996,7 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
bool ChatHandler::HandleDebugGetValueCommand(const char* args)
{
if(!*args)
if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -1006,7 +1006,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
return false;
Unit* target = getSelectedUnit();
if(!target)
if (!target)
{
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
SetSentErrorMessage(true);
@@ -1016,7 +1016,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
uint64 guid = target->GetGUID();
uint32 Opcode = (uint32)atoi(px);
if(Opcode >= target->GetValuesCount())
if (Opcode >= target->GetValuesCount())
{
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
return false;
@@ -1024,10 +1024,10 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
uint32 iValue;
float fValue;
bool isint32 = true;
if(pz)
if (pz)
isint32 = (bool)atoi(pz);
if(isint32)
if (isint32)
{
iValue = target->GetUInt32Value( Opcode );
sLog.outDebug(GetTrinityString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue);
@@ -1045,7 +1045,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
{
if(!*args)
if (!*args)
return false;
char* px = strtok((char*)args, " ");
@@ -1057,7 +1057,7 @@ bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
uint32 Opcode = (uint32)atoi(px);
int Value = atoi(py);
if(Opcode >= m_session->GetPlayer()->GetValuesCount())
if (Opcode >= m_session->GetPlayer()->GetValuesCount())
{
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer( )->GetValuesCount());
return false;
@@ -1077,7 +1077,7 @@ bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
bool ChatHandler::HandleDebugUpdateCommand(const char* args)
{
if(!*args)
if (!*args)
return false;
uint32 updateIndex;
@@ -1093,13 +1093,13 @@ bool ChatHandler::HandleDebugUpdateCommand(const char* args)
return false;
}
if(!pUpdateIndex)
if (!pUpdateIndex)
{
return true;
}
updateIndex = atoi(pUpdateIndex);
//check updateIndex
if(chr->GetTypeId() == TYPEID_PLAYER)
if (chr->GetTypeId() == TYPEID_PLAYER)
{
if (updateIndex>=PLAYER_END) return true;
}
+8 -8
View File
@@ -36,7 +36,7 @@ DestinationHolder<TRAVELLER>::_findOffSetPoint(float x1, float y1, float x2, flo
* hence x = x2 - (offset/d)*(x2-x1)
* like wise offset/d = (y2-y)/(y2-y1);
*/
if( offset == 0 )
if ( offset == 0 )
{
x = x2;
y = y2;
@@ -46,7 +46,7 @@ DestinationHolder<TRAVELLER>::_findOffSetPoint(float x1, float y1, float x2, flo
double x_diff = double(x2 - x1);
double y_diff = double(y2 - y1);
double distance_d = (double)((x_diff*x_diff) + (y_diff * y_diff));
if(distance_d == 0)
if (distance_d == 0)
{
x = x2;
y = y2;
@@ -78,7 +78,7 @@ template<typename TRAVELLER>
uint32
DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove)
{
if(!i_destSet) return 0;
if (!i_destSet) return 0;
i_fromX = traveller.GetPositionX();
i_fromY = traveller.GetPositionY();
@@ -86,7 +86,7 @@ DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove)
i_totalTravelTime = traveller.GetTotalTrevelTimeTo(i_destX,i_destY,i_destZ);
i_timeElapsed = 0;
if(sendMove)
if (sendMove)
traveller.MoveTo(i_destX, i_destY, i_destZ, i_totalTravelTime);
return i_totalTravelTime;
}
@@ -99,12 +99,12 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
// Update every TRAVELLER_UPDATE_INTERVAL
i_tracker.Update(diff);
if(!i_tracker.Passed())
if (!i_tracker.Passed())
return false;
else
ResetUpdate();
if(!i_destSet) return true;
if (!i_destSet) return true;
float x, y, z;
if (!micro_movement)
@@ -172,7 +172,7 @@ DestinationHolder<TRAVELLER>::GetLocationNow(const Map * map, float &x, float &y
const float groundDist = sqrt(distanceX*distanceX + distanceY*distanceY);
const float zDist = fabs(i_fromZ - z) + 0.000001f;
const float slope = groundDist / zDist;
if(slope < 1.0f) // This prevents the ground returned by GetHeight to be used when in cave
if (slope < 1.0f) // This prevents the ground returned by GetHeight to be used when in cave
z = z2; // a climb or jump of more than 45 is denied
}
}
@@ -198,7 +198,7 @@ template<typename TRAVELLER>
void
DestinationHolder<TRAVELLER>::GetLocationNowNoMicroMovement(float &x, float &y, float &z) const
{
if( HasArrived() )
if ( HasArrived() )
{
x = i_destX;
y = i_destY;
+5 -5
View File
@@ -32,7 +32,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
Player *pl;
Player *plTarget;
if(!GetPlayer()->duel) // ignore accept from duel-sender
if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
recvPacket >> guid;
@@ -40,7 +40,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
pl = GetPlayer();
plTarget = pl->duel->opponent;
if(pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
return;
//sLog.outDebug( "WORLD: received CMSG_DUEL_ACCEPTED" );
@@ -60,14 +60,14 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
//sLog.outDebug( "WORLD: received CMSG_DUEL_CANCELLED" );
// no duel requested
if(!GetPlayer()->duel)
if (!GetPlayer()->duel)
return;
// player surrendered in a duel using /forfeit
if(GetPlayer()->duel->startTime != 0)
if (GetPlayer()->duel->startTime != 0)
{
GetPlayer()->CombatStopWithPets(true);
if(GetPlayer()->duel->opponent)
if (GetPlayer()->duel->opponent)
GetPlayer()->duel->opponent->CombatStopWithPets(true);
GetPlayer()->CastSpell(GetPlayer(), 7267, true); // beg
+7 -7
View File
@@ -44,7 +44,7 @@ DynamicObject::DynamicObject() : WorldObject()
void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup
if(!IsInWorld())
if (!IsInWorld())
{
ObjectAccessor::Instance().AddObject(this);
WorldObject::AddToWorld();
@@ -54,13 +54,13 @@ void DynamicObject::AddToWorld()
void DynamicObject::RemoveFromWorld()
{
///- Remove the dynamicObject from the accessor
if(IsInWorld())
if (IsInWorld())
{
if(m_isWorldObject)
if (m_isWorldObject)
{
if(Unit *caster = GetCaster())
if (Unit *caster = GetCaster())
{
if(caster->GetTypeId() == TYPEID_PLAYER)
if (caster->GetTypeId() == TYPEID_PLAYER)
caster->ToPlayer()->SetViewpoint(this, false);
}
else
@@ -77,7 +77,7 @@ bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, const P
{
SetMap(caster->GetMap());
Relocate(pos);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,GetPositionX(),GetPositionY());
return false;
@@ -132,7 +132,7 @@ void DynamicObject::Update(uint32 p_time)
}
else
{
if(GetDuration() > int32(p_time))
if (GetDuration() > int32(p_time))
m_duration -= p_time;
else
expired = true;
+30 -30
View File
@@ -32,17 +32,17 @@ template<class T>
void
FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
{
if( !&owner )
if ( !&owner )
return;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return;
if(!_setMoveData(owner))
if (!_setMoveData(owner))
return;
float x, y, z;
if(!_getPoint(owner, x, y, z))
if (!_getPoint(owner, x, y, z))
return;
owner.addUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
@@ -53,7 +53,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
template<>
bool FleeingMovementGenerator<Creature>::GetDestination(float &x, float &y, float &z) const
{
if(i_destinationHolder.HasArrived())
if (i_destinationHolder.HasArrived())
return false;
i_destinationHolder.GetDestination(x, y, z);
@@ -70,7 +70,7 @@ template<class T>
bool
FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
{
if(!&owner)
if (!&owner)
return false;
x = owner.GetPositionX();
@@ -82,7 +82,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
//primitive path-finding
for (uint8 i = 0; i < 18; ++i)
{
if(i_only_forward && i > 2)
if (i_only_forward && i > 2)
break;
float distance = 5.0f;
@@ -161,11 +161,11 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
temp_y = y + distance * sin(angle);
Trinity::NormalizeMapCoord(temp_x);
Trinity::NormalizeMapCoord(temp_y);
if( owner.IsWithinLOS(temp_x,temp_y,z))
if ( owner.IsWithinLOS(temp_x,temp_y,z))
{
bool is_water_now = _map->IsInWater(x,y,z);
if(is_water_now && _map->IsInWater(temp_x,temp_y,z))
if (is_water_now && _map->IsInWater(temp_x,temp_y,z))
{
x = temp_x;
y = temp_y;
@@ -173,19 +173,19 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
}
float new_z = _map->GetHeight(temp_x,temp_y,z,true);
if(new_z <= INVALID_HEIGHT)
if (new_z <= INVALID_HEIGHT)
continue;
bool is_water_next = _map->IsInWater(temp_x,temp_y,new_z);
if((is_water_now && !is_water_next && !is_land_ok) || (!is_water_now && is_water_next && !is_water_ok))
if ((is_water_now && !is_water_next && !is_land_ok) || (!is_water_now && is_water_next && !is_water_ok))
continue;
if( !(new_z - z) || distance / fabs(new_z - z) > 1.0f)
if ( !(new_z - z) || distance / fabs(new_z - z) > 1.0f)
{
float new_z_left = _map->GetHeight(temp_x + 1.0f*cos(angle+M_PI/2),temp_y + 1.0f*sin(angle+M_PI/2),z,true);
float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-M_PI/2),temp_y + 1.0f*sin(angle-M_PI/2),z,true);
if(fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
{
x = temp_x;
y = temp_y;
@@ -206,9 +206,9 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
{
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
if(i_to_distance_from_caster > 0.0f)
if (i_to_distance_from_caster > 0.0f)
{
if((i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz < i_to_distance_from_caster) ||
if ((i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz < i_to_distance_from_caster) ||
// if we reach lower distance
(i_last_distance_from_caster > i_to_distance_from_caster && cur_dist_xyz > i_last_distance_from_caster) ||
// if we can't be close
@@ -236,10 +236,10 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID);
if(fright)
if (fright)
{
cur_dist = fright->GetDistance(&owner);
if(cur_dist < cur_dist_xyz)
if (cur_dist < cur_dist_xyz)
{
i_caster_x = fright->GetPositionX();
i_caster_y = fright->GetPositionY();
@@ -264,18 +264,18 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
//get angle and 'distance from caster' to run
float angle;
if(i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time
if (i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time
{
angle = rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI/3 + rand_norm()*M_PI*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE;
i_only_forward = true;
}
else if(cur_dist < MIN_QUIET_DISTANCE)
else if (cur_dist < MIN_QUIET_DISTANCE)
{
angle = M_PI/6 + rand_norm()*M_PI*2/3;
i_to_distance_from_caster = cur_dist*2/3 + rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3);
}
else if(cur_dist > MAX_QUIET_DISTANCE)
else if (cur_dist > MAX_QUIET_DISTANCE)
{
angle = rand_norm()*M_PI/3 + M_PI*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f);
@@ -299,7 +299,7 @@ template<class T>
void
FleeingMovementGenerator<T>::Initialize(T &owner)
{
if(!&owner)
if (!&owner)
return;
_Init(owner);
@@ -309,7 +309,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
owner.SetUInt64Value(UNIT_FIELD_TARGET, 0);
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
if(Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID))
if (Unit * fright = ObjectAccessor::GetUnit(owner, i_frightGUID))
{
i_caster_x = fright->GetPositionX();
i_caster_y = fright->GetPositionY();
@@ -333,7 +333,7 @@ template<>
void
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
{
if(!&owner)
if (!&owner)
return;
is_water_ok = owner.canSwim();
@@ -354,7 +354,7 @@ FleeingMovementGenerator<T>::Finalize(T &owner)
{
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
if(owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
if (owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
owner.SetUInt64Value(UNIT_FIELD_TARGET, owner.getVictim()->GetGUID());
}
@@ -369,16 +369,16 @@ template<class T>
bool
FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
{
if( !&owner || !owner.isAlive() )
if ( !&owner || !owner.isAlive() )
return false;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return true;
Traveller<T> traveller(owner);
i_nextCheckTime.Update(time_diff);
if( (owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination() )
if ( (owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination() )
{
_setTargetLocation(owner);
return true;
@@ -387,7 +387,7 @@ FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
if (i_destinationHolder.UpdateTraveller(traveller, time_diff))
{
i_destinationHolder.ResetUpdate(50);
if(i_nextCheckTime.Passed() && i_destinationHolder.HasArrived())
if (i_nextCheckTime.Passed() && i_destinationHolder.HasArrived())
{
_setTargetLocation(owner);
return true;
@@ -427,10 +427,10 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_diff)
{
if( !owner.isAlive() )
if ( !owner.isAlive() )
return false;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return true;
i_totalFleeTime.Update(time_diff);
+101 -101
View File
@@ -60,7 +60,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
time_t currenttime = time(NULL);
for (std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr)
{
if( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
if ( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
mGameEvent[*itr].nextstart > currenttime) // if not in nextphase state for long enough, can't start this one
return false;
}
@@ -107,13 +107,13 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
void GameEventMgr::StartInternalEvent(uint16 event_id)
{
if(event_id < 1 || event_id >= mGameEvent.size())
if (event_id < 1 || event_id >= mGameEvent.size())
return;
if(!mGameEvent[event_id].isValid())
if (!mGameEvent[event_id].isValid())
return;
if(m_ActiveEvents.find(event_id) != m_ActiveEvents.end())
if (m_ActiveEvents.find(event_id) != m_ActiveEvents.end())
return;
StartEvent(event_id);
@@ -121,22 +121,22 @@ void GameEventMgr::StartInternalEvent(uint16 event_id)
bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite )
{
if(mGameEvent[event_id].state == GAMEEVENT_NORMAL
if (mGameEvent[event_id].state == GAMEEVENT_NORMAL
|| mGameEvent[event_id].state == GAMEEVENT_INTERNAL)
{
AddActiveEvent(event_id);
ApplyNewEvent(event_id);
if(overwrite)
if (overwrite)
{
mGameEvent[event_id].start = time(NULL);
if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
}
return false;
}
else
{
if( mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE )
if ( mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE )
// set to conditions phase
mGameEvent[event_id].state = GAMEEVENT_WORLD_CONDITIONS;
@@ -152,7 +152,7 @@ bool GameEventMgr::StartEvent( uint16 event_id, bool overwrite )
// force game event update to set the update timer if conditions were met from a command
// this update is needed to possibly start events dependent on the started one
// or to scedule another update where the next event will be started
if(overwrite && conditions_met)
if (overwrite && conditions_met)
sWorld.ForceGameEventUpdate();
return conditions_met;
@@ -166,16 +166,16 @@ void GameEventMgr::StopEvent( uint16 event_id, bool overwrite )
RemoveActiveEvent(event_id);
UnApplyEvent(event_id);
if(overwrite && !serverwide_evt)
if (overwrite && !serverwide_evt)
{
mGameEvent[event_id].start = time(NULL) - mGameEvent[event_id].length * MINUTE;
if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
}
else if(serverwide_evt)
else if (serverwide_evt)
{
// if finished world event, then only gm command can stop it
if(overwrite || mGameEvent[event_id].state != GAMEEVENT_WORLD_FINISHED)
if (overwrite || mGameEvent[event_id].state != GAMEEVENT_WORLD_FINISHED)
{
// reset conditions
mGameEvent[event_id].nextstart = 0;
@@ -230,7 +230,7 @@ void GameEventMgr::LoadFromDB()
bar.step();
uint16 event_id = fields[0].GetUInt16();
if(event_id==0)
if (event_id==0)
{
sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id);
continue;
@@ -248,15 +248,15 @@ void GameEventMgr::LoadFromDB()
pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
pGameEvent.nextstart = 0;
if(pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
if (pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
{
sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id);
continue;
}
if(pGameEvent.holiday_id)
if (pGameEvent.holiday_id)
{
if(!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
{
sLog.outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.",event_id,pGameEvent.holiday_id);
pGameEvent.holiday_id = 0;
@@ -299,13 +299,13 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_save` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
}
if(mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
{
mGameEvent[event_id].state = (GameEventState)(fields[1].GetUInt8());
mGameEvent[event_id].nextstart = time_t(fields[2].GetUInt64());
@@ -348,16 +348,16 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
}
if(mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
{
uint16 prerequisite_event = fields[1].GetUInt16();
if(prerequisite_event >= mGameEvent.size())
if (prerequisite_event >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`",prerequisite_event);
continue;
@@ -387,7 +387,7 @@ void GameEventMgr::LoadFromDB()
"FROM creature JOIN game_event_creature ON creature.guid = game_event_creature.guid");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -410,7 +410,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1;
if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -436,7 +436,7 @@ void GameEventMgr::LoadFromDB()
"FROM gameobject JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -459,7 +459,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1;
if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -487,7 +487,7 @@ void GameEventMgr::LoadFromDB()
"FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -507,7 +507,7 @@ void GameEventMgr::LoadFromDB()
uint32 guid = fields[0].GetUInt32();
uint16 event_id = fields[1].GetUInt16();
if(event_id >= mGameEventModelEquip.size())
if (event_id >= mGameEventModelEquip.size())
{
sLog.outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -521,9 +521,9 @@ void GameEventMgr::LoadFromDB()
newModelEquipSet.equipement_id_prev = 0;
newModelEquipSet.modelid_prev = 0;
if(newModelEquipSet.equipment_id > 0)
if (newModelEquipSet.equipment_id > 0)
{
if(!objmgr.GetEquipmentInfo(newModelEquipSet.equipment_id))
if (!objmgr.GetEquipmentInfo(newModelEquipSet.equipment_id))
{
sLog.outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", guid, newModelEquipSet.equipment_id);
continue;
@@ -547,7 +547,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_creature_quest");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar(1);
bar.step();
@@ -568,7 +568,7 @@ void GameEventMgr::LoadFromDB()
uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16();
if(event_id >= mGameEventCreatureQuests.size())
if (event_id >= mGameEventCreatureQuests.size())
{
sLog.outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -592,7 +592,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_gameobject_quest");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -613,7 +613,7 @@ void GameEventMgr::LoadFromDB()
uint32 quest = fields[1].GetUInt32();
uint16 event_id = fields[2].GetUInt16();
if(event_id >= mGameEventGameObjectQuests.size())
if (event_id >= mGameEventGameObjectQuests.size())
{
sLog.outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -636,7 +636,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT quest, event_id, condition_id, num FROM game_event_quest_condition");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -658,7 +658,7 @@ void GameEventMgr::LoadFromDB()
uint32 condition = fields[2].GetUInt32();
float num = fields[3].GetFloat();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -682,7 +682,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT event_id, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -702,7 +702,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
uint32 condition = fields[1].GetUInt32();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -728,7 +728,7 @@ void GameEventMgr::LoadFromDB()
result = CharacterDatabase.Query("SELECT event_id, condition_id, done FROM game_event_condition_save");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -748,14 +748,14 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
uint32 condition = fields[1].GetUInt32();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
}
std::map<uint32, GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.find(condition);
if(itr != mGameEvent[event_id].conditions.end())
if (itr != mGameEvent[event_id].conditions.end())
{
itr->second.done = fields[2].GetFloat();
}
@@ -781,7 +781,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT guid, event_id, npcflag FROM game_event_npcflag");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -802,7 +802,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[1].GetUInt16();
uint32 npcflag = fields[2].GetUInt32();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -826,7 +826,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -845,7 +845,7 @@ void GameEventMgr::LoadFromDB()
bar3.step();
uint16 event_id = fields[0].GetUInt16();
if(event_id >= mGameEventVendors.size())
if (event_id >= mGameEventVendors.size())
{
sLog.outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -863,7 +863,7 @@ void GameEventMgr::LoadFromDB()
NPCFlagList& flist = mGameEventNPCFlags[event_id];
for (NPCFlagList::const_iterator itr = flist.begin(); itr != flist.end(); ++itr)
{
if(itr->first == guid)
if (itr->first == guid)
{
event_npc_flag = itr->second;
break;
@@ -872,11 +872,11 @@ void GameEventMgr::LoadFromDB()
// get creature entry
newEntry.entry = 0;
if( CreatureData const* data = objmgr.GetCreatureData(guid) )
if ( CreatureData const* data = objmgr.GetCreatureData(guid) )
newEntry.entry = data->id;
// check validity with event's npcflag
if(!objmgr.IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, NULL, NULL, event_npc_flag))
if (!objmgr.IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, NULL, NULL, event_npc_flag))
continue;
++count;
vendors.push_back(newEntry);
@@ -894,7 +894,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT guid, event_id, textid FROM game_event_npc_gossip");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -915,7 +915,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[1].GetUInt16();
uint32 textid = fields[2].GetUInt32();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_npc_gossip` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -940,7 +940,7 @@ void GameEventMgr::LoadFromDB()
result = WorldDatabase.Query("SELECT event, bgflag FROM game_event_battleground_holiday");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar3(1);
bar3.step();
@@ -960,7 +960,7 @@ void GameEventMgr::LoadFromDB()
uint16 event_id = fields[0].GetUInt16();
if(event_id >= mGameEvent.size())
if (event_id >= mGameEvent.size())
{
sLog.outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -988,7 +988,7 @@ void GameEventMgr::LoadFromDB()
"FROM pool_template JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
count = 0;
if( !result )
if ( !result )
{
barGoLink bar2(1);
bar2.step();
@@ -1011,7 +1011,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1;
if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`",event_id);
continue;
@@ -1043,7 +1043,7 @@ uint32 GameEventMgr::GetNPCFlag(Creature * cr)
for (NPCFlagList::iterator itr = mGameEventNPCFlags[*e_itr].begin();
itr != mGameEventNPCFlags[*e_itr].end();
++ itr)
if(itr->first == guid)
if (itr->first == guid)
mask |= itr->second;
}
@@ -1053,8 +1053,8 @@ uint32 GameEventMgr::GetNPCFlag(Creature * cr)
uint32 GameEventMgr::GetNpcTextId(uint32 guid)
{
GuidEventNpcGossipIdMap::iterator itr = mNPCGossipIds.find(guid);
if(itr != mNPCGossipIds.end())
if(IsActiveEvent(itr->second.first))
if (itr != mNPCGossipIds.end())
if (IsActiveEvent(itr->second.first))
return itr->second.second;
return 0;
}
@@ -1090,7 +1090,7 @@ uint32 GameEventMgr::Update() // return the next e
// save the state of this gameevent
SaveWorldEventStateToDB(itr);
// queue for deactivation
if(IsActiveEvent(itr))
if (IsActiveEvent(itr))
deactivate.insert(itr);
// go to next event, this no longer needs an event update timer
continue;
@@ -1130,7 +1130,7 @@ uint32 GameEventMgr::Update() // return the next e
// start the event
// returns true the started event completed
// in that case, initiate next update in 1 second
if(StartEvent(*itr))
if (StartEvent(*itr))
nextEventDelay = 0;
for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
StopEvent(*itr);
@@ -1194,14 +1194,14 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
for (NPCFlagList::iterator itr = mGameEventNPCFlags[event_id].begin(); itr != mGameEventNPCFlags[event_id].end(); ++itr)
{
// get the creature data from the low guid to get the entry, to be able to find out the whole guid
if( CreatureData const* data = objmgr.GetCreatureData(itr->first) )
if ( CreatureData const* data = objmgr.GetCreatureData(itr->first) )
{
Creature * cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first,data->id,HIGHGUID_UNIT));
// if we found the creature, modify its npcflag
if(cr)
if (cr)
{
uint32 npcflag = GetNPCFlag(cr);
if(const CreatureInfo * ci = cr->GetCreatureInfo())
if (const CreatureInfo * ci = cr->GetCreatureInfo())
npcflag |= ci->npcflag;
cr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag);
// reset gossip options, since the flag change might have added / removed some
@@ -1224,7 +1224,7 @@ void GameEventMgr::UpdateEventNPCVendor(uint16 event_id, bool activate)
{
for (NPCVendorList::iterator itr = mGameEventVendors[event_id].begin(); itr != mGameEventVendors[event_id].end(); ++itr)
{
if(activate)
if (activate)
objmgr.AddVendorItem(itr->entry, itr->item, itr->maxcount, itr->incrtime, itr->ExtendedCost, false);
else
objmgr.RemoveVendorItem(itr->entry, itr->item, false);
@@ -1235,7 +1235,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{
int32 internal_event_id = mGameEvent.size() + event_id - 1;
if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return;
@@ -1263,7 +1263,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
}
if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return;
@@ -1294,7 +1294,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
}
if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return;
@@ -1308,7 +1308,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
{
int32 internal_event_id = mGameEvent.size() + event_id - 1;
if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return;
@@ -1317,19 +1317,19 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); itr != mGameEventCreatureGuids[internal_event_id].end(); ++itr)
{
// check if it's needed by another event, if so, don't remove
if( event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id) )
if ( event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id) )
continue;
// Remove the creature from grid
if( CreatureData const* data = objmgr.GetCreatureData(*itr) )
if ( CreatureData const* data = objmgr.GetCreatureData(*itr) )
{
objmgr.RemoveCreatureFromGrid(*itr, data);
if( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) )
if ( Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL) )
pCreature->AddObjectToRemoveList();
}
}
if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return;
@@ -1338,18 +1338,18 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
{
// check if it's needed by another event, if so, don't remove
if( event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id) )
if ( event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id) )
continue;
// Remove the gameobject from grid
if(GameObjectData const* data = objmgr.GetGOData(*itr))
if (GameObjectData const* data = objmgr.GetGOData(*itr))
{
objmgr.RemoveGameobjectFromGrid(*itr, data);
if( GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL) )
if ( GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL) )
pGameobject->AddObjectToRemoveList();
}
}
if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return;
@@ -1367,7 +1367,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
{
// Remove the creature from grid
CreatureData const* data = objmgr.GetCreatureData(itr->first);
if(!data)
if (!data)
continue;
// Update if spawned
@@ -1445,11 +1445,11 @@ bool GameEventMgr::hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 eve
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
if((*e_itr) != event_id)
if ((*e_itr) != event_id)
for (QuestRelList::iterator itr = mGameEventCreatureQuests[*e_itr].begin();
itr != mGameEventCreatureQuests[*e_itr].end();
++ itr)
if(itr->second == quest_id)
if (itr->second == quest_id)
return true;
}
return false;
@@ -1459,11 +1459,11 @@ bool GameEventMgr::hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 e
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
if((*e_itr) != event_id)
if ((*e_itr) != event_id)
for (QuestRelList::iterator itr = mGameEventGameObjectQuests[*e_itr].begin();
itr != mGameEventGameObjectQuests[*e_itr].end();
++ itr)
if(itr->second == quest_id)
if (itr->second == quest_id)
return true;
}
return false;
@@ -1472,13 +1472,13 @@ bool GameEventMgr::hasCreatureActiveEventExcept(uint32 creature_id, uint16 event
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
if((*e_itr) != event_id)
if ((*e_itr) != event_id)
{
int32 internal_event_id = mGameEvent.size() + (*e_itr) - 1;
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();
itr != mGameEventCreatureGuids[internal_event_id].end();
++ itr)
if(*itr == creature_id)
if (*itr == creature_id)
return true;
}
}
@@ -1488,13 +1488,13 @@ bool GameEventMgr::hasGameObjectActiveEventExcept(uint32 go_id, uint16 event_id)
{
for (ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr)
{
if((*e_itr) != event_id)
if ((*e_itr) != event_id)
{
int32 internal_event_id = mGameEvent.size() + (*e_itr) - 1;
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();
itr != mGameEventGameobjectGuids[internal_event_id].end();
++ itr)
if(*itr == go_id)
if (*itr == go_id)
return true;
}
}
@@ -1511,7 +1511,7 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool activate)
CreatureQuestMap.insert(QuestRelations::value_type(itr->first, itr->second));
else
{
if(!hasCreatureQuestActiveEventExcept(itr->second,event_id))
if (!hasCreatureQuestActiveEventExcept(itr->second,event_id))
{
// Remove the pair(id,quest) from the multimap
QuestRelations::iterator qitr = CreatureQuestMap.find(itr->first);
@@ -1536,7 +1536,7 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool activate)
GameObjectQuestMap.insert(QuestRelations::value_type(itr->first, itr->second));
else
{
if(!hasGameObjectQuestActiveEventExcept(itr->second,event_id))
if (!hasGameObjectQuestActiveEventExcept(itr->second,event_id))
{
// Remove the pair(id,quest) from the multimap
QuestRelations::iterator qitr = GameObjectQuestMap.find(itr->first);
@@ -1565,28 +1565,28 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id)
// translate the quest to event and condition
QuestIdToEventConditionMap::iterator itr = mQuestToEventConditions.find(quest_id);
// quest is registered
if(itr != mQuestToEventConditions.end())
if (itr != mQuestToEventConditions.end())
{
uint16 event_id = itr->second.event_id;
uint32 condition = itr->second.condition;
float num = itr->second.num;
// the event is not active, so return, don't increase condition finishes
if(!IsActiveEvent(event_id))
if (!IsActiveEvent(event_id))
return;
// not in correct phase, return
if(mGameEvent[event_id].state != GAMEEVENT_WORLD_CONDITIONS)
if (mGameEvent[event_id].state != GAMEEVENT_WORLD_CONDITIONS)
return;
std::map<uint32,GameEventFinishCondition>::iterator citr = mGameEvent[event_id].conditions.find(condition);
// condition is registered
if(citr != mGameEvent[event_id].conditions.end())
if (citr != mGameEvent[event_id].conditions.end())
{
// increase the done count, only if less then the req
if(citr->second.done < citr->second.reqNum)
if (citr->second.done < citr->second.reqNum)
{
citr->second.done += num;
// check max limit
if(citr->second.done > citr->second.reqNum)
if (citr->second.done > citr->second.reqNum)
citr->second.done = citr->second.reqNum;
// save the change to db
CharacterDatabase.BeginTransaction();
@@ -1594,7 +1594,7 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id)
CharacterDatabase.PExecute("INSERT INTO game_event_condition_save (event_id, condition_id, done) VALUES (%u,%u,%f)",event_id,condition,citr->second.done);
CharacterDatabase.CommitTransaction();
// check if all conditions are met, if so, update the event state
if(CheckOneGameEventConditions(event_id))
if (CheckOneGameEventConditions(event_id))
{
// changed, save to DB the gameevent state
SaveWorldEventStateToDB(event_id);
@@ -1609,13 +1609,13 @@ void GameEventMgr::HandleQuestComplete(uint32 quest_id)
bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id)
{
for (std::map<uint32,GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.begin(); itr != mGameEvent[event_id].conditions.end(); ++itr)
if(itr->second.done < itr->second.reqNum)
if (itr->second.done < itr->second.reqNum)
// return false if a condition doesn't match
return false;
// set the phase
mGameEvent[event_id].state = GAMEEVENT_WORLD_NEXTPHASE;
// set the followup events' start time
if(!mGameEvent[event_id].nextstart)
if (!mGameEvent[event_id].nextstart)
{
time_t currenttime = time(NULL);
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
@@ -1627,7 +1627,7 @@ void GameEventMgr::SaveWorldEventStateToDB(uint16 event_id)
{
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM game_event_save WHERE event_id = '%u'",event_id);
if(mGameEvent[event_id].nextstart)
if (mGameEvent[event_id].nextstart)
CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u',FROM_UNIXTIME("UI64FMTD"))",event_id,mGameEvent[event_id].state,(uint64)(mGameEvent[event_id].nextstart));
else
CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u','0000-00-00 00:00:00')",event_id,mGameEvent[event_id].state);
@@ -1640,8 +1640,8 @@ void GameEventMgr::HandleWorldEventGossip(Player *plr, Creature *c)
// find the npc's gossip id (if set) in an active game event
// if present, send the event's world states
GuidEventNpcGossipIdMap::iterator itr = mNPCGossipIds.find(c->GetDBTableGUIDLow());
if(itr != mNPCGossipIds.end())
if(IsActiveEvent(itr->second.first))
if (itr != mNPCGossipIds.end())
if (IsActiveEvent(itr->second.first))
// send world state updates to the player about the progress
SendWorldStateUpdate(plr, itr->second.first);
}
@@ -1651,9 +1651,9 @@ void GameEventMgr::SendWorldStateUpdate(Player * plr, uint16 event_id)
std::map<uint32,GameEventFinishCondition>::iterator itr;
for (itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr)
{
if(itr->second.done_world_state)
if (itr->second.done_world_state)
plr->SendUpdateWorldState(itr->second.done_world_state, (uint32)(itr->second.done));
if(itr->second.max_world_state)
if (itr->second.max_world_state)
plr->SendUpdateWorldState(itr->second.max_world_state, (uint32)(itr->second.reqNum));
}
}
@@ -1664,7 +1664,7 @@ void GameEventMgr::SendWorldStateUpdate(Player * plr, uint16 event_id)
GameEventMgr::ActiveEvents const& ae = gameeventmgr.GetActiveEventList();
for (GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr)
if(events[*itr].holiday_id == id)
if (events[*itr].holiday_id == id)
return true;
return false;
+118 -118
View File
@@ -70,7 +70,7 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue)
GameObject::~GameObject()
{
delete m_goValue;
//if(m_uint32Values) // field array can be not exist if GameOBject not loaded
//if (m_uint32Values) // field array can be not exist if GameOBject not loaded
// CleanupsBeforeDelete();
}
@@ -79,26 +79,26 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup)
if (IsInWorld())
RemoveFromWorld();
if(m_uint32Values) // field array can be not exist if GameOBject not loaded
if (m_uint32Values) // field array can be not exist if GameOBject not loaded
{
// Possible crash at access to deleted GO in Unit::m_gameobj
if(uint64 owner_guid = GetOwnerGUID())
if (uint64 owner_guid = GetOwnerGUID())
{
Unit* owner = NULL;
// Object may be deleted while player is not in world, skip this check for now.
/*if(IS_PLAYER_GUID(owner_guid))
/*if (IS_PLAYER_GUID(owner_guid))
owner = ObjectAccessor::GetObjectInWorld(owner_guid, (Player*)NULL);
else*/
owner = ObjectAccessor::GetUnit(*this,owner_guid);
if(owner)
if (owner)
owner->RemoveGameObject(this,false);
else
{
const char * ownerType = "creature";
if(IS_PLAYER_GUID(owner_guid))
if (IS_PLAYER_GUID(owner_guid))
ownerType = "player";
else if(IS_PET_GUID(owner_guid))
else if (IS_PET_GUID(owner_guid))
ownerType = "pet";
sLog.outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
@@ -111,9 +111,9 @@ void GameObject::CleanupsBeforeDelete(bool finalCleanup)
void GameObject::AddToWorld()
{
///- Register the gameobject for guid lookup
if(!IsInWorld())
if (!IsInWorld())
{
if(m_zoneScript)
if (m_zoneScript)
m_zoneScript->OnGameObjectCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
@@ -124,17 +124,17 @@ void GameObject::AddToWorld()
void GameObject::RemoveFromWorld()
{
///- Remove the gameobject from the accessor
if(IsInWorld())
if (IsInWorld())
{
if(m_zoneScript)
if (m_zoneScript)
m_zoneScript->OnGameObjectCreate(this, false);
// Possible crash at access to deleted GO in Unit::m_gameobj
if(uint64 owner_guid = GetOwnerGUID())
if (uint64 owner_guid = GetOwnerGUID())
{
if(Unit * owner = GetOwner(false))
if (Unit * owner = GetOwner(false))
owner->RemoveGameObject(this,false);
else if(!IS_PLAYER_GUID(owner_guid))
else if (!IS_PLAYER_GUID(owner_guid))
sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
}
WorldObject::RemoveFromWorld();
@@ -148,7 +148,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
SetMap(map);
Relocate(x,y,z,ang);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("Gameobject (GUID: %u Entry: %u ) not created. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,name_id,x,y);
return false;
@@ -245,11 +245,11 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE:
{
// fishing code (bobber ready)
if( time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME )
if ( time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME )
{
// splash bobber (bobber ready now)
Unit* caster = GetOwner();
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
SetGoState(GO_STATE_ACTIVE);
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
@@ -288,7 +288,7 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
{
Unit* caster = GetOwner();
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
caster->FinishSpell(CURRENT_CHANNELED_SPELL);
@@ -323,19 +323,19 @@ void GameObject::Update(uint32 diff)
}
}
if(isSpawned())
if (isSpawned())
{
// traps can have time and can not have
GameObjectInfo const* goInfo = GetGOInfo();
if(goInfo->type == GAMEOBJECT_TYPE_TRAP)
if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
{
if(m_cooldownTime >= time(NULL))
if (m_cooldownTime >= time(NULL))
return;
// Type 2 - Bomb ( will go away after casting it's spell )
if(goInfo->trap.charges == 2)
if (goInfo->trap.charges == 2)
{
if(goInfo->trap.spellId)
if (goInfo->trap.spellId)
CastSpell(NULL, goInfo->trap.spellId); // FIXME: null target won't work for target type 1
SetLootState(GO_JUST_DEACTIVATED);
break;
@@ -348,31 +348,31 @@ void GameObject::Update(uint32 diff)
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
float radius = (goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
if(!radius)
if (!radius)
{
if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
return;
else
{
if(m_respawnTime > 0)
if (m_respawnTime > 0)
break;
radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
IsBattleGroundTrap = true;
if(!radius)
if (!radius)
return;
}
}
// Note: this hack with search required until GO casting not implemented
// search unfriendly creature
if(owner) // hunter trap
if (owner) // hunter trap
{
Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker);
VisitNearbyGridObject(radius, searcher);
if(!ok) VisitNearbyWorldObject(radius, searcher);
if (!ok) VisitNearbyWorldObject(radius, searcher);
}
else // environmental trap
{
@@ -388,24 +388,24 @@ void GameObject::Update(uint32 diff)
if (ok)
{
// some traps do not have spell but should be triggered
if(goInfo->trap.spellId)
if (goInfo->trap.spellId)
CastSpell(ok, goInfo->trap.spellId);
m_cooldownTime = time(NULL) + 4; // 4 seconds
if(owner) // || goInfo->trap.charges == 1)
if (owner) // || goInfo->trap.charges == 1)
SetLootState(GO_JUST_DEACTIVATED);
if(IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
if (IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
{
//BattleGround gameobjects case
if(ok->ToPlayer()->InBattleGround())
if(BattleGround *bg = ok->ToPlayer()->GetBattleGround())
if (ok->ToPlayer()->InBattleGround())
if (BattleGround *bg = ok->ToPlayer()->GetBattleGround())
bg->HandleTriggerBuff(GetGUID());
}
}
}
else if(uint32 max_charges = goInfo->GetCharges())
else if (uint32 max_charges = goInfo->GetCharges())
{
if (m_usetimes >= max_charges)
{
@@ -460,7 +460,7 @@ void GameObject::Update(uint32 diff)
{
uint32 spellId = GetGOInfo()->goober.spellId;
if(spellId)
if (spellId)
{
std::set<uint32>::const_iterator it = m_unique_users.begin();
std::set<uint32>::const_iterator end = m_unique_users.end();
@@ -479,9 +479,9 @@ void GameObject::Update(uint32 diff)
//any return here in case battleground traps
}
if(GetOwnerGUID())
if (GetOwnerGUID())
{
if(Unit* owner = GetOwner(false))
if (Unit* owner = GetOwner(false))
{
owner->RemoveGameObject(this, false);
SetRespawnTime(0);
@@ -501,10 +501,10 @@ void GameObject::Update(uint32 diff)
loot.clear();
SetLootState(GO_READY);
if(!m_respawnDelayTime)
if (!m_respawnDelayTime)
return;
if(!m_spawnedByDefault)
if (!m_spawnedByDefault)
{
m_respawnTime = 0;
UpdateObjectVisibility();
@@ -514,7 +514,7 @@ void GameObject::Update(uint32 diff)
m_respawnTime = time(NULL) + m_respawnDelayTime;
// if option not set then object will be saved at grid unload
if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
SaveRespawnTime();
UpdateObjectVisibility();
@@ -527,10 +527,10 @@ void GameObject::Update(uint32 diff)
void GameObject::Refresh()
{
// not refresh despawned not casted GO (despawned casted GO destroyed in all cases anyway)
if(m_respawnTime > 0 && m_spawnedByDefault)
if (m_respawnTime > 0 && m_spawnedByDefault)
return;
if(isSpawned())
if (isSpawned())
GetMap()->Add(this);
}
@@ -578,7 +578,7 @@ void GameObject::SaveToDB()
// this should only be used when the gameobject has already been loaded
// preferably after adding to map, because mapid may not be valid otherwise
GameObjectData const *data = objmgr.GetGOData(m_DBTableGuid);
if(!data)
if (!data)
{
sLog.outError("GameObject::SaveToDB failed, cannot get gameobject data!");
return;
@@ -647,7 +647,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
{
GameObjectData const* data = objmgr.GetGOData(guid);
if( !data )
if ( !data )
{
sLog.outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ",guid);
return false;
@@ -676,11 +676,11 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit) )
return false;
if(data->spawntimesecs >= 0)
if (data->spawntimesecs >= 0)
{
m_spawnedByDefault = true;
if(!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
if (!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
{
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
m_respawnDelayTime = 0;
@@ -692,7 +692,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
// ready to respawn
if(m_respawnTime && m_respawnTime <= time(NULL))
if (m_respawnTime && m_respawnTime <= time(NULL))
{
m_respawnTime = 0;
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
@@ -732,7 +732,7 @@ bool GameObject::hasQuest(uint32 quest_id) const
QuestRelations const& qr = objmgr.mGOQuestRelations;
for (QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
{
if(itr->second==quest_id)
if (itr->second==quest_id)
return true;
}
return false;
@@ -743,7 +743,7 @@ bool GameObject::hasInvolvedQuest(uint32 quest_id) const
QuestRelations const& qr = objmgr.mGOQuestInvolvedRelations;
for (QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
{
if(itr->second==quest_id)
if (itr->second==quest_id)
return true;
}
return false;
@@ -753,7 +753,7 @@ bool GameObject::IsTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const * gInfo = GetGOInfo();
if(!gInfo) return false;
if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
}
@@ -762,7 +762,7 @@ bool GameObject::IsDynTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const * gInfo = GetGOInfo();
if(!gInfo) return false;
if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
@@ -776,32 +776,32 @@ Unit* GameObject::GetOwner(bool inWorld) const
void GameObject::SaveRespawnTime()
{
if(m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
}
bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const
{
// Not in world
if(!IsInWorld() || !u->IsInWorld())
if (!IsInWorld() || !u->IsInWorld())
return false;
// Transport always visible at this step implementation
if(IsTransport() && IsInMap(u))
if (IsTransport() && IsInMap(u))
return true;
// quick check visibility false cases for non-GM-mode
if(!u->isGameMaster())
if (!u->isGameMaster())
{
// despawned and then not visible for non-GM in GM-mode
if(!isSpawned())
if (!isSpawned())
return false;
// special invisibility cases
if(GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed)
if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed)
{
Unit *owner = GetOwner();
if(owner && u->IsHostileTo(owner) && !canDetectTrap(u, GetDistance(u)))
if (owner && u->IsHostileTo(owner) && !canDetectTrap(u, GetDistance(u)))
return false;
}
}
@@ -813,13 +813,13 @@ bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const
bool GameObject::canDetectTrap(Player const* u, float distance) const
{
if(u->hasUnitState(UNIT_STAT_STUNNED))
if (u->hasUnitState(UNIT_STAT_STUNNED))
return false;
if(distance < GetGOInfo()->size) //collision
if (distance < GetGOInfo()->size) //collision
return true;
if(!u->HasInArc(M_PI, this)) //behind
if (!u->HasInArc(M_PI, this)) //behind
return false;
if(u->HasAuraType(SPELL_AURA_DETECT_STEALTH))
if (u->HasAuraType(SPELL_AURA_DETECT_STEALTH))
return true;
//Visible distance is modified by -Level Diff (every level diff = 0.25f in visible distance)
@@ -834,7 +834,7 @@ bool GameObject::canDetectTrap(Player const* u, float distance) const
void GameObject::Respawn()
{
if(m_spawnedByDefault && m_respawnTime > 0)
if (m_spawnedByDefault && m_respawnTime > 0)
{
m_respawnTime = time(NULL);
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
@@ -883,7 +883,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
return;
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
if(!trapSpell) // checked at load already
if (!trapSpell) // checked at load already
return;
float range;
@@ -917,7 +917,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
// found correct GO
// FIXME: when GO casting will be implemented trap must cast spell to target
if(trapGO)
if (trapGO)
target->CastSpell(target,trapSpell,true, 0, 0, GetGUID());
}
@@ -949,10 +949,10 @@ void GameObject::ResetDoorOrButton()
void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = false */)
{
if(m_lootState != GO_READY)
if (m_lootState != GO_READY)
return;
if(!time_to_restore)
if (!time_to_restore)
time_to_restore = GetGOInfo()->GetAutoCloseTime();
SwitchDoorOrButton(true,alternative);
@@ -965,33 +965,33 @@ void GameObject::SetGoArtKit(uint8 kit)
{
SetByteValue(GAMEOBJECT_BYTES_1, 2, kit);
GameObjectData *data = const_cast<GameObjectData*>(objmgr.GetGOData(m_DBTableGuid));
if(data)
if (data)
data->artKit = kit;
}
void GameObject::SetGoArtKit(uint8 artkit, GameObject *go, uint32 lowguid)
{
const GameObjectData *data = NULL;
if(go)
if (go)
{
go->SetGoArtKit(artkit);
data = go->GetGOData();
}
else if(lowguid)
else if (lowguid)
data = objmgr.GetGOData(lowguid);
if(data)
if (data)
const_cast<GameObjectData*>(data)->artKit = artkit;
}
void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */)
{
if(activate)
if (activate)
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
else
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
if(GetGoState() == GO_STATE_READY) //if closed -> open
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);
@@ -1030,10 +1030,10 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_CHAIR: //7
{
GameObjectInfo const* info = GetGOInfo();
if(!info)
if (!info)
return;
if(user->GetTypeId() != TYPEID_PLAYER)
if (user->GetTypeId() != TYPEID_PLAYER)
return;
if (!ChairListSlots.size()) // this is called once at first chair use to make list of available slots
@@ -1066,9 +1066,9 @@ void GameObject::Use(Unit* user)
float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation);
if(itr->second)
if(Player* ChairUser = objmgr.GetPlayer(itr->second))
if(ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
if (itr->second)
if (Player* ChairUser = objmgr.GetPlayer(itr->second))
if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
else
itr->second = 0; // This seat is unoccupied.
@@ -1087,7 +1087,7 @@ void GameObject::Use(Unit* user)
helper->MonsterSay(output.str().c_str(), LANG_UNIVERSAL, 0);
*/
if(thisDistance <= lowestDist)
if (thisDistance <= lowestDist)
{
nearest_slot = itr->first;
lowestDist = thisDistance;
@@ -1096,7 +1096,7 @@ void GameObject::Use(Unit* user)
}
}
if(found_free_slot)
if (found_free_slot)
{
ChairSlotAndUser::iterator itr = ChairListSlots.find(nearest_slot);
if (itr != ChairListSlots.end())
@@ -1117,7 +1117,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
if(user->GetTypeId() == TYPEID_PLAYER)
if (user->GetTypeId() == TYPEID_PLAYER)
{
Player* player = (Player*)user;
@@ -1180,10 +1180,10 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_CAMERA: //13
{
GameObjectInfo const* info = GetGOInfo();
if(!info)
if (!info)
return;
if(user->GetTypeId() != TYPEID_PLAYER)
if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1199,12 +1199,12 @@ void GameObject::Use(Unit* user)
//fishing bobber
case GAMEOBJECT_TYPE_FISHINGNODE: //17
{
if(user->GetTypeId() != TYPEID_PLAYER)
if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
if(player->GetGUID() != GetOwnerGUID())
if (player->GetGUID() != GetOwnerGUID())
return;
switch(getLootState())
@@ -1215,11 +1215,11 @@ void GameObject::Use(Unit* user)
GetZoneAndAreaId(zone,subzone);
int32 zone_skill = objmgr.GetFishingBaseSkillLevel( subzone );
if(!zone_skill)
if (!zone_skill)
zone_skill = objmgr.GetFishingBaseSkillLevel( zone );
//provide error, no fishable zone or area should be 0
if(!zone_skill)
if (!zone_skill)
sLog.outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.",subzone);
int32 skill = player->GetSkillValue(SKILL_FISHING);
@@ -1280,7 +1280,7 @@ void GameObject::Use(Unit* user)
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
{
if(user->GetTypeId() != TYPEID_PLAYER)
if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1289,27 +1289,27 @@ void GameObject::Use(Unit* user)
GameObjectInfo const* info = GetGOInfo();
if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
if ( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
// accept only use by player from same group for caster except caster itself
if(caster->ToPlayer()==player || !caster->ToPlayer()->IsInSameRaidWith(player))
if (caster->ToPlayer()==player || !caster->ToPlayer()->IsInSameRaidWith(player))
return;
AddUniqueUse(player);
// full amount unique participants including original summoner
if(GetUniqueUseCount() < info->summoningRitual.reqParticipants)
if (GetUniqueUseCount() < info->summoningRitual.reqParticipants)
return;
// in case summoning ritual caster is GO creator
spellCaster = caster;
if(!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
if (!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
return;
spellId = info->summoningRitual.spellId;
if(spellId==62330) // GO store not existed spell, replace by expected
if (spellId==62330) // GO store not existed spell, replace by expected
{
// spell have reagent and mana cost but it not expected use its
// it triggered spell in fact casted at currently channeled GO
@@ -1331,16 +1331,16 @@ void GameObject::Use(Unit* user)
SetUInt32Value(GAMEOBJECT_FLAGS,2);
GameObjectInfo const* info = GetGOInfo();
if(!info)
if (!info)
return;
if(info->spellcaster.partyOnly)
if (info->spellcaster.partyOnly)
{
Unit* caster = GetOwner();
if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
if ( !caster || caster->GetTypeId() != TYPEID_PLAYER )
return;
if(user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster->ToPlayer()))
if (user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster->ToPlayer()))
return;
}
@@ -1353,7 +1353,7 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
if(user->GetTypeId() != TYPEID_PLAYER)
if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
@@ -1361,7 +1361,7 @@ void GameObject::Use(Unit* user)
Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetSelection());
// accept only use by player from same group for caster except caster itself
if(!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player))
if (!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player))
return;
//required lvl checks!
@@ -1372,7 +1372,7 @@ void GameObject::Use(Unit* user)
if (level < info->meetingstone.minLevel)
return;
if(info->id==194097)
if (info->id==194097)
spellId = 61994; // Ritual of Summoning
else
spellId = 59782; // Summoning Stone Effect
@@ -1391,7 +1391,7 @@ void GameObject::Use(Unit* user)
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
if(!bg)
if (!bg)
return;
// BG flag click
// AB:
@@ -1431,15 +1431,15 @@ void GameObject::Use(Unit* user)
{
case 179785: // Silverwing Flag
// check if it's correct bg
if(bg->GetTypeID() == BATTLEGROUND_WS)
if (bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag
if(bg->GetTypeID() == BATTLEGROUND_WS)
if (bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 184142: // Netherstorm Flag
if(bg->GetTypeID() == BATTLEGROUND_EY)
if (bg->GetTypeID() == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, this);
break;
}
@@ -1481,7 +1481,7 @@ void GameObject::Use(Unit* user)
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
if (!spellInfo)
{
if(user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
else
sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
@@ -1503,26 +1503,26 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
bool self = false;
for (uint8 i = 0; i < 3; ++i)
{
if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
{
self = true;
break;
}
}
if(self)
if (self)
{
if(target)
if (target)
target->CastSpell(target, spellInfo, true);
return;
}
//summon world trigger
Creature *trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, 1);
if(!trigger) return;
if (!trigger) return;
trigger->SetVisibility(VISIBILITY_OFF); //should this be true?
if(Unit *owner = GetOwner())
if (Unit *owner = GetOwner())
{
trigger->setFaction(owner->getFaction());
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
@@ -1573,10 +1573,10 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
return;
Player* pwho = NULL;
if(who && who->GetTypeId() == TYPEID_PLAYER)
if (who && who->GetTypeId() == TYPEID_PLAYER)
pwho = (Player*)who;
if(who && who->IsVehicle())
if (who && who->IsVehicle())
pwho = (Player*)who->GetCharmerOrOwner();
if (m_goValue->building.health > damage)
@@ -1586,16 +1586,16 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED)) // from damaged to destroyed
{
if(!m_goValue->building.health)
if (!m_goValue->building.health)
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->building.destroyedDisplayId);
EventInform(m_goInfo->building.destroyedEvent);
if(pwho)
if (pwho)
{
if(BattleGround* bg = pwho->GetBattleGround())
if (BattleGround* bg = pwho->GetBattleGround())
bg->EventPlayerDamagedGO(pwho, this, m_goInfo->building.destroyedEvent);
}
}
@@ -1626,7 +1626,7 @@ void GameObject::Rebuild()
void GameObject::EventInform(uint32 eventId)
{
if(eventId && m_zoneScript)
if (eventId && m_zoneScript)
m_zoneScript->ProcessEvent(this, eventId);
}
@@ -1661,7 +1661,7 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
m_rotation = rotation;
if(rotation2 == 0.0f && rotation3 == 0.0f)
if (rotation2 == 0.0f && rotation3 == 0.0f)
{
rotation2 = f_rot1;
rotation3 = f_rot2;
+1 -1
View File
@@ -643,7 +643,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
time_t GetRespawnTimeEx() const
{
time_t now = time(NULL);
if(m_respawnTime > now)
if (m_respawnTime > now)
return m_respawnTime;
else
return now;
+3 -3
View File
@@ -34,7 +34,7 @@
static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
{
if(!result)
if (!result)
return;
do
@@ -51,9 +51,9 @@ static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
sLog.outDebug("[Global event] Removing %s %u (X:%f Y:%f Map:%u).",(bones?"bones":"corpse"),guidlow,positionX,positionY,mapid);
/// Resurrectable - convert corpses to bones
if(!bones)
if (!bones)
{
if(!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid))
if (!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid))
{
sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow);
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
+5 -5
View File
@@ -211,7 +211,7 @@ void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flag
void PlayerMenu::SendPointOfInterest( uint32 poi_id )
{
PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id);
if(!poi)
if (!poi)
{
sLog.outErrorDb("Requested send not existed POI (Id: %u), ignore.",poi_id);
return;
@@ -372,7 +372,7 @@ bool QuestMenu::HasItem( uint32 questid )
{
for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
{
if(i->m_qId==questid)
if (i->m_qId==questid)
{
return true;
}
@@ -406,7 +406,7 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl
int loc_idx = pSession->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
if(QuestLocale const *ql = objmgr.GetQuestLocale(questID))
if (QuestLocale const *ql = objmgr.GetQuestLocale(questID))
{
if (ql->Title.size() > loc_idx && !ql->Title[loc_idx].empty())
title=ql->Title[loc_idx];
@@ -717,7 +717,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID,
uint32 EmoteCount = 0;
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
if(pQuest->OfferRewardEmote[i] <= 0)
if (pQuest->OfferRewardEmote[i] <= 0)
break;
++EmoteCount;
}
@@ -820,7 +820,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID
data << uint32(0x00); // unknown
if(Completable)
if (Completable)
data << pQuest->GetCompleteEmote();
else
data << pQuest->GetIncompleteEmote();
+6 -6
View File
@@ -89,7 +89,7 @@ struct CoordPair
void operator<<(const uint32 val)
{
if( x_coord > val )
if ( x_coord > val )
x_coord -= val;
else
x_coord = 0;
@@ -97,7 +97,7 @@ struct CoordPair
void operator>>(const uint32 val)
{
if( x_coord+val < LIMIT )
if ( x_coord+val < LIMIT )
x_coord += val;
else
x_coord = LIMIT - 1;
@@ -105,7 +105,7 @@ struct CoordPair
void operator-=(const uint32 val)
{
if( y_coord > val )
if ( y_coord > val )
y_coord -= val;
else
y_coord = 0;
@@ -113,7 +113,7 @@ struct CoordPair
void operator+=(const uint32 val)
{
if( y_coord+val < LIMIT )
if ( y_coord+val < LIMIT )
y_coord += val;
else
y_coord = LIMIT - 1;
@@ -164,9 +164,9 @@ namespace Trinity
inline void NormalizeMapCoord(float &c)
{
if(c > MAP_HALFSIZE - 0.5)
if (c > MAP_HALFSIZE - 0.5)
c = MAP_HALFSIZE - 0.5;
else if(c < -(MAP_HALFSIZE - 0.5))
else if (c < -(MAP_HALFSIZE - 0.5))
c = -(MAP_HALFSIZE - 0.5);
}
+37 -37
View File
@@ -39,13 +39,13 @@ VisibleNotifier::SendToSelf()
if (Transport* transport = i_player.GetTransport())
for (Transport::PlayerSet::const_iterator itr = transport->GetPassengers().begin();itr!=transport->GetPassengers().end();++itr)
{
if(vis_guids.find((*itr)->GetGUID()) != vis_guids.end())
if (vis_guids.find((*itr)->GetGUID()) != vis_guids.end())
{
vis_guids.erase((*itr)->GetGUID());
i_player.UpdateVisibilityOf((*itr), i_data, i_visibleNow);
if(!(*itr)->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
if (!(*itr)->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
(*itr)->UpdateVisibilityOf(&i_player);
}
}
@@ -55,15 +55,15 @@ VisibleNotifier::SendToSelf()
i_player.m_clientGUIDs.erase(*it);
i_data.AddOutOfRangeGUID(*it);
if(IS_PLAYER_GUID(*it))
if (IS_PLAYER_GUID(*it))
{
Player* plr = ObjectAccessor::FindPlayer(*it);
if(plr && plr->IsInWorld() && !plr->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
if (plr && plr->IsInWorld() && !plr->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
plr->UpdateVisibilityOf(&i_player);
}
}
if(!i_data.HasData())
if (!i_data.HasData())
return;
WorldPacket packet;
@@ -79,15 +79,15 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
if(iter->getSource() == &i_object)
if (iter->getSource() == &i_object)
continue;
iter->getSource()->UpdateVisibilityOf(&i_object);
if(!iter->getSource()->GetSharedVisionList().empty())
if (!iter->getSource()->GetSharedVisionList().empty())
for (SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
i != iter->getSource()->GetSharedVisionList().end(); ++i)
if((*i)->m_seer == iter->getSource())
if ((*i)->m_seer == iter->getSource())
(*i)->UpdateVisibilityOf(&i_object);
}
}
@@ -96,10 +96,10 @@ void
VisibleChangesNotifier::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if(!iter->getSource()->GetSharedVisionList().empty())
if (!iter->getSource()->GetSharedVisionList().empty())
for (SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
i != iter->getSource()->GetSharedVisionList().end(); ++i)
if((*i)->m_seer == iter->getSource())
if ((*i)->m_seer == iter->getSource())
(*i)->UpdateVisibilityOf(&i_object);
}
@@ -107,19 +107,19 @@ void
VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if(IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
if(Player* caster = (Player*)iter->getSource()->GetCaster())
if(caster->m_seer == iter->getSource())
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
if (Player* caster = (Player*)iter->getSource()->GetCaster())
if (caster->m_seer == iter->getSource())
caster->UpdateVisibilityOf(&i_object);
}
inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
{
if(!u->isAlive() || !c->isAlive() || c == u || u->isInFlight())
if (!u->isAlive() || !c->isAlive() || c == u || u->isInFlight())
return;
if(c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS))
if(c->_IsWithinDist(u, c->m_SightDistance, true) && c->IsAIEnabled)
if (c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS))
if (c->_IsWithinDist(u, c->m_SightDistance, true) && c->IsAIEnabled)
c->AI()->MoveInLineOfSight_Safe(u);
}
@@ -163,7 +163,7 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
{
Player * pl = iter->getSource();
if(!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
if (!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
pl->UpdateVisibilityOf(&i_creature);
CreatureUnitRelocationWorker(&i_creature, pl);
@@ -172,7 +172,7 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
void CreatureRelocationNotifier::Visit(CreatureMapType &m)
{
if(!i_creature.isAlive())
if (!i_creature.isAlive())
return;
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
@@ -180,7 +180,7 @@ void CreatureRelocationNotifier::Visit(CreatureMapType &m)
Creature* c = iter->getSource();
CreatureUnitRelocationWorker(&i_creature, c);
if(!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
CreatureUnitRelocationWorker(c, &i_creature);
}
}
@@ -190,7 +190,7 @@ void DelayedUnitRelocation::Visit(CreatureMapType &m)
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Creature * unit = iter->getSource();
if(!unit->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
if (!unit->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
continue;
CreatureRelocationNotifier relocate(*unit);
@@ -210,10 +210,10 @@ void DelayedUnitRelocation::Visit(PlayerMapType &m)
Player * player = iter->getSource();
WorldObject const *viewPoint = player->m_seer;
if(!viewPoint->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
if (!viewPoint->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
continue;
if(player != viewPoint && !viewPoint->IsPositionValid())
if (player != viewPoint && !viewPoint->IsPositionValid())
continue;
CellPair pair2(Trinity::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY()));
@@ -237,7 +237,7 @@ void AIRelocationNotifier::Visit(CreatureMapType &m)
{
Creature *c = iter->getSource();
CreatureUnitRelocationWorker(c, &i_unit);
if(isCreature)
if (isCreature)
CreatureUnitRelocationWorker((Creature*)&i_unit, c);
}
}
@@ -248,10 +248,10 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Player *target = iter->getSource();
if(!target->InSamePhase(i_phaseMask))
if (!target->InSamePhase(i_phaseMask))
continue;
if(target->GetExactDistSq(i_source) > i_distSq)
if (target->GetExactDistSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the player's vision
@@ -259,11 +259,11 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
{
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
for (; i != target->GetSharedVisionList().end(); ++i)
if((*i)->m_seer == target)
if ((*i)->m_seer == target)
SendPacket(*i);
}
if(target->m_seer == target || target->GetVehicle())
if (target->m_seer == target || target->GetVehicle())
SendPacket(target);
}
}
@@ -273,10 +273,10 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
if(!iter->getSource()->InSamePhase(i_phaseMask))
if (!iter->getSource()->InSamePhase(i_phaseMask))
continue;
if(iter->getSource()->GetExactDistSq(i_source) > i_distSq)
if (iter->getSource()->GetExactDistSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the creature's vision
@@ -284,7 +284,7 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
{
SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
for (; i != iter->getSource()->GetSharedVisionList().end(); ++i)
if((*i)->m_seer == iter->getSource())
if ((*i)->m_seer == iter->getSource())
SendPacket(*i);
}
}
@@ -295,10 +295,10 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
if(!iter->getSource()->InSamePhase(i_phaseMask))
if (!iter->getSource()->InSamePhase(i_phaseMask))
continue;
if(iter->getSource()->GetExactDistSq(i_source) > i_distSq)
if (iter->getSource()->GetExactDistSq(i_source) > i_distSq)
continue;
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
@@ -315,7 +315,7 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
void
MessageDistDeliverer::VisitObject(Player* plr)
{
if( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) )
if ( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) )
{
SendPacket(plr);
}
@@ -327,7 +327,7 @@ ObjectUpdater::Visit(GridRefManager<T> &m)
{
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
if(iter->getSource()->IsInWorld())
if (iter->getSource()->IsInWorld())
iter->getSource()->Update(i_timeDiff);
}
}
@@ -335,15 +335,15 @@ ObjectUpdater::Visit(GridRefManager<T> &m)
bool CannibalizeObjectCheck::operator()(Corpse* u)
{
// ignore bones
if(u->GetType()==CORPSE_BONES)
if (u->GetType()==CORPSE_BONES)
return false;
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID());
if( !owner || i_funit->IsFriendlyTo(owner))
if ( !owner || i_funit->IsFriendlyTo(owner))
return false;
if(i_funit->IsWithinDistInMap(u, i_range) )
if (i_funit->IsWithinDistInMap(u, i_range) )
return true;
return false;
+39 -39
View File
@@ -142,7 +142,7 @@ namespace Trinity
void SendPacket(Player* plr)
{
// never send packet to self
if(plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
if (plr == i_source || (team && plr->GetTeam() != team) || skipped_receiver == plr)
return;
plr->GetSession()->SendPacket(i_message);
@@ -213,34 +213,34 @@ namespace Trinity
void Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CorpseMapType &m)
{
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
@@ -408,7 +408,7 @@ namespace Trinity
void Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
@@ -459,7 +459,7 @@ namespace Trinity
void Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
@@ -542,7 +542,7 @@ namespace Trinity
CannibalizeObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
bool operator()(Player* u)
{
if( i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() )
if ( i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() )
return false;
return i_funit->IsWithinDistInMap(u, i_range);
@@ -582,10 +582,10 @@ namespace Trinity
GameObjectFocusCheck(Unit const* unit,uint32 focusId) : i_unit(unit), i_focusId(focusId) {}
bool operator()(GameObject* go) const
{
if(go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
if (go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
return false;
if(go->GetGOInfo()->spellFocus.focusId != i_focusId)
if (go->GetGOInfo()->spellFocus.focusId != i_focusId)
return false;
float dist = (go->GetGOInfo()->spellFocus.dist)/2;
@@ -604,7 +604,7 @@ namespace Trinity
NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(GameObject* go)
{
if(go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go->GetGOInfo()->fishinghole.radius))
if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go->GetGOInfo()->fishinghole.radius))
{
i_range = i_obj.GetDistance(go);
return true;
@@ -626,7 +626,7 @@ namespace Trinity
NearestGameObjectCheck(WorldObject const& obj) : i_obj(obj), i_range(999) {}
bool operator()(GameObject* go)
{
if(i_obj.IsWithinDistInMap(go, i_range))
if (i_obj.IsWithinDistInMap(go, i_range))
{
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
return true;
@@ -649,7 +649,7 @@ namespace Trinity
NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj,uint32 entry, float range) : i_obj(obj), i_entry(entry), i_range(range) {}
bool operator()(GameObject* go)
{
if(go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
{
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
return true;
@@ -687,7 +687,7 @@ namespace Trinity
MostHPMissingInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) {}
bool operator()(Unit* u)
{
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
{
i_hp = u->GetMaxHealth() - u->GetHealth();
return true;
@@ -706,7 +706,7 @@ namespace Trinity
FriendlyCCedInRange(Unit const* obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(Unit* u)
{
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
(u->isFeared() || u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_STUNNED) || u->hasUnitState(UNIT_STAT_CONFUSED)))
{
return true;
@@ -724,7 +724,7 @@ namespace Trinity
FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) {}
bool operator()(Unit* u)
{
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
!(u->HasAura(i_spell)))
{
return true;
@@ -743,7 +743,7 @@ namespace Trinity
AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
return true;
else
return false;
@@ -760,10 +760,10 @@ namespace Trinity
AnyUnfriendlyNoTotemUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
if(!u->isAlive())
if (!u->isAlive())
return false;
if(u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
return i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u);
@@ -812,7 +812,7 @@ namespace Trinity
AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u))
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u))
return true;
else
return false;
@@ -829,7 +829,7 @@ namespace Trinity
AnyUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(Unit* u)
{
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -846,7 +846,7 @@ namespace Trinity
NearestAttackableUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
bool operator()(Unit* u)
{
if( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
if ( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
!i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,false) )
{
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
@@ -872,7 +872,7 @@ namespace Trinity
{
Unit const* check = i_funit;
Unit const* owner = i_funit->GetOwner();
if(owner)
if (owner)
check = owner;
i_targetForPlayer = ( check->GetTypeId() == TYPEID_PLAYER );
}
@@ -881,10 +881,10 @@ namespace Trinity
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->isTargetableForAttack())
return false;
if(u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
if(( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range))
if (( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -951,17 +951,17 @@ namespace Trinity
bool operator()(Unit* u)
{
// TODO: addthreat for every enemy in range?
if(!m_creature->IsWithinDistInMap(u, m_range))
if (!m_creature->IsWithinDistInMap(u, m_range))
return false;
if(m_force)
if (m_force)
{
if(!m_creature->canAttack(u))
if (!m_creature->canAttack(u))
return false;
}
else
{
if(!m_creature->canStartAttack(u, false))
if (!m_creature->canStartAttack(u, false))
return false;
}
@@ -985,18 +985,18 @@ namespace Trinity
}
bool operator()(Creature* u)
{
if(u == i_funit)
if (u == i_funit)
return false;
if ( !u->CanAssistTo(i_funit, i_enemy) )
return false;
// too far
if( !i_funit->IsWithinDistInMap(u, i_range) )
if ( !i_funit->IsWithinDistInMap(u, i_range) )
return false;
// only if see assisted creature
if( !i_funit->IsWithinLOSInMap(u) )
if ( !i_funit->IsWithinLOSInMap(u) )
return false;
return true;
@@ -1015,15 +1015,15 @@ namespace Trinity
bool operator()(Creature* u)
{
if(u == i_obj)
if (u == i_obj)
return false;
if(!u->CanAssistTo(i_obj,i_enemy))
if (!u->CanAssistTo(i_obj,i_enemy))
return false;
if(!i_obj->IsWithinDistInMap(u, i_range))
if (!i_obj->IsWithinDistInMap(u, i_range))
return false;
if(!i_obj->IsWithinLOSInMap(u))
if (!i_obj->IsWithinLOSInMap(u))
return false;
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
@@ -1072,7 +1072,7 @@ namespace Trinity
AnyPlayerInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
bool operator()(Player* u)
{
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;
@@ -1088,7 +1088,7 @@ namespace Trinity
AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {}
bool operator() (Unit* u)
{
if(u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit))
if (u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit))
return true;
return false;
+62 -62
View File
@@ -45,7 +45,7 @@ inline void
Trinity::ObjectUpdater::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
if(iter->getSource()->IsInWorld() && !iter->getSource()->isSpiritService())
if (iter->getSource()->IsInWorld() && !iter->getSource()->isSpiritService())
iter->getSource()->Update(i_timeDiff);
}
@@ -57,12 +57,12 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
@@ -77,15 +77,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -97,15 +97,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -117,15 +117,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -137,15 +137,15 @@ template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -157,8 +157,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -166,8 +166,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -175,8 +175,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
{
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -184,8 +184,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -193,8 +193,8 @@ template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
{
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -204,15 +204,15 @@ template<class Check>
void Trinity::GameObjectSearcher<Check>::Visit(GameObjectMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -225,10 +225,10 @@ void Trinity::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -237,8 +237,8 @@ template<class Check>
void Trinity::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -248,15 +248,15 @@ template<class Check>
void Trinity::UnitSearcher<Check>::Visit(CreatureMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -268,15 +268,15 @@ template<class Check>
void Trinity::UnitSearcher<Check>::Visit(PlayerMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -289,10 +289,10 @@ void Trinity::UnitLastSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -302,10 +302,10 @@ void Trinity::UnitLastSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -314,8 +314,8 @@ template<class Check>
void Trinity::UnitListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -323,8 +323,8 @@ template<class Check>
void Trinity::UnitListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if(i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -334,15 +334,15 @@ template<class Check>
void Trinity::CreatureSearcher<Check>::Visit(CreatureMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -355,10 +355,10 @@ void Trinity::CreatureLastSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
@@ -367,8 +367,8 @@ template<class Check>
void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if( i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if ( i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -376,8 +376,8 @@ template<class Check>
void Trinity::PlayerListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if(itr->getSource()->InSamePhase(i_phaseMask))
if( i_check(itr->getSource()))
if (itr->getSource()->InSamePhase(i_phaseMask))
if ( i_check(itr->getSource()))
i_objects.push_back(itr->getSource());
}
@@ -385,15 +385,15 @@ template<class Check>
void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m)
{
// already found
if(i_object)
if (i_object)
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if(!itr->getSource()->InSamePhase(i_phaseMask))
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if(i_check(itr->getSource()))
if (i_check(itr->getSource()))
{
i_object = itr->getSource();
return;
@@ -409,9 +409,9 @@ void Trinity::LocalizedPacketDo<Builder>::operator()( Player* p )
WorldPacket* data;
// create if not cached yet
if(i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx])
if (i_data_cache.size() < cache_idx+1 || !i_data_cache[cache_idx])
{
if(i_data_cache.size() < cache_idx+1)
if (i_data_cache.size() < cache_idx+1)
i_data_cache.resize(cache_idx+1);
data = new WorldPacket(SMSG_MESSAGECHAT, 200);
@@ -434,9 +434,9 @@ void Trinity::LocalizedPacketListDo<Builder>::operator()( Player* p )
WorldPacketList* data_list;
// create if not cached yet
if(i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty())
if (i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty())
{
if(i_data_cache.size() < cache_idx+1)
if (i_data_cache.size() < cache_idx+1)
i_data_cache.resize(cache_idx+1);
data_list = &i_data_cache[cache_idx];
+5 -5
View File
@@ -33,9 +33,9 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, c
{
// Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
info.UpdateTimeTracker(t_diff);
if( info.getTimeTracker().Passed() )
if ( info.getTimeTracker().Passed() )
{
if( grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y) )
if ( grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y) )
{
ObjectGridStoper stoper(grid);
stoper.StopN();
@@ -60,12 +60,12 @@ IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 &x, const ui
void
RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 &x, const uint32 &y, const uint32 &t_diff) const
{
if(!info.getUnloadLock())
if (!info.getUnloadLock())
{
info.UpdateTimeTracker(t_diff);
if( info.getTimeTracker().Passed() )
if ( info.getTimeTracker().Passed() )
{
if( !m.UnloadGrid(x, y, false) )
if ( !m.UnloadGrid(x, y, false) )
{
sLog.outDebug("Grid[%u,%u] for map %u differed unloading due to players or active objects nearby", x, y, m.GetId());
m.ResetGridExpiry(grid);
+1 -1
View File
@@ -32,7 +32,7 @@ class GridState
GridState() { i_Magic = MAGIC_TESTVAL; }
bool checkMagic()
{
if(i_Magic != MAGIC_TESTVAL)
if (i_Magic != MAGIC_TESTVAL)
{
sLog.outError("!!! GridState: Magic value gone !!!");
return false;
+136 -136
View File
@@ -50,11 +50,11 @@ Group::Group()
Group::~Group()
{
if(m_bgGroup)
if (m_bgGroup)
{
sLog.outDebug("Group::~Group: battleground group being deleted.");
if(m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
else if(m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
else sLog.outError("Group::~Group: battleground group is not linked to the correct battleground.");
}
Rolls::iterator itr;
@@ -94,10 +94,10 @@ bool Group::Create(const uint64 &guid, const char * name)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
if(!isBGGroup())
if (!isBGGroup())
{
Player *leader = objmgr.GetPlayer(guid);
if(leader)
if (leader)
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -115,33 +115,33 @@ bool Group::Create(const uint64 &guid, const char * name)
GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), uint32(m_dungeonDifficulty), m_raidDifficulty);
}
if(!AddMember(guid, name))
if (!AddMember(guid, name))
return false;
if(!isBGGroup()) CharacterDatabase.CommitTransaction();
if (!isBGGroup()) CharacterDatabase.CommitTransaction();
return true;
}
bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result, bool loadMembers)
{
if(isBGGroup())
if (isBGGroup())
return false;
bool external = true;
if(!result)
if (!result)
{
external = false;
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
result = CharacterDatabase.PQuery("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid));
if(!result)
if (!result)
return false;
}
m_leaderGuid = leaderGuid;
// group leader not exist
if(!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
if (!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
return false;
m_groupType = (*result)[11].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;
@@ -166,10 +166,10 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result
for (int i=0; i<TARGETICONCOUNT; ++i)
m_targetIcons[i] = (*result)[3+i].GetUInt64();
if(loadMembers)
if (loadMembers)
{
result = CharacterDatabase.PQuery("SELECT memberGuid, memberFlags, subgroup FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid));
if(!result)
if (!result)
return false;
do
@@ -177,7 +177,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result
LoadMemberFromDB((*result)[0].GetUInt32(), (*result)[1].GetUInt8(), (*result)[2].GetUInt8());
} while ( result->NextRow() );
// group too small
if(GetMembersCount() < 2)
if (GetMembersCount() < 2)
return false;
}
@@ -190,7 +190,7 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup)
member.guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
// skip non-existed member
if(!objmgr.GetPlayerNameByGUID(member.guid, member.name))
if (!objmgr.GetPlayerNameByGUID(member.guid, member.name))
return false;
member.group = subgroup;
@@ -209,24 +209,24 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid));
SendUpdate();
// update quest related GO states (quest activity dependent from raid membership)
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
if(Player* player = objmgr.GetPlayer(citr->guid))
if (Player* player = objmgr.GetPlayer(citr->guid))
player->UpdateForQuestWorldObjects();
}
bool Group::AddInvite(Player *player)
{
if( !player || player->GetGroupInvite() )
if ( !player || player->GetGroupInvite() )
return false;
Group* group = player->GetGroup();
if( group && group->isBGGroup() )
if ( group && group->isBGGroup() )
group = player->GetOriginalGroup();
if( group )
if ( group )
return false;
RemoveInvite(player);
@@ -240,7 +240,7 @@ bool Group::AddInvite(Player *player)
bool Group::AddLeaderInvite(Player *player)
{
if(!AddInvite(player))
if (!AddInvite(player))
return false;
m_leaderGuid = player->GetGUID();
@@ -268,7 +268,7 @@ Player* Group::GetInvited(const uint64& guid) const
{
for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
if((*itr)->GetGUID() == guid)
if ((*itr)->GetGUID() == guid)
return (*itr);
}
return NULL;
@@ -278,7 +278,7 @@ Player* Group::GetInvited(const std::string& name) const
{
for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
if((*itr)->GetName() == name)
if ((*itr)->GetName() == name)
return (*itr);
}
return NULL;
@@ -286,14 +286,14 @@ Player* Group::GetInvited(const std::string& name) const
bool Group::AddMember(const uint64 &guid, const char* name)
{
if(!_addMember(guid, name))
if (!_addMember(guid, name))
return false;
SendUpdate();
Player *player = objmgr.GetPlayer(guid);
if(player)
if (player)
{
if(!IsLeader(player->GetGUID()) && !isBGGroup())
if (!IsLeader(player->GetGUID()) && !isBGGroup())
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
@@ -318,7 +318,7 @@ bool Group::AddMember(const uint64 &guid, const char* name)
UpdatePlayerOutOfRange(player);
// quest related GO state dependent from raid memebership
if(isRaidGroup())
if (isRaidGroup())
player->UpdateForQuestWorldObjects();
}
@@ -330,26 +330,26 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
BroadcastGroupUpdate();
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
if(GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
if (GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
{
bool leaderChanged = _removeMember(guid);
if(Player *player = objmgr.GetPlayer( guid ))
if (Player *player = objmgr.GetPlayer( guid ))
{
// quest related GO state dependent from raid membership
if(isRaidGroup())
if (isRaidGroup())
player->UpdateForQuestWorldObjects();
WorldPacket data;
if(method == 1)
if (method == 1)
{
data.Initialize( SMSG_GROUP_UNINVITE, 0 );
player->GetSession()->SendPacket( &data );
}
//we already removed player from group and in player->GetGroup() is his original group!
if( Group* group = player->GetGroup() )
if ( Group* group = player->GetGroup() )
{
group->SendUpdate();
}
@@ -364,7 +364,7 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
_homebindIfInstance(player);
}
if(leaderChanged)
if (leaderChanged)
{
WorldPacket data(SMSG_GROUP_SET_LEADER, (m_memberSlots.front().name.size()+1));
data << m_memberSlots.front().name;
@@ -384,7 +384,7 @@ void Group::ChangeLeader(const uint64 &guid)
{
member_citerator slot = _getMemberCSlot(guid);
if(slot==m_memberSlots.end())
if (slot==m_memberSlots.end())
return;
_setLeader(guid);
@@ -402,38 +402,38 @@ void Group::Disband(bool hideDestroy)
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
player = objmgr.GetPlayer(citr->guid);
if(!player)
if (!player)
continue;
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
if( isBGGroup() )
if ( isBGGroup() )
player->RemoveFromBattleGroundRaid();
else
{
//we can remove player who is in battleground from his original group
if( player->GetOriginalGroup() == this )
if ( player->GetOriginalGroup() == this )
player->SetOriginalGroup(NULL);
else
player->SetGroup(NULL);
}
// quest related GO state dependent from raid membership
if(isRaidGroup())
if (isRaidGroup())
player->UpdateForQuestWorldObjects();
if(!player->GetSession())
if (!player->GetSession())
continue;
WorldPacket data;
if(!hideDestroy)
if (!hideDestroy)
{
data.Initialize(SMSG_GROUP_DESTROYED, 0);
player->GetSession()->SendPacket(&data);
}
//we already removed player from group and in player->GetGroup() is his original group, send update
if( Group* group = player->GetGroup() )
if ( Group* group = player->GetGroup() )
{
group->SendUpdate();
}
@@ -452,7 +452,7 @@ void Group::Disband(bool hideDestroy)
RemoveAllInvites();
if(!isBGGroup())
if (!isBGGroup())
{
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid));
@@ -485,10 +485,10 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession())
if (!p || !p->GetSession())
continue;
if(itr->second != NOT_VALID)
if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -509,10 +509,10 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession())
if (!p || !p->GetSession())
continue;
if(itr->second != NOT_VALID)
if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -532,10 +532,10 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession())
if (!p || !p->GetSession())
continue;
if(itr->second != NOT_VALID)
if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -552,10 +552,10 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
{
Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession())
if (!p || !p->GetSession())
continue;
if(itr->second != NOT_VALID)
if (itr->second != NOT_VALID)
p->GetSession()->SendPacket( &data );
}
}
@@ -907,7 +907,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
player->SendEquipError(msg, NULL, NULL);
}
}
else if(rollvote == DISENCHANT)
else if (rollvote == DISENCHANT)
{
item->is_looted = true;
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
@@ -933,13 +933,13 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
{
if(id >= TARGETICONCOUNT)
if (id >= TARGETICONCOUNT)
return;
// clean other icons
if( targetGuid != 0 )
if ( targetGuid != 0 )
for (int i=0; i<TARGETICONCOUNT; ++i)
if( m_targetIcons[i] == targetGuid )
if ( m_targetIcons[i] == targetGuid )
SetTargetIcon(i, 0, 0);
m_targetIcons[id] = targetGuid;
@@ -957,19 +957,19 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* member = itr->getSource();
if(!member || !member->isAlive()) // only for alive
if (!member || !member->isAlive()) // only for alive
continue;
if(!member->IsAtGroupRewardDistance(victim)) // at req. distance
if (!member->IsAtGroupRewardDistance(victim)) // at req. distance
continue;
++count;
sum_level += member->getLevel();
if(!member_with_max_level || member_with_max_level->getLevel() < member->getLevel())
if (!member_with_max_level || member_with_max_level->getLevel() < member->getLevel())
member_with_max_level = member;
uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel());
if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level
if ( victim->getLevel() > gray_level && (!not_gray_member_with_max_level
|| not_gray_member_with_max_level->getLevel() < member->getLevel()))
not_gray_member_with_max_level = member;
}
@@ -977,7 +977,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev
void Group::SendTargetIconList(WorldSession *session)
{
if(!session)
if (!session)
return;
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
@@ -985,7 +985,7 @@ void Group::SendTargetIconList(WorldSession *session)
for (int i=0; i<TARGETICONCOUNT; ++i)
{
if(m_targetIcons[i] == 0)
if (m_targetIcons[i] == 0)
continue;
data << uint8(i);
@@ -1049,7 +1049,7 @@ void Group::SendUpdate()
void Group::UpdatePlayerOutOfRange(Player* pPlayer)
{
if(!pPlayer || !pPlayer->IsInWorld())
if (!pPlayer || !pPlayer->IsInWorld())
return;
Player *player;
@@ -1069,7 +1069,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pl = itr->getSource();
if(!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
if (!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
continue;
if (pl->GetSession() && (group==-1 || itr->getSubGroup()==group))
@@ -1082,8 +1082,8 @@ void Group::BroadcastReadyCheck(WorldPacket *packet)
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pl = itr->getSource();
if(pl && pl->GetSession())
if(IsLeader(pl->GetGUID()) || IsAssistant(pl->GetGUID()))
if (pl && pl->GetSession())
if (IsLeader(pl->GetGUID()) || IsAssistant(pl->GetGUID()))
pl->GetSession()->SendPacket(packet);
}
}
@@ -1128,10 +1128,10 @@ bool Group::_addMember(const uint64 &guid, const char* name)
bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
{
if(IsFull())
if (IsFull())
return false;
if(!guid)
if (!guid)
return false;
Player *player = objmgr.GetPlayer(guid);
@@ -1145,11 +1145,11 @@ bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
SubGroupCounterIncrease(group);
if(player)
if (player)
{
player->SetGroupInvite(NULL);
//if player is in group and he is being added to BG raid group, then call SetBattleGroundRaid()
if( player->GetGroup() && isBGGroup() )
if ( player->GetGroup() && isBGGroup() )
player->SetBattleGroundRaid(this, group);
//if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
else if ( player->GetGroup() )
@@ -1159,17 +1159,17 @@ bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
player->SetGroup(this, group);
// if the same group invites the player back, cancel the homebind timer
InstanceGroupBind *bind = GetBoundInstance(player);
if(bind && bind->save->GetInstanceId() == player->GetInstanceId())
if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
player->m_InstanceValid = true;
}
if(!isRaidGroup()) // reset targetIcons for non-raid-groups
if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{
for (int i=0; i<TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0;
}
if(!isBGGroup())
if (!isBGGroup())
{
// insert into group table
CharacterDatabase.PExecute("INSERT INTO group_member(leaderGuid,memberGuid,memberFlags,subgroup) VALUES('%u','%u','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(member.guid), member.flags, member.group);
@@ -1184,12 +1184,12 @@ bool Group::_removeMember(const uint64 &guid)
if (player)
{
//if we are removing player from battleground raid
if( isBGGroup() )
if ( isBGGroup() )
player->RemoveFromBattleGroundRaid();
else
{
//we can remove player who is in battleground from his original group
if( player->GetOriginalGroup() == this )
if ( player->GetOriginalGroup() == this )
player->SetOriginalGroup(NULL);
else
player->SetGroup(NULL);
@@ -1206,12 +1206,12 @@ bool Group::_removeMember(const uint64 &guid)
m_memberSlots.erase(slot);
}
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", GUID_LOPART(guid));
if(m_leaderGuid == guid) // leader was removed
if (m_leaderGuid == guid) // leader was removed
{
if(GetMembersCount() > 0)
if (GetMembersCount() > 0)
_setLeader(m_memberSlots.front().guid);
return true;
}
@@ -1222,10 +1222,10 @@ bool Group::_removeMember(const uint64 &guid)
void Group::_setLeader(const uint64 &guid)
{
member_witerator slot = _getMemberWSlot(guid);
if(slot==m_memberSlots.end())
if (slot==m_memberSlots.end())
return;
if(!isBGGroup())
if (!isBGGroup())
{
// TODO: set a time limit to have this function run rarely cause it can be slow
CharacterDatabase.BeginTransaction();
@@ -1242,13 +1242,13 @@ void Group::_setLeader(const uint64 &guid)
);
Player *player = objmgr.GetPlayer(slot->guid);
if(player)
if (player)
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();)
{
if(itr->second.perm)
if (itr->second.perm)
{
itr->second.save->RemoveGroup(this);
m_boundInstances[i].erase(itr++);
@@ -1284,7 +1284,7 @@ void Group::_removeRolls(const uint64 &guid)
{
Roll* roll = *it;
Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
if(itr2 == roll->playerVote.end())
if (itr2 == roll->playerVote.end())
continue;
if (itr2->second == GREED || itr2->second == DISENCHANT) --roll->totalGreed;
@@ -1301,14 +1301,14 @@ void Group::_removeRolls(const uint64 &guid)
bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
{
member_witerator slot = _getMemberWSlot(guid);
if(slot==m_memberSlots.end())
if (slot==m_memberSlots.end())
return false;
slot->group = group;
SubGroupCounterIncrease(group);
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
if (!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
return true;
}
@@ -1321,7 +1321,7 @@ bool Group::_setAssistantFlag(const uint64 &guid, const bool &apply)
ToggleGroupMemberFlag(slot, MEMBER_FLAG_ASSISTANT, apply);
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
return true;
}
@@ -1335,7 +1335,7 @@ bool Group::_setMainTank(const uint64 &guid, const bool &apply)
RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINTANK); // Remove main tank flag from current if any.
ToggleGroupMemberFlag(slot, MEMBER_FLAG_MAINTANK, apply); // And apply main tank flag on new main tank.
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
return true;
}
@@ -1349,14 +1349,14 @@ bool Group::_setMainAssistant(const uint64 &guid, const bool &apply)
RemoveUniqueGroupMemberFlag(MEMBER_FLAG_MAINASSIST); // Remove main assist flag from current if any.
ToggleGroupMemberFlag(slot, MEMBER_FLAG_MAINASSIST, apply); // Apply main assist flag on new main assist.
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
return true;
}
bool Group::SameSubGroup(Player const* member1, Player const* member2) const
{
if(!member1 || !member2) return false;
if (!member1 || !member2) return false;
if (member1->GetGroup() != this || member2->GetGroup() != this) return false;
else return member1->GetSubGroup() == member2->GetSubGroup();
}
@@ -1364,7 +1364,7 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
// allows setting subgroup for offline members
void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
{
if(!isRaidGroup())
if (!isRaidGroup())
return;
Player *player = objmgr.GetPlayer(guid);
@@ -1375,7 +1375,7 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
SubGroupCounterDecrease(prevSubGroup);
if(_setMembersGroup(guid, group))
if (_setMembersGroup(guid, group))
SendUpdate();
}
else
@@ -1386,12 +1386,12 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
// only for online members
void Group::ChangeMembersGroup(Player *player, const uint8 &group)
{
if(!player || !isRaidGroup())
if (!player || !isRaidGroup())
return;
if(_setMembersGroup(player->GetGUID(), group))
if (_setMembersGroup(player->GetGUID(), group))
{
uint8 prevSubGroup = player->GetSubGroup();
if( player->GetGroup() == this )
if ( player->GetGroup() == this )
player->GetGroupRef().setSubGroup(group);
//if player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference
else
@@ -1488,19 +1488,19 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleG
{
// check for min / max count
uint32 memberscount = GetMembersCount();
if(memberscount < MinPlayerCount)
if (memberscount < MinPlayerCount)
return BG_JOIN_ERR_GROUP_NOT_ENOUGH;
if(memberscount > MaxPlayerCount)
if (memberscount > MaxPlayerCount)
return BG_JOIN_ERR_GROUP_TOO_MANY;
// get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
Player * reference = GetFirstMember()->getSource();
// no reference found, can't join this way
if(!reference)
if (!reference)
return BG_JOIN_ERR_OFFLINE_MEMBER;
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(),reference->getLevel());
if(!bracketEntry)
if (!bracketEntry)
return BG_JOIN_ERR_OFFLINE_MEMBER;
uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
@@ -1511,26 +1511,26 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleG
{
Player *member = itr->getSource();
// offline member? don't let join
if(!member)
if (!member)
return BG_JOIN_ERR_OFFLINE_MEMBER;
// don't allow cross-faction join as group
if(member->GetTeam() != team)
if (member->GetTeam() != team)
return BG_JOIN_ERR_MIXED_FACTION;
// not in the same battleground level braket, don't let join
PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId,member->getLevel());
if(memberBracketEntry != bracketEntry)
if (memberBracketEntry != bracketEntry)
return BG_JOIN_ERR_MIXED_LEVELS;
// don't let join rated matches if the arena team id doesn't match
if(isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
return BG_JOIN_ERR_MIXED_ARENATEAM;
// don't let join if someone from the group is already in that bg queue
if(member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
if (member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
return BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE;
// check for deserter debuff in case not arena queue
if(bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
if (bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
return BG_JOIN_ERR_GROUP_DESERTER;
// check if member can join any more battleground queues
if(!member->HasFreeBattleGroundQueueId())
if (!member->HasFreeBattleGroundQueueId())
return BG_JOIN_ERR_ALL_QUEUES_USED;
}
return BG_JOIN_ERR_OK;
@@ -1549,13 +1549,13 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_dungeonDifficulty, GUID_LOPART(m_leaderGuid));
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *player = itr->getSource();
if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
if (!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
continue;
player->SetDungeonDifficulty(difficulty);
player->SendDungeonDifficulty(true);
@@ -1565,13 +1565,13 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
if(!isBGGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE leaderGuid ='%u'", m_raidDifficulty, GUID_LOPART(m_leaderGuid));
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *player = itr->getSource();
if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
if (!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
continue;
player->SetRaidDifficulty(difficulty);
player->SendRaidDifficulty(true);
@@ -1583,9 +1583,9 @@ bool Group::InCombatToInstance(uint32 instanceId)
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pPlayer = itr->getSource();
if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
if (pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i!=pPlayer->getAttackers().end(); ++i)
if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
return true;
}
return false;
@@ -1593,7 +1593,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
if(isBGGroup())
if (isBGGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -1605,13 +1605,13 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
InstanceSave *p = itr->second.save;
const MapEntry *entry = sMapStore.LookupEntry(itr->first);
if(!entry || entry->IsRaid() != isRaid || !p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)
if (!entry || entry->IsRaid() != isRaid || !p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)
{
++itr;
continue;
}
if(method == INSTANCE_RESET_ALL)
if (method == INSTANCE_RESET_ALL)
{
// the "reset all instances" method can only reset normal maps
if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
@@ -1624,24 +1624,24 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
bool isEmpty = true;
// if the map is loaded, reset it
Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId());
if(map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
{
if(p->CanReset())
if (p->CanReset())
isEmpty = ((InstanceMap*)map)->Reset(method);
else
isEmpty = !map->HavePlayers();
}
if(SendMsgTo)
if (SendMsgTo)
{
if(isEmpty) SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
if (isEmpty) SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
else SendMsgTo->SendResetInstanceFailed(0, p->GetMapId());
}
if(isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
{
// do not reset the instance, just unbind if others are permanently bound to it
if(p->CanReset()) p->DeleteFromDB();
if (p->CanReset()) p->DeleteFromDB();
else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId());
// i don't know for sure if hash_map iterators
m_boundInstances[diff].erase(itr);
@@ -1659,18 +1659,18 @@ InstanceGroupBind* Group::GetBoundInstance(Player* player)
{
uint32 mapid = player->GetMapId();
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if(!mapEntry)
if (!mapEntry)
return NULL;
Difficulty difficulty = player->GetDifficulty(mapEntry->IsRaid());
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
if(!mapDiff)
if (!mapDiff)
difficulty = DUNGEON_DIFFICULTY_NORMAL;
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
if(itr != m_boundInstances[difficulty].end())
if (itr != m_boundInstances[difficulty].end())
return &itr->second;
else
return NULL;
@@ -1683,11 +1683,11 @@ InstanceGroupBind* Group::GetBoundInstance(Map* aMap)
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetMapDifficultyData(aMap->GetId(),difficulty);
if(!mapDiff)
if (!mapDiff)
return NULL;
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(aMap->GetId());
if(itr != m_boundInstances[difficulty].end())
if (itr != m_boundInstances[difficulty].end())
return &itr->second;
else
return NULL;
@@ -1696,27 +1696,27 @@ InstanceGroupBind* Group::GetBoundInstance(Map* aMap)
InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load)
{
if(save && !isBGGroup())
if (save && !isBGGroup())
{
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
if(bind.save)
if (bind.save)
{
// when a boss is killed or when copying the players's binds to the group
if(permanent != bind.perm || save != bind.save)
if(!load) CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
if (permanent != bind.perm || save != bind.save)
if (!load) CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
}
else
if(!load) CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
if (!load) CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
if(bind.save != save)
if (bind.save != save)
{
if(bind.save) bind.save->RemoveGroup(this);
if (bind.save) bind.save->RemoveGroup(this);
save->AddGroup(this);
}
bind.save = save;
bind.perm = permanent;
if(!load) sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
if (!load) sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
return &bind;
}
else
@@ -1726,9 +1726,9 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, boo
void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
{
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
if(itr != m_boundInstances[difficulty].end())
if (itr != m_boundInstances[difficulty].end())
{
if(!unload) CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
if (!unload) CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
itr->second.save->RemoveGroup(this); // save can become invalid
m_boundInstances[difficulty].erase(itr);
}
@@ -1736,13 +1736,13 @@ void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
void Group::_homebindIfInstance(Player *player)
{
if(player && !player->isGameMaster() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
if (player && !player->isGameMaster() && sMapStore.LookupEntry(player->GetMapId())->IsDungeon())
{
// leaving the group in an instance, the homebind timer is started
// unless the player is permanently saved to the instance
InstanceSave *save = sInstanceSaveManager.GetInstanceSave(player->GetInstanceId());
InstancePlayerBind *playerBind = save ? player->GetBoundInstance(save->GetMapId(), save->GetDifficulty()) : NULL;
if(!playerBind || !playerBind->perm)
if (!playerBind || !playerBind->perm)
player->m_InstanceValid = false;
}
}
@@ -1755,7 +1755,7 @@ void Group::BroadcastGroupUpdate(void)
{
Player *pp = objmgr.GetPlayer(citr->guid);
if(pp && pp->IsInWorld())
if (pp && pp->IsInWorld())
{
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
+11 -11
View File
@@ -206,7 +206,7 @@ class Group
{
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
{
if(itr->name == name)
if (itr->name == name)
{
return itr->guid;
}
@@ -216,7 +216,7 @@ class Group
bool IsAssistant(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if(mslot==m_memberSlots.end())
if (mslot==m_memberSlots.end())
return false;
return mslot->flags & MEMBER_FLAG_ASSISTANT;
@@ -227,7 +227,7 @@ class Group
bool SameSubGroup(uint64 guid1,const uint64& guid2) const
{
member_citerator mslot2 = _getMemberCSlot(guid2);
if(mslot2==m_memberSlots.end())
if (mslot2==m_memberSlots.end())
return false;
return SameSubGroup(guid1,&*mslot2);
@@ -236,7 +236,7 @@ class Group
bool SameSubGroup(uint64 guid1, MemberSlot const* slot2) const
{
member_citerator mslot1 = _getMemberCSlot(guid1);
if(mslot1==m_memberSlots.end() || !slot2)
if (mslot1==m_memberSlots.end() || !slot2)
return false;
return (mslot1->group==slot2->group);
@@ -256,7 +256,7 @@ class Group
uint8 GetMemberGroup(uint64 guid) const
{
member_citerator mslot = _getMemberCSlot(guid);
if(mslot==m_memberSlots.end())
if (mslot==m_memberSlots.end())
return (MAXRAIDSIZE/MAXGROUPSIZE+1);
return mslot->group;
@@ -273,25 +273,25 @@ class Group
void SetAssistant(uint64 guid, const bool &apply)
{
if(!isRaidGroup())
if (!isRaidGroup())
return;
if(_setAssistantFlag(guid, apply))
if (_setAssistantFlag(guid, apply))
SendUpdate();
}
void SetMainTank(uint64 guid, const bool &apply)
{
if(!isRaidGroup())
if (!isRaidGroup())
return;
if(_setMainTank(guid, apply))
if (_setMainTank(guid, apply))
SendUpdate();
}
void SetMainAssistant(uint64 guid, const bool &apply)
{
if(!isRaidGroup())
if (!isRaidGroup())
return;
if(_setMainAssistant(guid, apply))
if (_setMainAssistant(guid, apply))
SendUpdate();
}
+77 -77
View File
@@ -64,7 +64,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
// attempt add selected player
// cheating
if(!normalizePlayerName(membername))
if (!normalizePlayerName(membername))
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
@@ -73,7 +73,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
Player *player = objmgr.GetPlayer(membername.c_str());
// no player
if(!player)
if (!player)
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
@@ -86,53 +86,53 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
return;
}
// can't group with
if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_UNFRIENDLY);
return;
}
if(GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
if (GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_NOT_IN_YOUR_INSTANCE);
return;
}
// just ignore us
if(player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
if (player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
}
if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
}
Group *group = GetPlayer()->GetGroup();
if( group && group->isBGGroup() )
if ( group && group->isBGGroup() )
group = GetPlayer()->GetOriginalGroup();
Group *group2 = player->GetGroup();
if( group2 && group2->isBGGroup() )
if ( group2 && group2->isBGGroup() )
group2 = player->GetOriginalGroup();
// player already in another group or invited
if( group2 || player->GetGroupInvite() )
if ( group2 || player->GetGroupInvite() )
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_ALREADY_IN_GROUP);
return;
}
if(group)
if (group)
{
// not have permissions for invite
if(group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_YOU_NOT_LEADER);
return;
}
// not have place
if(group->IsFull())
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
@@ -142,16 +142,16 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
// ok, but group not exist, start a new group
// but don't create and save the group to the DB until
// at least one person joins
if(!group)
if (!group)
{
group = new Group;
// new group: if can't add then delete
if(!group->AddLeaderInvite(GetPlayer()))
if (!group->AddLeaderInvite(GetPlayer()))
{
delete group;
return;
}
if(!group->AddInvite(player))
if (!group->AddInvite(player))
{
delete group;
return;
@@ -160,7 +160,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
else
{
// already existed group: if can't add then just leave
if(!group->AddInvite(player))
if (!group->AddInvite(player))
{
return;
}
@@ -180,7 +180,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
Group *group = GetPlayer()->GetGroupInvite();
if (!group) return;
if(group->GetLeaderGUID() == GetPlayer()->GetGUID())
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
sLog.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
@@ -193,7 +193,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
/********************/
// not have place
if(group->IsFull())
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
@@ -202,16 +202,16 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
Player* leader = objmgr.GetPlayer(group->GetLeaderGUID());
// forming a new group, create it
if(!group->IsCreated())
if (!group->IsCreated())
{
if( leader )
if ( leader )
group->RemoveInvite(leader);
group->Create(group->GetLeaderGUID(), group->GetLeaderName());
objmgr.AddGroup(group);
}
// everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
if (!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
group->BroadcastGroupUpdate();
@@ -228,7 +228,7 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
// uninvite, group can be deleted
GetPlayer()->UninviteFromGroup();
if(!leader || !leader->GetSession())
if (!leader || !leader->GetSession())
return;
// report
@@ -243,30 +243,30 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
recv_data >> guid;
//can't uninvite yourself
if(guid == GetPlayer()->GetGUID())
if (guid == GetPlayer()->GetGUID())
{
sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
PartyResult res = GetPlayer()->CanUninviteFromGroup();
if(res != PARTY_RESULT_OK)
if (res != PARTY_RESULT_OK)
{
SendPartyResult(PARTY_OP_LEAVE, "", res);
return;
}
Group* grp = GetPlayer()->GetGroup();
if(!grp)
if (!grp)
return;
if(grp->IsMember(guid))
if (grp->IsMember(guid))
{
Player::RemoveFromGroup(grp,guid);
return;
}
if(Player* plr = grp->GetInvited(guid))
if (Player* plr = grp->GetInvited(guid))
{
plr->UninviteFromGroup();
return;
@@ -281,34 +281,34 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
recv_data >> membername;
// player not found
if(!normalizePlayerName(membername))
if (!normalizePlayerName(membername))
return;
// can't uninvite yourself
if(GetPlayer()->GetName() == membername)
if (GetPlayer()->GetName() == membername)
{
sLog.outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
PartyResult res = GetPlayer()->CanUninviteFromGroup();
if(res != PARTY_RESULT_OK)
if (res != PARTY_RESULT_OK)
{
SendPartyResult(PARTY_OP_LEAVE, "", res);
return;
}
Group* grp = GetPlayer()->GetGroup();
if(!grp)
if (!grp)
return;
if(uint64 guid = grp->GetMemberGUID(membername))
if (uint64 guid = grp->GetMemberGUID(membername))
{
Player::RemoveFromGroup(grp,guid);
return;
}
if(Player* plr = grp->GetInvited(membername))
if (Player* plr = grp->GetInvited(membername))
{
plr->UninviteFromGroup();
return;
@@ -320,7 +320,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
uint64 guid;
@@ -339,10 +339,10 @@ void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
{
if(!GetPlayer()->GetGroup())
if (!GetPlayer()->GetGroup())
return;
if(_player->InBattleGround())
if (_player->InBattleGround())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_INVITE_RESTRICTED);
return;
@@ -360,7 +360,7 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
uint32 lootMethod;
@@ -369,7 +369,7 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
recv_data >> lootMethod >> lootMaster >> lootThreshold;
/** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()))
if (!group->IsLeader(GetPlayer()->GetGUID()))
return;
/********************/
@@ -382,7 +382,7 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
void WorldSession::HandleLootRoll( WorldPacket &recv_data )
{
if(!GetPlayer()->GetGroup())
if (!GetPlayer()->GetGroup())
return;
uint64 Guid;
@@ -395,7 +395,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise);
Group* group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
// everything's fine, do it
@@ -414,7 +414,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
{
if(!GetPlayer()->GetGroup())
if (!GetPlayer()->GetGroup())
return;
float x, y;
@@ -441,7 +441,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
recv_data >> maximum;
/** error handling **/
if(minimum > maximum || maximum > 10000) // < 32768 for urand call
if (minimum > maximum || maximum > 10000) // < 32768 for urand call
return;
/********************/
@@ -455,7 +455,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
data << uint32(maximum);
data << uint32(roll);
data << uint64(GetPlayer()->GetGUID());
if(GetPlayer()->GetGroup())
if (GetPlayer()->GetGroup())
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
else
SendPacket(&data);
@@ -464,7 +464,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
uint8 x;
@@ -474,13 +474,13 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
/********************/
// everything's fine, do it
if(x == 0xFF) // target icon request
if (x == 0xFF) // target icon request
{
group->SendTargetIconList(this);
}
else // target icon update
{
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
uint64 guid;
@@ -492,14 +492,14 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ )
{
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
if(_player->InBattleGround())
if (_player->InBattleGround())
return;
/** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2)
if (!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2)
return;
/********************/
@@ -512,7 +512,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
std::string name;
@@ -531,7 +531,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
/********************/
Player *movedPlayer=objmgr.GetPlayer(name.c_str());
if(!movedPlayer)
if (!movedPlayer)
return;
//Do not allow leader to change group of player in combat
@@ -545,7 +545,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
uint64 guid;
@@ -592,13 +592,13 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
{
Group *group = GetPlayer()->GetGroup();
if(!group)
if (!group)
return;
if(recv_data.empty()) // request
if (recv_data.empty()) // request
{
/** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
/********************/
@@ -625,10 +625,10 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data*/ )
{
//Group* group = GetPlayer()->GetGroup();
//if(!group)
//if (!group)
// return;
//if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
//if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
// return;
// Is any reaction need?
@@ -700,7 +700,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
*data << uint64(auramask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if(auramask & (uint64(1) << i))
if (auramask & (uint64(1) << i))
{
AuraApplication const * aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
@@ -712,7 +712,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
Pet *pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
{
if(pet)
if (pet)
*data << (uint64) pet->GetGUID();
else
*data << (uint64) 0;
@@ -720,7 +720,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
{
if(pet)
if (pet)
*data << pet->GetName();
else
*data << (uint8) 0;
@@ -728,7 +728,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
{
if(pet)
if (pet)
*data << (uint16) pet->GetDisplayId();
else
*data << (uint16) 0;
@@ -736,7 +736,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_CUR_HP)
{
if(pet)
if (pet)
*data << (uint32) pet->GetHealth();
else
*data << (uint32) 0;
@@ -744,7 +744,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_MAX_HP)
{
if(pet)
if (pet)
*data << (uint32) pet->GetMaxHealth();
else
*data << (uint32) 0;
@@ -752,7 +752,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE)
{
if(pet)
if (pet)
*data << (uint8) pet->getPowerType();
else
*data << (uint8) 0;
@@ -760,7 +760,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_CUR_POWER)
{
if(pet)
if (pet)
*data << (uint16) pet->GetPower(pet->getPowerType());
else
*data << (uint16) 0;
@@ -768,7 +768,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_MAX_POWER)
{
if(pet)
if (pet)
*data << (uint16) pet->GetMaxPower(pet->getPowerType());
else
*data << (uint16) 0;
@@ -776,7 +776,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
{
if(player->GetVehicle()){
if (player->GetVehicle()){
Vehicle* vv=player->GetVehicle();
*data << (uint32) vv->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat];
}
@@ -784,13 +784,13 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
if (mask & GROUP_UPDATE_FLAG_PET_AURAS)
{
if(pet)
if (pet)
{
const uint64& auramask = pet->GetAuraUpdateMaskForRaid();
*data << uint64(auramask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if(auramask & (uint64(1) << i))
if (auramask & (uint64(1) << i))
{
AuraApplication const * aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
@@ -811,7 +811,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
recv_data >> Guid;
Player *player = objmgr.GetPlayer(Guid);
if(!player)
if (!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
@@ -829,7 +829,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data.append(player->GetPackGUID());
uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF
if(pet)
if (pet)
mask1 = 0x7FFFFFFF; // for hunters and other classes with pets
Powers powerType = player->getPowerType();
@@ -850,7 +850,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) auramask; // placeholder
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if(AuraApplication * aurApp = player->GetVisibleAura(i))
if (AuraApplication * aurApp = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << (uint32) aurApp->GetBase()->GetId();
@@ -859,7 +859,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
}
data.put<uint64>(maskPos,auramask); // GROUP_UPDATE_FLAG_AURAS
if(pet)
if (pet)
{
Powers petpowertype = pet->getPowerType();
data << (uint64) pet->GetGUID(); // GROUP_UPDATE_FLAG_PET_GUID
@@ -876,7 +876,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) petauramask; // placeholder
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if(AuraApplication * auraApp = pet->GetVisibleAura(i))
if (AuraApplication * auraApp = pet->GetVisibleAura(i))
{
petauramask |= (uint64(1) << i);
data << (uint32) auraApp->GetBase()->GetId();
@@ -913,13 +913,13 @@ void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data )
recv_data >> unkn;
// ignore if player not loaded
if(!GetPlayer()) // needed because STATUS_AUTHED
if (!GetPlayer()) // needed because STATUS_AUTHED
{
if(unkn!=0)
if (unkn!=0)
sLog.outError("CMSG_GROUP_PASS_ON_LOOT value<>0 for not-loaded character!");
return;
}
if(unkn!=0)
if (unkn!=0)
sLog.outError("CMSG_GROUP_PASS_ON_LOOT: activation not implemented!");
}
+13 -13
View File
@@ -27,7 +27,7 @@
int GuardAI::Permissible(const Creature *creature)
{
if( creature->isGuard())
if ( creature->isGuard())
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
@@ -43,12 +43,12 @@ void GuardAI::MoveInLineOfSight(Unit *u)
if ( !m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
return;
if( !m_creature->getVictim() && m_creature->canAttack(u) &&
if ( !m_creature->getVictim() && m_creature->canAttack(u) &&
( u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/ ) &&
u->isInAccessiblePlaceFor(m_creature))
{
float attackRadius = m_creature->GetAttackDistance(u);
if(m_creature->IsWithinDistInMap(u,attackRadius))
if (m_creature->IsWithinDistInMap(u,attackRadius))
{
//Need add code to let guard support player
AttackStart(u);
@@ -59,7 +59,7 @@ void GuardAI::MoveInLineOfSight(Unit *u)
void GuardAI::EnterEvadeMode()
{
if( !m_creature->isAlive() )
if ( !m_creature->isAlive() )
{
DEBUG_LOG("Creature stopped attacking because he's dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->MoveIdle();
@@ -74,19 +74,19 @@ void GuardAI::EnterEvadeMode()
Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid );
if( !victim )
if ( !victim )
{
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow());
}
else if( !victim ->isAlive() )
else if ( !victim ->isAlive() )
{
DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", m_creature->GetGUIDLow());
}
else if( victim ->HasStealthAura() )
else if ( victim ->HasStealthAura() )
{
DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", m_creature->GetGUIDLow());
}
else if( victim ->isInFlight() )
else if ( victim ->isInFlight() )
{
DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", m_creature->GetGUIDLow());
}
@@ -102,21 +102,21 @@ void GuardAI::EnterEvadeMode()
i_state = STATE_NORMAL;
// Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
if( m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
if ( m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE )
m_creature->GetMotionMaster()->MoveTargetedHome();
}
void GuardAI::UpdateAI(const uint32 /*diff*/)
{
// update i_victimGuid if m_creature->getVictim() !=0 and changed
if(!UpdateVictim())
if (!UpdateVictim())
return;
i_victimGuid = m_creature->getVictim()->GetGUID();
if( m_creature->isAttackReady() )
if ( m_creature->isAttackReady() )
{
if( m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if ( m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
@@ -132,7 +132,7 @@ bool GuardAI::IsVisible(Unit *pl) const
void GuardAI::JustDied(Unit *killer)
{
if(Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
m_creature->SendZoneUnderAttackMessage(pkiller);
}
+1 -1
View File
@@ -1601,7 +1601,7 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t
data << uint8(enchCount); // number of enchantments
for (uint32 i = PERM_ENCHANTMENT_SLOT; i < MAX_ENCHANTMENT_SLOT; ++i)
{
if(uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
if (uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
{
data << uint8(i);
data << uint32(enchId);
+3 -3
View File
@@ -341,8 +341,8 @@ class Guild
void BroadcastWorker(Do& _do, Player* except = NULL)
{
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
if(Player *player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
if(player != except)
if (Player *player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
if (player != except)
_do(player);
}
@@ -367,7 +367,7 @@ class Guild
{
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
{
if(itr->second.Name == name)
if (itr->second.Name == name)
{
guid = itr->first;
return &itr->second;
+69 -69
View File
@@ -36,7 +36,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
uint32 guildId;
recvPacket >> guildId;
if(Guild *guild = objmgr.GetGuildById(guildId))
if (Guild *guild = objmgr.GetGuildById(guildId))
{
guild->Query(this);
return;
@@ -52,11 +52,11 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
std::string gname;
recvPacket >> gname;
if(GetPlayer()->GetGuildId()) // already in guild
if (GetPlayer()->GetGuildId()) // already in guild
return;
Guild *guild = new Guild;
if(!guild->Create(GetPlayer(), gname))
if (!guild->Create(GetPlayer(), gname))
{
delete guild;
return;
@@ -74,24 +74,24 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
Player * player = NULL;
recvPacket >> Invitedname;
if(normalizePlayerName(Invitedname))
if (normalizePlayerName(Invitedname))
player = ObjectAccessor::Instance().FindPlayerByName(Invitedname.c_str());
if(!player)
if (!player)
{
SendGuildCommandResult(GUILD_INVITE_S, Invitedname, GUILD_PLAYER_NOT_FOUND);
return;
}
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
// OK result but not send invite
if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
return;
// not let enemies sign guild charter
@@ -101,21 +101,21 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
return;
}
if(player->GetGuildId())
if (player->GetGuildId())
{
plname = player->GetName();
SendGuildCommandResult(GUILD_INVITE_S, plname, ALREADY_IN_GUILD);
return;
}
if(player->GetGuildIdInvited())
if (player->GetGuildIdInvited())
{
plname = player->GetName();
SendGuildCommandResult(GUILD_INVITE_S, plname, ALREADY_INVITED_TO_GUILD);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_INVITE))
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_INVITE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -142,17 +142,17 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
std::string plName;
recvPacket >> plName;
if(!normalizePlayerName(plName))
if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE))
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -160,20 +160,20 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
if(!slot)
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if(slot->RankId == GR_GUILDMASTER)
if (slot->RankId == GR_GUILDMASTER)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
//do not allow to kick player with same or higher rights
if(GetPlayer()->GetRank() >= slot->RankId)
if (GetPlayer()->GetRank() >= slot->RankId)
{
SendGuildCommandResult(GUILD_QUIT_S, plName, GUILD_RANK_TOO_HIGH_S);
return;
@@ -199,14 +199,14 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_ACCEPT");
guild = objmgr.GetGuildById(player->GetGuildIdInvited());
if(!guild || player->GetGuildId())
if (!guild || player->GetGuildId())
return;
// not let enemies sign guild charter
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != objmgr.GetPlayerTeamByGUID(guild->GetLeader()))
return;
if(!guild->AddMember(GetPlayer()->GetGUID(),guild->GetLowestRank()))
if (!guild->AddMember(GetPlayer()->GetGUID(),guild->GetLowestRank()))
return;
// Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_JOIN_GUILD, GetPlayer()->GetGUIDLow(), 0, 0);
@@ -234,7 +234,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_INFO");
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
@@ -253,7 +253,7 @@ void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/)
{
sLog.outDebug("WORLD: Received CMSG_GUILD_ROSTER");
if(Guild* guild = objmgr.GetGuildById(_player->GetGuildId()))
if (Guild* guild = objmgr.GetGuildById(_player->GetGuildId()))
guild->Roster(this);
}
@@ -264,17 +264,17 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
std::string plName;
recvPacket >> plName;
if(!normalizePlayerName(plName))
if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE))
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -283,13 +283,13 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(plName, plGuid);
if(!slot)
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if(plGuid == GetPlayer()->GetGUID())
if (plGuid == GetPlayer()->GetGUID())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return;
@@ -298,7 +298,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
//allow to promote only to lower rank than member's rank
//guildmaster's rank = 0
//GetPlayer()->GetRank() + 1 is highest rank that current player can promote to
if(GetPlayer()->GetRank() + 1 >= slot->RankId)
if (GetPlayer()->GetRank() + 1 >= slot->RankId)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_RANK_TOO_HIGH_S);
return;
@@ -326,18 +326,18 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
std::string plName;
recvPacket >> plName;
if(!normalizePlayerName(plName))
if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -352,21 +352,21 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return;
}
if(plGuid == GetPlayer()->GetGUID())
if (plGuid == GetPlayer()->GetGUID())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return;
}
//do not allow to demote same or higher rank
if(GetPlayer()->GetRank() >= slot->RankId)
if (GetPlayer()->GetRank() >= slot->RankId)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_RANK_TOO_HIGH_S);
return;
}
//do not allow to demote lowest rank
if(slot->RankId >= guild->GetLowestRank())
if (slot->RankId >= guild->GetLowestRank())
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_ALREADY_LOWEST_RANK_S);
return;
@@ -392,19 +392,19 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE");
Guild *guild = objmgr.GetGuildById(_player->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1)
if (_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
if(_player->GetGUID() == guild->GetLeader())
if (_player->GetGUID() == guild->GetLeader())
{
guild->Disband();
return;
@@ -430,13 +430,13 @@ void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_DISBAND");
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(GetPlayer()->GetGUID() != guild->GetLeader())
if (GetPlayer()->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -456,7 +456,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
Player *oldLeader = GetPlayer();
if(!normalizePlayerName(name))
if (!normalizePlayerName(name))
return;
Guild *guild = objmgr.GetGuildById(oldLeader->GetGuildId());
@@ -467,7 +467,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
return;
}
if( oldLeader->GetGUID() != guild->GetLeader())
if ( oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -501,19 +501,19 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
std::string MOTD;
if(!recvPacket.empty())
if (!recvPacket.empty())
recvPacket >> MOTD;
else
MOTD = "";
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_SETMOTD))
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_SETMOTD))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -537,7 +537,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
std::string name,PNOTE;
recvPacket >> name;
if(!normalizePlayerName(name))
if (!normalizePlayerName(name))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
@@ -575,7 +575,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
std::string plName, OFFNOTE;
recvPacket >> plName;
if(!normalizePlayerName(plName))
if (!normalizePlayerName(plName))
return;
Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
@@ -615,13 +615,13 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
sLog.outDebug("WORLD: Received CMSG_GUILD_RANK");
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
else if(GetPlayer()->GetGUID() != guild->GetLeader())
else if (GetPlayer()->GetGUID() != guild->GetLeader())
{
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
@@ -665,19 +665,19 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
recvPacket >> rankname;
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(GetPlayer()->GetGUID() != guild->GetLeader())
if (GetPlayer()->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
if(guild->GetRanksSize() >= GUILD_RANKS_MAX_COUNT) // client not let create more 10 than ranks
if (guild->GetRanksSize() >= GUILD_RANKS_MAX_COUNT) // client not let create more 10 than ranks
return;
guild->CreateRank(rankname, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
@@ -691,12 +691,12 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
sLog.outDebug("WORLD: Received CMSG_GUILD_DEL_RANK");
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
else if(GetPlayer()->GetGUID() != guild->GetLeader())
else if (GetPlayer()->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
@@ -728,13 +728,13 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
recvPacket >> GINFO;
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_MODIFY_GUILD_INFO))
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_MODIFY_GUILD_INFO))
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PERMISSIONS);
return;
@@ -764,11 +764,11 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
if (!guild)
{
//"You are not part of a guild!";
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOGUILD);
@@ -782,7 +782,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
return;
}
if(GetPlayer()->GetMoney() < 10*GOLD)
if (GetPlayer()->GetMoney() < 10*GOLD)
{
//"You can't afford to do that."
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOTENOUGHMONEY);
@@ -802,8 +802,8 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
{
// empty
sLog.outDebug("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)");
if(uint32 GuildId = GetPlayer()->GetGuildId())
if(Guild *pGuild = objmgr.GetGuildById(GuildId))
if (uint32 GuildId = GetPlayer()->GetGuildId())
if (Guild *pGuild = objmgr.GetGuildById(GuildId))
pGuild->DisplayGuildEventLog(this);
}
@@ -812,8 +812,8 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ )
{
sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)");
if(uint32 GuildId = GetPlayer()->GetGuildId())
if(Guild *pGuild = objmgr.GetGuildById(GuildId))
if (uint32 GuildId = GetPlayer()->GetGuildId())
if (Guild *pGuild = objmgr.GetGuildById(GuildId))
pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow());
}
@@ -821,9 +821,9 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ )
{
sLog.outDebug("WORLD: Received (MSG_GUILD_PERMISSIONS)");
if(uint32 GuildId = GetPlayer()->GetGuildId())
if (uint32 GuildId = GetPlayer()->GetGuildId())
{
if(Guild *pGuild = objmgr.GetGuildById(GuildId))
if (Guild *pGuild = objmgr.GetGuildById(GuildId))
{
uint32 rankId = GetPlayer()->GetRank();
@@ -859,7 +859,7 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data )
if (uint32 GuildId = GetPlayer()->GetGuildId())
{
if(Guild *pGuild = objmgr.GetGuildById(GuildId))
if (Guild *pGuild = objmgr.GetGuildById(GuildId))
{
pGuild->DisplayGuildBankTabsInfo(this); // this also will load guild bank if not yet
return;
@@ -935,7 +935,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
CharacterDatabase.CommitTransaction();
// logging money
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
if (_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
_player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId);
@@ -968,7 +968,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
return;
Guild *pGuild = objmgr.GetGuildById(GuildId);
if(!pGuild)
if (!pGuild)
return;
if (!pGuild->GetPurchasedTabs())
@@ -1098,7 +1098,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
// Player <-> Bank
// allow work with inventory only
if(!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
if (!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
{
_player->SendEquipError( EQUIP_ERR_NONE, NULL, NULL );
return;
@@ -1129,7 +1129,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
return;
Guild *pGuild = objmgr.GetGuildById(GuildId);
if(!pGuild)
if (!pGuild)
return;
// m_PurchasedTabs = 0 when buying Tab 0, that is why this check can be made
@@ -1166,10 +1166,10 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
recv_data >> Name;
recv_data >> IconIndex;
if(Name.empty())
if (Name.empty())
return;
if(IconIndex.empty())
if (IconIndex.empty())
return;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
+3 -3
View File
@@ -43,10 +43,10 @@ HomeMovementGenerator<Creature>::Reset(Creature &)
void
HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
{
if( !&owner )
if ( !&owner )
return;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
if ( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
return;
float x, y, z;
@@ -70,7 +70,7 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
owner.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
// restore orientation of not moving creature at returning to home
if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
if (owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
{
//sLog.outDebug("Entering HomeMovement::GetDestination(z,y,z)");
owner.SetOrientation(ori);
+4 -4
View File
@@ -43,7 +43,7 @@ void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry co
while (ref != NULL)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if(pVictim == getOwner())
if (pVictim == getOwner())
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
ref->getSource()->addThreat(pVictim, threat / size);
@@ -139,7 +139,7 @@ void HostileRefManager::deleteReferencesForFaction(uint32 faction)
while (ref)
{
HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
if (ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
{
ref->removeReference();
delete ref;
@@ -157,7 +157,7 @@ void HostileRefManager::deleteReference(Unit *pCreature)
while (ref)
{
HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
if (ref->getSource()->getOwner() == pCreature)
{
ref->removeReference();
delete ref;
@@ -176,7 +176,7 @@ void HostileRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
while (ref)
{
HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
if (ref->getSource()->getOwner() == pCreature)
{
ref->setOnlineOfflineState(bIsOnline);
break;
+8 -8
View File
@@ -28,23 +28,23 @@ IdleMovementGenerator si_idleMovement;
// But it should not be sent otherwise there are many redundent packets
void IdleMovementGenerator::Initialize(Unit &owner)
{
if(owner.hasUnitState(UNIT_STAT_MOVE))
if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
}
void
IdleMovementGenerator::Reset(Unit& owner)
{
if(owner.hasUnitState(UNIT_STAT_MOVE))
if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
}
void RotateMovementGenerator::Initialize(Unit& owner)
{
if(owner.hasUnitState(UNIT_STAT_MOVE))
if (owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
if(owner.getVictim())
if (owner.getVictim())
owner.SetInFront(owner.getVictim());
owner.addUnitState(UNIT_STAT_ROTATING);
@@ -55,7 +55,7 @@ void RotateMovementGenerator::Initialize(Unit& owner)
bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
{
float angle = owner.GetOrientation();
if(m_direction == ROTATE_DIRECTION_LEFT)
if (m_direction == ROTATE_DIRECTION_LEFT)
{
angle += (float)diff * M_PI * 2 / m_maxDuration;
while (angle >= M_PI * 2 ) angle -= M_PI * 2;
@@ -68,7 +68,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
owner.SetOrientation(angle);
owner.SendMovementFlagUpdate(); // this is a hack. we do not have anything correct to send in the beginning
if(m_duration > diff)
if (m_duration > diff)
m_duration -= diff;
else
return false;
@@ -79,7 +79,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
void RotateMovementGenerator::Finalize(Unit &unit)
{
unit.clearUnitState(UNIT_STAT_ROTATING);
if(unit.GetTypeId() == TYPEID_UNIT)
if (unit.GetTypeId() == TYPEID_UNIT)
unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
}
@@ -98,7 +98,7 @@ DistractMovementGenerator::Finalize(Unit& owner)
bool
DistractMovementGenerator::Update(Unit& owner, const uint32& time_diff)
{
if(time_diff > m_timer)
if (time_diff > m_timer)
return false;
m_timer -= time_diff;
+2 -2
View File
@@ -203,7 +203,7 @@ bool InstanceData::SetBossState(uint32 id, EncounterState state)
if (state == DONE)
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if((*i)->isWorldBoss() && (*i)->isAlive())
if ((*i)->isWorldBoss() && (*i)->isAlive())
return false;
bossInfo->state = state;
@@ -224,7 +224,7 @@ bool InstanceData::SetBossState(uint32 id, EncounterState state)
std::string InstanceData::LoadBossState(const char * data)
{
if(!data)
if (!data)
return NULL;
std::istringstream loadStream(data);
uint32 buff;
+37 -37
View File
@@ -79,7 +79,7 @@ InstanceSaveManager::~InstanceSaveManager()
*/
InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load)
{
if(InstanceSave *old_save = GetInstanceSave(instanceId))
if (InstanceSave *old_save = GetInstanceSave(instanceId))
return old_save;
const MapEntry* entry = sMapStore.LookupEntry(mapId);
@@ -101,11 +101,11 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
return NULL;
}
if(!resetTime)
if (!resetTime)
{
// initialize reset time
// for normal instances if no creatures are killed the instance will reset in two hours
if(entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
if (entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
resetTime = GetResetTimeFor(mapId,difficulty);
else
{
@@ -118,7 +118,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
sLog.outDebug("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d", mapId, instanceId);
InstanceSave *save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset);
if(!load) save->SaveToDB();
if (!load) save->SaveToDB();
m_instanceSaveById[instanceId] = save;
return save;
@@ -143,10 +143,10 @@ void InstanceSaveManager::DeleteInstanceFromDB(uint32 instanceid)
void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
{
InstanceSaveHashMap::iterator itr = m_instanceSaveById.find( InstanceId );
if(itr != m_instanceSaveById.end())
if (itr != m_instanceSaveById.end())
{
// save the resettime for normal instances only when they get unloaded
if(time_t resettime = itr->second->GetResetTimeForDB())
if (time_t resettime = itr->second->GetResetTimeForDB())
CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId);
delete itr->second;
m_instanceSaveById.erase(itr);
@@ -174,13 +174,13 @@ void InstanceSave::SaveToDB()
std::string data;
Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid);
if(map)
if (map)
{
assert(map->IsDungeon());
if(InstanceData *iData = ((InstanceMap*)map)->GetInstanceData())
if (InstanceData *iData = ((InstanceMap*)map)->GetInstanceData())
{
data = iData->GetSaveData();
if(!data.empty())
if (!data.empty())
CharacterDatabase.escape_string(data);
}
}
@@ -192,7 +192,7 @@ time_t InstanceSave::GetResetTimeForDB()
{
// only save the reset time for normal instances
const MapEntry *entry = sMapStore.LookupEntry(GetMapId());
if(!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
return 0;
else
return GetResetTime();
@@ -217,9 +217,9 @@ void InstanceSave::DeleteFromDB()
/* true if the instance save is still valid */
bool InstanceSave::UnloadIfEmpty()
{
if(m_playerList.empty() && m_groupList.empty())
if (m_playerList.empty() && m_groupList.empty())
{
if(!sInstanceSaveManager.lock_instLists)
if (!sInstanceSaveManager.lock_instLists)
sInstanceSaveManager.RemoveInstanceSave(GetInstanceId());
return false;
}
@@ -239,7 +239,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
va_end(ap);
QueryResult_AutoPtr result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
if(result)
if (result)
{
do
{
@@ -416,11 +416,11 @@ void InstanceSaveManager::LoadResetTimes()
ResetTimeMapDiffInstances mapDiffResetInstances;
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
if( result )
if ( result )
{
do
{
if(time_t resettime = time_t((*result)[3].GetUInt64()))
if (time_t resettime = time_t((*result)[3].GetUInt64()))
{
uint32 id = (*result)[0].GetUInt32();
uint32 mapid = (*result)[1].GetUInt32();
@@ -433,7 +433,7 @@ void InstanceSaveManager::LoadResetTimes()
// update reset time for normal instances with the max creature respawn time + X hours
result = WorldDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance");
if( result )
if ( result )
{
do
{
@@ -441,7 +441,7 @@ void InstanceSaveManager::LoadResetTimes()
uint32 instance = fields[1].GetUInt32();
time_t resettime = time_t(fields[0].GetUInt64() + 2 * HOUR);
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
if(itr != instResetTime.end() && itr->second.second != resettime)
if (itr != instResetTime.end() && itr->second.second != resettime)
{
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
itr->second.second = resettime;
@@ -452,14 +452,14 @@ void InstanceSaveManager::LoadResetTimes()
// schedule the reset times
for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
if(itr->second.second > now)
if (itr->second.second > now)
ScheduleReset(true, itr->second.second, InstResetEvent(0, PAIR32_LOPART(itr->second.first),Difficulty(PAIR32_HIPART(itr->second.first)),itr->first));
}
// load the global respawn times for raid/heroic instances
uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
if(result)
if (result)
{
do
{
@@ -469,7 +469,7 @@ void InstanceSaveManager::LoadResetTimes()
uint64 oldresettime = fields[2].GetUInt64();
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
if(!mapDiff)
if (!mapDiff)
{
sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid,difficulty);
@@ -478,7 +478,7 @@ void InstanceSaveManager::LoadResetTimes()
// update the reset time if the hour in the configs changes
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
if(oldresettime != newresettime)
if (oldresettime != newresettime)
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
SetResetTimeFor(mapid,difficulty,newresettime);
@@ -506,14 +506,14 @@ void InstanceSaveManager::LoadResetTimes()
period = DAY;
time_t t = GetResetTimeFor(mapid,difficulty);
if(!t)
if (!t)
{
// initialize the reset time
t = today + period + diff;
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t);
}
if(t < now)
if (t < now)
{
// assume that expired instances have already been cleaned
// calculate the next reset time
@@ -528,7 +528,7 @@ void InstanceSaveManager::LoadResetTimes()
uint8 type = 1;
static int tim[4] = {3600, 900, 300, 60};
for (; type < 4; type++)
if(t - tim[type-1] > now)
if (t - tim[type-1] > now)
break;
ScheduleReset(true, t - tim[type-1], InstResetEvent(type, mapid, difficulty, -1));
@@ -543,7 +543,7 @@ void InstanceSaveManager::LoadResetTimes()
void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent event)
{
if(add) m_resetTimeQueue.insert(std::pair<time_t, InstResetEvent>(time, event));
if (add) m_resetTimeQueue.insert(std::pair<time_t, InstResetEvent>(time, event));
else
{
// find the event in the queue and remove it
@@ -551,13 +551,13 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev
std::pair<ResetTimeQueue::iterator, ResetTimeQueue::iterator> range;
range = m_resetTimeQueue.equal_range(time);
for (itr = range.first; itr != range.second; ++itr)
if(itr->second == event) { m_resetTimeQueue.erase(itr); return; }
if (itr->second == event) { m_resetTimeQueue.erase(itr); return; }
// in case the reset time changed (should happen very rarely), we search the whole queue
if(itr == range.second)
if (itr == range.second)
{
for (itr = m_resetTimeQueue.begin(); itr != m_resetTimeQueue.end(); ++itr)
if(itr->second == event) { m_resetTimeQueue.erase(itr); return; }
if(itr == m_resetTimeQueue.end())
if (itr->second == event) { m_resetTimeQueue.erase(itr); return; }
if (itr == m_resetTimeQueue.end())
sLog.outError("InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d,%d,%d) was not found!", event.type, event.mapid, event.instanceId);
}
}
@@ -569,7 +569,7 @@ void InstanceSaveManager::Update()
while (!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
{
InstResetEvent &event = m_resetTimeQueue.begin()->second;
if(event.type == 0)
if (event.type == 0)
{
// for individual normal instances, max creature respawn + X hours
_ResetInstance(event.mapid, event.instanceId);
@@ -580,7 +580,7 @@ void InstanceSaveManager::Update()
// global reset/warning for a certain map
time_t resetTime = GetResetTimeFor(event.mapid,event.difficulty);
_ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, resetTime - now);
if(event.type != 4)
if (event.type != 4)
{
// schedule the next warning/reset
event.type++;
@@ -618,15 +618,15 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
{
sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
Map *map = (MapInstanced*)MapManager::Instance().CreateBaseMap(mapid);
if(!map->Instanceable())
if (!map->Instanceable())
return;
InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(instanceId);
if(itr != m_instanceSaveById.end()) _ResetSave(itr);
if (itr != m_instanceSaveById.end()) _ResetSave(itr);
DeleteInstanceFromDB(instanceId); // even if save not loaded
Map* iMap = ((MapInstanced*)map)->FindMap(instanceId);
if(iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
if (iMap && iMap->IsDungeon()) ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY);
else objmgr.DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded
}
@@ -639,7 +639,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
uint64 now = (uint64)time(NULL);
if(!warn)
if (!warn)
{
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
if (!mapDiff || !mapDiff->resetTime)
@@ -687,8 +687,8 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
for (mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr)
{
Map *map2 = mitr->second;
if(!map2->IsDungeon()) continue;
if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft);
if (!map2->IsDungeon()) continue;
if (warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft);
else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL);
}
+3 -3
View File
@@ -126,13 +126,13 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
{
ItemPrototype const *itemProto = objmgr.GetItemPrototype(item_id);
if(!itemProto)
if (!itemProto)
return 0;
if(!itemProto->RandomSuffix)
if (!itemProto->RandomSuffix)
return 0;
RandomPropertiesPointsEntry const *randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
if(!randomProperty)
if (!randomProperty)
return 0;
uint32 suffixFactor;
+114 -114
View File
@@ -41,19 +41,19 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
uint16 src = ( (srcbag << 8) | srcslot );
uint16 dst = ( (dstbag << 8) | dstslot );
if(src==dst)
if (src==dst)
return;
if (count==0)
return; //check count - if zero it's fake packet
if(!_player->IsValidPos(srcbag,srcslot))
if (!_player->IsValidPos(srcbag,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
if(!_player->IsValidPos(dstbag,dstslot))
if (!_player->IsValidPos(dstbag,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -71,16 +71,16 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot);
// prevent attempt swap same item to current position generated by client at special checting sequence
if(srcslot==dstslot)
if (srcslot==dstslot)
return;
if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -99,13 +99,13 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data )
recv_data >> itemguid >> dstslot;
// cheating attempt, client should never send opcode in that case
if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
return;
Item* item = _player->GetItemByGuid(itemguid);
uint16 dstpos = dstslot | (INVENTORY_SLOT_BAG_0 << 8);
if(!item || item->GetPos() == dstpos)
if (!item || item->GetPos() == dstpos)
return;
_player->SwapItem(item->GetPos(), dstpos);
@@ -123,16 +123,16 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data )
uint16 dst = ( (dstbag << 8) | dstslot );
// prevent attempt swap same item to current position generated by client at special checting sequence
if(src==dst)
if (src==dst)
return;
if(!_player->IsValidPos(srcbag,srcslot))
if (!_player->IsValidPos(srcbag,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
if(!_player->IsValidPos(dstbag,dstslot))
if (!_player->IsValidPos(dstbag,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -150,10 +150,10 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pSrcItem = _player->GetItemByPos( srcbag, srcslot );
if( !pSrcItem )
if ( !pSrcItem )
return; // only at cheat
if(pSrcItem->m_lootGenerated) // prevent swap looting item
if (pSrcItem->m_lootGenerated) // prevent swap looting item
{
//best error message found for attempting to swap while looting
_player->SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL );
@@ -162,18 +162,18 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
uint16 dest;
uint8 msg = _player->CanEquipItem( NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag() );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pSrcItem, NULL );
return;
}
uint16 src = pSrcItem->GetPos();
if(dest==src) // prevent equip in same slot, only at cheat
if (dest==src) // prevent equip in same slot, only at cheat
return;
Item *pDstItem = _player->GetItemByPos( dest );
if( !pDstItem ) // empty slot, simple case
if ( !pDstItem ) // empty slot, simple case
{
_player->RemoveItem( srcbag, srcslot, true );
_player->EquipItem( dest, pSrcItem, true );
@@ -185,7 +185,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
uint8 dstslot = pDstItem->GetSlot();
msg = _player->CanUnequipItem( dest, !pSrcItem->IsBag() );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pDstItem, NULL );
return;
@@ -194,30 +194,30 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
// check dest->src move possibility
ItemPosCountVec sSrc;
uint16 eSrc = 0;
if( _player->IsInventoryPos( src ) )
if ( _player->IsInventoryPos( src ) )
{
msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
msg = _player->CanStoreItem( srcbag, NULL_SLOT, sSrc, pDstItem, true );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true );
}
else if( _player->IsBankPos( src ) )
else if ( _player->IsBankPos( src ) )
{
msg = _player->CanBankItem( srcbag, srcslot, sSrc, pDstItem, true );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
msg = _player->CanBankItem( srcbag, NULL_SLOT, sSrc, pDstItem, true );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true );
}
else if( _player->IsEquipmentPos( src ) )
else if ( _player->IsEquipmentPos( src ) )
{
msg = _player->CanEquipItem( srcslot, eSrc, pDstItem, true);
if( msg == EQUIP_ERR_OK )
if ( msg == EQUIP_ERR_OK )
msg = _player->CanUnequipItem( eSrc, true);
}
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pDstItem, pSrcItem );
return;
@@ -231,11 +231,11 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
_player->EquipItem(dest, pSrcItem, true);
// add to src
if( _player->IsInventoryPos( src ) )
if ( _player->IsInventoryPos( src ) )
_player->StoreItem(sSrc, pDstItem, true);
else if( _player->IsBankPos( src ) )
else if ( _player->IsBankPos( src ) )
_player->BankItem(sSrc, pDstItem, true);
else if( _player->IsEquipmentPos( src ) )
else if ( _player->IsEquipmentPos( src ) )
_player->EquipItem(eSrc, pDstItem, true);
_player->AutoUnequipOffhandIfNeed();
@@ -253,10 +253,10 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
uint16 pos = (bag << 8) | slot;
// prevent drop unequipable items (in combat, for example) and non-empty bags
if(_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
{
uint8 msg = _player->CanUnequipItem( pos, false );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, _player->GetItemByPos(pos), NULL );
return;
@@ -264,13 +264,13 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
}
Item *pItem = _player->GetItemByPos( bag, slot );
if(!pItem)
if (!pItem)
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
if(count)
if (count)
{
uint32 i_count = count;
_player->DestroyItemCount( pItem, i_count, true );
@@ -289,7 +289,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
sLog.outDetail("STORAGE: Item Query = %u", item);
ItemPrototype const *pProto = objmgr.GetItemPrototype( item );
if( pProto )
if ( pProto )
{
std::string Name = pProto->Name1;
std::string Description = pProto->Description;
@@ -370,7 +370,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
// use `item_template` or if not set then only use spell cooldowns
SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId);
if(spell)
if (spell)
{
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
@@ -378,7 +378,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->Spells[s].SpellTrigger;
data << uint32(-abs(pProto->Spells[s].SpellCharges));
if(db_data)
if (db_data)
{
data << uint32(pProto->Spells[s].SpellCooldown);
data << uint32(pProto->Spells[s].SpellCategory);
@@ -452,12 +452,12 @@ void WorldSession::HandleReadItem( WorldPacket & recv_data )
//sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
Item *pItem = _player->GetItemByPos( bag, slot );
if( pItem && pItem->GetProto()->PageText )
if ( pItem && pItem->GetProto()->PageText )
{
WorldPacket data;
uint8 msg = _player->CanUseItem( pItem );
if( msg == EQUIP_ERR_OK )
if ( msg == EQUIP_ERR_OK )
{
data.Initialize (SMSG_READ_ITEM_OK, 8);
sLog.outDetail("STORAGE: Item page sent");
@@ -496,7 +496,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
recv_data >> vendorguid >> itemguid >> count;
if(!itemguid)
if (!itemguid)
return;
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
@@ -508,42 +508,42 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemByGuid( itemguid );
if( pItem )
if ( pItem )
{
// prevent sell not owner item
if(_player->GetGUID()!=pItem->GetOwnerGUID())
if (_player->GetGUID()!=pItem->GetOwnerGUID())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// prevent sell non empty bag by drag-and-drop at vendor's item list
if(pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
if (pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// prevent sell currently looted item
if(_player->GetLootGUID()==pItem->GetGUID())
if (_player->GetLootGUID()==pItem->GetGUID())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// special case at auto sell (sell all)
if(count==0)
if (count==0)
{
count = pItem->GetCount();
}
else
{
// prevent sell more items that exist in stack (possible only not from client)
if(count > pItem->GetCount())
if (count > pItem->GetCount())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
@@ -551,11 +551,11 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
}
ItemPrototype const *pProto = pItem->GetProto();
if( pProto )
if ( pProto )
{
if( pProto->SellPrice > 0 )
if ( pProto->SellPrice > 0 )
{
if(count < pItem->GetCount()) // need split items
if (count < pItem->GetCount()) // need split items
{
Item *pNewItem = pItem->CloneItem( count, _player );
if (!pNewItem)
@@ -567,12 +567,12 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
pItem->SetCount( pItem->GetCount() - count );
_player->ItemRemovedQuestCheck( pItem->GetEntry(), count );
if( _player->IsInWorld() )
if ( _player->IsInWorld() )
pItem->SendUpdateToPlayer( _player );
pItem->SetState(ITEM_CHANGED, _player);
_player->AddItemToBuyBackSlot( pNewItem );
if( _player->IsInWorld() )
if ( _player->IsInWorld() )
pNewItem->SendUpdateToPlayer( _player );
}
else
@@ -611,14 +611,14 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemFromBuyBackSlot( slot );
if( pItem )
if ( pItem )
{
uint32 price = _player->GetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START );
if( _player->GetMoney() < price )
if ( _player->GetMoney() < price )
{
_player->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0);
return;
@@ -626,7 +626,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
if( msg == EQUIP_ERR_OK )
if ( msg == EQUIP_ERR_OK )
{
_player->ModifyMoney( -(int32)price );
_player->RemoveItemFromBuyBackSlot( slot, false );
@@ -695,7 +695,7 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
recv_data >> guid;
if(!GetPlayer()->isAlive())
if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" );
@@ -716,14 +716,14 @@ void WorldSession::SendListInventory( uint64 vendorguid )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
VendorItemData const* vItems = pCreature->GetVendorItems();
if(!vItems)
if (!vItems)
{
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
return;
@@ -740,11 +740,11 @@ void WorldSession::SendListInventory( uint64 vendorguid )
for (int i = 0; i < numitems; ++i )
{
if(VendorItem const* crItem = vItems->GetItem(i))
if (VendorItem const* crItem = vItems->GetItem(i))
{
if(ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item))
if (ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item))
{
if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
if ((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
continue;
// Only display items in vendor lists for the team the
// player is on. If GM on, display all items.
@@ -786,10 +786,10 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
if( !pItem )
if ( !pItem )
return;
if(!_player->IsValidPos(dstbag,NULL_SLOT))
if (!_player->IsValidPos(dstbag,NULL_SLOT))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -798,10 +798,10 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
uint16 src = pItem->GetPos();
// check unequip potability for equipped items and bank bags
if(_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
if (_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
{
uint8 msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src ));
if(msg != EQUIP_ERR_OK)
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -810,14 +810,14 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
// no-op: placed in same slot
if(dest.size()==1 && dest[0].pos==src)
if (dest.size()==1 && dest[0].pos==src)
{
// just remove grey item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
@@ -838,7 +838,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
// cheating protection
/* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if(!pCreature)
if (!pCreature)
{
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
@@ -854,7 +854,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot);
if(!slotEntry)
if (!slotEntry)
return;
uint32 price = slotEntry->price;
@@ -877,12 +877,12 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
if( !pItem )
if ( !pItem )
return;
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -901,14 +901,14 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
if( !pItem )
if ( !pItem )
return;
if(_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
{
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -921,7 +921,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
{
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -934,7 +934,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
{
if(!GetPlayer()->isAlive())
if (!GetPlayer()->isAlive())
{
GetPlayer()->SendEquipError( EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL );
return;
@@ -945,7 +945,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
recv_data >> item;
if(!item)
if (!item)
GetPlayer()->RemoveAmmo();
else
GetPlayer()->SetAmmo(item);
@@ -981,7 +981,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid );
if( pProto )
if ( pProto )
{
std::string Name;
Name = pProto->Name1;
@@ -1009,7 +1009,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
/* else
{
// listed in dbc or not expected to exist unknown item
if(sItemStore.LookupEntry(itemid))
if (sItemStore.LookupEntry(itemid))
sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid);
else
sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid);
@@ -1029,13 +1029,13 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
sLog.outDebug("WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot);
Item *gift = _player->GetItemByPos( gift_bag, gift_slot );
if(!gift)
if (!gift)
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL );
return;
}
if(!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper
if (!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL );
return;
@@ -1043,50 +1043,50 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
Item *item = _player->GetItemByPos( item_bag, item_slot );
if( !item )
if ( !item )
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, item, NULL );
return;
}
if(item==gift) // not possable with pacjket from real client
if (item==gift) // not possable with pacjket from real client
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
if(item->IsEquipped())
if (item->IsEquipped())
{
_player->SendEquipError( EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
if(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
if(item->IsBag())
if (item->IsBag())
{
_player->SendEquipError( EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL );
return;
}
if(item->IsSoulBound())
if (item->IsSoulBound())
{
_player->SendEquipError( EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL );
return;
}
if(item->GetMaxStackCount() != 1)
if (item->GetMaxStackCount() != 1)
{
_player->SendEquipError( EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL );
return;
}
// maybe not correct check (it is better than nothing)
if(item->GetProto()->MaxCount>0)
if (item->GetProto()->MaxCount>0)
{
_player->SendEquipError( EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL );
return;
@@ -1109,7 +1109,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
item->SetState(ITEM_CHANGED, _player);
if(item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
if (item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
{
// after save it will be impossible to remove the item from the queue
item->RemoveFromUpdateQueueOf(_player);
@@ -1129,7 +1129,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
uint64 gem_guids[MAX_GEM_SOCKETS];
recv_data >> item_guid;
if(!item_guid)
if (!item_guid)
return;
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
@@ -1141,11 +1141,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
Item *itemTarget = _player->GetItemByGuid(item_guid);
if(!itemTarget) //missing item to socket
if (!itemTarget) //missing item to socket
return;
ItemPrototype const* itemProto = itemTarget->GetProto();
if(!itemProto)
if (!itemProto)
return;
//this slot is excepted when applying / removing meta gem bonus
@@ -1168,11 +1168,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
if (!itemProto->Socket[i].Color)
{
// no prismatic socket
if(!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
if (!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
return;
// not first not-colored (not normaly used) socket
if(i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color))
if (i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color))
return;
// ok, this is first not colored socket for item with prismatic socket
@@ -1198,7 +1198,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// check unique-equipped conditions
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
if(!Gems[i])
if (!Gems[i])
continue;
// continue check for case when attempt add 2 similar unique equipped gems in one item.
@@ -1209,7 +1209,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
if(i==j) // skip self
if (i==j) // skip self
continue;
if (Gems[j])
@@ -1220,9 +1220,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
}
}
else if(OldEnchants[j])
else if (OldEnchants[j])
{
if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
{
if (iGemProto->ItemId == enchantEntry->GemID)
{
@@ -1239,7 +1239,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
int32 limit_newcount = 0;
if (iGemProto->ItemLimitCategory)
{
if(ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
if (ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
@@ -1248,8 +1248,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// destroyed gem
if (OldEnchants[j])
{
if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if(ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
--limit_newcount;
}
@@ -1259,16 +1259,16 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
++limit_newcount;
}
// existed gem
else if(OldEnchants[j])
else if (OldEnchants[j])
{
if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if(ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
++limit_newcount;
}
}
if(limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
if (limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
{
_player->SendEquipError( EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL );
return;
@@ -1277,9 +1277,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
// for equipped item check all equipment for duplicate equipped gems
if(itemTarget->IsEquipped())
if (itemTarget->IsEquipped())
{
if(uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0))
if (uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0))
{
_player->SendEquipError( res, itemTarget, NULL );
return;
@@ -1298,10 +1298,10 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
if(GemEnchants[i])
if (GemEnchants[i])
{
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), GemEnchants[i],0,0);
if(Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
if (Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
}
}
@@ -1310,7 +1310,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
if (SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
{
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false);
itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0);
@@ -1330,15 +1330,15 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
recv_data >> eslot;
// apply only to equipped item
if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot))
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot))
return;
Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot);
if(!item)
if (!item)
return;
if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
if (!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return;
GetPlayer()->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false);
+47 -47
View File
@@ -29,7 +29,7 @@
static void AttemptJoin(Player* _player)
{
// skip not can autojoin cases and player group case
if(!_player->m_lookingForGroup.canAutoJoin() || _player->GetGroup())
if (!_player->m_lookingForGroup.canAutoJoin() || _player->GetGroup())
return;
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
@@ -39,26 +39,26 @@ static void AttemptJoin(Player* _player)
Player *plr = iter->second;
// skip enemies and self
if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
if (!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
continue;
//skip players not in world
if(!plr->IsInWorld())
if (!plr->IsInWorld())
continue;
// skip not auto add, not group leader cases
if(!plr->GetSession()->LookingForGroup_auto_add || plr->GetGroup() && plr->GetGroup()->GetLeaderGUID()!=plr->GetGUID())
if (!plr->GetSession()->LookingForGroup_auto_add || plr->GetGroup() && plr->GetGroup()->GetLeaderGUID()!=plr->GetGUID())
continue;
// skip non auto-join or empty slots, or non compatible slots
if(!plr->m_lookingForGroup.more.canAutoJoin() || !_player->m_lookingForGroup.HaveInSlot(plr->m_lookingForGroup.more))
if (!plr->m_lookingForGroup.more.canAutoJoin() || !_player->m_lookingForGroup.HaveInSlot(plr->m_lookingForGroup.more))
continue;
// attempt create group, or skip
if(!plr->GetGroup())
if (!plr->GetGroup())
{
Group* group = new Group;
if(!group->Create(plr->GetGUID(), plr->GetName()))
if (!group->Create(plr->GetGUID(), plr->GetName()))
{
delete group;
continue;
@@ -68,16 +68,16 @@ static void AttemptJoin(Player* _player)
}
// stop at success join
if(plr->GetGroup()->AddMember(_player->GetGUID(), _player->GetName()))
if (plr->GetGroup()->AddMember(_player->GetGUID(), _player->GetName()))
{
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
break;
}
// full
else
{
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
plr->LeaveLFGChannel();
}
}
@@ -86,10 +86,10 @@ static void AttemptJoin(Player* _player)
static void AttemptAddMore(Player* _player)
{
// skip not group leader case
if(_player->GetGroup() && _player->GetGroup()->GetLeaderGUID()!=_player->GetGUID())
if (_player->GetGroup() && _player->GetGroup()->GetLeaderGUID()!=_player->GetGUID())
return;
if(!_player->m_lookingForGroup.more.canAutoJoin())
if (!_player->m_lookingForGroup.more.canAutoJoin())
return;
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
@@ -99,24 +99,24 @@ static void AttemptAddMore(Player* _player)
Player *plr = iter->second;
// skip enemies and self
if(!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
if (!plr || plr==_player || plr->GetTeam() != _player->GetTeam())
continue;
if(!plr->IsInWorld())
if (!plr->IsInWorld())
continue;
// skip not auto join or in group
if(!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup() )
if (!plr->GetSession()->LookingForGroup_auto_join || plr->GetGroup() )
continue;
if(!plr->m_lookingForGroup.HaveInSlot(_player->m_lookingForGroup.more))
if (!plr->m_lookingForGroup.HaveInSlot(_player->m_lookingForGroup.more))
continue;
// attempt create group if need, or stop attempts
if(!_player->GetGroup())
if (!_player->GetGroup())
{
Group* group = new Group;
if(!group->Create(_player->GetGUID(), _player->GetName()))
if (!group->Create(_player->GetGUID(), _player->GetName()))
{
delete group;
return; // can't create group (??)
@@ -126,22 +126,22 @@ static void AttemptAddMore(Player* _player)
}
// stop at join fail (full)
if(!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName()) )
if (!_player->GetGroup()->AddMember(plr->GetGUID(), plr->GetName()) )
{
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
break;
}
// joined
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
plr->LeaveLFGChannel();
// and group full
if(_player->GetGroup()->IsFull() )
if (_player->GetGroup()->IsFull() )
{
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
break;
@@ -154,7 +154,7 @@ void WorldSession::HandleLfgSetAutoJoinOpcode( WorldPacket & /*recv_data*/ )
sLog.outDebug("CMSG_LFG_SET_AUTOJOIN");
LookingForGroup_auto_join = true;
if(!_player) // needed because STATUS_AUTHED
if (!_player) // needed because STATUS_AUTHED
return;
AttemptJoin(_player);
@@ -171,7 +171,7 @@ void WorldSession::HandleLfmSetAutoFillOpcode( WorldPacket & /*recv_data*/ )
sLog.outDebug("CMSG_LFM_SET_AUTOFILL");
LookingForGroup_auto_add = true;
if(!_player) // needed because STATUS_AUTHED
if (!_player) // needed because STATUS_AUTHED
return;
AttemptAddMore(_player);
@@ -191,7 +191,7 @@ void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ )
for (int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
_player->m_lookingForGroup.slots[i].Clear();
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
if ( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
SendLfgUpdate(0, 0, 0);
@@ -221,7 +221,7 @@ void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data )
_player->m_lookingForGroup.more.Set(entry,type);
sLog.outDebug("LFM set: temp %u, zone %u, type %u", temp, entry, type);
if(LookingForGroup_auto_add)
if (LookingForGroup_auto_add)
AttemptAddMore(_player);
SendLfgResult(type, entry, 1);
@@ -248,10 +248,10 @@ void WorldSession::HandleLookingForGroup(WorldPacket& recv_data)
recv_data >> type >> entry >> unk;
sLog.outDebug("MSG_LOOKING_FOR_GROUP: type %u, entry %u, unk %u", type, entry, unk);
if(LookingForGroup_auto_add)
if (LookingForGroup_auto_add)
AttemptAddMore(_player);
if(LookingForGroup_auto_join)
if (LookingForGroup_auto_join)
AttemptJoin(_player);
SendLfgResult(type, entry, 0);
@@ -267,7 +267,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
data << uint32(entry); // entry from LFGDungeons.dbc
data << uint8(0);
if(uint8)
if (uint8)
{
uint32 count1;
for (count1)
@@ -282,15 +282,15 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
{
uint64 // not player guid
uint32 flags;
if(flags & 0x2)
if (flags & 0x2)
{
string
}
if(flags & 0x10)
if (flags & 0x10)
{
uint8
}
if(flags & 0x20)
if (flags & 0x20)
{
for (3)
{
@@ -309,13 +309,13 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
{
Player *plr = iter->second;
if(!plr || plr->GetTeam() != _player->GetTeam())
if (!plr || plr->GetTeam() != _player->GetTeam())
continue;
if(!plr->IsInWorld())
if (!plr->IsInWorld())
continue;
if(!plr->m_lookingForGroup.HaveInSlot(entry, type))
if (!plr->m_lookingForGroup.HaveInSlot(entry, type))
continue;
++number;
@@ -325,7 +325,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
uint32 flags = 0x1FF;
data << uint32(flags); // flags
if(flags & 0x1)
if (flags & 0x1)
{
data << uint8(plr->getLevel());
data << uint8(plr->getClass());
@@ -356,28 +356,28 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
data << uint32(0); // unk
}
if(flags & 0x2)
if (flags & 0x2)
data << plr->m_lookingForGroup.comment; // comment
if(flags & 0x4)
if (flags & 0x4)
data << uint8(0); // unk
if(flags & 0x8)
if (flags & 0x8)
data << uint64(0); // guid from count2 block, not player guid
if(flags & 0x10)
if (flags & 0x10)
data << uint8(0); // unk
if(flags & 0x20)
if (flags & 0x20)
data << uint8(plr->m_lookingForGroup.roles); // roles
if(flags & 0x40)
if (flags & 0x40)
data << uint32(plr->GetZoneId()); // areaid
if(flags & 0x100)
if (flags & 0x100)
data << uint8(0); // LFG/LFM flag?
if(flags & 0x80)
if (flags & 0x80)
{
for (uint8 j = 0; j < MAX_LOOKING_FOR_GROUP_SLOT; ++j)
{
@@ -404,14 +404,14 @@ void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data )
entry = ( temp & 0x00FFFFFF);
type = ( (temp >> 24) & 0x000000FF);
if(slot >= MAX_LOOKING_FOR_GROUP_SLOT)
if (slot >= MAX_LOOKING_FOR_GROUP_SLOT)
return;
_player->m_lookingForGroup.slots[slot].Set(entry, type);
_player->m_lookingForGroup.roles = roles;
sLog.outDebug("LFG set: looknumber %u, temp %X, type %u, entry %u", slot, temp, type, entry);
if(LookingForGroup_auto_join)
if (LookingForGroup_auto_join)
AttemptJoin(_player);
//SendLfgResult(type, entry, 0);
+13 -13
View File
@@ -34,14 +34,14 @@
bool ChatHandler::HandleHelpCommand(const char* args)
{
char* cmd = strtok((char*)args, " ");
if(!cmd)
if (!cmd)
{
ShowHelpForCommand(getCommandTable(), "help");
ShowHelpForCommand(getCommandTable(), "");
}
else
{
if(!ShowHelpForCommand(getCommandTable(), cmd))
if (!ShowHelpForCommand(getCommandTable(), cmd))
SendSysMessage(LANG_NO_HELP_CMD);
}
@@ -65,21 +65,21 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
{
Player *chr = m_session->GetPlayer();
if(chr->isInFlight())
if (chr->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
if(chr->isInCombat())
if (chr->isInCombat())
{
SendSysMessage(LANG_YOU_IN_COMBAT);
SetSentErrorMessage(true);
return false;
}
if((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)))
if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)))
{
// if player is dead and stuck, send ghost to graveyard
chr->RepopAtGraveyard();
@@ -103,7 +103,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
uint32 updateTime = sWorld.GetUpdateTime();
PSendSysMessage(_FULLVERSION);
//if(m_session)
//if (m_session)
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
//else
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID);
@@ -129,7 +129,7 @@ bool ChatHandler::HandleDismountCommand(const char* /*args*/)
return false;
}
if(m_session->GetPlayer( )->isInFlight())
if (m_session->GetPlayer( )->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
@@ -146,7 +146,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
Player *player=m_session->GetPlayer();
// save GM account without delay and output message (testing, etc)
if(m_session->GetSecurity() > SEC_PLAYER)
if (m_session->GetSecurity() > SEC_PLAYER)
{
player->SaveToDB();
SendSysMessage(LANG_PLAYER_SAVED);
@@ -173,7 +173,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{
if(first)
if (first)
{
SendSysMessage(LANG_GMS_ON_SRV);
first = false;
@@ -183,7 +183,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
}
}
if(first)
if (first)
SendSysMessage(LANG_GMS_NOT_LOGGED);
return true;
@@ -191,7 +191,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
bool ChatHandler::HandleAccountPasswordCommand(const char* args)
{
if(!*args)
if (!*args)
return false;
char *old_pass = strtok ((char*)args, " ");
@@ -242,7 +242,7 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
bool ChatHandler::HandleAccountAddonCommand(const char* args)
{
if(!*args)
if (!*args)
return false;
char *szExp = strtok((char*)args," ");
@@ -250,7 +250,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
uint32 account_id = m_session->GetAccountId();
int expansion=atoi(szExp); //get int anyway (0 if error)
if(expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
return false;
// No SQL injection
+136 -136
View File
File diff suppressed because it is too large Load Diff
+343 -343
View File
File diff suppressed because it is too large Load Diff
+458 -458
View File
File diff suppressed because it is too large Load Diff
+23 -23
View File
@@ -83,7 +83,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
if( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
{
player->SendLootRelease(lguid);
return;
@@ -98,7 +98,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
LootItem *item = loot->LootItemInSlot(lootSlot,player,&qitem,&ffaitem,&conditem);
if(!item)
if (!item)
{
player->SendEquipError( EQUIP_ERR_ALREADY_LOOTED, NULL, NULL );
return;
@@ -137,7 +137,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
else
{
//not freeforall, notify everyone
if(conditem)
if (conditem)
conditem->is_looted=true;
loot->NotifyItemRemoved(lootSlot);
}
@@ -164,7 +164,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
Player *player = GetPlayer();
uint64 guid = player->GetLootGUID();
if(!guid)
if (!guid)
return;
Loot *pLoot = NULL;
@@ -192,7 +192,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
}
case HIGHGUID_ITEM:
{
if(Item *item = GetPlayer()->GetItemByGuid(guid))
if (Item *item = GetPlayer()->GetItemByGuid(guid))
pLoot = &item->loot;
break;
}
@@ -211,7 +211,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
return; // unlootable type
}
if( pLoot )
if ( pLoot )
{
if (!IS_ITEM_GUID(guid) && player->GetGroup()) //item can be looted only single player
{
@@ -221,7 +221,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* playerGroup = itr->getSource();
if(!playerGroup)
if (!playerGroup)
continue;
if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
playersNear.push_back(playerGroup);
@@ -257,7 +257,7 @@ void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
recv_data >> guid;
// Check possible cheat
if(!_player->isAlive())
if (!_player->isAlive())
return;
GetPlayer()->SendLoot(guid, LOOT_CORPSE);
@@ -271,7 +271,7 @@ void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
// use internal stored guid
recv_data.read_skip<uint64>(); // guid;
if(uint64 lguid = GetPlayer()->GetLootGUID())
if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);
}
@@ -306,13 +306,13 @@ void WorldSession::DoLootRelease(uint64 lguid)
else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
// GO is mineral vein? so it is not removed after its looted
if(go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
{
uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
// only vein pass this check
if(go_min != 0 && go_max > go_min)
if (go_min != 0 && go_max > go_min)
{
float amount_rate = sWorld.getRate(RATE_MINING_AMOUNT);
float min_amount = go_min*amount_rate;
@@ -321,19 +321,19 @@ void WorldSession::DoLootRelease(uint64 lguid)
go->AddUse();
float uses = float(go->GetUseCount());
if(uses < max_amount)
if (uses < max_amount)
{
if(uses >= min_amount)
if (uses >= min_amount)
{
float chance_rate = sWorld.getRate(RATE_MINING_NEXT);
int32 ReqValue = 175;
LockEntry const *lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
if(lockInfo)
if (lockInfo)
ReqValue = lockInfo->Skill[0];
float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25);
double chance = pow(0.8*chance_rate,4*(1/double(max_amount))*double(uses));
if(roll_chance_f(100*chance+skill))
if (roll_chance_f(100*chance+skill))
{
go->SetLootState(GO_READY);
}
@@ -478,41 +478,41 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
recv_data >> lootguid >> slotid >> target_playerguid;
if(!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
if (!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
{
_player->SendLootRelease(GetPlayer()->GetLootGUID());
return;
}
Player *target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER));
if(!target)
if (!target)
return;
sLog.outDebug("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName());
if(_player->GetLootGUID() != lootguid)
if (_player->GetLootGUID() != lootguid)
return;
Loot *pLoot = NULL;
if(IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
{
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
if(!pCreature)
if (!pCreature)
return;
pLoot = &pCreature->loot;
}
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
{
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
if(!pGO)
if (!pGO)
return;
pLoot = &pGO->loot;
}
if(!pLoot)
if (!pLoot)
return;
if (slotid > pLoot->items.size())
+40 -40
View File
@@ -122,13 +122,13 @@ void LootStore::LoadLootTable()
uint32 cond_value1 = fields[8].GetUInt32();
uint32 cond_value2 = fields[9].GetUInt32();
if(maxcount > std::numeric_limits<uint8>::max())
if (maxcount > std::numeric_limits<uint8>::max())
{
sLog.outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount,std::numeric_limits<uint8>::max());
continue; // error already printed to log/console.
}
if(!PlayerCondition::IsValid(condition,cond_value1, cond_value2))
if (!PlayerCondition::IsValid(condition,cond_value1, cond_value2))
{
sLog.outErrorDb("... in table '%s' entry %u item %u", GetName(), entry, item);
continue; // error already printed to log/console.
@@ -178,7 +178,7 @@ void LootStore::LoadLootTable()
bool LootStore::HaveQuestLootFor(uint32 loot_id) const
{
LootTemplateMap::const_iterator itr = m_LootTemplates.find(loot_id);
if(itr == m_LootTemplates.end())
if (itr == m_LootTemplates.end())
return false;
// scan loot for quest items
@@ -239,10 +239,10 @@ void LootStore::ReportNotExistedId(uint32 id) const
// RATE_DROP_ITEMS is no longer used for all types of entries
bool LootStoreItem::Roll(bool rate) const
{
if(chance >= 100.0f)
if (chance >= 100.0f)
return true;
if(mincountOrRef < 0) // reference case
if (mincountOrRef < 0) // reference case
return roll_chance_f(chance* (rate ? sWorld.getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f));
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
@@ -255,7 +255,7 @@ bool LootStoreItem::Roll(bool rate) const
// Checks correctness of values
bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
{
if(group >= 1 << 7) // it stored in 7 bit field
if (group >= 1 << 7) // it stored in 7 bit field
{
sLog.outErrorDb("Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7);
return false;
@@ -270,26 +270,26 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
if (mincountOrRef > 0) // item (quest or non-quest) entry, maybe grouped
{
ItemPrototype const *proto = objmgr.GetItemPrototype(itemid);
if(!proto)
if (!proto)
{
sLog.outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
return false;
}
if( chance == 0 && group == 0) // Zero chance is allowed for grouped entries only
if ( chance == 0 && group == 0) // Zero chance is allowed for grouped entries only
{
sLog.outErrorDb("Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
return false;
}
if( chance != 0 && chance < 0.000001f ) // loot with low chance
if ( chance != 0 && chance < 0.000001f ) // loot with low chance
{
sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped",
store.GetName(), entry, itemid, chance);
return false;
}
if( maxcount < mincountOrRef) // wrong max count
if ( maxcount < mincountOrRef) // wrong max count
{
sLog.outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
return false;
@@ -300,7 +300,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
{
if (needs_quest)
sLog.outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
else if( chance == 0 ) // no chance for the reference
else if ( chance == 0 ) // no chance for the reference
{
sLog.outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
return false;
@@ -413,7 +413,7 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
roundRobinPlayer = loot_owner->GetGUID();
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
if(Player* pl = itr->getSource())
if (Player* pl = itr->getSource())
FillNotNormalLootFor(pl);
for (uint8 i = 0; i < items.size(); ++i)
@@ -454,7 +454,7 @@ QuestItemList* Loot::FillFFALoot(Player* player)
for (uint8 i = 0; i < items.size(); ++i)
{
LootItem &item = items[i];
if(!item.is_looted && item.freeforall && item.AllowedForPlayer(player) )
if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player) )
{
ql->push_back(QuestItem(i));
++unlootedCount;
@@ -512,10 +512,10 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player)
for (uint8 i = 0; i < items.size(); ++i)
{
LootItem &item = items[i];
if(!item.is_looted && !item.freeforall && item.conditionId && item.AllowedForPlayer(player))
if (!item.is_looted && !item.freeforall && item.conditionId && item.AllowedForPlayer(player))
{
ql->push_back(QuestItem(i));
if(!item.is_counted)
if (!item.is_counted)
{
++unlootedCount;
item.is_counted = true;
@@ -543,7 +543,7 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
{
i_next = i;
++i_next;
if(Player* pl = ObjectAccessor::FindPlayer(*i))
if (Player* pl = ObjectAccessor::FindPlayer(*i))
pl->SendNotifyLootItemRemoved(lootIndex);
else
PlayersLooting.erase(i);
@@ -558,7 +558,7 @@ void Loot::NotifyMoneyRemoved()
{
i_next = i;
++i_next;
if(Player* pl = ObjectAccessor::FindPlayer(*i))
if (Player* pl = ObjectAccessor::FindPlayer(*i))
pl->SendNotifyLootMoneyRemoved();
else
PlayersLooting.erase(i);
@@ -577,7 +577,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
{
i_next = i;
++i_next;
if(Player* pl = ObjectAccessor::FindPlayer(*i))
if (Player* pl = ObjectAccessor::FindPlayer(*i))
{
QuestItemMap::const_iterator pq = PlayerQuestItems.find(pl->GetGUIDLow());
if (pq != PlayerQuestItems.end() && pq->second)
@@ -623,7 +623,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
if (itr != PlayerQuestItems.end() && questSlot < itr->second->size())
{
QuestItem *qitem2 = &itr->second->at(questSlot);
if(qitem)
if (qitem)
*qitem = qitem2;
item = &quest_items[qitem2->index];
is_looted = qitem2->is_looted;
@@ -633,33 +633,33 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
{
item = &items[lootSlot];
is_looted = item->is_looted;
if(item->freeforall)
if (item->freeforall)
{
QuestItemMap::const_iterator itr = PlayerFFAItems.find(player->GetGUIDLow());
if (itr != PlayerFFAItems.end())
{
for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
if(iter->index==lootSlot)
if (iter->index==lootSlot)
{
QuestItem *ffaitem2 = (QuestItem*)&(*iter);
if(ffaitem)
if (ffaitem)
*ffaitem = ffaitem2;
is_looted = ffaitem2->is_looted;
break;
}
}
}
else if(item->conditionId)
else if (item->conditionId)
{
QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow());
if (itr != PlayerNonQuestNonFFAConditionalItems.end())
{
for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
{
if(iter->index==lootSlot)
if (iter->index==lootSlot)
{
QuestItem *conditem2 = (QuestItem*)&(*iter);
if(conditem)
if (conditem)
*conditem = conditem2;
is_looted = conditem2->is_looted;
break;
@@ -669,7 +669,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
}
}
if(is_looted)
if (is_looted)
return NULL;
return item;
@@ -1072,7 +1072,7 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
sLog.outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
}
if(chance >= 100.0f && !EqualChanced.empty())
if (chance >= 100.0f && !EqualChanced.empty())
{
sLog.outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
}
@@ -1082,22 +1082,22 @@ void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& store, LootId
{
for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
{
if(ieItr->mincountOrRef < 0)
if (ieItr->mincountOrRef < 0)
{
if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
else if(ref_set)
else if (ref_set)
ref_set->erase(-ieItr->mincountOrRef);
}
}
for (LootStoreItemList::const_iterator ieItr=EqualChanced.begin(); ieItr != EqualChanced.end(); ++ieItr)
{
if(ieItr->mincountOrRef < 0)
if (ieItr->mincountOrRef < 0)
{
if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
else if(ref_set)
else if (ref_set)
ref_set->erase(-ieItr->mincountOrRef);
}
}
@@ -1151,7 +1151,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint16
++_item_counter;
if (_proto->InventoryType == 0 && _item_counter == 3) // Non-equippable items are limited to 3 drops
continue;
else if(_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop
else if (_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop
continue;
}
if (_item != loot.items.end())
@@ -1192,7 +1192,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
if (i->mincountOrRef < 0) // References
{
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
if( Referenced ==store.end())
if ( Referenced ==store.end())
continue; // Error message [should be] already printed at loading stage
if (Referenced->second->HasQuestDrop(store, i->group))
return true;
@@ -1407,9 +1407,9 @@ void LoadLootTemplates_Pickpocketing()
// remove real entries and check existence loot
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
{
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
{
if(uint32 lootid = cInfo->pickpocketLootId)
if (uint32 lootid = cInfo->pickpocketLootId)
{
if (ids_set.find(lootid) == ids_set.end())
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
@@ -1455,7 +1455,7 @@ void LoadLootTemplates_Mail()
// remove real entries and check existence loot
for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
if(sMailTemplateStore.LookupEntry(i))
if (sMailTemplateStore.LookupEntry(i))
if (ids_set.find(i) != ids_set.end())
ids_set.erase(i);
@@ -1498,11 +1498,11 @@ void LoadLootTemplates_Spell()
for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry (spell_id);
if(!spellInfo)
if (!spellInfo)
continue;
// possible cases
if( !IsLootCraftingSpell(spellInfo))
if ( !IsLootCraftingSpell(spellInfo))
continue;
if (ids_set.find(spell_id) == ids_set.end())
+1 -1
View File
@@ -186,7 +186,7 @@ struct Mail
{
for (std::vector<MailItemInfo>::iterator itr = items.begin(); itr != items.end(); ++itr)
{
if(itr->item_guid == item_guid)
if (itr->item_guid == item_guid)
{
items.erase(itr);
return true;
+195 -195
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -248,8 +248,8 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl
// currently unused for normal maps
bool CanUnload(uint32 diff)
{
if(!m_unloadTimer) return false;
if(m_unloadTimer <= diff) return true;
if (!m_unloadTimer) return false;
if (m_unloadTimer <= diff) return true;
m_unloadTimer -= diff;
return false;
}
@@ -368,7 +368,7 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl
bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); }
bool GetEntrancePos(int32 &mapid, float &x, float &y)
{
if(!i_mapEntry)
if (!i_mapEntry)
return false;
return i_mapEntry->GetEntrancePos(mapid, x, y);
}
@@ -538,12 +538,12 @@ class Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockabl
void RemoveFromActiveHelper(T* obj)
{
// Map::Update for active object in proccess
if(m_activeNonPlayersIter != m_activeNonPlayers.end())
if (m_activeNonPlayersIter != m_activeNonPlayers.end())
{
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
if(itr == m_activeNonPlayers.end())
if (itr == m_activeNonPlayers.end())
return;
if(itr==m_activeNonPlayersIter)
if (itr==m_activeNonPlayersIter)
++m_activeNonPlayersIter;
m_activeNonPlayers.erase(itr);
}
@@ -634,7 +634,7 @@ Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor)
const uint32 cell_x = cell.CellX();
const uint32 cell_y = cell.CellY();
if( !cell.NoCreate() || loaded(GridPair(x,y)) )
if ( !cell.NoCreate() || loaded(GridPair(x,y)) )
{
EnsureGridLoaded(cell);
getNGrid(x, y)->Visit(cell_x, cell_y, visitor);
+15 -15
View File
@@ -36,7 +36,7 @@ MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEO
void MapInstanced::InitVisibilityDistance()
{
if(m_InstancedMaps.empty())
if (m_InstancedMaps.empty())
return;
//initialize visibility distances for all instance copies
for (InstancedMaps::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); ++i)
@@ -55,9 +55,9 @@ void MapInstanced::Update(const uint32& t)
while (i != m_InstancedMaps.end())
{
if(i->second->CanUnload(t))
if (i->second->CanUnload(t))
{
if(!DestroyInstance(i)) // iterator incremented
if (!DestroyInstance(i)) // iterator incremented
{
//m_unloadTimer
}
@@ -122,20 +122,20 @@ void MapInstanced::UnloadAll()
*/
Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
{
if(GetId() != mapId || !player)
if (GetId() != mapId || !player)
return NULL;
Map* map = NULL;
uint32 NewInstanceId = 0; // instanceId of the resulting map
if(IsBattleGroundOrArena())
if (IsBattleGroundOrArena())
{
// instantiate or find existing bg map for player
// the instance id is set in battlegroundid
NewInstanceId = player->GetBattleGroundId();
if(!NewInstanceId) return NULL;
if (!NewInstanceId) return NULL;
map = _FindMap(NewInstanceId);
if(!map)
if (!map)
map = CreateBattleGround(NewInstanceId, player->GetBattleGround());
}
else
@@ -145,21 +145,21 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
// the player's permanent player bind is taken into consideration first
// then the player's group bind and finally the solo bind.
if(!pBind || !pBind->perm)
if (!pBind || !pBind->perm)
{
InstanceGroupBind *groupBind = NULL;
Group *group = player->GetGroup();
// use the player's difficulty setting (it may not be the same as the group's)
if(group && (groupBind = group->GetBoundInstance(this)))
if (group && (groupBind = group->GetBoundInstance(this)))
pSave = groupBind->save;
}
if(pSave)
if (pSave)
{
// solo/perm/group
NewInstanceId = pSave->GetInstanceId();
map = _FindMap(NewInstanceId);
// it is possible that the save exists but the map doesn't
if(!map)
if (!map)
map = CreateInstance(NewInstanceId, pSave, pSave->GetDifficulty());
}
else
@@ -183,13 +183,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
// make sure we have a valid map id
const MapEntry* entry = sMapStore.LookupEntry(GetId());
if(!entry)
if (!entry)
{
sLog.outError("CreateInstance: no entry for map %d", GetId());
assert(false);
}
const InstanceTemplate * iTemplate = objmgr.GetInstanceTemplate(GetId());
if(!iTemplate)
if (!iTemplate)
{
sLog.outError("CreateInstance: no instance template for map %d", GetId());
assert(false);
@@ -236,7 +236,7 @@ BattleGroundMap* MapInstanced::CreateBattleGround(uint32 InstanceId, BattleGroun
bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
{
itr->second->RemoveAllPlayers();
if(itr->second->HavePlayers())
if (itr->second->HavePlayers())
{
++itr;
return false;
@@ -244,7 +244,7 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
itr->second->UnloadAll();
// should only unload VMaps if this is the last instance and grid unloading is enabled
if(m_InstancedMaps.size() <= 1 && sWorld.getConfig(CONFIG_GRID_UNLOAD))
if (m_InstancedMaps.size() <= 1 && sWorld.getConfig(CONFIG_GRID_UNLOAD))
{
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(itr->second->GetId());
// in that case, unload grids of the base map, too
+4 -4
View File
@@ -136,7 +136,7 @@ Map* MapManager::_createBaseMap(uint32 id)
Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 instanceId)
{
ASSERT(obj);
//if(!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
//if (!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
Map *m = _createBaseMap(id);
if (m && (obj->GetTypeId() == TYPEID_PLAYER) && m->Instanceable()) m = ((MapInstanced*)m)->CreateInstance(id, (Player*)obj);
@@ -159,11 +159,11 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
{
const MapEntry *entry = sMapStore.LookupEntry(mapid);
if(!entry)
if (!entry)
return false;
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
if(entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
if (entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
{
if (entry->map_type == MAP_RAID)
{
@@ -375,7 +375,7 @@ uint32 MapManager::GetNumInstances()
continue;
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
if(mitr->second->IsDungeon()) ret++;
if (mitr->second->IsDungeon()) ret++;
}
return ret;
}
+2 -2
View File
@@ -67,7 +67,7 @@ class MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLock
void SetGridCleanUpDelay(uint32 t)
{
if( t < MIN_GRID_DELAY )
if ( t < MIN_GRID_DELAY )
i_gridCleanUpDelay = MIN_GRID_DELAY;
else
i_gridCleanUpDelay = t;
@@ -75,7 +75,7 @@ class MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLock
void SetMapUpdateInterval(uint32 t)
{
if( t > MIN_MAP_UPDATE_DELAY )
if ( t > MIN_MAP_UPDATE_DELAY )
t = MIN_MAP_UPDATE_DELAY;
i_timer.SetInterval(t);
+1 -1
View File
@@ -34,7 +34,7 @@ class MapReference : public Reference<Map, Player>
void targetObjectDestroyLink()
{
// called from unlink()
if(isValid()) getTarget()->m_mapRefManager.decSize();
if (isValid()) getTarget()->m_mapRefManager.decSize();
}
void sourceObjectDestroyLink()
{
+115 -115
View File
@@ -55,7 +55,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
recv_data.read_skip<uint8>();
if(GetPlayer()->isAlive()||GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
if (GetPlayer()->isAlive()||GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return;
// the world update order is sessions, players, creatures
@@ -63,7 +63,7 @@ void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
// creatures can kill players
// so if the server is lagging enough the player can
// release spirit after he's killed but before he is updated
if(GetPlayer()->getDeathState() == JUST_DIED)
if (GetPlayer()->getDeathState() == JUST_DIED)
{
sLog.outDebug("HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
GetPlayer()->KillPlayer();
@@ -86,7 +86,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
recv_data >> guid >> menuId >> gossipListId;
if(_player->PlayerTalkClass->GossipOptionCoded(gossipListId))
if (_player->PlayerTalkClass->GossipOptionCoded(gossipListId))
{
// recheck
sLog.outBasic("reading string");
@@ -96,7 +96,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
Creature *unit = NULL;
GameObject *go = NULL;
if(IS_CRE_OR_VEH_GUID(guid))
if (IS_CRE_OR_VEH_GUID(guid))
{
unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
@@ -105,7 +105,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
return;
}
}
else if(IS_GAMEOBJECT_GUID(guid))
else if (IS_GAMEOBJECT_GUID(guid))
{
go = _player->GetMap()->GetGameObject(guid);
if (!go)
@@ -121,14 +121,14 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!code.empty())
if (!code.empty())
{
if(unit)
if (unit)
{
if(!sScriptMgr.GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) )
if (!sScriptMgr.GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()) )
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
@@ -136,9 +136,9 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
}
else
{
if(unit)
if (unit)
{
if(!sScriptMgr.GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) )
if (!sScriptMgr.GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)) )
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
@@ -236,7 +236,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
}
//do not process players which are not in world
if(!(itr->second->IsInWorld()))
if (!(itr->second->IsInWorld()))
continue;
// check if target is globally visible for player
@@ -263,7 +263,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
bool z_show = true;
for (uint32 i = 0; i < zones_count; ++i)
{
if(zoneids[i] == pzoneid)
if (zoneids[i] == pzoneid)
{
z_show = true;
break;
@@ -276,7 +276,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
std::string pname = itr->second->GetName();
std::wstring wpname;
if(!Utf8toWStr(pname,wpname))
if (!Utf8toWStr(pname,wpname))
continue;
wstrToLower(wpname);
@@ -285,7 +285,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
std::string gname = objmgr.GetGuildNameById(itr->second->GetGuildId());
std::wstring wgname;
if(!Utf8toWStr(gname,wgname))
if (!Utf8toWStr(gname,wgname))
continue;
wstrToLower(wgname);
@@ -293,7 +293,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
continue;
std::string aname;
if(AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
aname = areaEntry->area_name[GetSessionDbcLocale()];
bool s_show = true;
@@ -343,7 +343,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
DoLootRelease(lguid);
//Can not logout if...
if( GetPlayer()->isInCombat() || //...is in combat
if ( GetPlayer()->isInCombat() || //...is in combat
GetPlayer()->duel || //...is in Duel
GetPlayer()->HasAura(9454) || //...is frozen by GM via freeze command
//...is jumping ...is falling
@@ -367,7 +367,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
}
// not set flags if player can't free move to prevent lost state at logout cancel
if(GetPlayer()->CanFreeMove())
if (GetPlayer()->CanFreeMove())
{
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
@@ -400,7 +400,7 @@ void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ )
SendPacket( &data );
// not remove flags if can't free move - its not set in Logout request code.
if(GetPlayer()->CanFreeMove())
if (GetPlayer()->CanFreeMove())
{
//!we can move again
data.Initialize( SMSG_FORCE_MOVE_UNROOT, 8 ); // guess size
@@ -421,7 +421,7 @@ void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleTogglePvP( WorldPacket & recv_data )
{
// this opcode can be used in two ways: Either set explicit new status or toggle old status
if(recv_data.size() == 1)
if (recv_data.size() == 1)
{
bool newPvPStatus;
recv_data >> newPvPStatus;
@@ -434,18 +434,18 @@ void WorldSession::HandleTogglePvP( WorldPacket & recv_data )
GetPlayer()->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER);
}
if(GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP))
if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP))
{
if(!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.endTimer != 0)
if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.endTimer != 0)
GetPlayer()->UpdatePvP(true, true);
}
else
{
if(!GetPlayer()->pvpInfo.inHostileArea && GetPlayer()->IsPvP())
if (!GetPlayer()->pvpInfo.inHostileArea && GetPlayer()->IsPvP())
GetPlayer()->pvpInfo.endTimer = time(NULL); // start toggle-off
}
//if(OutdoorPvP * pvp = _player->GetOutdoorPvP())
//if (OutdoorPvP * pvp = _player->GetOutdoorPvP())
// pvp->HandlePlayerActivityChanged(_player);
}
@@ -473,10 +473,10 @@ void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data )
// update reputation list if need
Unit* unit = ObjectAccessor::GetUnit(*_player, guid );
if(!unit)
if (!unit)
return;
if(FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
_player->GetReputationMgr().SetVisible(factionTemplateEntry);
}
@@ -489,10 +489,10 @@ void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data )
// update reputation list if need
Unit* unit = ObjectAccessor::GetUnit(*_player, guid );
if(!unit)
if (!unit)
return;
if(FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
_player->GetReputationMgr().SetVisible(factionTemplateEntry);
}
@@ -525,7 +525,7 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data )
recv_data >> friendNote;
if(!normalizePlayerName(friendName))
if (!normalizePlayerName(friendName))
return;
CharacterDatabase.escape_string(friendName); // prevent SQL injection - normal name don't must changed by this call
@@ -545,13 +545,13 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin
WorldSession * session = sWorld.FindSession(accountId);
if(!session || !session->GetPlayer())
if (!session || !session->GetPlayer())
return;
friendResult = FRIEND_NOT_FOUND;
friendGuid = 0;
if(result)
if (result)
{
friendGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
team = Player::TeamForRace((*result)[1].GetUInt8());
@@ -559,22 +559,22 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uin
if ( session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || accmgr.GetSecurity(friendAcctid) < SEC_MODERATOR)
{
if(friendGuid)
if (friendGuid)
{
if(friendGuid==session->GetPlayer()->GetGUID())
if (friendGuid==session->GetPlayer()->GetGUID())
friendResult = FRIEND_SELF;
else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
else if (session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
friendResult = FRIEND_ENEMY;
else if(session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
else if (session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
friendResult = FRIEND_ALREADY;
else
{
Player* pFriend = ObjectAccessor::FindPlayer(friendGuid);
if( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
if ( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
friendResult = FRIEND_ADDED_ONLINE;
else
friendResult = FRIEND_ADDED_OFFLINE;
if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
{
friendResult = FRIEND_LIST_FULL;
sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName());
@@ -613,7 +613,7 @@ void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data )
recv_data >> IgnoreName;
if(!normalizePlayerName(IgnoreName))
if (!normalizePlayerName(IgnoreName))
return;
CharacterDatabase.escape_string(IgnoreName); // prevent SQL injection - normal name don't must changed by this call
@@ -631,28 +631,28 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uin
WorldSession * session = sWorld.FindSession(accountId);
if(!session || !session->GetPlayer())
if (!session || !session->GetPlayer())
return;
ignoreResult = FRIEND_IGNORE_NOT_FOUND;
IgnoreGuid = 0;
if(result)
if (result)
{
IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
if(IgnoreGuid)
if (IgnoreGuid)
{
if(IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself
if (IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself
ignoreResult = FRIEND_IGNORE_SELF;
else if( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) )
else if ( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) )
ignoreResult = FRIEND_IGNORE_ALREADY;
else
{
ignoreResult = FRIEND_IGNORE_ADDED;
// ignore list full
if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
if (!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
ignoreResult = FRIEND_IGNORE_FULL;
}
}
@@ -696,7 +696,7 @@ void WorldSession::HandleBugOpcode( WorldPacket & recv_data )
recv_data >> typelen >> type;
if( suggestion == 0 )
if ( suggestion == 0 )
sLog.outDebug( "WORLD: Received CMSG_BUG [Bug Report]" );
else
sLog.outDebug( "WORLD: Received CMSG_BUG [Suggestion]" );
@@ -720,7 +720,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
return;
// body not released yet
if(!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
if (!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return;
Corpse *corpse = GetPlayer()->GetCorpse();
@@ -729,7 +729,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
return;
// prevent resurrect before 30-sec delay after body release not finished
if(corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP) > time(NULL))
if (corpse->GetGhostTime() + GetPlayer()->GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP) > time(NULL))
return;
if (!corpse->IsWithinDistInMap(GetPlayer(), CORPSE_RECLAIM_RADIUS, true))
@@ -749,7 +749,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
{
sLog.outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE");
if(GetPlayer()->isAlive())
if (GetPlayer()->isAlive())
return;
uint64 guid;
@@ -757,13 +757,13 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
recv_data >> guid;
recv_data >> status;
if(status == 0)
if (status == 0)
{
GetPlayer()->clearResurrectRequestData(); // reject
return;
}
if(!GetPlayer()->isRessurectRequestedBy(guid))
if (!GetPlayer()->isRessurectRequestedBy(guid))
return;
GetPlayer()->ResurectUsingRequestData();
@@ -795,14 +795,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
recv_data >> Trigger_ID;
sLog.outDebug("Trigger ID:%u",Trigger_ID);
if(GetPlayer()->isInFlight())
if (GetPlayer()->isInFlight())
{
sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(), Trigger_ID);
return;
}
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if(!atEntry)
if (!atEntry)
{
sLog.outDebug("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow(), Trigger_ID);
return;
@@ -823,7 +823,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
{
// if we have radius check it
float dist = pl->GetDistance(atEntry->x,atEntry->y,atEntry->z);
if(dist > atEntry->radius + delta)
if (dist > atEntry->radius + delta)
{
sLog.outDebug("Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
pl->GetName(), pl->GetGUIDLow(), atEntry->radius, dist, Trigger_ID);
@@ -852,7 +852,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
float dz = pl->GetPositionZ() - atEntry->z;
float dx = rotPlayerX - atEntry->x;
float dy = rotPlayerY - atEntry->y;
if( (fabs(dx) > atEntry->box_x/2 + delta) ||
if ( (fabs(dx) > atEntry->box_x/2 + delta) ||
(fabs(dy) > atEntry->box_y/2 + delta) ||
(fabs(dz) > atEntry->box_z/2 + delta) )
{
@@ -862,55 +862,55 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
}
}
if(sScriptMgr.AreaTrigger(GetPlayer(), atEntry))
if (sScriptMgr.AreaTrigger(GetPlayer(), atEntry))
return;
uint32 quest_id = objmgr.GetQuestForAreaTrigger( Trigger_ID );
if( quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id) )
if ( quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id) )
{
Quest const* pQuest = objmgr.GetQuestTemplate(quest_id);
if( pQuest )
if ( pQuest )
{
if(GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
if (GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
GetPlayer()->AreaExploredOrEventHappens( quest_id );
}
}
if(objmgr.IsTavernAreaTrigger(Trigger_ID))
if (objmgr.IsTavernAreaTrigger(Trigger_ID))
{
// set resting flag we are in the inn
GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
GetPlayer()->InnEnter(time(NULL), atEntry->mapid, atEntry->x, atEntry->y, atEntry->z);
GetPlayer()->SetRestType(REST_TYPE_IN_TAVERN);
if(sWorld.IsFFAPvPRealm())
if (sWorld.IsFFAPvPRealm())
GetPlayer()->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
return;
}
if(GetPlayer()->InBattleGround())
if (GetPlayer()->InBattleGround())
{
BattleGround* bg = GetPlayer()->GetBattleGround();
if(bg)
if(bg->GetStatus() == STATUS_IN_PROGRESS)
if (bg)
if (bg->GetStatus() == STATUS_IN_PROGRESS)
bg->HandleAreaTrigger(GetPlayer(), Trigger_ID);
return;
}
if(OutdoorPvP * pvp = GetPlayer()->GetOutdoorPvP())
if (OutdoorPvP * pvp = GetPlayer()->GetOutdoorPvP())
{
if(pvp->HandleAreaTrigger(_player, Trigger_ID))
if (pvp->HandleAreaTrigger(_player, Trigger_ID))
return;
}
// NULL if all values default (non teleport trigger)
AreaTrigger const* at = objmgr.GetAreaTrigger(Trigger_ID);
if(!at)
if (!at)
return;
if(!GetPlayer()->Satisfy(objmgr.GetAccessRequirement(at->access_id), at->target_mapId, true))
if (!GetPlayer()->Satisfy(objmgr.GetAccessRequirement(at->access_id), at->target_mapId, true))
return;
GetPlayer()->TeleportTo(at->target_mapId,at->target_X,at->target_Y,at->target_Z,at->target_Orientation,TELE_TO_NOT_LEAVE_TRANSPORT);
@@ -925,10 +925,10 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
sLog.outDebug("UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize);
if(type > NUM_ACCOUNT_DATA_TYPES)
if (type > NUM_ACCOUNT_DATA_TYPES)
return;
if(decompressedSize == 0) // erase
if (decompressedSize == 0) // erase
{
SetAccountData(AccountDataType(type), 0, "");
@@ -940,7 +940,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
return;
}
if(decompressedSize > 0xFFFF)
if (decompressedSize > 0xFFFF)
{
recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case
sLog.outError("UAD: Account data packet too big, size %u", decompressedSize);
@@ -951,7 +951,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
if(uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
{
recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case
sLog.outError("UAD: Failed to decompress account data");
@@ -980,7 +980,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
sLog.outDebug("RAD: type %u", type);
if(type > NUM_ACCOUNT_DATA_TYPES)
if (type > NUM_ACCOUNT_DATA_TYPES)
return;
AccountData *adata = GetAccountData(AccountDataType(type));
@@ -992,7 +992,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
ByteBuffer dest;
dest.resize(destSize);
if(size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
if (size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
{
sLog.outDebug("RAD: Failed to compress account data");
return;
@@ -1066,7 +1066,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data )
DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" );
uint64 guid;
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
{
recv_data.rpos(recv_data.wpos());
return;
@@ -1104,7 +1104,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
recv_data >> guid;
// now can skip not our packet
if(_player->GetGUID() != guid)
if (_player->GetGUID() != guid)
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -1130,7 +1130,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
recv_data >> guid;
// now can skip not our packet
if(_player->GetGUID() != guid)
if (_player->GetGUID() != guid)
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -1151,9 +1151,9 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
recv_data >> ActionBar;
if(!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
{
if(ActionBar!=0)
if (ActionBar!=0)
sLog.outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored",uint32(ActionBar));
return;
}
@@ -1192,7 +1192,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
_player->SetSelection(guid);
Player *plr = objmgr.GetPlayer(guid);
if(!plr) // wrong player
if (!plr) // wrong player
return;
uint32 talent_points = 0x47;
@@ -1200,7 +1200,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
WorldPacket data(SMSG_INSPECT_TALENT, guid_size+4+talent_points);
data.append(plr->GetPackGUID());
if(sWorld.getConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
if (sWorld.getConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
{
plr->BuildPlayerTalentsInfoData(&data);
}
@@ -1223,7 +1223,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
Player *player = objmgr.GetPlayer(guid);
if(!player)
if (!player)
{
sLog.outError("InspectHonorStats: WTF, player not found...");
return;
@@ -1260,7 +1260,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
recv_data >> Orientation; // o (3.141593 = 180 degrees)
//sLog.outDebug("Received opcode CMSG_WORLD_TELEPORT");
if(GetPlayer()->isInFlight())
if (GetPlayer()->isInFlight())
{
sLog.outDebug("Player '%s' (GUID: %u) in flight, ignore worldport command.",GetPlayer()->GetName(),GetPlayer()->GetGUIDLow());
return;
@@ -1287,7 +1287,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return;
}
if(charname.empty() || !normalizePlayerName (charname))
if (charname.empty() || !normalizePlayerName (charname))
{
SendNotification(LANG_NEED_CHARACTER_NAME);
return;
@@ -1295,7 +1295,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
Player *plr = objmgr.GetPlayer(charname.c_str());
if(!plr)
if (!plr)
{
SendNotification(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, charname.c_str());
return;
@@ -1304,7 +1304,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
uint32 accid = plr->GetSession()->GetAccountId();
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
if(!result)
if (!result)
{
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
return;
@@ -1312,13 +1312,13 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
Field *fields = result->Fetch();
std::string acc = fields[0].GetCppString();
if(acc.empty())
if (acc.empty())
acc = "Unknown";
std::string email = fields[1].GetCppString();
if(email.empty())
if (email.empty())
email = "Unknown";
std::string lastip = fields[2].GetCppString();
if(lastip.empty())
if (lastip.empty())
lastip = "Unknown";
std::string msg = charname + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
@@ -1407,7 +1407,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
break;
case 1:
sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
if(WorldObject *target = _player->GetViewpoint())
if (WorldObject *target = _player->GetViewpoint())
_player->SetSeer(target);
else
sLog.outError("Player %s requests non-existing seer", _player->GetName());
@@ -1428,9 +1428,9 @@ void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data )
recv_data >> title;
// -1 at none
if(title > 0 && title < MAX_TITLE_INDEX)
if (title > 0 && title < MAX_TITLE_INDEX)
{
if(!GetPlayer()->HasTitle(title))
if (!GetPlayer()->HasTitle(title))
return;
}
else
@@ -1456,9 +1456,9 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ )
{
sLog.outDebug("WORLD: CMSG_RESET_INSTANCES");
Group *pGroup = _player->GetGroup();
if(pGroup)
if (pGroup)
{
if(pGroup->IsLeader(_player->GetGUID()))
if (pGroup->IsLeader(_player->GetGUID()))
{
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
@@ -1478,42 +1478,42 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
if(mode >= MAX_DUNGEON_DIFFICULTY)
if (mode >= MAX_DUNGEON_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
if(Difficulty(mode) == _player->GetDungeonDifficulty())
if (Difficulty(mode) == _player->GetDungeonDifficulty())
return;
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
if (map && map->IsDungeon())
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
if (_player->getLevel() < LEVELREQUIREMENT_HEROIC)
return;
Group *pGroup = _player->GetGroup();
if(pGroup)
if (pGroup)
{
if(pGroup->IsLeader(_player->GetGUID()))
if (pGroup->IsLeader(_player->GetGUID()))
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if(!pGroupGuy)
if (!pGroupGuy)
continue;
if(!pGroupGuy->IsInMap(pGroupGuy))
if (!pGroupGuy->IsInMap(pGroupGuy))
return;
map = pGroupGuy->GetMap();
if(map && map->IsRaidOrHeroicDungeon() )
if (map && map->IsRaidOrHeroicDungeon() )
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
@@ -1539,7 +1539,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
if(mode >= MAX_RAID_DIFFICULTY)
if (mode >= MAX_RAID_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
@@ -1547,34 +1547,34 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
if (map && map->IsDungeon())
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
if(Difficulty(mode) == _player->GetRaidDifficulty())
if (Difficulty(mode) == _player->GetRaidDifficulty())
return;
if(_player->getLevel() < LEVELREQUIREMENT_HEROIC)
if (_player->getLevel() < LEVELREQUIREMENT_HEROIC)
return;
Group *pGroup = _player->GetGroup();
if(pGroup)
if (pGroup)
{
if(pGroup->IsLeader(_player->GetGUID()))
if (pGroup->IsLeader(_player->GetGUID()))
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if(!pGroupGuy)
if (!pGroupGuy)
continue;
if(!pGroupGuy->IsInMap(pGroupGuy))
if (!pGroupGuy->IsInMap(pGroupGuy))
return;
map = pGroupGuy->GetMap();
if(map && map->IsRaidOrHeroicDungeon() )
if (map && map->IsRaidOrHeroicDungeon() )
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
@@ -1604,7 +1604,7 @@ void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ )
return;
}
if(_player->isInFlight()) // not blizz like; no any messages on blizz
if (_player->isInFlight()) // not blizz like; no any messages on blizz
{
ChatHandler(this).SendSysMessage(LANG_YOU_IN_FLIGHT);
return;
@@ -1621,7 +1621,7 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data )
//recv_data.hexlike();
uint64 guid; // guid - unused
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -1654,11 +1654,11 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data )
void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data )
{
uint64 guid;
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
Player *player = objmgr.GetPlayer(guid);
if(!player)
if (!player)
return;
player->GetAchievementMgr().SendRespondInspectAchievements(_player);
+34 -34
View File
@@ -47,7 +47,7 @@ MotionMaster::Initialize()
{
MovementGenerator *curr = top();
pop();
if(curr) DirectDelete(curr);
if (curr) DirectDelete(curr);
}
InitDefault();
@@ -56,7 +56,7 @@ MotionMaster::Initialize()
// set new default movement generator
void MotionMaster::InitDefault()
{
if(i_owner->GetTypeId() == TYPEID_UNIT)
if (i_owner->GetTypeId() == TYPEID_UNIT)
{
MovementGenerator* movement = FactorySelector::selectMovementGenerator(i_owner->ToCreature());
Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE);
@@ -74,7 +74,7 @@ MotionMaster::~MotionMaster()
{
MovementGenerator *curr = top();
pop();
if(curr) DirectDelete(curr);
if (curr) DirectDelete(curr);
}
}
@@ -122,7 +122,7 @@ MotionMaster::DirectClean(bool reset)
{
MovementGenerator *curr = top();
pop();
if(curr) DirectDelete(curr);
if (curr) DirectDelete(curr);
}
if (needInitTop())
@@ -239,7 +239,7 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
return;
i_owner->clearUnitState(UNIT_STAT_FOLLOW);
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) chase to %s (GUID: %u)",
i_owner->GetGUIDLow(),
@@ -265,7 +265,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
return;
i_owner->addUnitState(UNIT_STAT_FOLLOW);
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
@@ -285,7 +285,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
void
MotionMaster::MovePoint(uint32 id, float x, float y, float z)
{
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_ACTIVE);
@@ -301,7 +301,7 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{
//this function may make players fall below map
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -313,7 +313,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
{
//this function may make players fall below map
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
@@ -329,7 +329,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
i_owner->m_TempSpeed = speedXY;
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(0,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -347,12 +347,12 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
void
MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
{
if(Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
return;
i_owner->addUnitState(UNIT_STAT_CHARGING);
i_owner->m_TempSpeed = speed;
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z );
Mutate(new PointMovementGenerator<Player>(id,x,y,z), MOTION_SLOT_CONTROLLED);
@@ -376,7 +376,7 @@ void MotionMaster::MoveFall(float z, uint32 id)
void
MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to seek assistance",i_owner->GetGUIDLow());
}
@@ -393,7 +393,7 @@ MotionMaster::MoveSeekAssistance(float x, float y, float z)
void
MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to call distract after assistance",i_owner->GetGUIDLow());
}
@@ -408,13 +408,13 @@ MotionMaster::MoveSeekAssistanceDistract(uint32 time)
void
MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
{
if(!enemy)
if (!enemy)
return;
if(i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
if (i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
@@ -438,7 +438,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
void
MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) taxi to (Path %u node %u)", i_owner->GetGUIDLow(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(path,pathnode);
@@ -454,10 +454,10 @@ MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
void
MotionMaster::MoveDistract(uint32 timer)
{
if(Impl[MOTION_SLOT_CONTROLLED])
if (Impl[MOTION_SLOT_CONTROLLED])
return;
if(i_owner->GetTypeId() == TYPEID_PLAYER)
if (i_owner->GetTypeId() == TYPEID_PLAYER)
{
DEBUG_LOG("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
}
@@ -473,20 +473,20 @@ MotionMaster::MoveDistract(uint32 timer)
void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot)
{
if(MovementGenerator *curr = Impl[slot])
if (MovementGenerator *curr = Impl[slot])
{
Impl[slot] = NULL; // in case a new one is generated in this slot during directdelete
if(i_top == slot && (m_cleanFlag & MMCF_UPDATE))
if (i_top == slot && (m_cleanFlag & MMCF_UPDATE))
DelayedDelete(curr);
else
DirectDelete(curr);
}
else if(i_top < slot)
else if (i_top < slot)
{
i_top = slot;
}
if(i_top > slot)
if (i_top > slot)
needInit[slot] = true;
else
{
@@ -498,7 +498,7 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot)
void MotionMaster::MovePath(uint32 path_id, bool repeatable)
{
if(!path_id)
if (!path_id)
return;
//We set waypoint movement as new default movement generator
// clear ALL movement generators (including default)
@@ -507,7 +507,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
MovementGenerator *curr = top();
curr->Finalize(*i_owner);
pop();
if( !isStatic( curr ) )
if ( !isStatic( curr ) )
delete curr;
}*/
@@ -522,7 +522,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
{
if(!time)
if (!time)
return;
Mutate(new RotateMovementGenerator(time, direction), MOTION_SLOT_ACTIVE);
@@ -537,14 +537,14 @@ void MotionMaster::propagateSpeedChange()
}*/
for (int i = 0; i <= i_top; ++i)
{
if(Impl[i])
if (Impl[i])
Impl[i]->unitSpeedChanged();
}
}
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
{
if(empty())
if (empty())
return IDLE_MOTION_TYPE;
return top()->GetMovementGeneratorType();
@@ -552,7 +552,7 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
{
if(!Impl[slot])
if (!Impl[slot])
return NULL_MOTION_TYPE;
else
return Impl[slot]->GetMovementGeneratorType();
@@ -566,7 +566,7 @@ void MotionMaster::InitTop()
void MotionMaster::DirectDelete(_Ty curr)
{
if(isStatic(curr))
if (isStatic(curr))
return;
curr->Finalize(*i_owner);
delete curr;
@@ -575,16 +575,16 @@ void MotionMaster::DirectDelete(_Ty curr)
void MotionMaster::DelayedDelete(_Ty curr)
{
sLog.outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType());
if(isStatic(curr))
if (isStatic(curr))
return;
if(!m_expList)
if (!m_expList)
m_expList = new ExpireList();
m_expList->push_back(curr);
}
bool MotionMaster::GetDestination(float &x, float &y, float &z)
{
if(empty())
if (empty())
return false;
return top()->GetDestination(x,y,z);
+2 -2
View File
@@ -121,7 +121,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
{
if (m_cleanFlag & MMCF_UPDATE)
{
if(reset)
if (reset)
m_cleanFlag |= MMCF_RESET;
else
m_cleanFlag &= ~MMCF_RESET;
@@ -134,7 +134,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
{
if (m_cleanFlag & MMCF_UPDATE)
{
if(reset)
if (reset)
m_cleanFlag |= MMCF_RESET;
else
m_cleanFlag &= ~MMCF_RESET;
+52 -52
View File
@@ -43,14 +43,14 @@ void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleMoveWorldportAckOpcode()
{
// ignore unexpected far teleports
if(!GetPlayer()->IsBeingTeleportedFar())
if (!GetPlayer()->IsBeingTeleportedFar())
return;
// get the teleport destination
WorldLocation &loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if(!MapManager::IsValidMapCoord(loc))
if (!MapManager::IsValidMapCoord(loc))
{
LogoutPlayer(false);
return;
@@ -61,14 +61,14 @@ void WorldSession::HandleMoveWorldportAckOpcode()
InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.GetMapId());
// reset instance validity, except if going to an instance inside an instance
if(GetPlayer()->m_InstanceValid == false && !mInstance)
if (GetPlayer()->m_InstanceValid == false && !mInstance)
GetPlayer()->m_InstanceValid = true;
GetPlayer()->SetSemaphoreTeleportFar(false);
Map * oldMap = GetPlayer()->GetMap();
assert(oldMap);
if(GetPlayer()->IsInWorld())
if (GetPlayer()->IsInWorld())
{
sLog.outCrash("Player is still in world when teleported out of map %u! to new map %u", oldMap->GetId(), loc.GetMapId());
oldMap->Remove(GetPlayer(), false);
@@ -91,7 +91,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
if (!GetPlayer()->GetMap()->Add(GetPlayer()))
{
sLog.outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
@@ -102,10 +102,10 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// battleground state prepare (in case join to BG), at relogin/tele player not invited
// only add to bg group and object, if the player was invited (else he entered through command)
if(_player->InBattleGround())
if (_player->InBattleGround())
{
// cleanup setting if outdated
if(!mEntry->IsBattleGroundOrArena())
if (!mEntry->IsBattleGroundOrArena())
{
// We're not in BG
_player->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE);
@@ -113,9 +113,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
_player->SetBGTeam(0);
}
// join to bg case
else if(BattleGround *bg = _player->GetBattleGround())
else if (BattleGround *bg = _player->GetBattleGround())
{
if(_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
if (_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
bg->AddPlayer(_player);
}
}
@@ -123,9 +123,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
if(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
if(!_player->InBattleGround())
if (!_player->InBattleGround())
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
@@ -142,7 +142,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
Corpse *corpse = GetPlayer()->GetCorpse();
if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId())
{
if( mEntry->IsDungeon() )
if ( mEntry->IsDungeon() )
{
GetPlayer()->ResurrectPlayer(0.5f,false);
GetPlayer()->SpawnCorpseBones();
@@ -153,7 +153,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (mInstance)
{
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
if(MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,diff))
if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,diff))
{
if (mapDiff->resetTime)
{
@@ -177,7 +177,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->UpdateZone(newzone, newarea);
// honorless target
if(GetPlayer()->pvpInfo.inHostileArea)
if (GetPlayer()->pvpInfo.inHostileArea)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// resummon pet
@@ -192,7 +192,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
uint64 guid;
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
uint32 flags, time;
@@ -203,10 +203,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
Unit *mover = _player->m_mover;
Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
if(!plMover || !plMover->IsBeingTeleportedNear())
if (!plMover || !plMover->IsBeingTeleportedNear())
return;
if(guid != plMover->GetGUID())
if (guid != plMover->GetGUID())
return;
plMover->SetSemaphoreTeleportNear(false);
@@ -222,10 +222,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
plMover->UpdateZone(newzone, newarea);
// new zone
if(old_zone != newzone)
if (old_zone != newzone)
{
// honorless target
if(plMover->pvpInfo.inHostileArea)
if (plMover->pvpInfo.inHostileArea)
plMover->CastSpell(plMover, 2479, true);
}
@@ -258,7 +258,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
/* extract packet */
uint64 guid;
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
MovementInfo movementInfo;
@@ -266,7 +266,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
ReadMovementInfo(recv_data, &movementInfo);
/*----------------*/
/* if(recv_data.size() != recv_data.rpos())
/* if (recv_data.size() != recv_data.rpos())
{
sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos());
KickPlayer();*/
@@ -399,10 +399,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
/*else // creature charmed
{
if(mover->canFly())
if (mover->canFly())
{
bool flying = mover->IsFlying();
if(flying != ((mover->GetByteValue(UNIT_FIELD_BYTES_1, 3) & 0x02) ? true : false))
if (flying != ((mover->GetByteValue(UNIT_FIELD_BYTES_1, 3) & 0x02) ? true : false))
mover->SetFlying(flying);
}
}*/
@@ -421,11 +421,11 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
uint32 unk1;
float newspeed;
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
// now can skip not our packet
if(_player->GetGUID() != guid)
if (_player->GetGUID() != guid)
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -467,16 +467,16 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
// skip all forced speed changes except last and unexpected
// in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN} store both.
if(_player->m_forced_speed_changes[force_move_type] > 0)
if (_player->m_forced_speed_changes[force_move_type] > 0)
{
--_player->m_forced_speed_changes[force_move_type];
if(_player->m_forced_speed_changes[force_move_type] > 0)
if (_player->m_forced_speed_changes[force_move_type] > 0)
return;
}
if (!_player->GetTransport() && fabs(_player->GetSpeed(move_type) - newspeed) > 0.01f)
{
if(_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
{
sLog.outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), newspeed);
@@ -498,11 +498,11 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
uint64 guid;
recv_data >> guid;
if(GetPlayer()->IsInWorld())
if(Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid))
if (GetPlayer()->IsInWorld())
if (Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid))
{
GetPlayer()->SetMover(mover);
if(mover != GetPlayer() && mover->canFly())
if (mover != GetPlayer() && mover->canFly())
{
WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
data.append(mover->GetPackGUID());
@@ -522,10 +522,10 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
uint64 old_mover_guid;
if(!recv_data.readPackGUID(old_mover_guid))
if (!recv_data.readPackGUID(old_mover_guid))
return;
/*if(_player->m_mover->GetGUID() == old_mover_guid)
/*if (_player->m_mover->GetGUID() == old_mover_guid)
{
sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " I64FMT, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid);
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
@@ -547,7 +547,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
uint64 vehicleGUID = _player->GetCharmGUID();
if(!vehicleGUID) // something wrong here...
if (!vehicleGUID) // something wrong here...
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return;
@@ -555,7 +555,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
uint64 guid;
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
MovementInfo mi;
@@ -575,7 +575,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
recv_data.hexlike();
Unit* vehicle_base = GetPlayer()->GetVehicleBase();
if(!vehicle_base)
if (!vehicle_base)
return;
switch (recv_data.GetOpcode())
@@ -589,24 +589,24 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
{
uint64 guid; // current vehicle guid
if(!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
if (!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
return;
ReadMovementInfo(recv_data, &vehicle_base->m_movementInfo);
uint64 accessory; // accessory guid
if(!recv_data.readPackGUID(accessory))
if (!recv_data.readPackGUID(accessory))
return;
int8 seatId;
recv_data >> seatId;
if(!accessory)
if (!accessory)
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
else if(Unit *vehUnit = Unit::GetUnit(*GetPlayer(), accessory))
else if (Unit *vehUnit = Unit::GetUnit(*GetPlayer(), accessory))
{
if(Vehicle *vehicle = vehUnit->GetVehicleKit())
if(vehicle->HasEmptySeat(seatId))
if (Vehicle *vehicle = vehUnit->GetVehicleKit())
if (vehicle->HasEmptySeat(seatId))
GetPlayer()->EnterVehicle(vehicle, seatId);
}
}
@@ -614,7 +614,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
{
uint64 guid; // current vehicle guid
if(!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
if (!recv_data.readPackGUID(guid) || vehicle_base->GetGUID() != guid)
return;
int8 seatId;
@@ -634,13 +634,13 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
uint64 guid;
data >> guid;
if(Player* pl=ObjectAccessor::FindPlayer(guid))
if (Player* pl=ObjectAccessor::FindPlayer(guid))
{
if (!pl->GetVehicleKit())
return;
if (!pl->IsInRaidWith(_player))
return;
if(!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
if (!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
_player->EnterVehicle(pl);
}
@@ -648,13 +648,13 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
void WorldSession::HandleEjectPasenger(WorldPacket &data)
{
if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
if (data.GetOpcode()==CMSG_EJECT_PASSENGER)
{
if(Vehicle* Vv= _player->GetVehicleKit())
if (Vehicle* Vv= _player->GetVehicleKit())
{
uint64 guid;
data >> guid;
if(Player* Pl=ObjectAccessor::FindPlayer(guid))
if (Player* Pl=ObjectAccessor::FindPlayer(guid))
Pl->ExitVehicle();
}
}
@@ -682,7 +682,7 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK");
uint64 guid; // guid - unused
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -696,7 +696,7 @@ void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data )
sLog.outDebug("CMSG_MOVE_HOVER_ACK");
uint64 guid; // guid - unused
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -712,7 +712,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
sLog.outDebug("CMSG_MOVE_WATER_WALK_ACK");
uint64 guid; // guid - unused
if(!recv_data.readPackGUID(guid))
if (!recv_data.readPackGUID(guid))
return;
recv_data.read_skip<uint32>(); // unk
@@ -725,7 +725,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
{
if(!_player->isAlive() || _player->isInCombat() )
if (!_player->isAlive() || _player->isInCombat() )
return;
uint64 summoner_guid;
+55 -55
View File
@@ -51,7 +51,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendTabardVendorActivate(guid);
@@ -80,7 +80,7 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendShowBank(guid);
@@ -119,11 +119,11 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// trainer list loaded at check;
if(!unit->isCanTrainingOf(_player,true))
if (!unit->isCanTrainingOf(_player,true))
return;
CreatureInfo const *ci = unit->GetCreatureInfo();
@@ -135,7 +135,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
}
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
if(!trainer_spells)
if (!trainer_spells)
{
sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)",
GUID_LOPART(guid), unit->GetEntry());
@@ -164,7 +164,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
{
if (!tSpell->learnedSpell[i])
continue;
if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i]))
if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i]))
{
valid = false;
break;
@@ -243,31 +243,31 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!unit->isCanTrainingOf(_player,true))
if (!unit->isCanTrainingOf(_player,true))
return;
// check present spell in trainer spell list
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
if(!trainer_spells)
if (!trainer_spells)
return;
// not found, cheat?
TrainerSpell const* trainer_spell = trainer_spells->Find(spellId);
if(!trainer_spell)
if (!trainer_spell)
return;
// can't be learn, cheat? Or double learn with lags...
if(_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN)
if (_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN)
return;
// apply reputation discount
uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit)));
// check money requirement
if(_player->GetMoney() < nSpellCost )
if (_player->GetMoney() < nSpellCost )
return;
_player->ModifyMoney( -int32(nSpellCost) );
@@ -281,7 +281,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
SendPacket(&data);
// learn explicitly or cast explicitly
if(trainer_spell->IsCastable())
if (trainer_spell->IsCastable())
//FIXME: prof. spell entry in trainer list not marked gray until list re-open.
_player->CastSpell(_player,trainer_spell->spell,true);
else
@@ -308,10 +308,10 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
// remove fake death
//if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
//if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
// GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider())
if ( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider())
{
unit->StopMoving();
}
@@ -320,7 +320,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
if (unit->isSpiritGuide())
{
BattleGround *bg = _player->GetBattleGround();
if(bg)
if (bg)
{
bg->AddPlayerToResurrectQueue(unit->GetGUID(), _player->GetGUID());
sBattleGroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
@@ -328,7 +328,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
}
}
if(!sScriptMgr.GossipHello(_player, unit))
if (!sScriptMgr.GossipHello(_player, unit))
{
_player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
_player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId);
@@ -347,7 +347,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
recv_data >> guid >> unk >> option;
if(_player->PlayerTalkClass->GossipOptionCoded( option ))
if (_player->PlayerTalkClass->GossipOptionCoded( option ))
{
sLog.outDebug("reading string");
recv_data >> code;
@@ -362,10 +362,10 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!code.empty())
if (!code.empty())
{
if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()))
unit->OnGossipSelect (_player, option);
@@ -393,7 +393,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendSpiritResurrect();
@@ -408,7 +408,7 @@ void WorldSession::SendSpiritResurrect()
// get corpse nearest graveyard
WorldSafeLocsEntry const *corpseGrave = NULL;
Corpse *corpse = _player->GetCorpse();
if(corpse)
if (corpse)
corpseGrave = objmgr.GetClosestGraveYard(
corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam() );
@@ -416,12 +416,12 @@ void WorldSession::SendSpiritResurrect()
_player->SpawnCorpseBones();
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
if(corpseGrave)
if (corpseGrave)
{
WorldSafeLocsEntry const *ghostGrave = objmgr.GetClosestGraveYard(
_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam() );
if(corpseGrave != ghostGrave)
if (corpseGrave != ghostGrave)
_player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation());
// or update at original position
else
@@ -437,7 +437,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
uint64 npcGUID;
recv_data >> npcGUID;
if(!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
return;
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER);
@@ -448,7 +448,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendBindPoint(unit);
@@ -457,7 +457,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
void WorldSession::SendBindPoint(Creature *npc)
{
// prevent set homebind to instances in any case
if(GetPlayer()->GetMap()->Instanceable())
if (GetPlayer()->GetMap()->Instanceable())
return;
uint32 bindspell = 3286;
@@ -518,11 +518,11 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// remove mounts this fix bug where getting pet from stable while mounted deletes pet.
if(GetPlayer()->IsMounted())
if (GetPlayer()->IsMounted())
GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
SendStablePet(npcGUID);
@@ -545,7 +545,7 @@ void WorldSession::SendStablePet(uint64 guid )
uint8 num = 0; // counter for place holder
// not let move dead pet in slot
if(pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
if (pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
{
data << uint32(pet->GetCharmInfo()->GetPetNumber());
data << uint32(pet->GetEntry());
@@ -559,7 +559,7 @@ void WorldSession::SendStablePet(uint64 guid )
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
if (result)
{
do
{
@@ -586,7 +586,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
recv_data >> npcGUID;
if(!GetPlayer()->isAlive())
if (!GetPlayer()->isAlive())
return;
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
@@ -597,13 +597,13 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet *pet = _player->GetPet();
// can't place in stable dead pet
if(!pet||!pet->isAlive()||pet->getPetType()!=HUNTER_PET)
if (!pet||!pet->isAlive()||pet->getPetType()!=HUNTER_PET)
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -615,7 +615,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
if (result)
{
do
{
@@ -624,7 +624,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
uint32 slot = fields[1].GetUInt32();
// slots ordered in query, and if not equal then free
if(slot!=free_slot)
if (slot!=free_slot)
break;
// this slot not free, skip
@@ -633,7 +633,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
}
WorldPacket data(SMSG_STABLE_RESULT, 1);
if( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
if ( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
{
_player->RemovePet(pet,PetSaveMode(free_slot));
data << uint8(0x08);
@@ -660,7 +660,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint32 creature_id = 0;
@@ -668,14 +668,14 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
_player->GetGUIDLow(),petnumber,PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
if (result)
{
Field *fields = result->Fetch();
creature_id = fields[0].GetUInt32();
}
}
if(!creature_id)
if (!creature_id)
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -684,7 +684,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id);
if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -693,7 +693,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
Pet* pet = _player->GetPet();
if(pet && pet->isAlive())
if (pet && pet->isAlive())
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -702,11 +702,11 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
}
// delete dead pet
if(pet)
if (pet)
_player->RemovePet(pet,PET_SAVE_AS_DELETED);
Pet *newpet = new Pet(_player, HUNTER_PET);
if(!newpet->LoadPetFromDB(_player,creature_id,petnumber))
if (!newpet->LoadPetFromDB(_player,creature_id,petnumber))
{
delete newpet;
newpet = NULL;
@@ -736,15 +736,15 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200);
if(GetPlayer()->m_stableSlots < MAX_PET_STABLES)
if (GetPlayer()->m_stableSlots < MAX_PET_STABLES)
{
StableSlotPricesEntry const *SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
if(_player->GetMoney() >= SlotPrice->Price)
if (_player->GetMoney() >= SlotPrice->Price)
{
++GetPlayer()->m_stableSlots;
_player->ModifyMoney(-int32(SlotPrice->Price));
@@ -780,20 +780,20 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size
Pet* pet = _player->GetPet();
if(!pet || pet->getPetType()!=HUNTER_PET)
if (!pet || pet->getPetType()!=HUNTER_PET)
return;
// find swapped pet slot in stable
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
_player->GetGUIDLow(),pet_number);
if(!result)
if (!result)
return;
Field *fields = result->Fetch();
@@ -801,7 +801,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
uint32 slot = fields[0].GetUInt32();
uint32 creature_id = fields[1].GetUInt32();
if(!creature_id)
if (!creature_id)
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -810,7 +810,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
}
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id);
if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
{
WorldPacket data(SMSG_STABLE_RESULT, 1);
data << uint8(0x06);
@@ -823,7 +823,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
// summon unstabled pet
Pet *newpet = new Pet(_player);
if(!newpet->LoadPetFromDB(_player,creature_id,pet_number))
if (!newpet->LoadPetFromDB(_player,creature_id,pet_number))
{
delete newpet;
data << uint8(0x06);
@@ -851,7 +851,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
}
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// reputation discount
@@ -864,7 +864,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
Item* item = _player->GetItemByGuid(itemGUID);
if(item)
if (item)
TotalCost= _player->DurabilityRepair(item->GetPos(),true,discountMod,guildBank>0?true:false);
}
else
+190 -190
View File
File diff suppressed because it is too large Load Diff
+13 -13
View File
@@ -126,7 +126,7 @@ class Object
const bool IsInWorld() const { return m_inWorld; }
virtual void AddToWorld()
{
if(m_inWorld)
if (m_inWorld)
return;
assert(m_uint32Values);
@@ -138,7 +138,7 @@ class Object
}
virtual void RemoveFromWorld()
{
if(!m_inWorld)
if (!m_inWorld)
return;
m_inWorld = false;
@@ -236,7 +236,7 @@ class Object
void ToggleFlag( uint16 index, uint32 flag)
{
if(HasFlag(index, flag))
if (HasFlag(index, flag))
RemoveFlag(index, flag);
else
SetFlag(index, flag);
@@ -244,7 +244,7 @@ class Object
bool HasFlag( uint16 index, uint32 flag ) const
{
if( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
if ( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
return (m_uint32Values[ index ] & flag) != 0;
}
@@ -253,7 +253,7 @@ class Object
void ToggleFlag( uint16 index, uint8 offset, uint8 flag )
{
if(HasByteFlag(index, offset, flag))
if (HasByteFlag(index, offset, flag))
RemoveByteFlag(index, offset, flag);
else
SetByteFlag(index, offset, flag);
@@ -268,7 +268,7 @@ class Object
void ApplyModFlag( uint16 index, uint32 flag, bool apply)
{
if(apply) SetFlag(index,flag); else RemoveFlag(index,flag);
if (apply) SetFlag(index,flag); else RemoveFlag(index,flag);
}
void SetFlag64( uint16 index, uint64 newFlag )
@@ -287,7 +287,7 @@ class Object
void ToggleFlag64( uint16 index, uint64 flag)
{
if(HasFlag64(index, flag))
if (HasFlag64(index, flag))
RemoveFlag64(index, flag);
else
SetFlag64(index, flag);
@@ -301,7 +301,7 @@ class Object
void ApplyModFlag64( uint16 index, uint64 flag, bool apply)
{
if(apply) SetFlag64(index,flag); else RemoveFlag64(index,flag);
if (apply) SetFlag64(index,flag); else RemoveFlag64(index,flag);
}
void ClearUpdateMask(bool remove);
@@ -318,10 +318,10 @@ class Object
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
Player* ToPlayer(){ if(GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
const Player* ToPlayer() const { if(GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; }
Creature* ToCreature(){ if(GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
const Creature* ToCreature() const {if(GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
Player* ToPlayer(){ if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
const Player* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; }
Creature* ToCreature(){ if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
const Creature* ToCreature() const {if (GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
protected:
@@ -643,7 +643,7 @@ class WorldObject : public Object, public WorldLocation
TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const;
TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0)
{
if(!x && !y && !z)
if (!x && !y && !z)
{
GetClosePoint(x, y, z, GetObjectSize());
ang = GetOrientation();
+7 -7
View File
@@ -111,24 +111,24 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, u
return ((Player const&)p).GetItemByGuid(guid);
break;
case HIGHGUID_PLAYER:
if(typemask & TYPEMASK_PLAYER)
if (typemask & TYPEMASK_PLAYER)
return FindPlayer(guid);
break;
case HIGHGUID_GAMEOBJECT:
if(typemask & TYPEMASK_GAMEOBJECT)
if (typemask & TYPEMASK_GAMEOBJECT)
return p.GetMap()->GetGameObject(guid);
break;
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
if(typemask & TYPEMASK_UNIT)
if (typemask & TYPEMASK_UNIT)
return p.GetMap()->GetCreature(guid);
break;
case HIGHGUID_PET:
if(typemask & TYPEMASK_UNIT)
if (typemask & TYPEMASK_UNIT)
return GetPet(guid);
break;
case HIGHGUID_DYNAMICOBJECT:
if(typemask & TYPEMASK_DYNAMICOBJECT)
if (typemask & TYPEMASK_DYNAMICOBJECT)
return p.GetMap()->GetDynamicObject(guid);
break;
case HIGHGUID_TRANSPORT:
@@ -255,7 +255,7 @@ void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid,
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
if(!corpse)
if (!corpse)
{
//in fact this function is called from several places
//even when player doesn't have a corpse, not an error
@@ -275,7 +275,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
// remove resurrectable corpse from grid object registry (loaded state checked into call)
// do not load the map if it's not loaded
//Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId());
//if(map)
//if (map)
// map->Remove(corpse, false);
// remove corpse from DB
+2 -2
View File
@@ -130,7 +130,7 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
if (IS_PLAYER_GUID(guid))
{
Unit* u = (Unit*)HashMapHolder<Player>::Find(guid);
if(!u)
if (!u)
return NULL;
return u;
@@ -154,7 +154,7 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
}
CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
if(q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
{
sLog.outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
+9 -9
View File
@@ -68,7 +68,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y);
Cell resp_cell(resp_val);
if(cur_cell.DiffGrid(resp_cell))
if (cur_cell.DiffGrid(resp_cell))
{
c->GetMap()->CreatureRespawnRelocation(c);
// false result ignored: will be unload with other creatures at grid
@@ -105,7 +105,7 @@ template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
Cell cell(cell_pair);
obj->SetCurrentCell(cell);
if(obj->isSpiritService())
if (obj->isSpiritService())
obj->setDeathState(DEAD);
}
@@ -115,7 +115,7 @@ void AddObjectHelper(CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* m
obj->GetGridRef().link(&m, obj);
addUnitState(obj,cell);
obj->AddToWorld();
if(obj->isActiveObject())
if (obj->isActiveObject())
map->AddToActive(obj);
++count;
@@ -129,7 +129,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
T* obj = new T;
uint32 guid = *i_guid;
//sLog.outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading",table,guid);
if(!obj->LoadFromDB(guid, map))
if (!obj->LoadFromDB(guid, map))
{
delete obj;
continue;
@@ -141,18 +141,18 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType &m, uint32 &count, Map* map)
{
if(cell_corpses.empty())
if (cell_corpses.empty())
return;
for (CellCorpseSet::const_iterator itr = cell_corpses.begin(); itr != cell_corpses.end(); ++itr)
{
if(itr->second != map->GetInstanceId())
if (itr->second != map->GetInstanceId())
continue;
uint32 player_guid = itr->first;
Corpse *obj = ObjectAccessor::Instance().GetCorpseForPlayerGUID(player_guid);
if(!obj)
if (!obj)
continue;
// TODO: this is a hack
@@ -264,7 +264,7 @@ ObjectGridUnloader::Visit(GridRefManager<T> &m)
{
T *obj = m.getFirst()->getSource();
// if option set then object already saved at this moment
if(!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
if (!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
obj->SaveRespawnTime();
///- object will get delinked from the manager when deleted
delete obj;
@@ -285,7 +285,7 @@ ObjectGridStoper::Visit(CreatureMapType &m)
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
{
iter->getSource()->RemoveAllDynObjects();
if(iter->getSource()->isInCombat())
if (iter->getSource()->isInCombat())
{
iter->getSource()->CombatStop();
iter->getSource()->DeleteThreatList();
+609 -609
View File
File diff suppressed because it is too large Load Diff
+30 -30
View File
@@ -479,17 +479,17 @@ class ObjectMgr
PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const
{
if(class_ >= MAX_CLASSES) return NULL;
if (class_ >= MAX_CLASSES) return NULL;
return &playerClassInfo[class_];
}
void GetPlayerClassLevelInfo(uint32 class_,uint8 level, PlayerClassLevelInfo* info) const;
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
{
if(race >= MAX_RACES) return NULL;
if(class_ >= MAX_CLASSES) return NULL;
if (race >= MAX_RACES) return NULL;
if (class_ >= MAX_CLASSES) return NULL;
PlayerInfo const* info = &playerInfo[race][class_];
if(info->displayId_m==0 || info->displayId_f==0) return NULL;
if (info->displayId_m==0 || info->displayId_f==0) return NULL;
return info;
}
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const;
@@ -516,7 +516,7 @@ class ObjectMgr
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
{
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
if(itr != mQuestAreaTriggerMap.end())
if (itr != mQuestAreaTriggerMap.end())
return itr->second;
return 0;
}
@@ -541,7 +541,7 @@ class ObjectMgr
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
{
AreaTriggerMap::const_iterator itr = mAreaTriggers.find( trigger );
if( itr != mAreaTriggers.end( ) )
if ( itr != mAreaTriggers.end( ) )
return &itr->second;
return NULL;
}
@@ -549,7 +549,7 @@ class ObjectMgr
AccessRequirement const* GetAccessRequirement(uint32 requirement) const
{
AccessRequirementMap::const_iterator itr = mAccessRequirements.find( requirement );
if( itr != mAccessRequirements.end( ) )
if ( itr != mAccessRequirements.end( ) )
return &itr->second;
return NULL;
}
@@ -562,7 +562,7 @@ class ObjectMgr
ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
{
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
if(itr != mRepOnKill.end())
if (itr != mRepOnKill.end())
return &itr->second;
return NULL;
}
@@ -570,7 +570,7 @@ class ObjectMgr
PointOfInterest const* GetPointOfInterest(uint32 id) const
{
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
if(itr != mPointsOfInterest.end())
if (itr != mPointsOfInterest.end())
return &itr->second;
return NULL;
}
@@ -578,7 +578,7 @@ class ObjectMgr
QuestPOIVector const* GetQuestPOIVector(uint32 questId)
{
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
if(itr != mQuestPOIMap.end())
if (itr != mQuestPOIMap.end())
return &itr->second;
return NULL;
}
@@ -749,7 +749,7 @@ class ObjectMgr
WeatherZoneChances const* GetWeatherChances(uint32 zone_id) const
{
WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id);
if(itr != mWeatherZoneMap.end())
if (itr != mWeatherZoneMap.end())
return &itr->second;
else
return NULL;
@@ -763,7 +763,7 @@ class ObjectMgr
CreatureData const* GetCreatureData(uint32 guid) const
{
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
if(itr==mCreatureDataMap.end()) return NULL;
if (itr==mCreatureDataMap.end()) return NULL;
return &itr->second;
}
CreatureData& NewOrExistCreatureData(uint32 guid) { return mCreatureDataMap[guid]; }
@@ -771,55 +771,55 @@ class ObjectMgr
uint32 GetLinkedRespawnGuid(uint32 guid) const
{
CreatureLinkedRespawnMap::const_iterator itr = mCreatureLinkedRespawnMap.find(guid);
if(itr == mCreatureLinkedRespawnMap.end()) return 0;
if (itr == mCreatureLinkedRespawnMap.end()) return 0;
return itr->second;
}
CreatureLocale const* GetCreatureLocale(uint32 entry) const
{
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
if(itr==mCreatureLocaleMap.end()) return NULL;
if (itr==mCreatureLocaleMap.end()) return NULL;
return &itr->second;
}
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
{
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
if(itr==mGameObjectLocaleMap.end()) return NULL;
if (itr==mGameObjectLocaleMap.end()) return NULL;
return &itr->second;
}
ItemLocale const* GetItemLocale(uint32 entry) const
{
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
if(itr==mItemLocaleMap.end()) return NULL;
if (itr==mItemLocaleMap.end()) return NULL;
return &itr->second;
}
QuestLocale const* GetQuestLocale(uint32 entry) const
{
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
if(itr==mQuestLocaleMap.end()) return NULL;
if (itr==mQuestLocaleMap.end()) return NULL;
return &itr->second;
}
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
{
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
if(itr==mNpcTextLocaleMap.end()) return NULL;
if (itr==mNpcTextLocaleMap.end()) return NULL;
return &itr->second;
}
PageTextLocale const* GetPageTextLocale(uint32 entry) const
{
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
if(itr==mPageTextLocaleMap.end()) return NULL;
if (itr==mPageTextLocaleMap.end()) return NULL;
return &itr->second;
}
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
{
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
if(itr==mGossipMenuItemsLocaleMap.end()) return NULL;
if (itr==mGossipMenuItemsLocaleMap.end()) return NULL;
return &itr->second;
}
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
{
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
if(itr==mPointOfInterestLocaleMap.end()) return NULL;
if (itr==mPointOfInterestLocaleMap.end()) return NULL;
return &itr->second;
}
@@ -835,7 +835,7 @@ class ObjectMgr
GameObjectData const* GetGOData(uint32 guid) const
{
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
if(itr==mGameObjectDataMap.end()) return NULL;
if (itr==mGameObjectDataMap.end()) return NULL;
return &itr->second;
}
GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; }
@@ -844,7 +844,7 @@ class ObjectMgr
TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const
{
TrinityStringLocaleMap::const_iterator itr = mTrinityStringLocaleMap.find(entry);
if(itr==mTrinityStringLocaleMap.end()) return NULL;
if (itr==mTrinityStringLocaleMap.end()) return NULL;
return &itr->second;
}
const char *GetTrinityString(int32 entry, int locale_idx) const;
@@ -892,7 +892,7 @@ class ObjectMgr
uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
{
if(condition_id >= mConditions.size())
if (condition_id >= mConditions.size())
return false;
return mConditions[condition_id].Meets(player);
@@ -901,7 +901,7 @@ class ObjectMgr
GameTele const* GetGameTele(uint32 id) const
{
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
if(itr==m_GameTeleMap.end()) return NULL;
if (itr==m_GameTeleMap.end()) return NULL;
return &itr->second;
}
GameTele const* GetGameTele(const std::string& name) const;
@@ -912,7 +912,7 @@ class ObjectMgr
uint32 GetNpcGossip(uint32 entry) const
{
CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
if(iter == m_mCacheNpcTextIdMap.end())
if (iter == m_mCacheNpcTextIdMap.end())
return 0;
return iter->second;
@@ -921,7 +921,7 @@ class ObjectMgr
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
{
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
if(iter == m_mCacheTrainerSpellMap.end())
if (iter == m_mCacheTrainerSpellMap.end())
return NULL;
return &iter->second;
@@ -930,7 +930,7 @@ class ObjectMgr
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
{
CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
if(iter == m_mCacheVendorItemMap.end())
if (iter == m_mCacheVendorItemMap.end())
return NULL;
return &iter->second;
@@ -959,7 +959,7 @@ class ObjectMgr
GM_Ticket *GetGMTicket(uint64 ticketGuid)
{
for (GmTicketList::const_iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
if((*i) && (*i)->guid == ticketGuid)
if ((*i) && (*i)->guid == ticketGuid)
return (*i);
return NULL;
@@ -967,7 +967,7 @@ class ObjectMgr
GM_Ticket *GetGMTicketByPlayer(uint64 playerGuid)
{
for (GmTicketList::const_iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
if((*i) && (*i)->playerGuid == playerGuid && (*i)->closed == 0)
if ((*i) && (*i)->playerGuid == playerGuid && (*i)->closed == 0)
return (*i);
return NULL;
+4 -4
View File
@@ -900,15 +900,15 @@ enum Opcodes
CMSG_LFG_LEAVE = 0x35D, // CMSG LeaveLFG
CMSG_SEARCH_LFG_JOIN = 0x35E, // CMSG SearchLFGJoin
CMSG_SEARCH_LFG_LEAVE = 0x35F, // CMSG SearchLFGLeave
SMSG_UPDATE_LFG_LIST = 0x360, // SMSG uint32, uint32, if(uint8) { uint32 count, for (count) { uint64} }, uint32 count2, uint32, for (count2) { uint64, uint32 flags, if(flags & 0x2) {string}, if(flags & 0x10) {for (3) uint8}, if(flags & 0x80) {uint64, uint32}}, uint32 count3, uint32, for (count3) {uint64, uint32 flags, if(flags & 0x1) {uint8, uint8, uint8, for (3) uint8, uint32, uint32, uint32, uint32, uint32, uint32, float, float, uint32, uint32, uint32, uint32, uint32, float, uint32, uint32, uint32, uint32, uint32, uint32}, if(flags&0x2) string, if(flags&0x4) uint8, if(flags&0x8) uint64, if(flags&0x10) uint8, if(flags&0x20) uint32, if(flags&0x40) uint8, if(flags& 0x80) {uint64, uint32}}
SMSG_UPDATE_LFG_LIST = 0x360, // SMSG uint32, uint32, if (uint8) { uint32 count, for (count) { uint64} }, uint32 count2, uint32, for (count2) { uint64, uint32 flags, if (flags & 0x2) {string}, if (flags & 0x10) {for (3) uint8}, if (flags & 0x80) {uint64, uint32}}, uint32 count3, uint32, for (count3) {uint64, uint32 flags, if (flags & 0x1) {uint8, uint8, uint8, for (3) uint8, uint32, uint32, uint32, uint32, uint32, uint32, float, float, uint32, uint32, uint32, uint32, uint32, float, uint32, uint32, uint32, uint32, uint32, uint32}, if (flags&0x2) string, if (flags&0x4) uint8, if (flags&0x8) uint64, if (flags&0x10) uint8, if (flags&0x20) uint32, if (flags&0x40) uint8, if (flags& 0x80) {uint64, uint32}}
SMSG_LFG_PROPOSAL_DECLINED = 0x361, // SMSG uint32, uint8, uint32, uint32, uint8, for (uint8) {uint32,uint8,uint8,uint8,uint8}
CMSG_LFG_PROPOSAL_RESULT = 0x362, // CMSG AcceptProposal, RejectProposal
SMSG_LFG_ROLE_CHECK = 0x363, // SMSG uint32, uint8, for (uint8) uint32, uint8, for (uint8) { uint64, uint8, uint32, uint8, }
SMSG_LFG_ROLE_CHECK_FAILED_RESULT = 0x364, // SMSG uint32 unk, uint32, if(unk==6) { uint8 count, for (count) uint64 }
SMSG_LFG_ROLE_CHECK_FAILED_RESULT = 0x364, // SMSG uint32 unk, uint32, if (unk==6) { uint8 count, for (count) uint64 }
SMSG_LFG_QUEUE_STATUS_UPDATE = 0x365, // SMSG uint32 dungeon, uint32 lfgtype, uint32, uint32, uint32, uint32, uint8, uint8, uint8, uint8
CMSG_SET_LFG_COMMENT = 0x366, // CMSG SetLFGComment
SMSG_LFG_LFG_PROPOSAL_INFO = 0x367, // SMSG uint8, if(uint8) { uint8, uint8, uint8, uint8, if(uint8) for (uint8) uint32, string}
SMSG_LFG_LFG_PROPOSAL_INFO2 = 0x368, // SMSG uint8, if(uint8) { uint8, uint8, uint8, for (3) uint8, uint8, if(uint8) for (uint8) uint32, string}
SMSG_LFG_LFG_PROPOSAL_INFO = 0x367, // SMSG uint8, if (uint8) { uint8, uint8, uint8, uint8, if (uint8) for (uint8) uint32, string}
SMSG_LFG_LFG_PROPOSAL_INFO2 = 0x368, // SMSG uint8, if (uint8) { uint8, uint8, uint8, for (3) uint8, uint8, if (uint8) for (uint8) uint32, string}
SMSG_LFG_UPDATE_LIST = 0x369, // SMSG uint8
CMSG_LFG_SET_ROLES = 0x36A, // CMSG SetLFGRoles
CMSG_LFG_SET_NEEDS = 0x36B, // CMSG SetLFGNeeds
+58 -58
View File
@@ -40,7 +40,7 @@ m_maxSpeed(0), m_capturePoint(NULL)
bool OPvPCapturePoint::HandlePlayerEnter(Player * plr)
{
if(m_capturePoint)
if (m_capturePoint)
{
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
@@ -51,14 +51,14 @@ bool OPvPCapturePoint::HandlePlayerEnter(Player * plr)
void OPvPCapturePoint::HandlePlayerLeave(Player * plr)
{
if(m_capturePoint)
if (m_capturePoint)
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
m_activePlayers[plr->GetTeamId()].erase(plr);
}
void OPvPCapturePoint::SendChangePhase()
{
if(!m_capturePoint)
if (!m_capturePoint)
return;
// send this too, sometimes the slider disappears, dunno why :(
@@ -71,10 +71,10 @@ void OPvPCapturePoint::SendChangePhase()
void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
{
if(!entry)
if (!entry)
{
const GameObjectData *data = objmgr.GetGOData(guid);
if(!data)
if (!data)
return;
entry = data->id;
}
@@ -84,10 +84,10 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
{
if(!entry)
if (!entry)
{
const CreatureData *data = objmgr.GetCreatureData(guid);
if(!data)
if (!data)
return;
entry = data->id;
}
@@ -97,7 +97,7 @@ void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{
if(uint32 guid = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
if (uint32 guid = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
{
AddGO(type, guid, entry);
return true;
@@ -108,7 +108,7 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x,
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay)
{
if(uint32 guid = objmgr.AddCreData(entry, team, map, x, y, z, o, spawntimedelay))
if (uint32 guid = objmgr.AddCreData(entry, team, map, x, y, z, o, spawntimedelay))
{
AddCre(type, guid, entry);
return true;
@@ -123,14 +123,14 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
// check info existence
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry);
if(!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
{
sLog.outError("OutdoorPvP: GO %u is not capture point!", entry);
return false;
}
m_capturePointGUID = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
if(!m_capturePointGUID)
if (!m_capturePointGUID)
return false;
// get the needed values from goinfo
@@ -144,14 +144,14 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
bool OPvPCapturePoint::DelCreature(uint32 type)
{
if(!m_Creatures[type])
if (!m_Creatures[type])
{
sLog.outDebug("opvp creature type %u was already deleted",type);
return false;
}
Creature *cr = HashMapHolder<Creature>::Find(m_Creatures[type]);
if(!cr)
if (!cr)
{
// can happen when closing the core
m_Creatures[type] = 0;
@@ -165,7 +165,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
// explicit removal from map
// beats me why this is needed, but with the recent removal "cleanup" some creatures stay in the map if "properly" deleted
// so this is a big fat workaround, if AddObjectToRemoveList and DoDelayedMovesAndRemoves worked correctly, this wouldn't be needed
//if(Map * map = MapManager::Instance().FindMap(cr->GetMapId()))
//if (Map * map = MapManager::Instance().FindMap(cr->GetMapId()))
// map->Remove(cr,false);
// delete respawn time for this creature
WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u'", guid);
@@ -178,11 +178,11 @@ bool OPvPCapturePoint::DelCreature(uint32 type)
bool OPvPCapturePoint::DelObject(uint32 type)
{
if(!m_Objects[type])
if (!m_Objects[type])
return false;
GameObject *obj = HashMapHolder<GameObject>::Find(m_Objects[type]);
if(!obj)
if (!obj)
{
m_Objects[type] = 0;
return false;
@@ -201,7 +201,7 @@ bool OPvPCapturePoint::DelCapturePoint()
objmgr.DeleteGOData(m_capturePointGUID);
m_capturePointGUID = 0;
if(m_capturePoint)
if (m_capturePoint)
{
m_capturePoint->SetRespawnTime(0); // not save respawn time
m_capturePoint->Delete();
@@ -245,7 +245,7 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
itr->second->HandlePlayerLeave(plr);
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
if(!plr->GetSession()->PlayerLogout())
if (!plr->GetSession()->PlayerLogout())
SendRemoveWorldStates(plr);
m_players[plr->GetTeamId()].erase(plr);
sLog.outDebug("Player %s left an outdoorpvp zone", plr->GetName());
@@ -260,7 +260,7 @@ bool OutdoorPvP::Update(uint32 diff)
bool objective_changed = false;
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{
if(itr->second->Update(diff))
if (itr->second->Update(diff))
objective_changed = true;
}
return objective_changed;
@@ -268,7 +268,7 @@ bool OutdoorPvP::Update(uint32 diff)
bool OPvPCapturePoint::Update(uint32 diff)
{
if(!m_capturePoint)
if (!m_capturePoint)
return false;
float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
@@ -279,7 +279,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
{
Player *player = *itr;
++itr;
if(!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
HandlePlayerLeave(player);
}
}
@@ -291,28 +291,28 @@ bool OPvPCapturePoint::Update(uint32 diff)
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
if((*itr)->IsOutdoorPvPActive())
if ((*itr)->IsOutdoorPvPActive())
{
if(m_activePlayers[(*itr)->GetTeamId()].insert(*itr).second)
if (m_activePlayers[(*itr)->GetTeamId()].insert(*itr).second)
HandlePlayerEnter(*itr);
}
}
// get the difference of numbers
float fact_diff = ((float)m_activePlayers[0].size() - (float)m_activePlayers[1].size()) * diff / OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
if(!fact_diff)
if (!fact_diff)
return false;
uint32 Challenger = 0;
float maxDiff = m_maxSpeed * diff;
if(fact_diff < 0)
if (fact_diff < 0)
{
// horde is in majority, but it's already horde-controlled -> no change
if(m_State == OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
if (m_State == OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
return false;
if(fact_diff < -maxDiff)
if (fact_diff < -maxDiff)
fact_diff = -maxDiff;
Challenger = HORDE;
@@ -320,10 +320,10 @@ bool OPvPCapturePoint::Update(uint32 diff)
else
{
// ally is in majority, but it's already ally-controlled -> no change
if(m_State == OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
if (m_State == OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
return false;
if(fact_diff > maxDiff)
if (fact_diff > maxDiff)
fact_diff = maxDiff;
Challenger = ALLIANCE;
@@ -336,47 +336,47 @@ bool OPvPCapturePoint::Update(uint32 diff)
m_value += fact_diff;
if(m_value < -m_minValue) // red
if (m_value < -m_minValue) // red
{
if(m_value < -m_maxValue)
if (m_value < -m_maxValue)
m_value = -m_maxValue;
m_State = OBJECTIVESTATE_HORDE;
m_team = TEAM_HORDE;
}
else if(m_value > m_minValue) // blue
else if (m_value > m_minValue) // blue
{
if(m_value > m_maxValue)
if (m_value > m_maxValue)
m_value = m_maxValue;
m_State = OBJECTIVESTATE_ALLIANCE;
m_team = TEAM_ALLIANCE;
}
else if(oldValue * m_value <= 0) // grey, go through mid point
else if (oldValue * m_value <= 0) // grey, go through mid point
{
// if challenger is ally, then n->a challenge
if(Challenger == ALLIANCE)
if (Challenger == ALLIANCE)
m_State = OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
// if challenger is horde, then n->h challenge
else if(Challenger == HORDE)
else if (Challenger == HORDE)
m_State = OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
m_team = TEAM_NEUTRAL;
}
else // grey, did not go through mid point
{
// old phase and current are on the same side, so one team challenges the other
if(Challenger == ALLIANCE && (m_OldState == OBJECTIVESTATE_HORDE || m_OldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
if (Challenger == ALLIANCE && (m_OldState == OBJECTIVESTATE_HORDE || m_OldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
m_State = OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
else if(Challenger == HORDE && (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
else if (Challenger == HORDE && (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
m_State = OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
m_team = TEAM_NEUTRAL;
}
if(m_value != oldValue)
if (m_value != oldValue)
SendChangePhase();
if(m_OldState != m_State)
if (m_OldState != m_State)
{
//sLog.outError("%u->%u", m_OldState, m_State);
if(oldTeam != m_team)
if (oldTeam != m_team)
ChangeTeam(oldTeam);
ChangeState();
return true;
@@ -387,7 +387,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
{
if(m_sendUpdate)
if (m_sendUpdate)
for (int i = 0; i < 2; ++i)
for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
(*itr)->SendUpdateWorldState(field, value);
@@ -427,22 +427,22 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id,uint64 guid)
void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
{
if(Group * pGroup = killer->GetGroup())
if (Group * pGroup = killer->GetGroup())
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pGroupGuy = itr->getSource();
if(!pGroupGuy)
if (!pGroupGuy)
continue;
// skip if too far away
if(!pGroupGuy->IsAtGroupRewardDistance(killed))
if (!pGroupGuy->IsAtGroupRewardDistance(killed))
continue;
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
if(( pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy) ) || killed->GetTypeId() == TYPEID_UNIT)
if (( pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy) ) || killed->GetTypeId() == TYPEID_UNIT)
{
HandleKillImpl(pGroupGuy, killed);
}
@@ -451,7 +451,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
else
{
// creature kills must be notified, even if not inside objective / not outdoor pvp active
if(killer && (( killer->IsOutdoorPvPActive() && IsInsideObjective(killer) ) || killed->GetTypeId() == TYPEID_UNIT))
if (killer && (( killer->IsOutdoorPvPActive() && IsInsideObjective(killer) ) || killed->GetTypeId() == TYPEID_UNIT))
{
HandleKillImpl(killer, killed);
}
@@ -461,7 +461,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
bool OutdoorPvP::IsInsideObjective(Player *plr) const
{
for (OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(itr->second->IsInsideObjective(plr))
if (itr->second->IsInsideObjective(plr))
return true;
return false;
@@ -475,7 +475,7 @@ bool OPvPCapturePoint::IsInsideObjective(Player *plr) const
bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(itr->second->HandleCustomSpell(plr,spellId,go))
if (itr->second->HandleCustomSpell(plr,spellId,go))
return true;
return false;
@@ -483,7 +483,7 @@ bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
bool OPvPCapturePoint::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
{
if(!plr->IsOutdoorPvPActive())
if (!plr->IsOutdoorPvPActive())
return false;
return false;
}
@@ -491,7 +491,7 @@ bool OPvPCapturePoint::HandleCustomSpell(Player *plr, uint32 spellId, GameObject
bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(itr->second->HandleOpenGo(plr,guid) >= 0)
if (itr->second->HandleOpenGo(plr,guid) >= 0)
return true;
return false;
@@ -500,7 +500,7 @@ bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid)
bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(itr->second->HandleGossipOption(plr, guid, id))
if (itr->second->HandleGossipOption(plr, guid, id))
return true;
return false;
@@ -509,7 +509,7 @@ bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id)
bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(itr->second->CanTalkTo(plr, c, gso))
if (itr->second->CanTalkTo(plr, c, gso))
return true;
return false;
@@ -518,7 +518,7 @@ bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipMenuItems gso)
bool OutdoorPvP::HandleDropFlag(Player * plr, uint32 id)
{
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(itr->second->HandleDropFlag(plr, id))
if (itr->second->HandleDropFlag(plr, id))
return true;
return false;
@@ -542,7 +542,7 @@ bool OPvPCapturePoint::HandleDropFlag(Player * plr, uint32 id)
int32 OPvPCapturePoint::HandleOpenGo(Player *plr, uint64 guid)
{
std::map<uint64,uint32>::iterator itr = m_ObjectTypes.find(guid);
if(itr != m_ObjectTypes.end())
if (itr != m_ObjectTypes.end())
{
return itr->second;
}
@@ -574,7 +574,7 @@ bool OutdoorPvP::HasPlayer(Player *plr) const
void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
{
if(spellId > 0)
if (spellId > 0)
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
(*itr)->CastSpell(*itr, (uint32)spellId, true);
else
@@ -590,9 +590,9 @@ void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2)
void OutdoorPvP::OnGameObjectCreate(GameObject *go, bool add)
{
if(go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
return;
if(OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow()))
if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow()))
cp->m_capturePoint = add ? go : NULL;
}

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