mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Various Cleanups (game A-B)
This commit is contained in:
parent
2a4b8f2cb0
commit
f80629e307
47 changed files with 1359 additions and 1337 deletions
|
|
@ -37,18 +37,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");
|
||||
|
||||
|
|
@ -57,8 +57,8 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
|||
|
||||
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||
{
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||
if(!result)
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||
if (!result)
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
delete result;
|
||||
|
||||
|
|
@ -68,14 +68,15 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
|||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
uint32 guidlo = fields[0].GetUInt32();
|
||||
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidlo);
|
||||
|
||||
// kick if player currently
|
||||
ObjectAccessor::KickPlayer(guid);
|
||||
Player::DeleteFromDB(guid, accid, false); // no need to update realm characters
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
|||
|
||||
LoginDatabase.CommitTransaction();
|
||||
|
||||
if(!res)
|
||||
if (!res)
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error;
|
||||
|
||||
return AOR_OK;
|
||||
|
|
@ -99,15 +100,15 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
|||
|
||||
AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
|
||||
{
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||
if(!result)
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||
if (!result)
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
delete result;
|
||||
|
||||
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);
|
||||
|
|
@ -116,7 +117,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='%u'", safe_new_uname.c_str(),
|
||||
if (!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%u'", safe_new_uname.c_str(),
|
||||
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||
|
||||
|
|
@ -127,7 +128,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)
|
||||
|
|
@ -136,7 +137,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='%u'",
|
||||
if (!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%u'",
|
||||
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||
|
||||
|
|
@ -146,8 +147,8 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
|||
uint32 AccountMgr::GetId(std::string username)
|
||||
{
|
||||
LoginDatabase.escape_string(username);
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
||||
if(!result)
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
||||
if (!result)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
|
@ -159,8 +160,8 @@ uint32 AccountMgr::GetId(std::string username)
|
|||
|
||||
AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
||||
{
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
|
||||
if(result)
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
|
||||
if (result)
|
||||
{
|
||||
AccountTypes sec = AccountTypes((*result)[0].GetInt32());
|
||||
delete result;
|
||||
|
|
@ -170,10 +171,10 @@ AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
|||
return SEC_PLAYER;
|
||||
}
|
||||
|
||||
bool AccountMgr::GetName(uint32 acc_id, std::string &name)
|
||||
bool AccountMgr::GetName(uint32 acc_id, std::string& name)
|
||||
{
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
||||
if(result)
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
||||
if (result)
|
||||
{
|
||||
name = (*result)[0].GetCppString();
|
||||
delete result;
|
||||
|
|
@ -186,10 +187,10 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name)
|
|||
uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
||||
{
|
||||
// check character count
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", acc_id);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", acc_id);
|
||||
if (result)
|
||||
{
|
||||
Field *fields=result->Fetch();
|
||||
Field* fields=result->Fetch();
|
||||
uint32 charcount = fields[0].GetUInt32();
|
||||
delete result;
|
||||
return charcount;
|
||||
|
|
@ -201,12 +202,12 @@ uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
|||
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
||||
{
|
||||
std::string username;
|
||||
if(!GetName(accid, username))
|
||||
if (!GetName(accid, username))
|
||||
return false;
|
||||
|
||||
normalizeString(passwd);
|
||||
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
||||
if (result)
|
||||
{
|
||||
delete result;
|
||||
|
|
@ -221,10 +222,10 @@ 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 );
|
||||
std::transform(&wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin);
|
||||
|
||||
return WStrToUtf8(wstr_buf,wstr_len,utf8str);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class AccountMgr
|
|||
|
||||
uint32 GetId(std::string username);
|
||||
AccountTypes GetSecurity(uint32 acc_id);
|
||||
bool GetName(uint32 acc_id, std::string &name);
|
||||
bool GetName(uint32 acc_id, std::string& name);
|
||||
uint32 GetCharactersCount(uint32 acc_id);
|
||||
std::string CalculateShaPassHash(std::string& name, std::string& password);
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -47,7 +47,8 @@ struct CriteriaProgress
|
|||
};
|
||||
|
||||
enum AchievementCriteriaRequirementType
|
||||
{ // value1 value2 comment
|
||||
{
|
||||
// value1 value2 comment
|
||||
ACHIEVEMENT_CRITERIA_REQUIRE_NONE = 0, // 0 0
|
||||
ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE = 1, // creature_id 0
|
||||
ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_CLASS_RACE = 2, // class_id race_id
|
||||
|
|
@ -261,12 +262,12 @@ class AchievementMgr
|
|||
|
||||
void Reset();
|
||||
static void DeleteFromDB(ObjectGuid guid);
|
||||
void LoadFromDB(QueryResult *achievementResult, QueryResult *criteriaResult);
|
||||
void LoadFromDB(QueryResult* achievementResult, QueryResult* criteriaResult);
|
||||
void SaveToDB();
|
||||
void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0);
|
||||
void StartTimedAchievementCriteria(AchievementCriteriaTypes type, uint32 timedRequirementId, time_t startTime = 0);
|
||||
void DoFailedTimedAchievementCriterias();
|
||||
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0);
|
||||
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit* unit=NULL, uint32 time=0);
|
||||
void CheckAllAchievementCriteria();
|
||||
void SendAllAchievementData();
|
||||
void SendRespondInspectAchievements(Player* player);
|
||||
|
|
@ -298,7 +299,7 @@ class AchievementMgr
|
|||
void IncompletedAchievement(AchievementEntry const* entry);
|
||||
bool IsCompletedAchievement(AchievementEntry const* entry);
|
||||
void CompleteAchievementsWithRefs(AchievementEntry const* entry);
|
||||
void BuildAllDataPacket(WorldPacket *data);
|
||||
void BuildAllDataPacket(WorldPacket* data);
|
||||
|
||||
Player* m_player;
|
||||
CriteriaProgressMap m_criteriaProgress;
|
||||
|
|
|
|||
|
|
@ -28,38 +28,38 @@
|
|||
#include <list>
|
||||
|
||||
int
|
||||
AggressorAI::Permissible(const Creature *creature)
|
||||
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;
|
||||
}
|
||||
|
||||
AggressorAI::AggressorAI(Creature *c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
|
||||
AggressorAI::AggressorAI(Creature* c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AggressorAI::MoveInLineOfSight(Unit *u)
|
||||
AggressorAI::MoveInLineOfSight(Unit* u)
|
||||
{
|
||||
// Ignore Z for flying creatures
|
||||
if( !m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
|
||||
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() &&
|
||||
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
|
||||
{
|
||||
float attackRadius = m_creature->GetAttackDistance(u);
|
||||
if(m_creature->IsWithinDistInMap(u, attackRadius) && m_creature->IsWithinLOSInMap(u) )
|
||||
if (m_creature->IsWithinDistInMap(u, attackRadius) && m_creature->IsWithinLOSInMap(u))
|
||||
{
|
||||
if(!m_creature->getVictim())
|
||||
if (!m_creature->getVictim())
|
||||
{
|
||||
AttackStart(u);
|
||||
u->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
}
|
||||
else if(sMapStore.LookupEntry(m_creature->GetMapId())->IsDungeon())
|
||||
else if (sMapStore.LookupEntry(m_creature->GetMapId())->IsDungeon())
|
||||
{
|
||||
m_creature->AddThreat(u);
|
||||
u->SetInCombatWith(m_creature);
|
||||
|
|
@ -123,7 +123,7 @@ void
|
|||
AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||
{
|
||||
// update i_victimGuid if m_creature->getVictim() !=0 and changed
|
||||
if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
return;
|
||||
|
||||
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
||||
|
|
@ -132,19 +132,19 @@ AggressorAI::UpdateAI(const uint32 /*diff*/)
|
|||
}
|
||||
|
||||
bool
|
||||
AggressorAI::IsVisible(Unit *pl) const
|
||||
AggressorAI::IsVisible(Unit* pl) const
|
||||
{
|
||||
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
|
||||
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
|
||||
}
|
||||
|
||||
void
|
||||
AggressorAI::AttackStart(Unit *u)
|
||||
AggressorAI::AttackStart(Unit* u)
|
||||
{
|
||||
if( !u )
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
if(m_creature->Attack(u,true))
|
||||
if (m_creature->Attack(u,true))
|
||||
{
|
||||
i_victimGuid = u->GetObjectGuid();
|
||||
|
||||
|
|
|
|||
|
|
@ -35,15 +35,15 @@ class MANGOS_DLL_DECL AggressorAI : public CreatureAI
|
|||
|
||||
public:
|
||||
|
||||
explicit AggressorAI(Creature *c);
|
||||
explicit AggressorAI(Creature* c);
|
||||
|
||||
void MoveInLineOfSight(Unit *);
|
||||
void AttackStart(Unit *);
|
||||
void MoveInLineOfSight(Unit*);
|
||||
void AttackStart(Unit*);
|
||||
void EnterEvadeMode();
|
||||
bool IsVisible(Unit *) const;
|
||||
bool IsVisible(Unit*) const;
|
||||
|
||||
void UpdateAI(const uint32);
|
||||
static int Permissible(const Creature *);
|
||||
static int Permissible(const Creature*);
|
||||
|
||||
private:
|
||||
ObjectGuid i_victimGuid;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
|
|||
personal_rating = 0;
|
||||
else
|
||||
personal_rating += mod;
|
||||
if(plr)
|
||||
if (plr)
|
||||
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
if (GetMembersSize() >= GetMaxMembersSize())
|
||||
return false;
|
||||
|
||||
Player *pl = sObjectMgr.GetPlayer(playerGuid);
|
||||
Player* pl = sObjectMgr.GetPlayer(playerGuid);
|
||||
if (pl)
|
||||
{
|
||||
if (pl->GetArenaTeamId(GetSlot()))
|
||||
|
|
@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
else
|
||||
{
|
||||
// 0 1
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", playerGuid.GetCounter());
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", playerGuid.GetCounter());
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
|
|
@ -174,9 +174,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
|
||||
m_members.push_back(newmember);
|
||||
|
||||
CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, newmember.guid.GetCounter(), newmember.personal_rating );
|
||||
CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, newmember.guid.GetCounter(), newmember.personal_rating);
|
||||
|
||||
if(pl)
|
||||
if (pl)
|
||||
{
|
||||
pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType());
|
||||
pl->SetArenaTeamIdInvited(0);
|
||||
|
|
@ -189,12 +189,12 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult)
|
||||
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
|
||||
{
|
||||
if(!arenaTeamDataResult)
|
||||
if (!arenaTeamDataResult)
|
||||
return false;
|
||||
|
||||
Field *fields = arenaTeamDataResult->Fetch();
|
||||
Field* fields = arenaTeamDataResult->Fetch();
|
||||
|
||||
m_TeamId = fields[0].GetUInt32();
|
||||
m_Name = fields[1].GetCppString();
|
||||
|
|
@ -220,16 +220,16 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
||||
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
||||
{
|
||||
if(!arenaTeamMembersResult)
|
||||
if (!arenaTeamMembersResult)
|
||||
return false;
|
||||
|
||||
bool captainPresentInTeam = false;
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = arenaTeamMembersResult->Fetch();
|
||||
Field* fields = arenaTeamMembersResult->Fetch();
|
||||
//prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
|
||||
if (!fields)
|
||||
break;
|
||||
|
|
@ -272,7 +272,8 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
|||
captainPresentInTeam = true;
|
||||
|
||||
m_members.push_back(newmember);
|
||||
} while (arenaTeamMembersResult->NextRow());
|
||||
}
|
||||
while (arenaTeamMembersResult->NextRow());
|
||||
|
||||
if (Empty() || !captainPresentInTeam)
|
||||
{
|
||||
|
|
@ -287,7 +288,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
|||
void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||
{
|
||||
// disable remove/promote buttons
|
||||
Player *oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
||||
Player* oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
||||
if (oldcaptain)
|
||||
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||
|
||||
|
|
@ -298,7 +299,7 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
|||
CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", guid.GetCounter(), m_TeamId);
|
||||
|
||||
// enable remove/promote buttons
|
||||
if (Player *newcaptain = sObjectMgr.GetPlayer(guid))
|
||||
if (Player* newcaptain = sObjectMgr.GetPlayer(guid))
|
||||
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
||||
}
|
||||
|
||||
|
|
@ -317,14 +318,14 @@ void ArenaTeam::DelMember(ObjectGuid guid)
|
|||
{
|
||||
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
|
||||
// delete all info regarding this team
|
||||
for(int i = 0; i < ARENA_TEAM_END; ++i)
|
||||
for (int i = 0; i < ARENA_TEAM_END; ++i)
|
||||
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), guid.GetCounter());
|
||||
}
|
||||
|
||||
void ArenaTeam::Disband(WorldSession *session)
|
||||
void ArenaTeam::Disband(WorldSession* session)
|
||||
{
|
||||
// event
|
||||
if (session)
|
||||
|
|
@ -347,9 +348,9 @@ void ArenaTeam::Disband(WorldSession *session)
|
|||
sObjectMgr.RemoveArenaTeam(m_TeamId);
|
||||
}
|
||||
|
||||
void ArenaTeam::Roster(WorldSession *session)
|
||||
void ArenaTeam::Roster(WorldSession* session)
|
||||
{
|
||||
Player *pl = NULL;
|
||||
Player* pl = NULL;
|
||||
|
||||
uint8 unk308 = 0;
|
||||
|
||||
|
|
@ -374,7 +375,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
|
||||
|
|
@ -385,7 +386,7 @@ void ArenaTeam::Roster(WorldSession *session)
|
|||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_ROSTER");
|
||||
}
|
||||
|
||||
void ArenaTeam::Query(WorldSession *session)
|
||||
void ArenaTeam::Query(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+GetName().size()+1);
|
||||
data << uint32(GetId()); // team id
|
||||
|
|
@ -400,7 +401,7 @@ void ArenaTeam::Query(WorldSession *session)
|
|||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE");
|
||||
}
|
||||
|
||||
void ArenaTeam::Stats(WorldSession *session)
|
||||
void ArenaTeam::Stats(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7);
|
||||
data << uint32(GetId()); // team id
|
||||
|
|
@ -417,18 +418,18 @@ void ArenaTeam::NotifyStatsChanged()
|
|||
{
|
||||
// this is called after a rated match ended
|
||||
// updates arena team stats for every member of the team (not only the ones who participated!)
|
||||
for(MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
Player * plr = sObjectMgr.GetPlayer(itr->guid);
|
||||
if(plr)
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->guid);
|
||||
if (plr)
|
||||
Stats(plr->GetSession());
|
||||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::InspectStats(WorldSession *session, ObjectGuid guid)
|
||||
void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
|
||||
{
|
||||
ArenaTeamMember* member = GetMember(guid);
|
||||
if(!member)
|
||||
if (!member)
|
||||
return;
|
||||
|
||||
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6);
|
||||
|
|
@ -456,7 +457,7 @@ void ArenaTeam::SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emb
|
|||
|
||||
void ArenaTeam::SetStats(uint32 stat_type, uint32 value)
|
||||
{
|
||||
switch(stat_type)
|
||||
switch (stat_type)
|
||||
{
|
||||
case STAT_TYPE_RATING:
|
||||
m_stats.rating = value;
|
||||
|
|
@ -488,12 +489,12 @@ void ArenaTeam::SetStats(uint32 stat_type, uint32 value)
|
|||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::BroadcastPacket(WorldPacket *packet)
|
||||
void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
||||
{
|
||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
Player *player = sObjectMgr.GetPlayer(itr->guid);
|
||||
if(player)
|
||||
Player* player = sObjectMgr.GetPlayer(itr->guid);
|
||||
if (player)
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
|
@ -528,9 +529,9 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char cons
|
|||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_EVENT");
|
||||
}
|
||||
|
||||
uint8 ArenaTeam::GetSlotByType(ArenaType type )
|
||||
uint8 ArenaTeam::GetSlotByType(ArenaType type)
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case ARENA_TYPE_2v2: return 0;
|
||||
case ARENA_TYPE_3v3: return 1;
|
||||
|
|
@ -545,7 +546,7 @@ uint8 ArenaTeam::GetSlotByType(ArenaType type )
|
|||
bool ArenaTeam::HaveMember(ObjectGuid 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;
|
||||
|
|
@ -572,7 +573,7 @@ uint32 ArenaTeam::GetPoints(uint32 MemberRating)
|
|||
// type penalties for <5v5 teams
|
||||
if (m_Type == ARENA_TYPE_2v2)
|
||||
points *= 0.76f;
|
||||
else if(m_Type == ARENA_TYPE_3v3)
|
||||
else if (m_Type == ARENA_TYPE_3v3)
|
||||
points *= 0.88f;
|
||||
|
||||
return (uint32) points;
|
||||
|
|
@ -601,7 +602,7 @@ void ArenaTeam::FinishGame(int32 mod)
|
|||
// update team's rank
|
||||
m_stats.rank = 1;
|
||||
ObjectMgr::ArenaTeamMap::const_iterator i = sObjectMgr.GetArenaTeamMapBegin();
|
||||
for ( ; i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
|
||||
for (; i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
|
||||
{
|
||||
if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating)
|
||||
++m_stats.rank;
|
||||
|
|
@ -640,10 +641,10 @@ int32 ArenaTeam::LostAgainst(uint32 againstRating)
|
|||
return mod;
|
||||
}
|
||||
|
||||
void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
|
||||
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)
|
||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
if (itr->guid == plr->GetObjectGuid())
|
||||
{
|
||||
|
|
@ -667,7 +668,7 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
|
|||
void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstRating)
|
||||
{
|
||||
// called for offline player after ending rated arena match!
|
||||
for(MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
if (itr->guid == guid)
|
||||
{
|
||||
|
|
@ -688,10 +689,10 @@ void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstRating)
|
|||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
|
||||
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)
|
||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
if (itr->guid == plr->GetObjectGuid())
|
||||
{
|
||||
|
|
@ -723,7 +724,7 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
|
|||
return;
|
||||
// to get points, a player has to participate in at least 30% of the matches
|
||||
uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3);
|
||||
for(MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
// the player participated in enough games, update his points
|
||||
uint32 points_to_add = 0;
|
||||
|
|
@ -749,7 +750,7 @@ void ArenaTeam::SaveToDB()
|
|||
// called after a match has ended, or when calculating arena_points
|
||||
CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games_week = '%u',games_season = '%u',rank = '%u',wins_week = '%u',wins_season = '%u' WHERE arenateamid = '%u'", m_stats.rating, m_stats.games_week, m_stats.games_season, m_stats.rank, m_stats.wins_week, m_stats.wins_season, GetId());
|
||||
for(MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
CharacterDatabase.PExecute("UPDATE arena_team_member SET played_week = '%u', wons_week = '%u', played_season = '%u', wons_season = '%u', personal_rating = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->games_week, itr->wins_week, itr->games_season, itr->wins_season, itr->personal_rating, m_TeamId, itr->guid.GetCounter());
|
||||
}
|
||||
|
|
@ -760,7 +761,7 @@ void ArenaTeam::FinishWeek()
|
|||
{
|
||||
m_stats.games_week = 0; // played this week
|
||||
m_stats.wins_week = 0; // wins this week
|
||||
for(MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
itr->games_week = 0;
|
||||
itr->wins_week = 0;
|
||||
|
|
@ -771,7 +772,7 @@ bool ArenaTeam::IsFighting() const
|
|||
{
|
||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
{
|
||||
if (Player *p = sObjectMgr.GetPlayer(itr->guid))
|
||||
if (Player* p = sObjectMgr.GetPlayer(itr->guid))
|
||||
{
|
||||
if (p->GetMap()->IsBattleArena())
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class ArenaTeam
|
|||
~ArenaTeam();
|
||||
|
||||
bool Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName);
|
||||
void Disband(WorldSession *session);
|
||||
void Disband(WorldSession* session);
|
||||
|
||||
typedef std::list<ArenaTeamMember> MemberList;
|
||||
|
||||
|
|
@ -173,13 +173,13 @@ class ArenaTeam
|
|||
|
||||
bool IsFighting() const;
|
||||
|
||||
bool LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult);
|
||||
bool LoadMembersFromDB(QueryResult *arenaTeamMembersResult);
|
||||
bool LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult);
|
||||
bool LoadMembersFromDB(QueryResult* arenaTeamMembersResult);
|
||||
void LoadStatsFromDB(uint32 ArenaTeamId);
|
||||
|
||||
void SaveToDB();
|
||||
|
||||
void BroadcastPacket(WorldPacket *packet);
|
||||
void BroadcastPacket(WorldPacket* packet);
|
||||
|
||||
void BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char const* str1 = NULL, char const* str2 = NULL, char const* str3 = NULL);
|
||||
void BroadcastEvent(ArenaTeamEvents event, char const* str1 = NULL, char const* str2 = NULL, char const* str3 = NULL)
|
||||
|
|
@ -187,20 +187,20 @@ class ArenaTeam
|
|||
BroadcastEvent(event, ObjectGuid(), str1, str2, str3);
|
||||
}
|
||||
|
||||
void Roster(WorldSession *session);
|
||||
void Query(WorldSession *session);
|
||||
void Stats(WorldSession *session);
|
||||
void InspectStats(WorldSession *session, ObjectGuid guid);
|
||||
void Roster(WorldSession* session);
|
||||
void Query(WorldSession* session);
|
||||
void Stats(WorldSession* session);
|
||||
void InspectStats(WorldSession* session, ObjectGuid guid);
|
||||
|
||||
uint32 GetPoints(uint32 MemberRating);
|
||||
float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating);
|
||||
int32 WonAgainst(uint32 againstRating);
|
||||
void MemberWon(Player * plr, uint32 againstRating);
|
||||
void MemberWon(Player* plr, uint32 againstRating);
|
||||
int32 LostAgainst(uint32 againstRating);
|
||||
void MemberLost(Player * plr, uint32 againstRating);
|
||||
void MemberLost(Player* plr, uint32 againstRating);
|
||||
void OfflineMemberLost(ObjectGuid guid, uint32 againstRating);
|
||||
|
||||
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
|
||||
void UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints);
|
||||
|
||||
void NotifyStatsChanged();
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include "World.h"
|
||||
#include "SocialMgr.h"
|
||||
|
||||
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("MSG_INSPECT_ARENA_TEAMS");
|
||||
|
||||
|
|
@ -34,84 +34,84 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
|
|||
recv_data >> guid;
|
||||
DEBUG_LOG("Inspect Arena stats %s", guid.GetString().c_str());
|
||||
|
||||
if(Player *plr = sObjectMgr.GetPlayer(guid))
|
||||
if (Player* plr = sObjectMgr.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 = sObjectMgr.GetArenaTeamById(a_id))
|
||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(a_id))
|
||||
at->InspectStats(this, plr->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Received CMSG_ARENA_TEAM_QUERY" );
|
||||
DEBUG_LOG("WORLD: Received CMSG_ARENA_TEAM_QUERY");
|
||||
|
||||
uint32 ArenaTeamId;
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
if(ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
{
|
||||
arenateam->Query(this);
|
||||
arenateam->Stats(this);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Received CMSG_ARENA_TEAM_ROSTER" );
|
||||
DEBUG_LOG("WORLD: Received CMSG_ARENA_TEAM_ROSTER");
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
if(ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
arenateam->Roster(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_INVITE");
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
std::string Invitedname;
|
||||
|
||||
Player * player = NULL;
|
||||
Player* player = NULL;
|
||||
|
||||
recv_data >> ArenaTeamId >> Invitedname;
|
||||
|
||||
if(!Invitedname.empty())
|
||||
if (!Invitedname.empty())
|
||||
{
|
||||
if(!normalizePlayerName(Invitedname))
|
||||
if (!normalizePlayerName(Invitedname))
|
||||
return;
|
||||
|
||||
player = ObjectAccessor::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_UINT32_MAX_PLAYER_LEVEL))
|
||||
if (player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
|
||||
return;
|
||||
}
|
||||
|
||||
ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
if(!arenateam)
|
||||
ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
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()->GetObjectGuid()))
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
|
||||
|
|
@ -120,19 +120,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->GetMaxMembersSize())
|
||||
if (arenateam->GetMembersSize() >= arenateam->GetMaxMembersSize())
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, arenateam->GetName(), "", ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S);
|
||||
return;
|
||||
|
|
@ -150,11 +150,11 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
|||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_INVITE");
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
|
||||
|
||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
|
||||
if (!at)
|
||||
return;
|
||||
|
||||
|
|
@ -184,21 +184,21 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
|
|||
at->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetObjectGuid(), _player->GetName(), at->GetName().c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_DECLINE"); // empty opcode
|
||||
|
||||
_player->SetArenaTeamIdInvited(0); // no more invited
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_LEAVE");
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
if (!at)
|
||||
return;
|
||||
|
||||
|
|
@ -226,14 +226,14 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
|
|||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_DISBAND");
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
if (ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
{
|
||||
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
||||
return;
|
||||
|
|
@ -246,7 +246,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_REMOVE");
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
|
|||
recv_data >> ArenaTeamId;
|
||||
recv_data >> name;
|
||||
|
||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
if (!at) // arena team not found
|
||||
return;
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
|
|||
at->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, name.c_str(), at->GetName().c_str(), _player->GetName());
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_ARENA_TEAM_LEADER");
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
|
|||
recv_data >> ArenaTeamId;
|
||||
recv_data >> name;
|
||||
|
||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||
if (!at) // arena team not found
|
||||
return;
|
||||
|
||||
|
|
@ -342,7 +342,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class AHB_Seller_Config
|
|||
uint32 GetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
|
||||
void SetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass, uint32 found)
|
||||
{
|
||||
if (m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems > found )
|
||||
if (m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems > found)
|
||||
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems=m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
|
||||
else
|
||||
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
|
||||
|
|
@ -191,7 +191,7 @@ class AuctionBotSeller : public AuctionBotAgent
|
|||
void addNewAuctions(AHB_Seller_Config& config);
|
||||
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
||||
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val);
|
||||
void SetItemsAmount(uint32 (&vals) [MAX_AUCTION_QUALITY]);
|
||||
void SetItemsAmount(uint32(&vals) [MAX_AUCTION_QUALITY]);
|
||||
void SetItemsAmountForQuality(AuctionQuality quality, uint32 val);
|
||||
void LoadConfig();
|
||||
|
||||
|
|
@ -202,13 +202,13 @@ class AuctionBotSeller : public AuctionBotAgent
|
|||
|
||||
void LoadSellerValues(AHB_Seller_Config& config);
|
||||
uint32 SetStat(AHB_Seller_Config& config);
|
||||
bool getRandomArray( AHB_Seller_Config& config, RandomArray& ra, const std::vector<std::vector<uint32> >& addedItem );
|
||||
void SetPricesOfItem(ItemPrototype const *itemProto, AHB_Seller_Config& config, uint32& buyp, uint32& bidp, uint32 stackcnt, ItemQualities itemQuality);
|
||||
bool getRandomArray(AHB_Seller_Config& config, RandomArray& ra, const std::vector<std::vector<uint32> >& addedItem);
|
||||
void SetPricesOfItem(ItemPrototype const* itemProto, AHB_Seller_Config& config, uint32& buyp, uint32& bidp, uint32 stackcnt, ItemQualities itemQuality);
|
||||
void LoadItemsQuantity(AHB_Seller_Config& config);
|
||||
};
|
||||
|
||||
INSTANTIATE_SINGLETON_1( AuctionHouseBot );
|
||||
INSTANTIATE_SINGLETON_1( AuctionBotConfig );
|
||||
INSTANTIATE_SINGLETON_1(AuctionHouseBot);
|
||||
INSTANTIATE_SINGLETON_1(AuctionBotConfig);
|
||||
|
||||
//== AuctionBotConfig functions ============================
|
||||
|
||||
|
|
@ -486,19 +486,19 @@ bool AuctionBotBuyer::Initialize()
|
|||
void AuctionBotBuyer::LoadBuyerValues(AHB_Buyer_Config& config)
|
||||
{
|
||||
uint32 FactionChance;
|
||||
switch(config.GetHouseType())
|
||||
switch (config.GetHouseType())
|
||||
{
|
||||
case AUCTION_HOUSE_ALLIANCE:
|
||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO )+50;
|
||||
FactionChance = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE );
|
||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO)+50;
|
||||
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE);
|
||||
break;
|
||||
case AUCTION_HOUSE_HORDE:
|
||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO )+50;
|
||||
FactionChance = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE );
|
||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO)+50;
|
||||
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE);
|
||||
break;
|
||||
default:
|
||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO )+50;
|
||||
FactionChance = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL );
|
||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO)+50;
|
||||
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL);
|
||||
break;
|
||||
}
|
||||
config.FactionChance=5000*FactionChance;
|
||||
|
|
@ -523,11 +523,11 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
|
|||
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(config.GetHouseType())->GetAuctionsBounds();
|
||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = itr->second;
|
||||
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
if (item)
|
||||
{
|
||||
ItemPrototype const *prototype = item->GetProto();
|
||||
ItemPrototype const* prototype = item->GetProto();
|
||||
if (prototype)
|
||||
{
|
||||
++config.SameItemInfo[item->GetEntry()].ItemCount; // Structure constructor will make sure Element are correctly initialised if entry is created here.
|
||||
|
|
@ -586,7 +586,7 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
|
|||
{
|
||||
time_t Now=time(NULL)-5;
|
||||
|
||||
for (CheckEntryMap::iterator itr=config.CheckedEntry.begin();itr != config.CheckedEntry.end();)
|
||||
for (CheckEntryMap::iterator itr=config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
|
||||
{
|
||||
if (itr->second.LastExist < (Now-5))
|
||||
config.CheckedEntry.erase(itr++);
|
||||
|
|
@ -699,7 +699,8 @@ bool AuctionBotBuyer::IsBidableEntry(uint32 bidPrice, double InGame_BuyPrice, do
|
|||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BID! Chance = %u, num = %u.",Chance, RandNum);
|
||||
return true;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: LOOSE BID! Chance = %u, num = %u.",Chance, RandNum);
|
||||
return false;
|
||||
|
|
@ -758,19 +759,19 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
|||
|
||||
uint32 MaxChance=5000;
|
||||
|
||||
Item *item = sAuctionMgr.GetAItem(auction->itemGuidLow);
|
||||
Item* item = sAuctionMgr.GetAItem(auction->itemGuidLow);
|
||||
if (!item) // auction item not accessible, possible auction in payment pending mode
|
||||
{
|
||||
config.CheckedEntry.erase(itr++);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemPrototype const *prototype = item->GetProto();
|
||||
ItemPrototype const* prototype = item->GetProto();
|
||||
|
||||
uint32 BasePrice = sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
|
||||
BasePrice *= item->GetCount();
|
||||
|
||||
double MaxBuyablePrice = ( BasePrice * config.BuyerPriceRatio )/100;
|
||||
double MaxBuyablePrice = (BasePrice * config.BuyerPriceRatio)/100;
|
||||
BuyerItemInfoMap::iterator sameitem_itr = config.SameItemInfo.find(item->GetEntry());
|
||||
uint32 buyoutPrice = auction->buyout/item->GetCount();
|
||||
|
||||
|
|
@ -801,7 +802,7 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
|||
InGame_BidPrice=sameitem_itr->second.BidPrice/sameitem_itr->second.ItemCount;
|
||||
}
|
||||
|
||||
double MaxBidablePrice = MaxBuyablePrice - ( MaxBuyablePrice / 30); // Max Bidable price defined to 70% of max buyable price
|
||||
double MaxBidablePrice = MaxBuyablePrice - (MaxBuyablePrice / 30); // Max Bidable price defined to 70% of max buyable price
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Auction added with data:");
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, MaxBuyablePrice / 10000);
|
||||
|
|
@ -903,7 +904,8 @@ bool AuctionBotSeller::Initialize()
|
|||
Field* fields = result->Fetch();
|
||||
npcItems.push_back(fields[0].GetUInt32());
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
|
|
@ -938,7 +940,8 @@ bool AuctionBotSeller::Initialize()
|
|||
continue;
|
||||
|
||||
lootItems.push_back(fields[0].GetUInt32());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
|
|
@ -1018,7 +1021,7 @@ bool AuctionBotSeller::Initialize()
|
|||
// no price filter
|
||||
if (sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_SELLER))
|
||||
{
|
||||
if(prototype->BuyPrice == 0)
|
||||
if (prototype->BuyPrice == 0)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
|
@ -1364,7 +1367,7 @@ void AuctionBotSeller::LoadSellerValues(AHB_Seller_Config& config)
|
|||
{
|
||||
LoadItemsQuantity(config);
|
||||
uint32 PriceRatio;
|
||||
switch(config.GetHouseType())
|
||||
switch (config.GetHouseType())
|
||||
{
|
||||
case AUCTION_HOUSE_ALLIANCE:
|
||||
PriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO);
|
||||
|
|
@ -1411,11 +1414,11 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
|
|||
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(config.GetHouseType())->GetAuctionsBounds();
|
||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = itr->second;
|
||||
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
if (item)
|
||||
{
|
||||
ItemPrototype const *prototype = item->GetProto();
|
||||
ItemPrototype const* prototype = item->GetProto();
|
||||
if (prototype)
|
||||
{
|
||||
if (!Aentry->owner) // Add only ahbot items
|
||||
|
|
@ -1428,7 +1431,7 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
|
|||
uint32 count=0;
|
||||
for (uint32 j=0; j<MAX_AUCTION_QUALITY; ++j)
|
||||
{
|
||||
for (uint32 i=0;i<MAX_ITEM_CLASS;++i)
|
||||
for (uint32 i=0; i<MAX_ITEM_CLASS; ++i)
|
||||
{
|
||||
config.SetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i, ItemsInAH[j][i]);
|
||||
count+=config.GetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i);
|
||||
|
|
@ -1436,7 +1439,7 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
|
|||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: Missed Item \tGrey\tWhite\tGreen\tBlue\tPurple\tOrange\tYellow");
|
||||
for (uint32 i=0; i<MAX_ITEM_CLASS;++i)
|
||||
for (uint32 i=0; i<MAX_ITEM_CLASS; ++i)
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: %-18s\t%u\t%u\t%u\t%u\t%u\t%u\t%u",
|
||||
sAuctionBotConfig.GetItemClassName(ItemClass(i)),
|
||||
|
|
@ -1453,7 +1456,7 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
|
|||
}
|
||||
|
||||
// getRandomArray is used to make aviable the possibility to add any of missed item in place of first one to last one.
|
||||
bool AuctionBotSeller::getRandomArray( AHB_Seller_Config& config, RandomArray& ra, const std::vector<std::vector<uint32> >& addedItem )
|
||||
bool AuctionBotSeller::getRandomArray(AHB_Seller_Config& config, RandomArray& ra, const std::vector<std::vector<uint32> >& addedItem)
|
||||
{
|
||||
ra.clear();
|
||||
bool Ok=false;
|
||||
|
|
@ -1476,7 +1479,7 @@ bool AuctionBotSeller::getRandomArray( AHB_Seller_Config& config, RandomArray& r
|
|||
}
|
||||
|
||||
// Set items price. All important value are passed by address.
|
||||
void AuctionBotSeller::SetPricesOfItem(ItemPrototype const *itemProto, AHB_Seller_Config& config, uint32& buyp, uint32& bidp, uint32 stackcnt, ItemQualities itemQuality)
|
||||
void AuctionBotSeller::SetPricesOfItem(ItemPrototype const* itemProto, AHB_Seller_Config& config, uint32& buyp, uint32& bidp, uint32 stackcnt, ItemQualities itemQuality)
|
||||
{
|
||||
double temp_buyp = buyp * stackcnt *
|
||||
(itemQuality < MAX_AUCTION_QUALITY ? config.GetPriceRatioPerQuality(AuctionQuality(itemQuality)) : 1) ;
|
||||
|
|
@ -1513,7 +1516,7 @@ void AuctionBotSeller::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
|||
LoadItemsQuantity(m_HouseConfig[house]);
|
||||
}
|
||||
|
||||
void AuctionBotSeller::SetItemsAmount(uint32 (&vals) [MAX_AUCTION_QUALITY])
|
||||
void AuctionBotSeller::SetItemsAmount(uint32(&vals) [MAX_AUCTION_QUALITY])
|
||||
{
|
||||
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT, vals[AUCTION_QUALITY_GREY]);
|
||||
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, vals[AUCTION_QUALITY_WHITE]);
|
||||
|
|
@ -1689,7 +1692,7 @@ void AuctionHouseBot::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
|||
seller->SetItemsRatioForHouse(house, val);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsAmount(uint32 (&vals) [MAX_AUCTION_QUALITY])
|
||||
void AuctionHouseBot::SetItemsAmount(uint32(&vals) [MAX_AUCTION_QUALITY])
|
||||
{
|
||||
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
|
||||
seller->SetItemsAmount(vals);
|
||||
|
|
@ -1725,10 +1728,10 @@ void AuctionHouseBot::PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo)
|
|||
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(AuctionHouseType(i))->GetAuctionsBounds();
|
||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = itr->second;
|
||||
if (Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow))
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow))
|
||||
{
|
||||
ItemPrototype const *prototype = item->GetProto();
|
||||
ItemPrototype const* prototype = item->GetProto();
|
||||
if (!Aentry->owner) // Add only ahbot items
|
||||
{
|
||||
if (prototype->Quality < MAX_AUCTION_QUALITY)
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class AuctionHouseBot
|
|||
// Followed method is mainly used by level3.cpp for ingame/console command
|
||||
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
||||
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val);
|
||||
void SetItemsAmount(uint32 (&vals) [MAX_AUCTION_QUALITY]);
|
||||
void SetItemsAmount(uint32(&vals) [MAX_AUCTION_QUALITY]);
|
||||
void SetItemsAmountForQuality(AuctionQuality quality, uint32 val);
|
||||
bool ReloadAllConfig();
|
||||
void Rebuild(bool all);
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@
|
|||
// post-incrementation is always slower than pre-incrementation !
|
||||
|
||||
// void called when player click on auctioneer npc
|
||||
void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid auctioneerGuid; // NPC guid
|
||||
recv_data >> auctioneerGuid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(auctioneerGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(auctioneerGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionHelloOpcode - %s not found or you can't interact with him.", auctioneerGuid.GetString().c_str());
|
||||
|
|
@ -67,7 +67,7 @@ void WorldSession::SendAuctionHello(Unit* unit)
|
|||
}
|
||||
|
||||
// call this method when player bids, creates, or deletes auction
|
||||
void WorldSession::SendAuctionCommandResult(AuctionEntry *auc, AuctionAction Action, AuctionError ErrorCode, InventoryResult invError)
|
||||
void WorldSession::SendAuctionCommandResult(AuctionEntry* auc, AuctionAction Action, AuctionError ErrorCode, InventoryResult invError)
|
||||
{
|
||||
WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 16);
|
||||
data << uint32(auc ? auc->Id : 0);
|
||||
|
|
@ -149,13 +149,13 @@ void WorldSession::SendAuctionRemovedNotification(AuctionEntry* auction)
|
|||
}
|
||||
|
||||
// this function sends mail to old bidder
|
||||
void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction)
|
||||
void WorldSession::SendAuctionOutbiddedMail(AuctionEntry* auction)
|
||||
{
|
||||
ObjectGuid oldBidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||
Player *oldBidder = sObjectMgr.GetPlayer(oldBidder_guid);
|
||||
Player* oldBidder = sObjectMgr.GetPlayer(oldBidder_guid);
|
||||
|
||||
uint32 oldBidder_accId = 0;
|
||||
if(!oldBidder)
|
||||
if (!oldBidder)
|
||||
oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
|
||||
|
||||
// old bidder exist
|
||||
|
|
@ -177,7 +177,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction)
|
|||
void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
||||
{
|
||||
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||
Player *bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||
Player* bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
if (!bidder)
|
||||
|
|
@ -231,7 +231,7 @@ AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(Objec
|
|||
}
|
||||
|
||||
// this void creates new auction and adds auction to some auctionhouse
|
||||
void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionSellItem");
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||
if (!bid || !etime)
|
||||
return; // check for cheaters
|
||||
|
||||
Player *pl = GetPlayer();
|
||||
Player* pl = GetPlayer();
|
||||
|
||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||
if (!auctionHouseEntry)
|
||||
|
|
@ -301,7 +301,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||
|
||||
uint32 stackSize = stackSizes[i];
|
||||
|
||||
Item *it = pl->GetItemByGuid(itemGuid);
|
||||
Item* it = pl->GetItemByGuid(itemGuid);
|
||||
|
||||
// do not allow to sell already auctioned items
|
||||
if (sAuctionMgr.GetAItem(itemGuid.GetCounter()))
|
||||
|
|
@ -353,7 +353,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
||||
continue;
|
||||
|
||||
Item *newItem = it->CloneItem(stackSize);
|
||||
Item* newItem = it->CloneItem(stackSize);
|
||||
|
||||
pl->DestroyItemCount(it, stackSize, true);
|
||||
|
||||
|
|
@ -371,7 +371,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// this function is called when client bids or buys out auction
|
||||
void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionPlaceBid");
|
||||
|
||||
|
|
@ -395,8 +395,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionEntry *auction = auctionHouse->GetAuction(auctionId);
|
||||
Player *pl = GetPlayer();
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
Player* pl = GetPlayer();
|
||||
|
||||
if (!auction || auction->owner == pl->GetGUIDLow())
|
||||
{
|
||||
|
|
@ -453,7 +453,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// this void is called when auction_owner cancels his auction
|
||||
void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionRemoveItem");
|
||||
|
||||
|
|
@ -474,8 +474,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionEntry *auction = auctionHouse->GetAuction(auctionId);
|
||||
Player *pl = GetPlayer();
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
Player* pl = GetPlayer();
|
||||
|
||||
if (!auction || auction->owner != pl->GetGUIDLow())
|
||||
{
|
||||
|
|
@ -484,7 +484,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||
return;
|
||||
}
|
||||
|
||||
Item *pItem = sAuctionMgr.GetAItem(auction->itemGuidLow);
|
||||
Item* pItem = sAuctionMgr.GetAItem(auction->itemGuidLow);
|
||||
if (!pItem)
|
||||
{
|
||||
sLog.outError("Auction id: %u has nonexistent item (item guid : %u)!!!", auction->Id, auction->itemGuidLow);
|
||||
|
|
@ -525,7 +525,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// called when player lists his bids
|
||||
void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionListBidderItems");
|
||||
|
||||
|
|
@ -554,7 +554,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
|||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
|
||||
Player *pl = GetPlayer();
|
||||
Player* pl = GetPlayer();
|
||||
data << uint32(0); // add 0 as count
|
||||
uint32 count = 0;
|
||||
uint32 totalcount = 0;
|
||||
|
|
@ -563,7 +563,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
|||
--outbiddedCount;
|
||||
uint32 outbiddedAuctionId;
|
||||
recv_data >> outbiddedAuctionId;
|
||||
AuctionEntry *auction = auctionHouse->GetAuction(outbiddedAuctionId);
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
|
||||
if (auction && auction->BuildAuctionInfo(data))
|
||||
{
|
||||
++totalcount;
|
||||
|
|
@ -579,7 +579,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// this void sends player info about his auctions
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionListOwnerItems");
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// this void is called when player clicks on search button
|
||||
void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleAuctionListItems");
|
||||
|
||||
|
|
@ -696,7 +696,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAuctionListPendingSales(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAuctionListPendingSales(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_AUCTION_LIST_PENDING_SALES");
|
||||
|
||||
|
|
|
|||
|
|
@ -44,17 +44,17 @@ AuctionHouseMgr::AuctionHouseMgr()
|
|||
|
||||
AuctionHouseMgr::~AuctionHouseMgr()
|
||||
{
|
||||
for(ItemMap::const_iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr)
|
||||
for (ItemMap::const_iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr)
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house)
|
||||
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house)
|
||||
{
|
||||
if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
return &mAuctions[AUCTION_HOUSE_NEUTRAL];
|
||||
|
||||
// team have linked auction houses
|
||||
switch(GetAuctionHouseTeam(house))
|
||||
switch (GetAuctionHouseTeam(house))
|
||||
{
|
||||
case ALLIANCE: return &mAuctions[AUCTION_HOUSE_ALLIANCE];
|
||||
case HORDE: return &mAuctions[AUCTION_HOUSE_HORDE];
|
||||
|
|
@ -62,7 +62,7 @@ AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* ho
|
|||
}
|
||||
}
|
||||
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem)
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem)
|
||||
{
|
||||
float deposit = float(pItem->GetProto()->SellPrice * pItem->GetCount() * (time / MIN_AUCTION_TIME));
|
||||
|
||||
|
|
@ -77,14 +77,14 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
|||
}
|
||||
|
||||
// does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction)
|
||||
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||
{
|
||||
Item *pItem = GetAItem(auction->itemGuidLow);
|
||||
Item* pItem = GetAItem(auction->itemGuidLow);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||
Player *bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||
Player* bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
|
||||
|
|
@ -176,10 +176,10 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction)
|
|||
}
|
||||
|
||||
// call this method to send mail to auction owner, when auction is successful, it does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction)
|
||||
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction)
|
||||
{
|
||||
ObjectGuid owner_guid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
|
||||
Player *owner = sObjectMgr.GetPlayer(owner_guid);
|
||||
Player* owner = sObjectMgr.GetPlayer(owner_guid);
|
||||
|
||||
uint32 owner_accId = 0;
|
||||
if (!owner)
|
||||
|
|
@ -217,9 +217,10 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction)
|
|||
}
|
||||
|
||||
// does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
||||
{ // return an item in auction to its owner by mail
|
||||
Item *pItem = GetAItem(auction->itemGuidLow);
|
||||
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
||||
{
|
||||
// return an item in auction to its owner by mail
|
||||
Item* pItem = GetAItem(auction->itemGuidLow);
|
||||
if (!pItem)
|
||||
{
|
||||
sLog.outError("Auction item (GUID: %u) not found, and lost.", auction->itemGuidLow);
|
||||
|
|
@ -227,7 +228,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
|||
}
|
||||
|
||||
ObjectGuid owner_guid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
|
||||
Player *owner = sObjectMgr.GetPlayer(owner_guid);
|
||||
Player* owner = sObjectMgr.GetPlayer(owner_guid);
|
||||
|
||||
uint32 owner_accId = 0;
|
||||
if (!owner)
|
||||
|
|
@ -263,7 +264,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
|||
void AuctionHouseMgr::LoadAuctionItems()
|
||||
{
|
||||
// data needs to be at first place for Item::LoadFromDB 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT data,text,itemguid,item_template FROM auction JOIN item_instance ON itemguid = guid");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT data,text,itemguid,item_template FROM auction JOIN item_instance ON itemguid = guid");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -278,7 +279,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
|
||||
uint32 count = 0;
|
||||
|
||||
Field *fields;
|
||||
Field* fields;
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
|
|
@ -287,7 +288,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
uint32 item_guid = fields[2].GetUInt32();
|
||||
uint32 item_template = fields[3].GetUInt32();
|
||||
|
||||
ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template);
|
||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item_template);
|
||||
|
||||
if (!proto)
|
||||
{
|
||||
|
|
@ -295,7 +296,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
continue;
|
||||
}
|
||||
|
||||
Item *item = NewItemOrBag(proto);
|
||||
Item* item = NewItemOrBag(proto);
|
||||
|
||||
if (!item->LoadFromDB(item_guid, fields))
|
||||
{
|
||||
|
|
@ -315,7 +316,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
|||
|
||||
void AuctionHouseMgr::LoadAuctions()
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction");
|
||||
if (!result)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
|
|
@ -325,7 +326,7 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
return;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
uint32 AuctionCount=fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
|
|
@ -359,7 +360,7 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
|
||||
bar.step();
|
||||
|
||||
AuctionEntry *auction = new AuctionEntry;
|
||||
AuctionEntry* auction = new AuctionEntry;
|
||||
auction->Id = fields[0].GetUInt32();
|
||||
uint32 houseid = fields[1].GetUInt32();
|
||||
auction->itemGuidLow = fields[2].GetUInt32();
|
||||
|
|
@ -455,7 +456,8 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
|
||||
GetAuctionsMap(auction->auctionHouseEntry)->AddAuction(auction);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
|
|
@ -567,7 +569,7 @@ void AuctionHouseObject::Update()
|
|||
{
|
||||
time_t curTime = sWorld.GetGameTime();
|
||||
///- Handle expired auctions
|
||||
for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); )
|
||||
for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end();)
|
||||
{
|
||||
if (itr->second->moneyDeliveryTime) // pending auction
|
||||
{
|
||||
|
|
@ -608,9 +610,9 @@ void AuctionHouseObject::Update()
|
|||
|
||||
void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount)
|
||||
{
|
||||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin();itr != AuctionsMap.end();++itr)
|
||||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = itr->second;
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||
continue;
|
||||
if (Aentry->bidder == player->GetGUIDLow())
|
||||
|
|
@ -626,7 +628,7 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
|||
{
|
||||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = itr->second;
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||
continue;
|
||||
if (Aentry->owner == player->GetGUIDLow())
|
||||
|
|
@ -638,7 +640,7 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
|||
}
|
||||
}
|
||||
|
||||
int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Player* viewPlayer) const
|
||||
int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Player* viewPlayer) const
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
|
|
@ -771,7 +773,7 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Pl
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool AuctionSorter::operator()(const AuctionEntry *auc1, const AuctionEntry *auc2) const
|
||||
bool AuctionSorter::operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const
|
||||
{
|
||||
if (m_sort[0] == MAX_AUCTION_SORT) // not sorted
|
||||
return false;
|
||||
|
|
@ -799,10 +801,10 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
|
||||
for (std::vector<AuctionEntry*>::const_iterator itr = auctions.begin(); itr != auctions.end(); ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = *itr;
|
||||
AuctionEntry* Aentry = *itr;
|
||||
if (Aentry->moneyDeliveryTime)
|
||||
continue;
|
||||
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
|
|
@ -813,7 +815,7 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemPrototype const *proto = item->GetProto();
|
||||
ItemPrototype const* proto = item->GetProto();
|
||||
|
||||
if (itemClass != 0xffffffff && proto->Class != itemClass)
|
||||
continue;
|
||||
|
|
@ -854,7 +856,7 @@ void AuctionHouseObject::BuildListPendingSales(WorldPacket& data, Player* player
|
|||
{
|
||||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry *Aentry = itr->second;
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (!Aentry->moneyDeliveryTime) // skip not pending auctions
|
||||
continue;
|
||||
if (Aentry->owner == player->GetGUIDLow())
|
||||
|
|
@ -878,11 +880,11 @@ void AuctionHouseObject::BuildListPendingSales(WorldPacket& data, Player* player
|
|||
}
|
||||
}
|
||||
|
||||
AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHouseEntry, Item* newItem, uint32 etime, uint32 bid, uint32 buyout, uint32 deposit, Player * pl /*= NULL*/)
|
||||
AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHouseEntry, Item* newItem, uint32 etime, uint32 bid, uint32 buyout, uint32 deposit, Player* pl /*= NULL*/)
|
||||
{
|
||||
uint32 auction_time = uint32(etime * sWorld.getConfig(CONFIG_FLOAT_RATE_AUCTION_TIME));
|
||||
|
||||
AuctionEntry *AH = new AuctionEntry;
|
||||
AuctionEntry* AH = new AuctionEntry;
|
||||
AH->Id = sObjectMgr.GenerateAuctionID();
|
||||
AH->itemGuidLow = newItem->GetObjectGuid().GetCounter();
|
||||
AH->itemTemplate = newItem->GetEntry();
|
||||
|
|
@ -920,9 +922,9 @@ AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHou
|
|||
}
|
||||
|
||||
// this function inserts to WorldPacket auction's data
|
||||
bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const
|
||||
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
||||
{
|
||||
Item *pItem = sAuctionMgr.GetAItem(itemGuidLow);
|
||||
Item* pItem = sAuctionMgr.GetAItem(itemGuidLow);
|
||||
if (!pItem)
|
||||
{
|
||||
sLog.outError("auction to item, that doesn't exist !!!!");
|
||||
|
|
|
|||
|
|
@ -76,13 +76,13 @@ struct AuctionEntry
|
|||
uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
|
||||
uint32 GetAuctionCut() const;
|
||||
uint32 GetAuctionOutBid() const;
|
||||
bool BuildAuctionInfo(WorldPacket & data) const;
|
||||
bool BuildAuctionInfo(WorldPacket& data) const;
|
||||
void DeleteFromDB() const;
|
||||
void SaveToDB() const;
|
||||
void AuctionBidWinning(Player* bidder = NULL);
|
||||
|
||||
// -1,0,+1 order result
|
||||
int CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Player* viewPlayer) const;
|
||||
int CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Player* viewPlayer) const;
|
||||
|
||||
bool UpdateBid(uint32 newbid, Player* newbidder = NULL);// true if normal bid, false if buyout, bidder==NULL for generated bid
|
||||
};
|
||||
|
|
@ -106,15 +106,15 @@ class AuctionHouseObject
|
|||
AuctionEntryMap const& GetAuctions() const { return AuctionsMap; }
|
||||
AuctionEntryMapBounds GetAuctionsBounds() const {return AuctionEntryMapBounds(AuctionsMap.begin(), AuctionsMap.end()); }
|
||||
|
||||
void AddAuction(AuctionEntry *ah)
|
||||
void AddAuction(AuctionEntry* ah)
|
||||
{
|
||||
MANGOS_ASSERT( ah );
|
||||
MANGOS_ASSERT(ah);
|
||||
AuctionsMap[ah->Id] = ah;
|
||||
}
|
||||
|
||||
AuctionEntry* GetAuction(uint32 id) const
|
||||
{
|
||||
AuctionEntryMap::const_iterator itr = AuctionsMap.find( id );
|
||||
AuctionEntryMap::const_iterator itr = AuctionsMap.find(id);
|
||||
return itr != AuctionsMap.end() ? itr->second : NULL;
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ class AuctionHouseObject
|
|||
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
void BuildListPendingSales(WorldPacket& data, Player* player, uint32& count);
|
||||
|
||||
AuctionEntry* AddAuction(AuctionHouseEntry const* auctionHouseEntry, Item* newItem, uint32 etime, uint32 bid, uint32 buyout = 0, uint32 deposit = 0, Player * pl = NULL);
|
||||
AuctionEntry* AddAuction(AuctionHouseEntry const* auctionHouseEntry, Item* newItem, uint32 etime, uint32 bid, uint32 buyout = 0, uint32 deposit = 0, Player* pl = NULL);
|
||||
private:
|
||||
AuctionEntryMap AuctionsMap;
|
||||
};
|
||||
|
|
@ -138,8 +138,8 @@ class AuctionSorter
|
|||
{
|
||||
public:
|
||||
AuctionSorter(AuctionSorter const& sorter) : m_sort(sorter.m_sort), m_viewPlayer(sorter.m_viewPlayer) {}
|
||||
AuctionSorter(uint8 *sort, Player* viewPlayer) : m_sort(sort), m_viewPlayer(viewPlayer) {}
|
||||
bool operator()(const AuctionEntry *auc1, const AuctionEntry *auc2) const;
|
||||
AuctionSorter(uint8* sort, Player* viewPlayer) : m_sort(sort), m_viewPlayer(viewPlayer) {}
|
||||
bool operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const;
|
||||
|
||||
private:
|
||||
uint8* m_sort;
|
||||
|
|
@ -177,10 +177,10 @@ class AuctionHouseMgr
|
|||
}
|
||||
|
||||
//auction messages
|
||||
void SendAuctionWonMail( AuctionEntry * auction );
|
||||
void SendAuctionSuccessfulMail( AuctionEntry * auction );
|
||||
void SendAuctionExpiredMail( AuctionEntry * auction );
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
|
||||
void SendAuctionWonMail(AuctionEntry* auction);
|
||||
void SendAuctionSuccessfulMail(AuctionEntry* auction);
|
||||
void SendAuctionExpiredMail(AuctionEntry* auction);
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem);
|
||||
|
||||
static uint32 GetAuctionHouseTeam(AuctionHouseEntry const* house);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(Unit* unit);
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) con
|
|||
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory )
|
||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory)
|
||||
count += m_bagslot[i]->GetCount();
|
||||
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Bag : public Item
|
|||
bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
|
||||
|
||||
void Clear();
|
||||
void StoreItem(uint8 slot, Item *pItem, bool update);
|
||||
void StoreItem(uint8 slot, Item* pItem, bool update);
|
||||
void RemoveItem(uint8 slot, bool update);
|
||||
|
||||
Item* GetItemByPos(uint8 slot) const;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MaNGOS
|
|||
va_copy(ap,*i_args);
|
||||
|
||||
char str [2048];
|
||||
vsnprintf(str,2048,text, ap );
|
||||
vsnprintf(str,2048,text, ap);
|
||||
va_end(ap);
|
||||
|
||||
do_helper(data,&str[0]);
|
||||
|
|
@ -91,14 +91,14 @@ namespace MaNGOS
|
|||
{
|
||||
char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx);
|
||||
|
||||
if(i_args)
|
||||
if (i_args)
|
||||
{
|
||||
// we need copy va_list before use or original va_list will corrupted
|
||||
va_list ap;
|
||||
va_copy(ap,*i_args);
|
||||
|
||||
char str [2048];
|
||||
vsnprintf(str,2048,text, ap );
|
||||
vsnprintf(str,2048,text, ap);
|
||||
va_end(ap);
|
||||
|
||||
do_helper(data,&str[0]);
|
||||
|
|
@ -141,7 +141,7 @@ namespace MaNGOS
|
|||
char const* arg2str = i_arg2 ? sObjectMgr.GetMangosString(i_arg2,loc_idx) : "";
|
||||
|
||||
char str [2048];
|
||||
snprintf(str,2048,text, arg1str, arg2str );
|
||||
snprintf(str,2048,text, arg1str, arg2str);
|
||||
|
||||
ObjectGuid targetGuid = i_source ? i_source ->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
|
|
@ -201,8 +201,8 @@ namespace MaNGOS
|
|||
template<class Do>
|
||||
void BattleGround::BroadcastWorker(Do& _do)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
_do(plr);
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ BattleGround::~BattleGround()
|
|||
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
|
||||
|
||||
int size = m_BgObjects.size();
|
||||
for(int i = 0; i < size; ++i)
|
||||
for (int i = 0; i < size; ++i)
|
||||
DelObject(i);
|
||||
|
||||
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
|
||||
|
|
@ -300,7 +300,7 @@ BattleGround::~BattleGround()
|
|||
// remove from bg free slot queue
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
|
||||
for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -462,7 +462,7 @@ void BattleGround::Update(uint32 diff)
|
|||
|
||||
PlaySoundToAll(SOUND_BG_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||
//Announce BG starting
|
||||
|
|
@ -486,7 +486,7 @@ void BattleGround::Update(uint32 diff)
|
|||
{
|
||||
m_EndTime = 0;
|
||||
BattleGroundPlayerMap::iterator itr, next;
|
||||
for(itr = m_Players.begin(); itr != m_Players.end(); itr = next)
|
||||
for (itr = m_Players.begin(); itr != m_Players.end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
|
|
@ -510,28 +510,28 @@ void BattleGround::SetTeamStartLoc(Team team, float X, float Y, float Z, float O
|
|||
m_TeamStartLocO[teamIdx] = O;
|
||||
}
|
||||
|
||||
void BattleGround::SendPacketToAll(WorldPacket *packet)
|
||||
void BattleGround::SendPacketToAll(WorldPacket* packet)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
continue;
|
||||
|
||||
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
|
||||
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
else
|
||||
sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGround::SendPacketToTeam(Team teamId, WorldPacket *packet, Player *sender, bool self)
|
||||
void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* sender, bool self)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
continue;
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround:SendPacketToTeam: %s not found!", itr->first.GetString().c_str());
|
||||
|
|
@ -560,12 +560,12 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
|||
{
|
||||
WorldPacket data;
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
continue;
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround:PlaySoundToTeam: %s not found!", itr->first.GetString().c_str());
|
||||
|
|
@ -573,7 +573,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if(!team) team = plr->GetTeam();
|
||||
if (!team) team = plr->GetTeam();
|
||||
|
||||
if (team == teamId)
|
||||
{
|
||||
|
|
@ -585,12 +585,12 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
|||
|
||||
void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
continue;
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
if (!plr)
|
||||
{
|
||||
|
|
@ -599,7 +599,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if(!team) team = plr->GetTeam();
|
||||
if (!team) team = plr->GetTeam();
|
||||
|
||||
if (team == teamId)
|
||||
plr->CastSpell(plr, SpellID, true);
|
||||
|
|
@ -608,12 +608,12 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
|||
|
||||
void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
||||
{
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
continue;
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
if (!plr)
|
||||
{
|
||||
|
|
@ -622,7 +622,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if(!team) team = plr->GetTeam();
|
||||
if (!team) team = plr->GetTeam();
|
||||
|
||||
if (team == teamId)
|
||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
|
||||
|
|
@ -636,12 +636,12 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
if (!factionEntry)
|
||||
return;
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
continue;
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
if (!plr)
|
||||
{
|
||||
|
|
@ -650,7 +650,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if(!team) team = plr->GetTeam();
|
||||
if (!team) team = plr->GetTeam();
|
||||
|
||||
if (team == teamId)
|
||||
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
|
||||
|
|
@ -664,7 +664,7 @@ void BattleGround::UpdateWorldState(uint32 Field, uint32 Value)
|
|||
SendPacketToAll(&data);
|
||||
}
|
||||
|
||||
void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source)
|
||||
void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value);
|
||||
|
|
@ -675,8 +675,8 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
{
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
|
||||
ArenaTeam * winner_arena_team = NULL;
|
||||
ArenaTeam * loser_arena_team = NULL;
|
||||
ArenaTeam* winner_arena_team = NULL;
|
||||
ArenaTeam* loser_arena_team = NULL;
|
||||
uint32 loser_rating = 0;
|
||||
uint32 winner_rating = 0;
|
||||
WorldPacket data;
|
||||
|
|
@ -723,7 +723,7 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
}
|
||||
}
|
||||
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Team team = itr->second.PlayerTeam;
|
||||
|
||||
|
|
@ -740,7 +740,7 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
continue;
|
||||
}
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround:EndBattleGround %s not found!", itr->first.GetString().c_str());
|
||||
|
|
@ -841,7 +841,7 @@ uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const
|
|||
|
||||
uint32 BattleGround::GetBattlemasterEntry() const
|
||||
{
|
||||
switch(GetTypeID())
|
||||
switch (GetTypeID())
|
||||
{
|
||||
case BATTLEGROUND_AV: return 15972;
|
||||
case BATTLEGROUND_WS: return 14623;
|
||||
|
|
@ -852,9 +852,9 @@ uint32 BattleGround::GetBattlemasterEntry() const
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGround::RewardMark(Player *plr,uint32 count)
|
||||
void BattleGround::RewardMark(Player* plr,uint32 count)
|
||||
{
|
||||
switch(GetTypeID())
|
||||
switch (GetTypeID())
|
||||
{
|
||||
case BATTLEGROUND_AV:
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
|
|
@ -880,14 +880,14 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id)
|
||||
void BattleGround::RewardSpellCast(Player* plr, uint32 spell_id)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
return;
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if(!spellInfo)
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog.outError("Battleground reward casting spell %u not exist.",spell_id);
|
||||
return;
|
||||
|
|
@ -896,7 +896,7 @@ void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id)
|
|||
plr->CastSpell(plr, spellInfo, true);
|
||||
}
|
||||
|
||||
void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count)
|
||||
void BattleGround::RewardItem(Player* plr, uint32 item_id, uint32 count)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
|
|
@ -904,26 +904,26 @@ void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count)
|
|||
|
||||
ItemPosCountVec dest;
|
||||
uint32 no_space_count = 0;
|
||||
uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count );
|
||||
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 (Item* item = plr->StoreNewItem( dest, item_id, true, 0))
|
||||
if (count != 0 && !dest.empty()) // can add some
|
||||
if (Item* item = plr->StoreNewItem(dest, item_id, true, 0))
|
||||
plr->SendNewItem(item,count,true,false);
|
||||
|
||||
if (no_space_count > 0)
|
||||
SendRewardMarkByMail(plr,item_id,no_space_count);
|
||||
}
|
||||
|
||||
void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
||||
void BattleGround::SendRewardMarkByMail(Player* plr,uint32 mark, uint32 count)
|
||||
{
|
||||
uint32 bmEntry = GetBattlemasterEntry();
|
||||
if (!bmEntry)
|
||||
|
|
@ -955,10 +955,10 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGround::RewardQuestComplete(Player *plr)
|
||||
void BattleGround::RewardQuestComplete(Player* plr)
|
||||
{
|
||||
uint32 quest;
|
||||
switch(GetTypeID())
|
||||
switch (GetTypeID())
|
||||
{
|
||||
case BATTLEGROUND_AV:
|
||||
quest = SPELL_AV_QUEST_REWARD;
|
||||
|
|
@ -979,7 +979,7 @@ void BattleGround::RewardQuestComplete(Player *plr)
|
|||
RewardSpellCast(plr, quest);
|
||||
}
|
||||
|
||||
void BattleGround::BlockMovement(Player *plr)
|
||||
void BattleGround::BlockMovement(Player* plr)
|
||||
{
|
||||
plr->SetClientControl(plr, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
|
||||
}
|
||||
|
|
@ -1005,7 +1005,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
m_PlayerScores.erase(itr2);
|
||||
}
|
||||
|
||||
Player *plr = sObjectMgr.GetPlayer(guid);
|
||||
Player* plr = sObjectMgr.GetPlayer(guid);
|
||||
|
||||
if (plr)
|
||||
{
|
||||
|
|
@ -1024,7 +1024,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
|
||||
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());
|
||||
|
|
@ -1047,8 +1047,8 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam * winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam * loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
ArenaTeam* winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam* loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if (winner_arena_team && loser_arena_team)
|
||||
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
||||
}
|
||||
|
|
@ -1069,17 +1069,17 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam * others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam * players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
ArenaTeam* others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam* players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if (others_arena_team && players_arena_team)
|
||||
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
|
||||
// remove from raid group if player is member
|
||||
if (Group *group = GetBgRaid(team))
|
||||
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;
|
||||
|
|
@ -1145,7 +1145,7 @@ void BattleGround::Reset()
|
|||
|
||||
m_Players.clear();
|
||||
|
||||
for(BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
|
||||
delete itr->second;
|
||||
m_PlayerScores.clear();
|
||||
}
|
||||
|
|
@ -1170,7 +1170,7 @@ void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 e
|
|||
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
|
||||
}
|
||||
|
||||
void BattleGround::AddPlayer(Player *plr)
|
||||
void BattleGround::AddPlayer(Player* plr)
|
||||
{
|
||||
// remove afk from player
|
||||
if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
|
||||
|
|
@ -1218,14 +1218,14 @@ 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);
|
||||
|
||||
plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
|
||||
}
|
||||
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.
|
||||
|
||||
plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
|
||||
|
|
@ -1243,7 +1243,7 @@ void BattleGround::AddPlayer(Player *plr)
|
|||
}
|
||||
|
||||
/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */
|
||||
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_guid, Team team)
|
||||
void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player* plr, ObjectGuid plr_guid, Team team)
|
||||
{
|
||||
if (Group* group = GetBgRaid(team)) // raid already exist
|
||||
{
|
||||
|
|
@ -1272,7 +1272,7 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_gu
|
|||
void BattleGround::EventPlayerLoggedIn(Player* player, ObjectGuid plr_guid)
|
||||
{
|
||||
// player is correct pointer
|
||||
for(OfflineQueue::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
|
||||
for (OfflineQueue::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
|
||||
{
|
||||
if (*itr == plr_guid)
|
||||
{
|
||||
|
|
@ -1346,15 +1346,15 @@ bool BattleGround::HasFreeSlots() const
|
|||
return GetPlayersSize() < GetMaxPlayers();
|
||||
}
|
||||
|
||||
void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
|
||||
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->GetObjectGuid());
|
||||
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_KILLING_BLOWS: // Killing blows
|
||||
itr->second->KillingBlows += value;
|
||||
|
|
@ -1392,7 +1392,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
// must be created this way, adding to godatamap would add it to the base map of the instance
|
||||
// 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;
|
||||
GameObject* go = new GameObject;
|
||||
if (!go->Create(GetBgMap()->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
|
||||
PHASEMASK_NORMAL, x,y,z,o, QuaternionData(rotation0,rotation1,rotation2,rotation3)))
|
||||
{
|
||||
|
|
@ -1401,7 +1401,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
delete go;
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
uint32 guid = go->GetGUIDLow();
|
||||
|
||||
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
|
||||
|
|
@ -1422,7 +1422,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
data.spawnMask = 1;
|
||||
data.animprogress = 100;
|
||||
data.go_state = 1;
|
||||
*/
|
||||
*/
|
||||
// add to world, so it can be later looked up from HashMapHolder
|
||||
go->AddToWorld();
|
||||
m_BgObjects[type] = go->GetObjectGuid();
|
||||
|
|
@ -1433,7 +1433,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
//it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
|
||||
void BattleGround::DoorClose(ObjectGuid guid)
|
||||
{
|
||||
GameObject *obj = GetBgMap()->GetGameObject(guid);
|
||||
GameObject* obj = GetBgMap()->GetGameObject(guid);
|
||||
if (obj)
|
||||
{
|
||||
//if doors are open, close it
|
||||
|
|
@ -1450,7 +1450,7 @@ void BattleGround::DoorClose(ObjectGuid guid)
|
|||
|
||||
void BattleGround::DoorOpen(ObjectGuid guid)
|
||||
{
|
||||
GameObject *obj = GetBgMap()->GetGameObject(guid);
|
||||
GameObject* obj = GetBgMap()->GetGameObject(guid);
|
||||
if (obj)
|
||||
{
|
||||
//change state to be sure they will be opened
|
||||
|
|
@ -1524,7 +1524,7 @@ void BattleGround::OpenDoorEvent(uint8 event1, uint8 event2 /*=0*/)
|
|||
return;
|
||||
}
|
||||
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
|
||||
for(; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr)
|
||||
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr)
|
||||
DoorOpen(*itr);
|
||||
}
|
||||
|
||||
|
|
@ -1546,10 +1546,10 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
|||
m_ActiveEvents[event1] = BG_EVENT_NONE; // no event active if event2 gets despawned
|
||||
|
||||
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
|
||||
for(; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
|
||||
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
|
||||
SpawnBGCreature(*itr, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
GuidVector::const_iterator itr2 = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
|
||||
for(; itr2 != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr2)
|
||||
for (; itr2 != m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.end(); ++itr2)
|
||||
SpawnBGObject(*itr2, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
|
|
@ -1557,8 +1557,8 @@ void BattleGround::SpawnBGObject(ObjectGuid guid, uint32 respawntime)
|
|||
{
|
||||
Map* map = GetBgMap();
|
||||
|
||||
GameObject *obj = map->GetGameObject(guid);
|
||||
if(!obj)
|
||||
GameObject* obj = map->GetGameObject(guid);
|
||||
if (!obj)
|
||||
return;
|
||||
if (respawntime == 0)
|
||||
{
|
||||
|
|
@ -1602,7 +1602,7 @@ bool BattleGround::DelObject(uint32 type)
|
|||
if (!m_BgObjects[type])
|
||||
return true;
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
|
||||
GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
|
||||
if (!obj)
|
||||
{
|
||||
sLog.outError("Can't find gobject: %s", m_BgObjects[type].GetString().c_str());
|
||||
|
|
@ -1625,7 +1625,7 @@ void BattleGround::SendMessageToAll(int32 entry, ChatMsg type, Player const* sou
|
|||
void BattleGround::SendYellToAll(int32 entry, uint32 language, ObjectGuid guid)
|
||||
{
|
||||
Creature* source = GetBgMap()->GetCreature(guid);
|
||||
if(!source)
|
||||
if (!source)
|
||||
return;
|
||||
MaNGOS::BattleGroundYellBuilder bg_builder(language, entry, source);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::BattleGroundYellBuilder> bg_do(bg_builder);
|
||||
|
|
@ -1654,7 +1654,7 @@ void BattleGround::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* so
|
|||
void BattleGround::SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid, int32 arg1, int32 arg2)
|
||||
{
|
||||
Creature* source = GetBgMap()->GetCreature(guid);
|
||||
if(!source)
|
||||
if (!source)
|
||||
return;
|
||||
MaNGOS::BattleGround2YellBuilder bg_builder(language, entry, source, arg1, arg2);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::BattleGround2YellBuilder> bg_do(bg_builder);
|
||||
|
|
@ -1675,7 +1675,7 @@ buffs are in their positions when battleground starts
|
|||
*/
|
||||
void BattleGround::HandleTriggerBuff(ObjectGuid go_guid)
|
||||
{
|
||||
GameObject *obj = GetBgMap()->GetGameObject(go_guid);
|
||||
GameObject* obj = GetBgMap()->GetGameObject(go_guid);
|
||||
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
return;
|
||||
|
||||
|
|
@ -1720,7 +1720,7 @@ void BattleGround::HandleTriggerBuff(ObjectGuid go_guid)
|
|||
SpawnBGObject(m_BgObjects[index], BUFF_RESPAWN_TIME);
|
||||
}
|
||||
|
||||
void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
||||
void BattleGround::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
// add +1 deaths
|
||||
UpdatePlayerScore(player, SCORE_DEATHS, 1);
|
||||
|
|
@ -1731,9 +1731,9 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
|||
UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1);
|
||||
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
if (!plr || plr == killer)
|
||||
continue;
|
||||
|
|
@ -1745,7 +1745,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
|||
|
||||
// to be able to remove insignia -- ONLY IN BattleGrounds
|
||||
if (!isArena())
|
||||
player->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE );
|
||||
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
}
|
||||
|
||||
// return the player's team based on battlegroundplayer info
|
||||
|
|
@ -1786,11 +1786,11 @@ void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
|
|||
uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
|
||||
{
|
||||
int count = 0;
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.PlayerTeam == team)
|
||||
{
|
||||
Player * pl = sObjectMgr.GetPlayer(itr->first);
|
||||
Player* pl = sObjectMgr.GetPlayer(itr->first);
|
||||
if (pl && pl->isAlive())
|
||||
++count;
|
||||
}
|
||||
|
|
@ -1806,9 +1806,9 @@ void BattleGround::CheckArenaWinConditions()
|
|||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
|
||||
void BattleGround::SetBgRaid(Team team, Group *bg_raid)
|
||||
void BattleGround::SetBgRaid(Team team, Group* bg_raid)
|
||||
{
|
||||
Group* &old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
||||
Group*& old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
||||
|
||||
if (old_raid)
|
||||
old_raid->SetBattlegroundGroup(NULL);
|
||||
|
|
@ -1819,7 +1819,7 @@ void BattleGround::SetBgRaid(Team team, Group *bg_raid)
|
|||
old_raid = bg_raid;
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player )
|
||||
WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
return sObjectMgr.GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
|
||||
}
|
||||
|
|
@ -1831,7 +1831,7 @@ bool BattleGround::IsTeamScoreInRange(Team team, uint32 minScore, uint32 maxScor
|
|||
return score >= minScore && score <= maxScore;
|
||||
}
|
||||
|
||||
void BattleGround::SetBracket( PvPDifficultyEntry const* bracketEntry )
|
||||
void BattleGround::SetBracket(PvPDifficultyEntry const* bracketEntry)
|
||||
{
|
||||
m_BracketId = bracketEntry->GetBracketId();
|
||||
SetLevelRange(bracketEntry->minLevel,bracketEntry->maxLevel);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ struct BattleGroundObjectInfo
|
|||
{
|
||||
BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {}
|
||||
|
||||
GameObject *object;
|
||||
GameObject* object;
|
||||
int32 timer;
|
||||
uint32 spellid;
|
||||
};
|
||||
|
|
@ -388,7 +388,7 @@ class BattleGround
|
|||
}
|
||||
|
||||
void SetTeamStartLoc(Team team, float X, float Y, float Z, float O);
|
||||
void GetTeamStartLoc(Team team, float &X, float &Y, float &Z, float &O) const
|
||||
void GetTeamStartLoc(Team team, float& X, float& Y, float& Z, float& O) const
|
||||
{
|
||||
BattleGroundTeamIndex idx = GetTeamIndexByTeamId(team);
|
||||
X = m_TeamStartLocX[idx];
|
||||
|
|
@ -400,8 +400,8 @@ class BattleGround
|
|||
/* Packet Transfer */
|
||||
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {}
|
||||
void SendPacketToTeam(Team team, WorldPacket *packet, Player *sender = NULL, bool self = true);
|
||||
void SendPacketToAll(WorldPacket *packet);
|
||||
void SendPacketToTeam(Team team, WorldPacket* packet, Player* sender = NULL, bool self = true);
|
||||
void SendPacketToAll(WorldPacket* packet);
|
||||
|
||||
template<class Do>
|
||||
void BroadcastWorker(Do& _do);
|
||||
|
|
@ -411,29 +411,29 @@ class BattleGround
|
|||
void CastSpellOnTeam(uint32 SpellID, Team team);
|
||||
void RewardHonorToTeam(uint32 Honor, Team team);
|
||||
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, Team team);
|
||||
void RewardMark(Player *plr,uint32 count);
|
||||
void SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count);
|
||||
void RewardItem(Player *plr, uint32 item_id, uint32 count);
|
||||
void RewardQuestComplete(Player *plr);
|
||||
void RewardSpellCast(Player *plr, uint32 spell_id);
|
||||
void RewardMark(Player* plr,uint32 count);
|
||||
void SendRewardMarkByMail(Player* plr,uint32 mark, uint32 count);
|
||||
void RewardItem(Player* plr, uint32 item_id, uint32 count);
|
||||
void RewardQuestComplete(Player* plr);
|
||||
void RewardSpellCast(Player* plr, uint32 spell_id);
|
||||
void UpdateWorldState(uint32 Field, uint32 Value);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source);
|
||||
virtual void EndBattleGround(Team winner);
|
||||
void BlockMovement(Player *plr);
|
||||
void BlockMovement(Player* plr);
|
||||
|
||||
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
|
||||
void SendYellToAll(int32 entry, uint32 language, ObjectGuid guid);
|
||||
void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ... );
|
||||
void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...);
|
||||
|
||||
// specialized version with 2 string id args
|
||||
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
|
||||
void SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid, int32 arg1, int32 arg2);
|
||||
|
||||
/* Raid Group */
|
||||
Group *GetBgRaid(Team team) const { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||
void SetBgRaid(Team team, Group *bg_raid);
|
||||
Group* GetBgRaid(Team team) const { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||
void SetBgRaid(Team team, Group* bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
|
||||
static BattleGroundTeamIndex GetTeamIndexByTeamId(Team team) { return team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
|
||||
uint32 GetPlayersCountByTeam(Team team) const { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
||||
|
|
@ -457,7 +457,7 @@ class BattleGround
|
|||
// must be implemented in BG subclass
|
||||
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
|
||||
// must be implemented in BG subclass if need AND call base class generic code
|
||||
virtual void HandleKillPlayer(Player *player, Player *killer);
|
||||
virtual void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/) { return; };
|
||||
|
||||
/* Battleground events */
|
||||
|
|
@ -470,9 +470,9 @@ class BattleGround
|
|||
/* Death related */
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
virtual void AddPlayer(Player *plr); // must be implemented in BG subclass
|
||||
virtual void AddPlayer(Player* plr); // must be implemented in BG subclass
|
||||
|
||||
void AddOrSetPlayerToCorrectBgGroup(Player *plr, ObjectGuid plr_guid, Team team);
|
||||
void AddOrSetPlayerToCorrectBgGroup(Player* plr, ObjectGuid plr_guid, Team team);
|
||||
|
||||
virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket);
|
||||
// can be extended in in BG subclass
|
||||
|
|
@ -507,12 +507,12 @@ class BattleGround
|
|||
void DoorOpen(ObjectGuid guid);
|
||||
void DoorClose(ObjectGuid guid);
|
||||
|
||||
virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; }
|
||||
virtual bool HandlePlayerUnderMap(Player* /*plr*/) { return false; }
|
||||
|
||||
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
||||
Team GetPlayerTeam(ObjectGuid guid);
|
||||
static Team GetOtherTeam(Team team){ return team ? ((team == ALLIANCE) ? HORDE : ALLIANCE) : TEAM_NONE; }
|
||||
static BattleGroundTeamIndex GetOtherTeamIndex(BattleGroundTeamIndex teamIdx){ return teamIdx == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; }
|
||||
static Team GetOtherTeam(Team team) { return team ? ((team == ALLIANCE) ? HORDE : ALLIANCE) : TEAM_NONE; }
|
||||
static BattleGroundTeamIndex GetOtherTeamIndex(BattleGroundTeamIndex teamIdx) { return teamIdx == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; }
|
||||
bool IsPlayerInBattleGround(ObjectGuid guid);
|
||||
|
||||
/* virtual score-array - get's used in bg-subclasses */
|
||||
|
|
@ -543,7 +543,7 @@ class BattleGround
|
|||
|
||||
BattleGroundScoreMap m_PlayerScores; // Player scores
|
||||
// must be implemented in BG subclass
|
||||
virtual void RemovePlayer(Player * /*player*/, ObjectGuid /*guid*/) {}
|
||||
virtual void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/) {}
|
||||
|
||||
/* Player lists, those need to be accessible by inherited classes */
|
||||
BattleGroundPlayerMap m_Players;
|
||||
|
|
@ -575,7 +575,7 @@ class BattleGround
|
|||
bool m_IsRated; // is this battle rated?
|
||||
bool m_PrematureCountDown;
|
||||
uint32 m_PrematureCountDownTimer;
|
||||
char const *m_Name;
|
||||
char const* m_Name;
|
||||
|
||||
/* Player lists */
|
||||
typedef std::deque<ObjectGuid> OfflineQueue;
|
||||
|
|
@ -588,7 +588,7 @@ class BattleGround
|
|||
uint32 m_InvitedHorde;
|
||||
|
||||
/* Raid Group */
|
||||
Group *m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
|
||||
/* Players count by team */
|
||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||
|
|
@ -645,7 +645,7 @@ struct WorldStatePair
|
|||
|
||||
inline void FillInitialWorldState(ByteBuffer& data, uint32& count, WorldStatePair const* array)
|
||||
{
|
||||
for(WorldStatePair const* itr = array; itr->state; ++itr)
|
||||
for (WorldStatePair const* itr = array; itr->state; ++itr)
|
||||
{
|
||||
data << uint32(itr->state);
|
||||
data << uint32(itr->value);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void BattleGroundAA::StartingEventOpenDoors()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundAA::AddPlayer(Player *plr)
|
||||
void BattleGroundAA::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -62,7 +62,7 @@ void BattleGroundAA::AddPlayer(Player *plr)
|
|||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundAA::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/)
|
||||
void BattleGroundAA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void BattleGroundAA::HandleKillPlayer(Player* player, Player* killer)
|
|||
BattleGround::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattleGroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
void BattleGroundAA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ class BattleGroundAA : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ void BattleGroundAB::StartingEventOpenDoors()
|
|||
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AB_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattleGroundAB::AddPlayer(Player *plr)
|
||||
void BattleGroundAB::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in the constructor
|
||||
|
|
@ -189,14 +189,14 @@ void BattleGroundAB::AddPlayer(Player *plr)
|
|||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundAB::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/)
|
||||
void BattleGroundAB::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
switch(Trigger)
|
||||
switch (Trigger)
|
||||
{
|
||||
case 3948: // Arathi Basin Alliance Exit.
|
||||
if (Source->GetTeam() != ALLIANCE)
|
||||
|
|
@ -334,7 +334,7 @@ void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
|
|||
}
|
||||
|
||||
/* Invoked if a player used a banner as a gameobject */
|
||||
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
|
||||
void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -522,7 +522,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
float mindist = 999999.0f;
|
||||
for (uint8 i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[nodes[i]] );
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]);
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
||||
|
|
@ -536,18 +536,18 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
}
|
||||
// If not, place ghost on starting location
|
||||
if (!good_entry)
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] );
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex+5]);
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
||||
void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
|
||||
void BattleGroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
||||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
if( itr == m_PlayerScores.end() ) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
((BattleGroundABScore*)itr->second)->BasesAssaulted += value;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ enum BG_AB_WorldStates
|
|||
BG_AB_OP_RESOURCES_HORDE = 1777,
|
||||
BG_AB_OP_RESOURCES_MAX = 1780,
|
||||
BG_AB_OP_RESOURCES_WARNING = 1955
|
||||
/*
|
||||
/*
|
||||
BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE)
|
||||
BG_AB_OP_STABLE_STATE_ALIENCE = 1767, //Stable map state (ALIENCE)
|
||||
BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE)
|
||||
|
|
@ -56,7 +56,7 @@ enum BG_AB_WorldStates
|
|||
BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE)
|
||||
BG_AB_OP_GOLDMINE_STATE_CON_ALI = 1789, //Gold Mine map state (CON ALIENCE
|
||||
BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE)
|
||||
*/
|
||||
*/
|
||||
};
|
||||
|
||||
const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787};
|
||||
|
|
@ -149,7 +149,8 @@ const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30};
|
|||
const uint32 BG_AB_GraveyardIds[7] = {895, 894, 893, 897, 896, 898, 899};
|
||||
|
||||
// x, y, z, o
|
||||
const float BG_AB_BuffPositions[BG_AB_NODES_MAX][4] = {
|
||||
const float BG_AB_BuffPositions[BG_AB_NODES_MAX][4] =
|
||||
{
|
||||
{1185.71f, 1185.24f, -56.36f, 2.56f}, // stables
|
||||
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
|
||||
{817.66f, 843.34f, -56.54f, 3.01f}, // farm
|
||||
|
|
@ -182,23 +183,23 @@ class BattleGroundAB : public BattleGround
|
|||
~BattleGroundAB();
|
||||
|
||||
void Update(uint32 diff);
|
||||
void AddPlayer(Player *plr);
|
||||
void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void EndBattleGround(Team winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||
|
||||
/* Nodes occupying */
|
||||
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
|
||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(Team team) const; // overwrited
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ BattleGroundAV::~BattleGroundAV()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
|
||||
void BattleGroundAV::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -47,7 +47,7 @@ void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
|
|||
UpdateScore(GetTeamIndexByTeamId(player->GetTeam()), -1);
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer)
|
||||
void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry());
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -55,7 +55,7 @@ void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer)
|
|||
uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
|
||||
if (event1 == BG_EVENT_NONE)
|
||||
return;
|
||||
switch(event1)
|
||||
switch (event1)
|
||||
{
|
||||
case BG_AV_BOSS_A:
|
||||
CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, HORDE); // this is a spell which finishes a quest where a player has to kill the boss
|
||||
|
|
@ -98,7 +98,7 @@ void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
||||
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -108,7 +108,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
|||
uint32 reputation = 0; // reputation for the whole team (other reputation must be done in db)
|
||||
// TODO add events (including quest not available anymore, next quest availabe, go/npc de/spawning)
|
||||
sLog.outError("BattleGroundAV: Quest %i completed", questid);
|
||||
switch(questid)
|
||||
switch (questid)
|
||||
{
|
||||
case BG_AV_QUEST_A_SCRAPS1:
|
||||
case BG_AV_QUEST_A_SCRAPS2:
|
||||
|
|
@ -116,7 +116,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
|||
case BG_AV_QUEST_H_SCRAPS2:
|
||||
m_Team_QuestStatus[teamIdx][0] += 20;
|
||||
reputation = 1;
|
||||
if( m_Team_QuestStatus[teamIdx][0] == 500 || m_Team_QuestStatus[teamIdx][0] == 1000 || m_Team_QuestStatus[teamIdx][0] == 1500 ) //25,50,75 turn ins
|
||||
if (m_Team_QuestStatus[teamIdx][0] == 500 || m_Team_QuestStatus[teamIdx][0] == 1000 || m_Team_QuestStatus[teamIdx][0] == 1500) //25,50,75 turn ins
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: 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)
|
||||
|
|
@ -209,10 +209,10 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
|||
RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam());
|
||||
}
|
||||
|
||||
void BattleGroundAV::UpdateScore(BattleGroundTeamIndex teamIdx, int32 points )
|
||||
void BattleGroundAV::UpdateScore(BattleGroundTeamIndex teamIdx, int32 points)
|
||||
{
|
||||
// note: to remove reinforcements points must be negative, for adding reinforcements points must be positive
|
||||
MANGOS_ASSERT( teamIdx == BG_TEAM_ALLIANCE || teamIdx == BG_TEAM_HORDE);
|
||||
MANGOS_ASSERT(teamIdx == BG_TEAM_ALLIANCE || teamIdx == BG_TEAM_HORDE);
|
||||
m_TeamScores[teamIdx] += points; // m_TeamScores is int32 - so no problems here
|
||||
|
||||
if (points < 0)
|
||||
|
|
@ -242,7 +242,7 @@ void BattleGroundAV::Update(uint32 diff)
|
|||
return;
|
||||
|
||||
// add points from mine owning, and look if the neutral team can reclaim the mine
|
||||
for(uint8 mine = 0; mine < BG_AV_MAX_MINES; mine++)
|
||||
for (uint8 mine = 0; mine < BG_AV_MAX_MINES; mine++)
|
||||
{
|
||||
if (m_Mine_Owner[mine] != BG_AV_TEAM_NEUTRAL)
|
||||
{
|
||||
|
|
@ -261,7 +261,7 @@ void BattleGroundAV::Update(uint32 diff)
|
|||
}
|
||||
|
||||
// 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)
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
{
|
||||
if (m_Nodes[i].State == POINT_ASSAULTED)
|
||||
{
|
||||
|
|
@ -289,7 +289,7 @@ void BattleGroundAV::StartingEventOpenDoors()
|
|||
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AV_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattleGroundAV::AddPlayer(Player *plr)
|
||||
void BattleGroundAV::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
// create score and add it to map, default values are set in constructor
|
||||
|
|
@ -304,17 +304,17 @@ void BattleGroundAV::EndBattleGround(Team winner)
|
|||
uint32 graves_owned[BG_TEAMS_COUNT] = {0, 0};
|
||||
uint32 mines_owned[BG_TEAMS_COUNT] = {0, 0};
|
||||
// towers all not destroyed:
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
|
||||
if (m_Nodes[i].State == POINT_CONTROLLED)
|
||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE)
|
||||
++tower_survived[BG_TEAM_ALLIANCE];
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
||||
if (m_Nodes[i].State == POINT_CONTROLLED)
|
||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE)
|
||||
++tower_survived[BG_TEAM_HORDE];
|
||||
|
||||
// graves all controlled
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL)
|
||||
++graves_owned[m_Nodes[i].Owner];
|
||||
|
||||
|
|
@ -358,10 +358,10 @@ void BattleGroundAV::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
switch(Trigger)
|
||||
switch (Trigger)
|
||||
{
|
||||
case 95:
|
||||
case 2608:
|
||||
|
|
@ -395,10 +395,10 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
|||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||
((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted += value;
|
||||
|
|
@ -474,7 +474,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx
|
|||
PlaySoundToAll((teamIdx == BG_AV_TEAM_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_GOOD : BG_AV_SOUND_HORDE_GOOD);
|
||||
m_Mine_Reclaim_Timer[mine] = BG_AV_MINE_RECLAIM_TIMER;
|
||||
SendYell2ToAll(LANG_BG_AV_MINE_TAKEN , LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||
(teamIdx == BG_AV_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE,
|
||||
(teamIdx == BG_AV_TEAM_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE,
|
||||
(mine == BG_AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH);
|
||||
}
|
||||
}
|
||||
|
|
@ -496,11 +496,11 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
if (IsGrave(node) && teamIdx != BG_AV_TEAM_NEUTRAL)
|
||||
{
|
||||
uint32 graveDefenderType;
|
||||
if (m_Team_QuestStatus[teamIdx][0] < 500 )
|
||||
if (m_Team_QuestStatus[teamIdx][0] < 500)
|
||||
graveDefenderType = 0;
|
||||
else if (m_Team_QuestStatus[teamIdx][0] < 1000 )
|
||||
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
||||
graveDefenderType = 1;
|
||||
else if (m_Team_QuestStatus[teamIdx][0] < 1500 )
|
||||
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
||||
graveDefenderType = 2;
|
||||
else
|
||||
graveDefenderType = 3;
|
||||
|
|
@ -514,7 +514,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
}
|
||||
|
||||
/// called when using a banner
|
||||
void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
|
||||
void BattleGroundAV::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -544,7 +544,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
|
|||
|
||||
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
|
||||
return;
|
||||
if( m_Nodes[node].TotalOwner == BG_AV_TEAM_NEUTRAL ) // initial snowfall capture
|
||||
if (m_Nodes[node].TotalOwner == BG_AV_TEAM_NEUTRAL) // initial snowfall capture
|
||||
{
|
||||
// until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
|
||||
// for neutral nodes.. but doing this just for snowfall will be a bit to much i think
|
||||
|
|
@ -566,9 +566,9 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
|
|||
|
||||
if (IsTower(node))
|
||||
{
|
||||
SendYell2ToAll( LANG_BG_AV_TOWER_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||
SendYell2ToAll(LANG_BG_AV_TOWER_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||
GetNodeName(node),
|
||||
( teamIdx == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
(teamIdx == BG_TEAM_ALLIANCE) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
UpdatePlayerScore(player, SCORE_TOWERS_DEFENDED, 1);
|
||||
PlaySoundToAll(BG_AV_SOUND_BOTH_TOWER_DEFEND);
|
||||
}
|
||||
|
|
@ -576,7 +576,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
|
|||
{
|
||||
SendYell2ToAll(LANG_BG_AV_GRAVE_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||
GetNodeName(node),
|
||||
( teamIdx == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
(teamIdx == BG_TEAM_ALLIANCE) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
UpdatePlayerScore(player, SCORE_GRAVEYARDS_DEFENDED, 1);
|
||||
// update the statistic for the defending player
|
||||
PlaySoundToAll((teamIdx == BG_TEAM_ALLIANCE)?BG_AV_SOUND_ALLIANCE_GOOD:BG_AV_SOUND_HORDE_GOOD);
|
||||
|
|
@ -599,14 +599,14 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node)
|
|||
{
|
||||
SendYell2ToAll(LANG_BG_AV_TOWER_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||
GetNodeName(node),
|
||||
( teamIdx == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
(teamIdx == BG_TEAM_ALLIANCE) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
UpdatePlayerScore(player, SCORE_TOWERS_ASSAULTED, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendYell2ToAll(LANG_BG_AV_GRAVE_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||
GetNodeName(node),
|
||||
( teamIdx == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
(teamIdx == BG_TEAM_ALLIANCE) ? LANG_BG_ALLY:LANG_BG_HORDE);
|
||||
// update the statistic for the assaulting player
|
||||
UpdatePlayerScore(player, SCORE_GRAVEYARDS_ASSAULTED, 1);
|
||||
}
|
||||
|
|
@ -629,12 +629,12 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
}
|
||||
}
|
||||
|
||||
if( m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_TEAM_NEUTRAL ) // cause neutral teams aren't handled generic
|
||||
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_TEAM_NEUTRAL) // cause neutral teams aren't handled generic
|
||||
FillInitialWorldState(data, count, AV_SNOWFALL_N, 1);
|
||||
|
||||
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[BG_TEAM_ALLIANCE]);
|
||||
FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[BG_TEAM_HORDE]);
|
||||
if( GetStatus() == STATUS_IN_PROGRESS ) // only if game is running the teamscores are displayed
|
||||
if (GetStatus() == STATUS_IN_PROGRESS) // only if game is running the teamscores are displayed
|
||||
{
|
||||
FillInitialWorldState(data, count, BG_AV_SHOW_A_SCORE, 1);
|
||||
FillInitialWorldState(data, count, BG_AV_SHOW_H_SCORE, 1);
|
||||
|
|
@ -657,7 +657,7 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
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 == BG_AV_TEAM_NEUTRAL ) // currently only snowfall is supported as neutral node
|
||||
if (m_Nodes[node].PrevOwner == BG_AV_TEAM_NEUTRAL) // currently only snowfall is supported as neutral node
|
||||
UpdateWorldState(AV_SNOWFALL_N, 0);
|
||||
else
|
||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)], 0);
|
||||
|
|
@ -672,7 +672,7 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
|||
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], 0);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player *plr)
|
||||
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
||||
{
|
||||
float x = plr->GetPositionX();
|
||||
float y = plr->GetPositionY();
|
||||
|
|
@ -682,11 +682,11 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player *plr)
|
|||
{
|
||||
// Is there any occupied node for this team?
|
||||
float mindist = 9999999.0f;
|
||||
for(uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||
{
|
||||
if (m_Nodes[i].Owner != teamIdx || m_Nodes[i].State != POINT_CONTROLLED)
|
||||
continue;
|
||||
WorldSafeLocsEntry const * entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] );
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
|
||||
|
|
@ -699,7 +699,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player *plr)
|
|||
}
|
||||
// If not, place ghost in the starting-cave
|
||||
if (!good_entry)
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[teamIdx + 7] );
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[teamIdx + 7]);
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
|
@ -794,16 +794,16 @@ void BattleGroundAV::Reset()
|
|||
m_RepSurviveTower = (isBGWeekend) ? BG_AV_REP_SURVIVING_TOWER_HOLIDAY : BG_AV_REP_SURVIVING_TOWER;
|
||||
m_RepOwnedMine = (isBGWeekend) ? BG_AV_REP_OWNED_MINE_HOLIDAY : BG_AV_REP_OWNED_MINE;
|
||||
|
||||
for(uint8 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint8 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
for(uint8 j = 0; j < 9; j++) // 9 quests getting tracked
|
||||
for (uint8 j = 0; j < 9; j++) // 9 quests getting tracked
|
||||
m_Team_QuestStatus[i][j] = 0;
|
||||
m_TeamScores[i] = BG_AV_SCORE_INITIAL_POINTS;
|
||||
m_IsInformedNearLose[i] = false;
|
||||
m_ActiveEvents[BG_AV_NodeEventCaptainDead_A + i] = BG_EVENT_NONE;
|
||||
}
|
||||
|
||||
for(uint8 i = 0; i < BG_AV_MAX_MINES; i++)
|
||||
for (uint8 i = 0; i < BG_AV_MAX_MINES; i++)
|
||||
{
|
||||
m_Mine_Owner[i] = BG_AV_TEAM_NEUTRAL;
|
||||
m_Mine_PrevOwner[i] = m_Mine_Owner[i];
|
||||
|
|
@ -817,17 +817,17 @@ void BattleGroundAV::Reset()
|
|||
m_ActiveEvents[BG_AV_HERALD] = 0;
|
||||
m_ActiveEvents[BG_AV_BOSS_A] = 0;
|
||||
m_ActiveEvents[BG_AV_BOSS_H] = 0;
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // towers
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // towers
|
||||
m_ActiveEvents[BG_AV_MARSHAL_A_SOUTH + i - BG_AV_NODES_DUNBALDAR_SOUTH] = 0;
|
||||
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) // alliance graves
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) // alliance graves
|
||||
InitNode(i, BG_AV_TEAM_ALLIANCE, false);
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers
|
||||
InitNode(i, BG_AV_TEAM_ALLIANCE, true);
|
||||
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) // horde graves
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) // horde graves
|
||||
InitNode(i, BG_AV_TEAM_HORDE, false);
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers
|
||||
InitNode(i, BG_AV_TEAM_HORDE, true);
|
||||
|
||||
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_TEAM_NEUTRAL, false); // give snowfall neutral owner
|
||||
|
|
|
|||
|
|
@ -175,7 +175,8 @@ enum BG_AV_Graveyards
|
|||
BG_AV_GRAVE_MAIN_HORDE = 610
|
||||
};
|
||||
|
||||
const uint32 BG_AV_GraveyardIds[9]= {
|
||||
const uint32 BG_AV_GraveyardIds[9]=
|
||||
{
|
||||
BG_AV_GRAVE_STORM_AID,
|
||||
BG_AV_GRAVE_STORM_GRAVE,
|
||||
BG_AV_GRAVE_STONE_GRAVE,
|
||||
|
|
@ -216,13 +217,15 @@ enum BattleGroundAVTeamIndex
|
|||
#define BG_AV_TEAMS_COUNT 3
|
||||
|
||||
// alliance_control horde_control neutral_control
|
||||
const uint32 BG_AV_MineWorldStates[2][BG_AV_TEAMS_COUNT] = {
|
||||
const uint32 BG_AV_MineWorldStates[2][BG_AV_TEAMS_COUNT] =
|
||||
{
|
||||
{1358, 1359, 1360},
|
||||
{1355, 1356, 1357}
|
||||
};
|
||||
|
||||
// alliance_control alliance_assault h_control h_assault
|
||||
const uint32 BG_AV_NodeWorldStates[BG_AV_NODES_MAX][4] = {
|
||||
const uint32 BG_AV_NodeWorldStates[BG_AV_NODES_MAX][4] =
|
||||
{
|
||||
// Stormpike first aid station
|
||||
{1326,1325,1328,1327},
|
||||
// Stormpike Graveyard
|
||||
|
|
@ -294,7 +297,7 @@ struct BG_AV_NodeInfo
|
|||
bool Tower;
|
||||
};
|
||||
|
||||
inline BG_AV_Nodes &operator++(BG_AV_Nodes &i)
|
||||
inline BG_AV_Nodes& operator++(BG_AV_Nodes& i)
|
||||
{
|
||||
return i = BG_AV_Nodes(i + 1);
|
||||
}
|
||||
|
|
@ -321,31 +324,31 @@ class BattleGroundAV : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
// world states
|
||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
virtual void Reset();
|
||||
|
||||
/*general stuff*/
|
||||
void UpdateScore(BattleGroundTeamIndex teamIdx, int32 points);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
|
||||
/*handle stuff*/ // these are functions which get called from extern scripts
|
||||
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
void HandleKillUnit(Creature *creature, Player *killer);
|
||||
void HandleQuestComplete(uint32 questid, Player *player);
|
||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
void HandleKillUnit(Creature* creature, Player* killer);
|
||||
void HandleQuestComplete(uint32 questid, Player* player);
|
||||
bool PlayerCanDoMineQuest(int32 GOId, Team team);
|
||||
|
||||
void EndBattleGround(Team winner);
|
||||
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player *plr);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* plr);
|
||||
|
||||
static BattleGroundAVTeamIndex GetAVTeamIndexByTeamId(Team team) { return BattleGroundAVTeamIndex(GetTeamIndexByTeamId(team)); }
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void BattleGroundBE::StartingEventOpenDoors()
|
|||
OpenDoorEvent(BG_EVENT_DOOR);
|
||||
}
|
||||
|
||||
void BattleGroundBE::AddPlayer(Player *plr)
|
||||
void BattleGroundBE::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -83,7 +83,7 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||
void BattleGroundBE::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -102,13 +102,13 @@ void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
|||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
||||
bool BattleGroundBE::HandlePlayerUnderMap(Player* player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(),6238.930176f,262.963470f,0.889519f,player->GetOrientation(),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -116,7 +116,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
switch (Trigger)
|
||||
{
|
||||
case 4538: // buff trigger?
|
||||
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1];
|
||||
|
|
@ -134,7 +134,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
void BattleGroundBE::FillInitialWorldStates(WorldPacket &data, uint32& count)
|
||||
void BattleGroundBE::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||
{
|
||||
FillInitialWorldState(data, count, 0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
FillInitialWorldState(data, count, 0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
|
@ -156,7 +156,7 @@ void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
|||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
//there is nothing special in this score
|
||||
|
|
|
|||
|
|
@ -37,19 +37,19 @@ class BattleGroundBE : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d, uint32& count);
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* plr);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void BattleGroundDS::StartingEventOpenDoors()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundDS::AddPlayer(Player *plr)
|
||||
void BattleGroundDS::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -62,7 +62,7 @@ void BattleGroundDS::AddPlayer(Player *plr)
|
|||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundDS::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/)
|
||||
void BattleGroundDS::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer)
|
|||
BattleGround::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattleGroundDS::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
void BattleGroundDS::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ class BattleGroundDS : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void BattleGroundEY::StartingEventOpenDoors()
|
|||
// eye-doors are despawned, not opened
|
||||
SpawnEvent(BG_EVENT_DOOR, 0, false);
|
||||
|
||||
for(uint32 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
for (uint32 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
{
|
||||
//randomly spawn buff
|
||||
uint8 buff = urand(0, 2);
|
||||
|
|
@ -119,7 +119,7 @@ void BattleGroundEY::AddPoints(Team team, uint32 Points)
|
|||
BattleGroundTeamIndex team_index = GetTeamIndexByTeamId(team);
|
||||
m_TeamScores[team_index] += Points;
|
||||
m_HonorScoreTics[team_index] += Points;
|
||||
if (m_HonorScoreTics[team_index] >= m_HonorTics )
|
||||
if (m_HonorScoreTics[team_index] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), team);
|
||||
m_HonorScoreTics[team_index] -= m_HonorTics;
|
||||
|
|
@ -134,7 +134,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
|||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].size())
|
||||
{
|
||||
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j]);
|
||||
Player* plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j]);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: %s not found!", m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j].GetString().c_str());
|
||||
|
|
@ -165,12 +165,12 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
|||
//reset current point counts
|
||||
for (uint8 i = 0; i < 2*BG_EY_NODES_MAX; ++i)
|
||||
m_CurrentPointPlayersCount[i] = 0;
|
||||
for(uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
{
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[i].size())
|
||||
{
|
||||
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
||||
Player* plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint %s not found!", m_PlayersNearPoint[i][j].GetString().c_str());
|
||||
|
|
@ -200,7 +200,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
|||
|
||||
void BattleGroundEY::UpdatePointStatuses()
|
||||
{
|
||||
for(uint8 point = 0; point < BG_EY_NODES_MAX; ++point)
|
||||
for (uint8 point = 0; point < BG_EY_NODES_MAX; ++point)
|
||||
{
|
||||
if (m_PlayersNearPoint[point].empty())
|
||||
continue;
|
||||
|
|
@ -225,7 +225,7 @@ void BattleGroundEY::UpdatePointStatuses()
|
|||
|
||||
for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i)
|
||||
{
|
||||
if (Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[point][i]))
|
||||
if (Player* plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[point][i]))
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
|
||||
//if point owner changed we must evoke event!
|
||||
|
|
@ -303,7 +303,7 @@ void BattleGroundEY::UpdatePointsIcons(Team team, uint32 Point)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::AddPlayer(Player *plr)
|
||||
void BattleGroundEY::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map
|
||||
|
|
@ -314,12 +314,12 @@ void BattleGroundEY::AddPlayer(Player *plr)
|
|||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundEY::RemovePlayer(Player *plr, ObjectGuid guid)
|
||||
void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
for (int j = BG_EY_NODES_MAX; j >= 0; --j)
|
||||
{
|
||||
for(size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i)
|
||||
for (size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i)
|
||||
if (m_PlayersNearPoint[j][i] == guid)
|
||||
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
|
||||
}
|
||||
|
|
@ -338,15 +338,15 @@ void BattleGroundEY::RemovePlayer(Player *plr, ObjectGuid guid)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
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)
|
||||
switch (Trigger)
|
||||
{
|
||||
case TR_BLOOD_ELF_POINT:
|
||||
if (m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == Source->GetTeam())
|
||||
|
|
@ -427,7 +427,7 @@ void BattleGroundEY::Reset()
|
|||
bool isBGWeekend = BattleGroundMgr::IsBGWeekend(GetTypeID());
|
||||
m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks;
|
||||
|
||||
for(uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
{
|
||||
m_PointOwnedByTeam[i] = TEAM_NONE;
|
||||
m_PointState[i] = EY_POINT_STATE_UNCONTROLLED;
|
||||
|
|
@ -462,7 +462,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
|||
{
|
||||
RespawnFlag(true);
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
||||
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
|
|
@ -471,7 +471,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
|||
ClearDroppedFlagGuid();
|
||||
}
|
||||
|
||||
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||
void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -480,7 +480,7 @@ void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
|||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
void BattleGroundEY::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
|
|
@ -516,7 +516,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
|||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
void BattleGroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
return;
|
||||
|
|
@ -550,7 +550,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
||||
void BattleGroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -584,7 +584,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
|||
UpdatePointsCount(team);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||
void BattleGroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -608,7 +608,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
|||
UpdatePointsCount(team);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node)
|
||||
void BattleGroundEY::EventPlayerCapturedFlag(Player* Source, BG_EY_Nodes node)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGuid() != Source->GetObjectGuid())
|
||||
return;
|
||||
|
|
@ -646,13 +646,13 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node)
|
|||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
|
||||
void BattleGroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
||||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
if(itr == m_PlayerScores.end()) // player not found
|
||||
if (itr == m_PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
|
||||
|
|
@ -700,11 +700,11 @@ void BattleGroundEY::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
FillInitialWorldState(data, count, 0xc0d, 0x17b);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||
WorldSafeLocsEntry const* BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
uint32 g_id = 0;
|
||||
|
||||
switch(player->GetTeam())
|
||||
switch (player->GetTeam())
|
||||
{
|
||||
case ALLIANCE: g_id = EY_GRAVEYARD_MAIN_ALLIANCE; break;
|
||||
case HORDE: g_id = EY_GRAVEYARD_MAIN_HORDE; break;
|
||||
|
|
@ -732,7 +732,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
|||
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
|
||||
nearestDistance = distance;
|
||||
|
||||
for(uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
for (uint8 i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
{
|
||||
if (m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
|
|
@ -756,7 +756,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
|||
|
||||
bool BattleGroundEY::IsAllNodesConrolledByTeam(Team team) const
|
||||
{
|
||||
for(int i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
for (int i = 0; i < BG_EY_NODES_MAX; ++i)
|
||||
if (m_PointState[i] != EY_POINT_UNDER_CONTROL || m_PointOwnedByTeam[i] != team)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ enum BG_EY_Nodes
|
|||
|
||||
// x, y, z
|
||||
// used to check, when player is in range of a node
|
||||
const float BG_EY_NodePositions[BG_EY_NODES_MAX][3] = {
|
||||
const float BG_EY_NodePositions[BG_EY_NODES_MAX][3] =
|
||||
{
|
||||
{2024.600708f, 1742.819580f, 1195.157715f}, // BG_EY_NODE_FEL_REAVER
|
||||
{2050.493164f, 1372.235962f, 1194.563477f}, // BG_EY_NODE_BLOOD_ELF
|
||||
{2301.010498f, 1386.931641f, 1197.183472f}, // BG_EY_NODE_DRAENEI_RUINS
|
||||
|
|
@ -235,7 +236,7 @@ const BattleGroundEYCapturingPointStruct CapturingPointTypes[BG_EY_NODES_MAX] =
|
|||
class BattleGroundEYScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundEYScore () : FlagCaptures(0) {};
|
||||
BattleGroundEYScore() : FlagCaptures(0) {};
|
||||
virtual ~BattleGroundEYScore() {};
|
||||
uint32 FlagCaptures;
|
||||
};
|
||||
|
|
@ -250,7 +251,7 @@ class BattleGroundEY : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
|
|
@ -263,31 +264,31 @@ class BattleGroundEY : public BattleGround
|
|||
void RespawnFlag(bool send_message);
|
||||
void RespawnFlagAfterDrop();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player *player, Player *killer);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void UpdateTeamScore(Team team);
|
||||
void EndBattleGround(Team winner);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||
void SetDroppedFlagGuid(ObjectGuid guid) { m_DroppedFlagGuid = guid;}
|
||||
void ClearDroppedFlagGuid() { m_DroppedFlagGuid.Clear();}
|
||||
ObjectGuid const& GetDroppedFlagGuid() const { return m_DroppedFlagGuid;}
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||
virtual void EventPlayerDroppedFlag(Player *Source);
|
||||
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
virtual void EventPlayerDroppedFlag(Player* Source);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(Team team) const;
|
||||
|
||||
private:
|
||||
void EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node);
|
||||
void EventTeamCapturedPoint(Player *Source, uint32 Point);
|
||||
void EventTeamLostPoint(Player *Source, uint32 Point);
|
||||
void EventPlayerCapturedFlag(Player* Source, BG_EY_Nodes node);
|
||||
void EventTeamCapturedPoint(Player* Source, uint32 Point);
|
||||
void EventTeamLostPoint(Player* Source, uint32 Point);
|
||||
void UpdatePointsCount(Team team);
|
||||
void UpdatePointsIcons(Team team, uint32 Point);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@
|
|||
#include "ScriptMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from %s", guid.GetString().c_str());
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
|
||||
if (!pCreature)
|
||||
return;
|
||||
|
|
@ -68,21 +68,21 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
|
|||
SendBattlegGroundList(guid, bgTypeId);
|
||||
}
|
||||
|
||||
void WorldSession::SendBattlegGroundList( ObjectGuid guid, BattleGroundTypeId bgTypeId )
|
||||
void WorldSession::SendBattlegGroundList(ObjectGuid guid, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId, 0);
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
uint32 bgTypeId_;
|
||||
uint32 instanceId;
|
||||
uint8 joinAsGroup;
|
||||
bool isPremade = false;
|
||||
Group * grp;
|
||||
Group* grp;
|
||||
|
||||
recv_data >> guid; // battlemaster guid
|
||||
recv_data >> bgTypeId_; // battleground type id (DBC id)
|
||||
|
|
@ -97,7 +97,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
|
||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
|
||||
|
||||
DEBUG_LOG( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from %s", guid.GetString().c_str());
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from %s", guid.GetString().c_str());
|
||||
|
||||
// can do this, since it's battleground, not arena
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, ARENA_TYPE_NONE);
|
||||
|
|
@ -107,7 +107,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
// get bg instance or bg template if instance not found
|
||||
BattleGround *bg = NULL;
|
||||
BattleGround* bg = NULL;
|
||||
if (instanceId)
|
||||
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
|
||||
|
||||
|
|
@ -164,22 +164,22 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
GroupQueueInfo* ginfo = NULL;
|
||||
uint32 avgTime = 0;
|
||||
|
||||
if(err > 0)
|
||||
if (err > 0)
|
||||
{
|
||||
DEBUG_LOG("Battleground: the following players are joining as group:");
|
||||
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
||||
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
}
|
||||
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *member = itr->getSource();
|
||||
if(!member)
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
continue; // this should never happen
|
||||
|
||||
WorldPacket data;
|
||||
|
||||
if(err <= 0)
|
||||
if (err <= 0)
|
||||
{
|
||||
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||
member->GetSession()->SendPacket(&data);
|
||||
|
|
@ -200,7 +200,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
else
|
||||
{
|
||||
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
||||
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
||||
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
// already checked if queueSlot is valid, now just get it
|
||||
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
|
@ -214,27 +214,27 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
|||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
// empty opcode
|
||||
DEBUG_LOG("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg) // can't be received if player not in battleground
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg) // can't be received if player not in battleground
|
||||
return;
|
||||
|
||||
switch( bg->GetTypeID() )
|
||||
switch (bg->GetTypeID())
|
||||
{
|
||||
case BATTLEGROUND_WS:
|
||||
{
|
||||
uint32 count1 = 0; // always constant zero?
|
||||
uint32 count2 = 0; // count of next fields
|
||||
|
||||
Player *ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGuid());
|
||||
Player* ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGuid());
|
||||
if (ali_plr)
|
||||
++count2;
|
||||
|
||||
Player *horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGuid());
|
||||
Player* horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGuid());
|
||||
if (horde_plr)
|
||||
++count2;
|
||||
|
||||
|
|
@ -282,11 +282,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandlePVPLogDataOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Recvd MSG_PVP_LOG_DATA Message");
|
||||
DEBUG_LOG("WORLD: Recvd MSG_PVP_LOG_DATA Message");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
|
|
@ -298,12 +298,12 @@ void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ )
|
|||
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
|
||||
SendPacket(&data);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent MSG_PVP_LOG_DATA Message");
|
||||
DEBUG_LOG("WORLD: Sent MSG_PVP_LOG_DATA Message");
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data )
|
||||
void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message");
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_BATTLEFIELD_LIST Message");
|
||||
|
||||
uint32 bgTypeId;
|
||||
recv_data >> bgTypeId; // id from DBC
|
||||
|
|
@ -323,12 +323,12 @@ void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data )
|
|||
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, ObjectGuid(), _player, BattleGroundTypeId(bgTypeId), fromWhere);
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
||||
void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Recvd CMSG_BATTLEFIELD_PORT Message");
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_BATTLEFIELD_PORT Message");
|
||||
|
||||
uint8 type; // arenatype if arena
|
||||
uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
|
|
@ -374,7 +374,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
|
||||
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||
if (!bg && action == 0)
|
||||
|
|
@ -413,7 +413,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
}
|
||||
uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
WorldPacket data;
|
||||
switch( action )
|
||||
switch (action)
|
||||
{
|
||||
case 1: // port to battleground
|
||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||
|
|
@ -441,7 +441,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
bgQueue.RemovePlayer(_player->GetObjectGuid(), false);
|
||||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
||||
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
||||
if (BattleGround *currentBg = _player->GetBattleGround())
|
||||
if (BattleGround* currentBg = _player->GetBattleGround())
|
||||
currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true);
|
||||
|
||||
// set the destination instance id
|
||||
|
|
@ -458,7 +458,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
// if player leaves rated arena match before match start, it is counted as he played but he lost
|
||||
if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.ArenaTeamId);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ginfo.ArenaTeamId);
|
||||
if (at)
|
||||
{
|
||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %s by opponents rating: %u, because he has left queue!", _player->GetGuidStr().c_str(), ginfo.OpponentsTeamRating);
|
||||
|
|
@ -481,9 +481,9 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket& recv_data )
|
||||
void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message");
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message");
|
||||
|
||||
recv_data.read_skip<uint8>(); // unk1
|
||||
recv_data.read_skip<uint8>(); // unk2
|
||||
|
|
@ -502,14 +502,14 @@ void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket& recv_data )
|
|||
_player->LeaveBattleground();
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
// empty opcode
|
||||
DEBUG_LOG( "WORLD: Battleground status" );
|
||||
DEBUG_LOG("WORLD: Battleground status");
|
||||
|
||||
WorldPacket data;
|
||||
// we must update all queues here
|
||||
BattleGround *bg = NULL;
|
||||
BattleGround* bg = NULL;
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
|
|
@ -567,49 +567,49 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
if (!unit->isSpiritService()) // it's not spirit service
|
||||
return;
|
||||
|
||||
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
|
||||
}
|
||||
|
||||
void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
if (!unit->isSpiritService()) // it's not spirit service
|
||||
return;
|
||||
|
||||
sScriptMgr.OnGossipHello(GetPlayer(), unit);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||
void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
|
||||
//recv_data.hexlike();
|
||||
|
|
@ -625,17 +625,17 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battle master
|
||||
if (!unit->isBattleMaster()) // it's not battle master
|
||||
return;
|
||||
|
||||
ArenaType arenatype;
|
||||
uint32 arenaRating = 0;
|
||||
|
||||
switch(arenaslot)
|
||||
switch (arenaslot)
|
||||
{
|
||||
case 0:
|
||||
arenatype = ARENA_TYPE_2v2;
|
||||
|
|
@ -667,7 +667,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
|
||||
GroupJoinBattlegroundResult err;
|
||||
|
||||
Group * grp = NULL;
|
||||
Group* grp = NULL;
|
||||
|
||||
// check queue conditions
|
||||
if (!asGroup)
|
||||
|
|
@ -702,7 +702,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
{
|
||||
ateamId = _player->GetArenaTeamId(arenaslot);
|
||||
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
|
||||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ateamId);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ateamId);
|
||||
if (!at)
|
||||
{
|
||||
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
|
||||
|
|
@ -714,7 +714,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
// get the personal ratings for queue
|
||||
uint32 avg_pers_rating = 0;
|
||||
|
||||
for(Group::member_citerator citr = grp->GetMemberSlots().begin(); citr != grp->GetMemberSlots().end(); ++citr)
|
||||
for (Group::member_citerator citr = grp->GetMemberSlots().begin(); citr != grp->GetMemberSlots().end(); ++citr)
|
||||
{
|
||||
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
|
||||
if (!at_member) // group member joining to arena must be in leader arena team
|
||||
|
|
@ -731,30 +731,30 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
arenaRating = avg_pers_rating;
|
||||
}
|
||||
|
||||
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
if (asGroup)
|
||||
{
|
||||
uint32 avgTime = 0;
|
||||
|
||||
if(err > 0)
|
||||
if (err > 0)
|
||||
{
|
||||
DEBUG_LOG("Battleground: arena join as group start");
|
||||
if (isRated)
|
||||
DEBUG_LOG("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
|
||||
|
||||
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
|
||||
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
|
||||
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
}
|
||||
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *member = itr->getSource();
|
||||
if(!member)
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
continue;
|
||||
|
||||
WorldPacket data;
|
||||
|
||||
if(err <= 0)
|
||||
if (err <= 0)
|
||||
{
|
||||
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||
member->GetSession()->SendPacket(&data);
|
||||
|
|
@ -775,7 +775,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
}
|
||||
else
|
||||
{
|
||||
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
|
||||
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
|
||||
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
||||
|
|
@ -788,11 +788,11 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
}
|
||||
|
||||
void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data )
|
||||
void WorldSession::HandleReportPvPAFK(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid playerGuid;
|
||||
recv_data >> playerGuid;
|
||||
Player *reportedPlayer = sObjectMgr.GetPlayer(playerGuid);
|
||||
Player* reportedPlayer = sObjectMgr.GetPlayer(playerGuid);
|
||||
|
||||
if (!reportedPlayer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void BattleGroundIC::StartingEventOpenDoors()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundIC::AddPlayer(Player *plr)
|
||||
void BattleGroundIC::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -62,7 +62,7 @@ void BattleGroundIC::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
|
||||
}
|
||||
|
||||
void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
void BattleGroundIC::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -74,7 +74,7 @@ void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
|||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
BattleGround::UpdatePlayerScore(Source,type,value);
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ class BattleGroundIC : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
//bool SetupBattleGround();
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1( BattleGroundMgr );
|
||||
INSTANTIATE_SINGLETON_1(BattleGroundMgr);
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
|
|
@ -53,13 +53,13 @@ INSTANTIATE_SINGLETON_1( BattleGroundMgr );
|
|||
|
||||
BattleGroundQueue::BattleGroundQueue()
|
||||
{
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
{
|
||||
for(uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)
|
||||
for (uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)
|
||||
{
|
||||
m_SumOfWaitTimes[i][j] = 0;
|
||||
m_WaitTimeLastPlayer[i][j] = 0;
|
||||
for(uint32 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)
|
||||
for (uint32 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)
|
||||
m_WaitTimes[i][j][k] = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -70,10 +70,10 @@ BattleGroundQueue::~BattleGroundQueue()
|
|||
m_QueuedPlayers.clear();
|
||||
for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i)
|
||||
{
|
||||
for(uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
|
||||
for (uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
|
||||
{
|
||||
for(GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr!= m_QueuedGroups[i][j].end(); ++itr)
|
||||
delete (*itr);
|
||||
for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr!= m_QueuedGroups[i][j].end(); ++itr)
|
||||
delete(*itr);
|
||||
m_QueuedGroups[i][j].clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
|||
// used when building selection pools
|
||||
// returns true if we can invite more players, or when we added group to selection pool
|
||||
// returns false when selection pool is full
|
||||
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
|
||||
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount)
|
||||
{
|
||||
//if group is larger than desired count - don't allow to add it to pool
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size())
|
||||
|
|
@ -147,7 +147,7 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de
|
|||
/*********************************************************/
|
||||
|
||||
// add group or player (grp == NULL) to bg queue with the given leader and bg specifications
|
||||
GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid)
|
||||
GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid)
|
||||
{
|
||||
BattleGroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
|
||||
|
|
@ -189,10 +189,10 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
|
|||
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||
if (grp)
|
||||
{
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *member = itr->getSource();
|
||||
if(!member)
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
continue; // this should never happen
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
|
|
@ -224,10 +224,10 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
|
|||
uint32 q_min_level = bracketEntry->minLevel;
|
||||
uint32 q_max_level = bracketEntry->maxLevel;
|
||||
GroupsQueueType::const_iterator itr;
|
||||
for(itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||
qAlliance += (*itr)->Players.size();
|
||||
for(itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||
qHorde += (*itr)->Players.size();
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
|||
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
|
||||
}
|
||||
//check if there is enought values(we always add values > 0)
|
||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] )
|
||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
|
||||
return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME);
|
||||
else
|
||||
//if there aren't enough values return 0 - not available
|
||||
|
|
@ -330,7 +330,7 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
|||
//they leave groupinfo so we can't use its players size to find out index
|
||||
for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_QUEUE_NORMAL_ALLIANCE)
|
||||
{
|
||||
for(group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp)
|
||||
for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp)
|
||||
{
|
||||
if ((*group_itr_tmp) == group)
|
||||
{
|
||||
|
|
@ -379,11 +379,11 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
|||
//if player leaves queue and he is invited to rated arena match, then he have to loose
|
||||
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
|
||||
{
|
||||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(group->ArenaTeamId);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(group->ArenaTeamId);
|
||||
if (at)
|
||||
{
|
||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %s by opponents rating: %u", guid.GetString().c_str(), group->OpponentsTeamRating);
|
||||
Player *plr = sObjectMgr.GetPlayer(guid);
|
||||
Player* plr = sObjectMgr.GetPlayer(guid);
|
||||
if (plr)
|
||||
at->MemberLost(plr, group->OpponentsTeamRating);
|
||||
else
|
||||
|
|
@ -405,9 +405,9 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
|||
{
|
||||
// remove next player, this is recursive
|
||||
// first send removal information
|
||||
if (Player *plr2 = sObjectMgr.GetPlayer(group->Players.begin()->first))
|
||||
if (Player* plr2 = sObjectMgr.GetPlayer(group->Players.begin()->first))
|
||||
{
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->arenaType);
|
||||
uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to
|
||||
|
|
@ -426,9 +426,9 @@ bool BattleGroundQueue::IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInsta
|
|||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> g(m_Lock);
|
||||
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
|
||||
return ( qItr != m_QueuedPlayers.end()
|
||||
return (qItr != m_QueuedPlayers.end()
|
||||
&& qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == bgInstanceGuid
|
||||
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime );
|
||||
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime);
|
||||
}
|
||||
|
||||
bool BattleGroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo)
|
||||
|
|
@ -441,7 +441,7 @@ bool BattleGroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo*
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, Team side)
|
||||
bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg, Team side)
|
||||
{
|
||||
// set side if needed
|
||||
if (side)
|
||||
|
|
@ -463,7 +463,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
ginfo->RemoveInviteTime = WorldTimer::getMSTime() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for(GroupQueueInfoPlayers::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
for (GroupQueueInfoPlayers::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
{
|
||||
// get the player
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
|
@ -544,7 +544,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
|||
// At first we need to compare free space in bg and our selection pool
|
||||
int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
|
||||
int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
|
||||
while( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) )
|
||||
while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
//each cycle execution we need to kick at least 1 group
|
||||
if (diffAli < diffHorde)
|
||||
|
|
@ -595,10 +595,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
|||
//start premade match
|
||||
//if groups aren't invited
|
||||
GroupsQueueType::const_iterator ali_group, horde_group;
|
||||
for( ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||
for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||
if (!(*ali_group)->IsInvitedToBGInstanceGUID)
|
||||
break;
|
||||
for( horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||
for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||
if (!(*horde_group)->IsInvitedToBGInstanceGUID)
|
||||
break;
|
||||
|
||||
|
|
@ -609,9 +609,9 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
|||
//add groups/players from normal queue to size of bigger group
|
||||
uint32 maxPlayers = std::max(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
|
||||
GroupsQueueType::const_iterator itr;
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
for(itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
|
||||
for (itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
|
||||
{
|
||||
//if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers))
|
||||
|
|
@ -627,7 +627,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
|||
// if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg
|
||||
// and when they click or after 80 seconds the queue info is removed from queue
|
||||
uint32 time_before = WorldTimer::getMSTime() - sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
|
||||
{
|
||||
|
|
@ -648,10 +648,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
|||
bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
|
||||
{
|
||||
GroupsQueueType::const_iterator itr_team[BG_TEAMS_COUNT];
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
itr_team[i] = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin();
|
||||
for(; itr_team[i] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i]))
|
||||
for (; itr_team[i] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i]))
|
||||
{
|
||||
if (!(*(itr_team[i]))->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
|
|
@ -665,12 +665,12 @@ 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_UINT32_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers )
|
||||
if (sWorld.getConfig(CONFIG_UINT32_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
|
||||
++(itr_team[j]); //this will not cause a crash, because for cycle above reached break;
|
||||
for(; itr_team[j] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j]))
|
||||
for (; itr_team[j] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j]))
|
||||
{
|
||||
if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
|
||||
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()))
|
||||
|
|
@ -695,7 +695,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
|||
BattleGroundTeamIndex teamIdx = BG_TEAM_ALLIANCE;
|
||||
BattleGroundTeamIndex otherTeamIdx = BG_TEAM_HORDE;
|
||||
Team otherTeamId = HORDE;
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam )
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam)
|
||||
{
|
||||
teamIdx = BG_TEAM_HORDE;
|
||||
otherTeamIdx = BG_TEAM_ALLIANCE;
|
||||
|
|
@ -707,7 +707,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
|||
GroupQueueInfo* ginfo = m_SelectionPools[teamIdx].SelectedGroups.back();
|
||||
//set itr_team to group that was added to selection pool latest
|
||||
GroupsQueueType::iterator itr_team = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].begin();
|
||||
for(; itr_team != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team)
|
||||
for (; itr_team != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team)
|
||||
if (ginfo == *itr_team)
|
||||
break;
|
||||
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
|
||||
|
|
@ -715,7 +715,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
|||
GroupsQueueType::iterator itr_team2 = itr_team;
|
||||
++itr_team2;
|
||||
//invite players to other selection pool
|
||||
for(; itr_team2 != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team2)
|
||||
for (; itr_team2 != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team2)
|
||||
{
|
||||
//if selection pool is full then break;
|
||||
if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeamIdx].AddGroup(*itr_team2, minPlayersPerTeam))
|
||||
|
|
@ -725,7 +725,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
|||
return false;
|
||||
|
||||
//here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue
|
||||
for(GroupsQueueType::iterator itr = m_SelectionPools[otherTeamIdx].SelectedGroups.begin(); itr != m_SelectionPools[otherTeamIdx].SelectedGroups.end(); ++itr)
|
||||
for (GroupsQueueType::iterator itr = m_SelectionPools[otherTeamIdx].SelectedGroups.begin(); itr != m_SelectionPools[otherTeamIdx].SelectedGroups.end(); ++itr)
|
||||
{
|
||||
//set correct team
|
||||
(*itr)->GroupTeam = otherTeamId;
|
||||
|
|
@ -734,7 +734,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
|||
//remove team from old queue
|
||||
GroupsQueueType::iterator itr2 = itr_team;
|
||||
++itr2;
|
||||
for(; itr2 != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr2)
|
||||
for (; itr2 != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr2)
|
||||
{
|
||||
if (*itr2 == *itr)
|
||||
{
|
||||
|
|
@ -755,10 +755,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||
//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() )
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
|
||||
//battleground with free slot for player should be always in the beggining of the queue
|
||||
|
|
@ -769,8 +769,8 @@ 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 &&
|
||||
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE )
|
||||
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!!)
|
||||
// and iterator is invalid
|
||||
|
|
@ -783,9 +783,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
FillPlayersToBG(bg, bracket_id);
|
||||
|
||||
// now everything is set, invite players
|
||||
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg, (*citr)->GroupTeam);
|
||||
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg, (*citr)->GroupTeam);
|
||||
|
||||
if (!bg->HasFreeSlots())
|
||||
|
|
@ -798,7 +798,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
|
||||
// finished iterating through the bgs with free slots, maybe we need to create a new bg
|
||||
|
||||
BattleGround * bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
BattleGround* bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog.outError("Battleground: Update: bg template not found for %u", bgTypeId);
|
||||
|
|
@ -856,15 +856,15 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam))
|
||||
{
|
||||
//create new battleground
|
||||
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, ARENA_TYPE_NONE, false);
|
||||
BattleGround* bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, ARENA_TYPE_NONE, false);
|
||||
if (!bg2)
|
||||
{
|
||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
||||
return;
|
||||
}
|
||||
//invite those selection pools
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
|
||||
//start bg
|
||||
bg2->StartBattleGround();
|
||||
|
|
@ -879,10 +879,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
{
|
||||
// if there are enough players in pools, start new battleground or non rated arena
|
||||
if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)
|
||||
|| (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)) )
|
||||
|| (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)))
|
||||
{
|
||||
// we successfully created a pool
|
||||
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false);
|
||||
BattleGround* bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false);
|
||||
if (!bg2)
|
||||
{
|
||||
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
||||
|
|
@ -890,8 +890,8 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
}
|
||||
|
||||
// invite those selection pools
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for(GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
|
||||
// start bg
|
||||
bg2->StartBattleGround();
|
||||
|
|
@ -902,7 +902,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
// found out the minimum and maximum ratings the newly added team should battle against
|
||||
// arenaRating is the rating of the latest joined team, or 0
|
||||
// 0 is on (automatic update call) and we must set it to team's with longest wait time
|
||||
if (!arenaRating )
|
||||
if (!arenaRating)
|
||||
{
|
||||
GroupQueueInfo* front1 = NULL;
|
||||
GroupQueueInfo* front2 = NULL;
|
||||
|
|
@ -940,16 +940,16 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
|
||||
//optimalization : --- we dont need to use selection_pools - each update we select max 2 groups
|
||||
|
||||
for(uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
|
||||
for (uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
|
||||
{
|
||||
// take the group that joined first
|
||||
itr_team[i] = m_QueuedGroups[bracket_id][i].begin();
|
||||
for(; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i]))
|
||||
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) )
|
||||
|| (*itr_team[i])->JoinTime < discardTime))
|
||||
{
|
||||
m_SelectionPools[i].AddGroup((*itr_team[i]), MaxPlayersPerTeam);
|
||||
// break for cycle to be able to start selecting another group from same faction queue
|
||||
|
|
@ -965,11 +965,11 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
{
|
||||
itr_team[BG_TEAM_ALLIANCE] = itr_team[BG_TEAM_HORDE];
|
||||
++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]))
|
||||
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) )
|
||||
|| (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime))
|
||||
{
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*itr_team[BG_TEAM_ALLIANCE]), MaxPlayersPerTeam);
|
||||
break;
|
||||
|
|
@ -981,11 +981,11 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
{
|
||||
itr_team[BG_TEAM_HORDE] = itr_team[BG_TEAM_ALLIANCE];
|
||||
++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]))
|
||||
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) )
|
||||
|| (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime))
|
||||
{
|
||||
m_SelectionPools[BG_TEAM_HORDE].AddGroup((*itr_team[BG_TEAM_HORDE]), MaxPlayersPerTeam);
|
||||
break;
|
||||
|
|
@ -1039,7 +1039,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
|
||||
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = sObjectMgr.GetPlayer( m_PlayerGuid );
|
||||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
if (!plr)
|
||||
return true;
|
||||
|
|
@ -1054,7 +1054,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground
|
||||
{
|
||||
// check if player is invited to this bg
|
||||
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
|
||||
{
|
||||
WorldPacket data;
|
||||
|
|
@ -1082,7 +1082,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
|
|||
*/
|
||||
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = sObjectMgr.GetPlayer( m_PlayerGuid );
|
||||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||
if (!plr)
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
return true;
|
||||
|
|
@ -1095,7 +1095,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
|
||||
{
|
||||
// check if player is in queue for this BG and if we are removing his invite event
|
||||
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId];
|
||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId];
|
||||
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
|
||||
{
|
||||
DEBUG_LOG("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
|
||||
|
|
@ -1127,7 +1127,7 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
|
|||
|
||||
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
|
||||
{
|
||||
for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
m_BattleGrounds[i].clear();
|
||||
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
|
||||
m_Testing=false;
|
||||
|
|
@ -1141,11 +1141,11 @@ BattleGroundMgr::~BattleGroundMgr()
|
|||
void BattleGroundMgr::DeleteAllBattleGrounds()
|
||||
{
|
||||
// will also delete template bgs:
|
||||
for(uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
||||
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
||||
{
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end();)
|
||||
for (BattleGroundSet::iterator itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end();)
|
||||
{
|
||||
BattleGround * bg = itr->second;
|
||||
BattleGround* bg = itr->second;
|
||||
++itr; // step from invalidate iterator pos in result element remove in ~BattleGround call
|
||||
delete bg;
|
||||
}
|
||||
|
|
@ -1187,8 +1187,8 @@ void BattleGroundMgr::Update(uint32 diff)
|
|||
{
|
||||
// forced update for rated arenas (scan all, but skipped non rated)
|
||||
DEBUG_LOG("BattleGroundMgr: UPDATING ARENA QUEUES");
|
||||
for(int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
|
||||
for(int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||
for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
|
||||
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||
m_BattleGroundQueues[qtype].Update(
|
||||
BATTLEGROUND_AA, BattleGroundBracketId(bracket),
|
||||
BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId(qtype)), true, 0);
|
||||
|
|
@ -1215,7 +1215,7 @@ void BattleGroundMgr::Update(uint32 diff)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype)
|
||||
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype)
|
||||
{
|
||||
// we can be in 2 queues in same time...
|
||||
|
||||
|
|
@ -1230,7 +1230,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
|||
data->Initialize(SMSG_BATTLEFIELD_STATUS, (4+8+1+1+4+1+4+4+4));
|
||||
*data << uint32(QueueSlot); // queue id (0...1) - player can be in 2 queues in time
|
||||
// uint64 in client
|
||||
*data << uint64( uint64(arenatype) | (uint64(0x0D) << 8) | (uint64(bg->GetTypeID()) << 16) | (uint64(0x1F90) << 48) );
|
||||
*data << uint64(uint64(arenatype) | (uint64(0x0D) << 8) | (uint64(bg->GetTypeID()) << 16) | (uint64(0x1F90) << 48));
|
||||
*data << uint8(0); // 3.3.0, some level, only saw 80...
|
||||
*data << uint8(0); // 3.3.0, some level, only saw 80...
|
||||
*data << uint32(bg->GetClientInstanceID());
|
||||
|
|
@ -1238,7 +1238,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
|||
// following displays the minimap-icon 0 = faction icon 1 = arenaicon
|
||||
*data << uint8(bg->isRated());
|
||||
*data << uint32(StatusID); // status
|
||||
switch(StatusID)
|
||||
switch (StatusID)
|
||||
{
|
||||
case STATUS_WAIT_QUEUE: // status_in_queue
|
||||
*data << uint32(Time1); // average wait time, milliseconds
|
||||
|
|
@ -1262,17 +1262,17 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
||||
void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
||||
{
|
||||
uint8 type = (bg->isArena() ? 1 : 0);
|
||||
// last check on 3.0.3
|
||||
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)
|
||||
for (int i = 1; i >= 0; --i)
|
||||
{
|
||||
uint32 pointsLost = bg->m_ArenaTeamRatingChanges[i] < 0 ? abs(bg->m_ArenaTeamRatingChanges[i]) : 0;
|
||||
uint32 pointsGained = bg->m_ArenaTeamRatingChanges[i] > 0 ? bg->m_ArenaTeamRatingChanges[i] : 0;
|
||||
|
|
@ -1282,10 +1282,10 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
|||
*data << uint32(0); // Matchmaking Value
|
||||
DEBUG_LOG("rating change: %d", bg->m_ArenaTeamRatingChanges[i]);
|
||||
}
|
||||
for(int i = 1; i >= 0; --i)
|
||||
for (int i = 1; i >= 0; --i)
|
||||
{
|
||||
uint32 at_id = bg->m_ArenaTeamIds[i];
|
||||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(at_id);
|
||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(at_id);
|
||||
if (at)
|
||||
*data << at->GetName();
|
||||
else
|
||||
|
|
@ -1305,7 +1305,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
|||
|
||||
*data << (int32)(bg->GetPlayerScoresSize());
|
||||
|
||||
for(BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
|
||||
for (BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
|
||||
{
|
||||
*data << ObjectGuid(itr->first);
|
||||
*data << (int32)itr->second->KillingBlows;
|
||||
|
|
@ -1329,7 +1329,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
|||
}
|
||||
*data << (int32)itr->second->DamageDone; // damage done
|
||||
*data << (int32)itr->second->HealingDone; // healing done
|
||||
switch(bg->GetTypeID()) // battleground specific things
|
||||
switch (bg->GetTypeID()) // battleground specific things
|
||||
{
|
||||
case BATTLEGROUND_AV:
|
||||
*data << (uint32)0x00000005; // count of next fields
|
||||
|
|
@ -1372,40 +1372,40 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result)
|
||||
void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result)
|
||||
{
|
||||
data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
*data << int32(result);
|
||||
if(result == ERR_BATTLEGROUND_JOIN_TIMED_OUT || result == ERR_BATTLEGROUND_JOIN_FAILED)
|
||||
if (result == ERR_BATTLEGROUND_JOIN_TIMED_OUT || result == ERR_BATTLEGROUND_JOIN_FAILED)
|
||||
*data << uint64(0); // player guid
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value)
|
||||
void BattleGroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value)
|
||||
{
|
||||
data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4);
|
||||
*data << uint32(field);
|
||||
*data << uint32(value);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid)
|
||||
void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
|
||||
{
|
||||
data->Initialize(SMSG_PLAY_SOUND, 4);
|
||||
*data << uint32(soundid);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, ObjectGuid guid)
|
||||
void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
|
||||
*data << ObjectGuid(guid);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr)
|
||||
void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* plr)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
|
||||
*data << plr->GetObjectGuid();
|
||||
}
|
||||
|
||||
BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId)
|
||||
BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
//cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from
|
||||
//SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
|
||||
|
|
@ -1416,7 +1416,7 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst
|
|||
if (bg->isArena())
|
||||
return GetBattleGround(instanceId, bgTypeId);
|
||||
|
||||
for(BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||
{
|
||||
if (itr->second->GetClientInstanceID() == instanceId)
|
||||
return itr->second;
|
||||
|
|
@ -1424,13 +1424,13 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId)
|
||||
BattleGround* BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
//search if needed
|
||||
BattleGroundSet::iterator itr;
|
||||
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
{
|
||||
for(uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
for (uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
{
|
||||
itr = m_BattleGrounds[i].find(InstanceID);
|
||||
if (itr != m_BattleGrounds[i].end())
|
||||
|
|
@ -1439,10 +1439,10 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT
|
|||
return NULL;
|
||||
}
|
||||
itr = m_BattleGrounds[bgTypeId].find(InstanceID);
|
||||
return ( (itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL );
|
||||
return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL);
|
||||
}
|
||||
|
||||
BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId)
|
||||
BattleGround* BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
//map is sorted and we can be sure that lowest instance id has only BG template
|
||||
return m_BattleGrounds[bgTypeId].empty() ? NULL : m_BattleGrounds[bgTypeId].begin()->second;
|
||||
|
|
@ -1461,9 +1461,9 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
|
|||
// the optimalization would be to use as bitmask std::vector<uint32> - but that would only make code unreadable
|
||||
uint32 lastId = 0;
|
||||
ClientBattleGroundIdSet& ids = m_ClientBattleGroundIds[bgTypeId][bracket_id];
|
||||
for(ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();)
|
||||
for (ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.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;
|
||||
}
|
||||
|
|
@ -1472,10 +1472,10 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
|
|||
}
|
||||
|
||||
// create a new battleground that will really be used to play
|
||||
BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated)
|
||||
BattleGround* BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated)
|
||||
{
|
||||
// get the template BG
|
||||
BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId);
|
||||
BattleGround* bg_template = GetBattleGroundTemplate(bgTypeId);
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
|
||||
|
|
@ -1495,9 +1495,9 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
|||
}
|
||||
}
|
||||
|
||||
BattleGround *bg = NULL;
|
||||
BattleGround* bg = NULL;
|
||||
// create a copy of the BG template
|
||||
switch(bgTypeId)
|
||||
switch (bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_AV:
|
||||
bg = new BattleGroundAV(*(BattleGroundAV*)bg_template);
|
||||
|
|
@ -1566,8 +1566,8 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
|||
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
|
||||
{
|
||||
// Create the BG
|
||||
BattleGround *bg = NULL;
|
||||
switch(bgTypeId)
|
||||
BattleGround* bg = NULL;
|
||||
switch (bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_AV: bg = new BattleGroundAV; break;
|
||||
case BATTLEGROUND_WS: bg = new BattleGroundWS; break;
|
||||
|
|
@ -1609,7 +1609,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
QueryResult* result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -1626,13 +1626,13 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 bgTypeID_ = fields[0].GetUInt32();
|
||||
|
||||
// can be overwrite by values from DB
|
||||
BattlemasterListEntry const *bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
|
||||
|
|
@ -1660,7 +1660,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
|
||||
uint32 start1 = fields[3].GetUInt32();
|
||||
|
||||
WorldSafeLocsEntry const *start = sWorldSafeLocsStore.LookupEntry(start1);
|
||||
WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(start1);
|
||||
if (start)
|
||||
{
|
||||
AStartLoc[0] = start->x;
|
||||
|
|
@ -1709,12 +1709,13 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
continue;
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battlegrounds", count );
|
||||
sLog.outString(">> Loaded %u battlegrounds", count);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
||||
|
|
@ -1722,7 +1723,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
|||
if (sWorld.getConfig(CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
DEBUG_LOG("Initializing Automatic Arena Point Distribution");
|
||||
QueryResult * result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
|
||||
if (!result)
|
||||
{
|
||||
DEBUG_LOG("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now.");
|
||||
|
|
@ -1749,9 +1750,9 @@ void BattleGroundMgr::DistributeArenaPoints()
|
|||
std::map<uint32, uint32> PlayerPoints;
|
||||
|
||||
//at first update all points for all team members
|
||||
for(ObjectMgr::ArenaTeamMap::iterator team_itr = sObjectMgr.GetArenaTeamMapBegin(); team_itr != sObjectMgr.GetArenaTeamMapEnd(); ++team_itr)
|
||||
for (ObjectMgr::ArenaTeamMap::iterator team_itr = sObjectMgr.GetArenaTeamMapBegin(); team_itr != sObjectMgr.GetArenaTeamMapEnd(); ++team_itr)
|
||||
{
|
||||
if (ArenaTeam * at = team_itr->second)
|
||||
if (ArenaTeam* at = team_itr->second)
|
||||
{
|
||||
at->UpdateArenaPointsHelper(PlayerPoints);
|
||||
}
|
||||
|
|
@ -1772,9 +1773,9 @@ void BattleGroundMgr::DistributeArenaPoints()
|
|||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
|
||||
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
|
||||
for(ObjectMgr::ArenaTeamMap::iterator titr = sObjectMgr.GetArenaTeamMapBegin(); titr != sObjectMgr.GetArenaTeamMapEnd(); ++titr)
|
||||
for (ObjectMgr::ArenaTeamMap::iterator titr = sObjectMgr.GetArenaTeamMapBegin(); titr != sObjectMgr.GetArenaTeamMapEnd(); ++titr)
|
||||
{
|
||||
if (ArenaTeam * at = titr->second)
|
||||
if (ArenaTeam* at = titr->second)
|
||||
{
|
||||
at->FinishWeek(); // set played this week etc values to 0 in memory, too
|
||||
at->SaveToDB(); // save changes
|
||||
|
|
@ -1787,7 +1788,7 @@ void BattleGroundMgr::DistributeArenaPoints()
|
|||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_END);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere)
|
||||
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere)
|
||||
{
|
||||
if (!plr)
|
||||
return;
|
||||
|
|
@ -1807,7 +1808,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid
|
|||
|
||||
uint8 isRandom = 0;
|
||||
*data << uint8(isRandom); // 3.3.3 isRandom
|
||||
if(isRandom)
|
||||
if (isRandom)
|
||||
{
|
||||
// Rewards (random)
|
||||
*data << uint8(0); // 3.3.3 hasWin_Random
|
||||
|
|
@ -1816,7 +1817,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid
|
|||
*data << uint32(0); // 3.3.3 lossHonor_Random
|
||||
}
|
||||
|
||||
if(bgTypeId == BATTLEGROUND_AA) // arena
|
||||
if (bgTypeId == BATTLEGROUND_AA) // arena
|
||||
{
|
||||
*data << uint32(0); // arena - no instances showed
|
||||
}
|
||||
|
|
@ -1826,27 +1827,27 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid
|
|||
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();
|
||||
ClientBattleGroundIdSet const& ids = m_ClientBattleGroundIds[bgTypeId][bracketId];
|
||||
for(ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();++itr)
|
||||
for (ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end(); ++itr)
|
||||
{
|
||||
*data << uint32(*itr);
|
||||
++count;
|
||||
}
|
||||
data->put<uint32>( count_pos , count);
|
||||
data->put<uint32>(count_pos , count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId)
|
||||
void BattleGroundMgr::SendToBattleGround(Player* pl, uint32 instanceId, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
BattleGround *bg = GetBattleGround(instanceId, bgTypeId);
|
||||
BattleGround* bg = GetBattleGround(instanceId, bgTypeId);
|
||||
if (bg)
|
||||
{
|
||||
uint32 mapid = bg->GetMapId();
|
||||
|
|
@ -1867,7 +1868,7 @@ void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGr
|
|||
|
||||
bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
switch(bgTypeId)
|
||||
switch (bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_NA:
|
||||
case BATTLEGROUND_BE:
|
||||
|
|
@ -1883,7 +1884,7 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
|
|||
|
||||
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, ArenaType arenaType)
|
||||
{
|
||||
switch(bgTypeId)
|
||||
switch (bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_WS:
|
||||
return BATTLEGROUND_QUEUE_WS;
|
||||
|
|
@ -1905,7 +1906,7 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType
|
|||
case BATTLEGROUND_BE:
|
||||
case BATTLEGROUND_DS:
|
||||
case BATTLEGROUND_RV:
|
||||
switch(arenaType)
|
||||
switch (arenaType)
|
||||
{
|
||||
case ARENA_TYPE_2v2:
|
||||
return BATTLEGROUND_QUEUE_2v2;
|
||||
|
|
@ -1923,7 +1924,7 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType
|
|||
|
||||
BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
switch (bgQueueTypeId)
|
||||
{
|
||||
case BATTLEGROUND_QUEUE_WS:
|
||||
return BATTLEGROUND_WS;
|
||||
|
|
@ -1948,7 +1949,7 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue
|
|||
|
||||
ArenaType BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
switch (bgQueueTypeId)
|
||||
{
|
||||
case BATTLEGROUND_QUEUE_2v2:
|
||||
return ARENA_TYPE_2v2;
|
||||
|
|
@ -2020,7 +2021,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
|||
{
|
||||
mBattleMastersMap.clear(); // need for reload case
|
||||
|
||||
QueryResult *result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" );
|
||||
QueryResult* result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
|
|
@ -2041,7 +2042,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
|||
++count;
|
||||
bar.step();
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
uint32 bgTypeId = fields[1].GetUInt32();
|
||||
|
|
@ -2053,12 +2054,13 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
|||
|
||||
mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId);
|
||||
|
||||
} while(result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battlemaster entries", count );
|
||||
sLog.outString(">> Loaded %u battlemaster entries", count);
|
||||
}
|
||||
|
||||
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
|
||||
|
|
@ -2104,9 +2106,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
|
||||
uint32 count = 0;
|
||||
|
||||
QueryResult *result =
|
||||
QueryResult* result =
|
||||
// 0 1 2 3 4 5 6
|
||||
WorldDatabase.Query( "SELECT data.typ, data.guid1, data.ev1 AS ev1, data.ev2 AS ev2, data.map AS m, data.guid2, description.map, "
|
||||
WorldDatabase.Query("SELECT data.typ, data.guid1, data.ev1 AS ev1, data.ev2 AS ev2, data.map AS m, data.guid2, description.map, "
|
||||
// 7 8 9
|
||||
"description.event1, description.event2, description.description "
|
||||
"FROM "
|
||||
|
|
@ -2135,7 +2137,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
") data "
|
||||
"LEFT OUTER JOIN battleground_events AS description ON data.map = description.map "
|
||||
"AND data.ev1 = description.event1 AND data.ev2 = description.event2 "
|
||||
"ORDER BY m, ev1, ev2" );
|
||||
"ORDER BY m, ev1, ev2");
|
||||
if (!result)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
|
|
@ -2151,7 +2153,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
do
|
||||
{
|
||||
bar.step();
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
if (fields[2].GetUInt8() == BG_EVENT_NONE || fields[3].GetUInt8() == BG_EVENT_NONE)
|
||||
continue; // we don't need to add those to the eventmap
|
||||
|
||||
|
|
@ -2164,7 +2166,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
uint32 desc_map = fields[6].GetUInt32();
|
||||
uint8 desc_event1 = fields[7].GetUInt8();
|
||||
uint8 desc_event2 = fields[8].GetUInt8();
|
||||
const char *description = fields[9].GetString();
|
||||
const char* description = fields[9].GetString();
|
||||
|
||||
// checking for NULL - through right outer join this will mean following:
|
||||
if (fields[5].GetUInt32() != dbTableGuidLow)
|
||||
|
|
@ -2199,9 +2201,10 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
|
||||
++count;
|
||||
|
||||
} while(result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battleground eventindexes", count);
|
||||
sLog.outString(">> Loaded %u battleground eventindexes", count);
|
||||
delete result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ struct GroupQueueInfo; // type predefinitio
|
|||
struct PlayerQueueInfo // stores information for players in queue
|
||||
{
|
||||
uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes
|
||||
GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo
|
||||
GroupQueueInfo* GroupInfo; // pointer to the associated groupqueueinfo
|
||||
};
|
||||
|
||||
typedef std::map<ObjectGuid, PlayerQueueInfo*> GroupQueueInfoPlayers;
|
||||
|
|
@ -85,7 +85,7 @@ class BattleGroundQueue
|
|||
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, ArenaType arenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
|
||||
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||
|
|
@ -119,7 +119,7 @@ class BattleGroundQueue
|
|||
{
|
||||
public:
|
||||
void Init();
|
||||
bool AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount);
|
||||
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||
bool KickGroup(uint32 size);
|
||||
uint32 GetPlayerCount() const {return PlayerCount;}
|
||||
public:
|
||||
|
|
@ -131,7 +131,7 @@ class BattleGroundQueue
|
|||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
|
||||
bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, Team side);
|
||||
bool InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg, Team side);
|
||||
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
|
|
@ -193,14 +193,14 @@ class BattleGroundMgr
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* Packet Building */
|
||||
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
|
||||
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, ObjectGuid guid);
|
||||
void BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid guid, Player *plr, BattleGroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg);
|
||||
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
||||
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
|
||||
void BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* plr);
|
||||
void BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid);
|
||||
void BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg);
|
||||
void BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
|
||||
/* Battlegrounds */
|
||||
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
|
||||
|
|
@ -222,7 +222,7 @@ class BattleGroundMgr
|
|||
void CreateInitialBattleGrounds();
|
||||
void DeleteAllBattleGrounds();
|
||||
|
||||
void SendToBattleGround(Player *pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
||||
void SendToBattleGround(Player* pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
||||
|
||||
/* Battleground queues */
|
||||
//these queues are instantiated when creating BattlegroundMrg
|
||||
|
|
@ -253,14 +253,14 @@ class BattleGroundMgr
|
|||
const BattleGroundEventIdx GetCreatureEventIndex(uint32 dbTableGuidLow) const
|
||||
{
|
||||
CreatureBattleEventIndexesMap::const_iterator itr = m_CreatureBattleEventIndexMap.find(dbTableGuidLow);
|
||||
if(itr != m_CreatureBattleEventIndexMap.end())
|
||||
if (itr != m_CreatureBattleEventIndexMap.end())
|
||||
return itr->second;
|
||||
return m_CreatureBattleEventIndexMap.find(-1)->second;
|
||||
}
|
||||
const BattleGroundEventIdx GetGameObjectEventIndex(uint32 dbTableGuidLow) const
|
||||
{
|
||||
GameObjectBattleEventIndexesMap::const_iterator itr = m_GameObjectBattleEventIndexMap.find(dbTableGuidLow);
|
||||
if(itr != m_GameObjectBattleEventIndexMap.end())
|
||||
if (itr != m_GameObjectBattleEventIndexMap.end())
|
||||
return itr->second;
|
||||
return m_GameObjectBattleEventIndexMap.find(-1)->second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void BattleGroundNA::StartingEventOpenDoors()
|
|||
OpenDoorEvent(BG_EVENT_DOOR);
|
||||
}
|
||||
|
||||
void BattleGroundNA::AddPlayer(Player *plr)
|
||||
void BattleGroundNA::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -84,7 +84,7 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||
void BattleGroundNA::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -103,20 +103,20 @@ void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
|||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
||||
bool BattleGroundNA::HandlePlayerUnderMap(Player* player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(),4055.504395f,2919.660645f,13.611241f,player->GetOrientation(),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
switch (Trigger)
|
||||
{
|
||||
case 4536: // buff trigger?
|
||||
case 4537: // buff trigger?
|
||||
|
|
@ -131,7 +131,7 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
void BattleGroundNA::FillInitialWorldStates(WorldPacket &data, uint32& count)
|
||||
void BattleGroundNA::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||
{
|
||||
FillInitialWorldState(data, count, 0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
FillInitialWorldState(data, count, 0xa10, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ class BattleGroundNA : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d, uint32& count);
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* plr);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void BattleGroundRB::StartingEventOpenDoors()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundRB::AddPlayer(Player *plr)
|
||||
void BattleGroundRB::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -62,7 +62,7 @@ void BattleGroundRB::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
|
||||
}
|
||||
|
||||
void BattleGroundRB::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
void BattleGroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -74,7 +74,7 @@ void BattleGroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
|||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
BattleGround::UpdatePlayerScore(Source,type,value);
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ class BattleGroundRB : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
//bool SetupBattleGround();
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void BattleGroundRL::StartingEventOpenDoors()
|
|||
OpenDoorEvent(BG_EVENT_DOOR);
|
||||
}
|
||||
|
||||
void BattleGroundRL::AddPlayer(Player *plr)
|
||||
void BattleGroundRL::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -83,7 +83,7 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||
void BattleGroundRL::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -102,13 +102,13 @@ void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
|||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
||||
bool BattleGroundRL::HandlePlayerUnderMap(Player* player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(),1285.810547f,1667.896851f,39.957642f,player->GetOrientation(),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundRL::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -116,7 +116,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
switch (Trigger)
|
||||
{
|
||||
case 4696: // buff trigger?
|
||||
case 4697: // buff trigger?
|
||||
|
|
@ -131,7 +131,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
void BattleGroundRL::FillInitialWorldStates(WorldPacket &data, uint32& count)
|
||||
void BattleGroundRL::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||
{
|
||||
FillInitialWorldState(data, count, 0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
FillInitialWorldState(data, count, 0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ class BattleGroundRL : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d, uint32& count);
|
||||
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* plr);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void BattleGroundRV::StartingEventOpenDoors()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundRV::AddPlayer(Player *plr)
|
||||
void BattleGroundRV::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -62,7 +62,7 @@ void BattleGroundRV::AddPlayer(Player *plr)
|
|||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundRV::RemovePlayer(Player * /*plr*/, ObjectGuid /*guid*/)
|
||||
void BattleGroundRV::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void BattleGroundRV::HandleKillPlayer(Player* player, Player* killer)
|
|||
BattleGround::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattleGroundRV::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
void BattleGroundRV::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ class BattleGroundRV : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void BattleGroundSA::StartingEventOpenDoors()
|
|||
{
|
||||
}
|
||||
|
||||
void BattleGroundSA::AddPlayer(Player *plr)
|
||||
void BattleGroundSA::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -62,7 +62,7 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
|
||||
}
|
||||
|
||||
void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
void BattleGroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -73,7 +73,7 @@ void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
|||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
BattleGround::UpdatePlayerScore(Source,type,value);
|
||||
|
|
|
|||
|
|
@ -41,16 +41,16 @@ class BattleGroundSA : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
//bool SetupBattleGround();
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void BattleGroundWS::StartingEventOpenDoors()
|
|||
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_WS_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattleGroundWS::AddPlayer(Player *plr)
|
||||
void BattleGroundWS::AddPlayer(Player* plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
|
|
@ -179,7 +179,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(Team team)
|
|||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
||||
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
|
|
@ -188,7 +188,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(Team team)
|
|||
ClearDroppedFlagGuid(team);
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
void BattleGroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -264,7 +264,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
void BattleGroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
|
|
@ -342,7 +342,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
void BattleGroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -353,7 +353,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
||||
|
||||
//alliance flag picked up from base
|
||||
if(Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
if (Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& event == WS_EVENT_FLAG_A)
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||
|
|
@ -447,7 +447,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
}
|
||||
|
||||
void BattleGroundWS::RemovePlayer(Player *plr, ObjectGuid guid)
|
||||
void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
|
|
@ -490,7 +490,7 @@ void BattleGroundWS::UpdateTeamScore(Team team)
|
|||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
|
||||
}
|
||||
|
||||
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
void BattleGroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
|
@ -498,7 +498,7 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
switch (Trigger)
|
||||
{
|
||||
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
|
||||
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
|
||||
|
|
@ -544,7 +544,7 @@ void BattleGroundWS::Reset()
|
|||
m_ActiveEvents[WS_EVENT_FLAG_A] = BG_EVENT_NONE;
|
||||
m_ActiveEvents[WS_EVENT_FLAG_H] = BG_EVENT_NONE;
|
||||
|
||||
for(uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
|
||||
{
|
||||
m_DroppedFlagGuid[i].Clear();
|
||||
m_FlagKeepers[i].Clear();
|
||||
|
|
@ -574,7 +574,7 @@ void BattleGroundWS::EndBattleGround(Team winner)
|
|||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
||||
void BattleGroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
|
@ -584,14 +584,14 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
|||
BattleGround::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
|
||||
void BattleGroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
||||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
if(itr == m_PlayerScores.end()) // player not found
|
||||
if (itr == m_PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
((BattleGroundWGScore*)itr->second)->FlagCaptures += value;
|
||||
|
|
|
|||
|
|
@ -105,12 +105,12 @@ class BattleGroundWS : public BattleGround
|
|||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void AddPlayer(Player* plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
ObjectGuid GetAllianceFlagPickerGuid() const{ return m_FlagKeepers[BG_TEAM_ALLIANCE]; }
|
||||
ObjectGuid GetAllianceFlagPickerGuid() const { return m_FlagKeepers[BG_TEAM_ALLIANCE]; }
|
||||
ObjectGuid GetHordeFlagPickerGuid() const { return m_FlagKeepers[BG_TEAM_HORDE]; }
|
||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
|
||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
|
||||
|
|
@ -123,13 +123,13 @@ class BattleGroundWS : public BattleGround
|
|||
uint8 GetFlagState(Team team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerDroppedFlag(Player *Source);
|
||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||
virtual void EventPlayerCapturedFlag(Player *Source);
|
||||
virtual void EventPlayerDroppedFlag(Player* Source);
|
||||
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
virtual void EventPlayerCapturedFlag(Player* Source);
|
||||
|
||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player *player, Player *killer);
|
||||
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void EndBattleGround(Team winner);
|
||||
|
|
@ -138,7 +138,7 @@ class BattleGroundWS : public BattleGround
|
|||
|
||||
void UpdateFlagState(Team team, uint32 value);
|
||||
void UpdateTeamScore(Team team);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||
void SetDroppedFlagGuid(ObjectGuid guid, Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)] = guid;}
|
||||
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
|
||||
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue