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)
|
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
|
return AOR_NAME_TOO_LONG; // username's too long
|
||||||
|
|
||||||
normalizeString(username);
|
normalizeString(username);
|
||||||
normalizeString(password);
|
normalizeString(password);
|
||||||
|
|
||||||
if(GetId(username))
|
if (GetId(username))
|
||||||
{
|
{
|
||||||
return AOR_NAME_ALREDY_EXIST; // username does already exist
|
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
|
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");
|
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)
|
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
{
|
{
|
||||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||||
if(!result)
|
if (!result)
|
||||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
|
|
@ -68,14 +68,15 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Field *fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 guidlo = fields[0].GetUInt32();
|
uint32 guidlo = fields[0].GetUInt32();
|
||||||
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidlo);
|
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidlo);
|
||||||
|
|
||||||
// kick if player currently
|
// kick if player currently
|
||||||
ObjectAccessor::KickPlayer(guid);
|
ObjectAccessor::KickPlayer(guid);
|
||||||
Player::DeleteFromDB(guid, accid, false); // no need to update realm characters
|
Player::DeleteFromDB(guid, accid, false); // no need to update realm characters
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +92,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
|
|
||||||
LoginDatabase.CommitTransaction();
|
LoginDatabase.CommitTransaction();
|
||||||
|
|
||||||
if(!res)
|
if (!res)
|
||||||
return AOR_DB_INTERNAL_ERROR; // unexpected error;
|
return AOR_DB_INTERNAL_ERROR; // unexpected error;
|
||||||
|
|
||||||
return AOR_OK;
|
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)
|
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);
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||||
if(!result)
|
if (!result)
|
||||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
if(utf8length(new_uname) > MAX_ACCOUNT_STR)
|
if (utf8length(new_uname) > MAX_ACCOUNT_STR)
|
||||||
return AOR_NAME_TOO_LONG;
|
return AOR_NAME_TOO_LONG;
|
||||||
|
|
||||||
if(utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
||||||
return AOR_PASS_TOO_LONG;
|
return AOR_PASS_TOO_LONG;
|
||||||
|
|
||||||
normalizeString(new_uname);
|
normalizeString(new_uname);
|
||||||
|
|
@ -116,8 +117,8 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
||||||
std::string safe_new_uname = new_uname;
|
std::string safe_new_uname = new_uname;
|
||||||
LoginDatabase.escape_string(safe_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))
|
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
||||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||||
|
|
||||||
return AOR_OK;
|
return AOR_OK;
|
||||||
|
|
@ -127,7 +128,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
{
|
{
|
||||||
std::string username;
|
std::string username;
|
||||||
|
|
||||||
if(!GetName(accid, username))
|
if (!GetName(accid, username))
|
||||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
|
|
||||||
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
||||||
|
|
@ -136,8 +137,8 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
normalizeString(new_passwd);
|
normalizeString(new_passwd);
|
||||||
|
|
||||||
// also reset s and v to force update at next realmd login
|
// 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))
|
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
||||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||||
|
|
||||||
return AOR_OK;
|
return AOR_OK;
|
||||||
|
|
@ -146,8 +147,8 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
uint32 AccountMgr::GetId(std::string username)
|
uint32 AccountMgr::GetId(std::string username)
|
||||||
{
|
{
|
||||||
LoginDatabase.escape_string(username);
|
LoginDatabase.escape_string(username);
|
||||||
QueryResult *result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
||||||
if(!result)
|
if (!result)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -159,8 +160,8 @@ uint32 AccountMgr::GetId(std::string username)
|
||||||
|
|
||||||
AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
||||||
{
|
{
|
||||||
QueryResult *result = LoginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
|
QueryResult* result = LoginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
|
||||||
if(result)
|
if (result)
|
||||||
{
|
{
|
||||||
AccountTypes sec = AccountTypes((*result)[0].GetInt32());
|
AccountTypes sec = AccountTypes((*result)[0].GetInt32());
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -170,10 +171,10 @@ AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
||||||
return SEC_PLAYER;
|
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);
|
QueryResult* result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
||||||
if(result)
|
if (result)
|
||||||
{
|
{
|
||||||
name = (*result)[0].GetCppString();
|
name = (*result)[0].GetCppString();
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -186,10 +187,10 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name)
|
||||||
uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
||||||
{
|
{
|
||||||
// check character count
|
// 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)
|
if (result)
|
||||||
{
|
{
|
||||||
Field *fields=result->Fetch();
|
Field* fields=result->Fetch();
|
||||||
uint32 charcount = fields[0].GetUInt32();
|
uint32 charcount = fields[0].GetUInt32();
|
||||||
delete result;
|
delete result;
|
||||||
return charcount;
|
return charcount;
|
||||||
|
|
@ -201,12 +202,12 @@ uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
||||||
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
||||||
{
|
{
|
||||||
std::string username;
|
std::string username;
|
||||||
if(!GetName(accid, username))
|
if (!GetName(accid, username))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
normalizeString(passwd);
|
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)
|
if (result)
|
||||||
{
|
{
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -221,10 +222,10 @@ bool AccountMgr::normalizeString(std::string& utf8str)
|
||||||
wchar_t wstr_buf[MAX_ACCOUNT_STR+1];
|
wchar_t wstr_buf[MAX_ACCOUNT_STR+1];
|
||||||
|
|
||||||
size_t wstr_len = MAX_ACCOUNT_STR;
|
size_t wstr_len = MAX_ACCOUNT_STR;
|
||||||
if(!Utf8toWStr(utf8str,wstr_buf,wstr_len))
|
if (!Utf8toWStr(utf8str,wstr_buf,wstr_len))
|
||||||
return false;
|
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);
|
return WStrToUtf8(wstr_buf,wstr_len,utf8str);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class AccountMgr
|
||||||
|
|
||||||
uint32 GetId(std::string username);
|
uint32 GetId(std::string username);
|
||||||
AccountTypes GetSecurity(uint32 acc_id);
|
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);
|
uint32 GetCharactersCount(uint32 acc_id);
|
||||||
std::string CalculateShaPassHash(std::string& name, std::string& password);
|
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
|
enum AchievementCriteriaRequirementType
|
||||||
{ // value1 value2 comment
|
{
|
||||||
|
// value1 value2 comment
|
||||||
ACHIEVEMENT_CRITERIA_REQUIRE_NONE = 0, // 0 0
|
ACHIEVEMENT_CRITERIA_REQUIRE_NONE = 0, // 0 0
|
||||||
ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE = 1, // creature_id 0
|
ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE = 1, // creature_id 0
|
||||||
ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_CLASS_RACE = 2, // class_id race_id
|
ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_CLASS_RACE = 2, // class_id race_id
|
||||||
|
|
@ -261,12 +262,12 @@ class AchievementMgr
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
static void DeleteFromDB(ObjectGuid guid);
|
static void DeleteFromDB(ObjectGuid guid);
|
||||||
void LoadFromDB(QueryResult *achievementResult, QueryResult *criteriaResult);
|
void LoadFromDB(QueryResult* achievementResult, QueryResult* criteriaResult);
|
||||||
void SaveToDB();
|
void SaveToDB();
|
||||||
void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0);
|
void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0);
|
||||||
void StartTimedAchievementCriteria(AchievementCriteriaTypes type, uint32 timedRequirementId, time_t startTime = 0);
|
void StartTimedAchievementCriteria(AchievementCriteriaTypes type, uint32 timedRequirementId, time_t startTime = 0);
|
||||||
void DoFailedTimedAchievementCriterias();
|
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 CheckAllAchievementCriteria();
|
||||||
void SendAllAchievementData();
|
void SendAllAchievementData();
|
||||||
void SendRespondInspectAchievements(Player* player);
|
void SendRespondInspectAchievements(Player* player);
|
||||||
|
|
@ -298,7 +299,7 @@ class AchievementMgr
|
||||||
void IncompletedAchievement(AchievementEntry const* entry);
|
void IncompletedAchievement(AchievementEntry const* entry);
|
||||||
bool IsCompletedAchievement(AchievementEntry const* entry);
|
bool IsCompletedAchievement(AchievementEntry const* entry);
|
||||||
void CompleteAchievementsWithRefs(AchievementEntry const* entry);
|
void CompleteAchievementsWithRefs(AchievementEntry const* entry);
|
||||||
void BuildAllDataPacket(WorldPacket *data);
|
void BuildAllDataPacket(WorldPacket* data);
|
||||||
|
|
||||||
Player* m_player;
|
Player* m_player;
|
||||||
CriteriaProgressMap m_criteriaProgress;
|
CriteriaProgressMap m_criteriaProgress;
|
||||||
|
|
|
||||||
|
|
@ -28,38 +28,38 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
int
|
int
|
||||||
AggressorAI::Permissible(const Creature *creature)
|
AggressorAI::Permissible(const Creature* creature)
|
||||||
{
|
{
|
||||||
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
|
// 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_PROACTIVE;
|
||||||
|
|
||||||
return PERMIT_BASE_NO;
|
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
|
void
|
||||||
AggressorAI::MoveInLineOfSight(Unit *u)
|
AggressorAI::MoveInLineOfSight(Unit* u)
|
||||||
{
|
{
|
||||||
// Ignore Z for flying creatures
|
// 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;
|
return;
|
||||||
|
|
||||||
if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() &&
|
if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() &&
|
||||||
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
|
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
|
||||||
{
|
{
|
||||||
float attackRadius = m_creature->GetAttackDistance(u);
|
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);
|
AttackStart(u);
|
||||||
u->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
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);
|
m_creature->AddThreat(u);
|
||||||
u->SetInCombatWith(m_creature);
|
u->SetInCombatWith(m_creature);
|
||||||
|
|
@ -123,7 +123,7 @@ void
|
||||||
AggressorAI::UpdateAI(const uint32 /*diff*/)
|
AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||||
{
|
{
|
||||||
// update i_victimGuid if m_creature->getVictim() !=0 and changed
|
// 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;
|
return;
|
||||||
|
|
||||||
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
||||||
|
|
@ -132,19 +132,19 @@ AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AggressorAI::IsVisible(Unit *pl) const
|
AggressorAI::IsVisible(Unit* pl) const
|
||||||
{
|
{
|
||||||
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
|
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
|
||||||
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
|
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AggressorAI::AttackStart(Unit *u)
|
AggressorAI::AttackStart(Unit* u)
|
||||||
{
|
{
|
||||||
if( !u )
|
if (!u)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_creature->Attack(u,true))
|
if (m_creature->Attack(u,true))
|
||||||
{
|
{
|
||||||
i_victimGuid = u->GetObjectGuid();
|
i_victimGuid = u->GetObjectGuid();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,23 +27,23 @@ class Creature;
|
||||||
|
|
||||||
class MANGOS_DLL_DECL AggressorAI : public CreatureAI
|
class MANGOS_DLL_DECL AggressorAI : public CreatureAI
|
||||||
{
|
{
|
||||||
enum AggressorState
|
enum AggressorState
|
||||||
{
|
{
|
||||||
STATE_NORMAL = 1,
|
STATE_NORMAL = 1,
|
||||||
STATE_LOOK_AT_VICTIM = 2
|
STATE_LOOK_AT_VICTIM = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit AggressorAI(Creature *c);
|
explicit AggressorAI(Creature* c);
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit *);
|
void MoveInLineOfSight(Unit*);
|
||||||
void AttackStart(Unit *);
|
void AttackStart(Unit*);
|
||||||
void EnterEvadeMode();
|
void EnterEvadeMode();
|
||||||
bool IsVisible(Unit *) const;
|
bool IsVisible(Unit*) const;
|
||||||
|
|
||||||
void UpdateAI(const uint32);
|
void UpdateAI(const uint32);
|
||||||
static int Permissible(const Creature *);
|
static int Permissible(const Creature*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectGuid i_victimGuid;
|
ObjectGuid i_victimGuid;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
|
||||||
personal_rating = 0;
|
personal_rating = 0;
|
||||||
else
|
else
|
||||||
personal_rating += mod;
|
personal_rating += mod;
|
||||||
if(plr)
|
if (plr)
|
||||||
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,10 +90,10 @@ bool ArenaTeam::Create(ObjectGuid captainGuid, ArenaType type, std::string arena
|
||||||
// CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid='%u'", m_TeamId); - MAX(arenateam)+1 not exist
|
// CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid='%u'", m_TeamId); - MAX(arenateam)+1 not exist
|
||||||
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid='%u'", m_TeamId);
|
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid='%u'", m_TeamId);
|
||||||
CharacterDatabase.PExecute("INSERT INTO arena_team (arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor) "
|
CharacterDatabase.PExecute("INSERT INTO arena_team (arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor) "
|
||||||
"VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')",
|
"VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')",
|
||||||
m_TeamId, arenaTeamName.c_str(), m_CaptainGuid.GetCounter(), m_Type, m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor);
|
m_TeamId, arenaTeamName.c_str(), m_CaptainGuid.GetCounter(), m_Type, m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor);
|
||||||
CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games_week, wins_week, games_season, wins_season, rank) VALUES "
|
CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games_week, wins_week, games_season, wins_season, rank) VALUES "
|
||||||
"('%u', '%u', '%u', '%u', '%u', '%u', '%u')", m_TeamId, m_stats.rating, m_stats.games_week, m_stats.wins_week, m_stats.games_season, m_stats.wins_season, m_stats.rank);
|
"('%u', '%u', '%u', '%u', '%u', '%u', '%u')", m_TeamId, m_stats.rating, m_stats.games_week, m_stats.wins_week, m_stats.games_season, m_stats.wins_season, m_stats.rank);
|
||||||
|
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
if (GetMembersSize() >= GetMaxMembersSize())
|
if (GetMembersSize() >= GetMaxMembersSize())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player *pl = sObjectMgr.GetPlayer(playerGuid);
|
Player* pl = sObjectMgr.GetPlayer(playerGuid);
|
||||||
if (pl)
|
if (pl)
|
||||||
{
|
{
|
||||||
if (pl->GetArenaTeamId(GetSlot()))
|
if (pl->GetArenaTeamId(GetSlot()))
|
||||||
|
|
@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 0 1
|
// 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)
|
if (!result)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -174,9 +174,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
|
|
||||||
m_members.push_back(newmember);
|
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->SetInArenaTeam(m_TeamId, GetSlot(), GetType());
|
||||||
pl->SetArenaTeamIdInvited(0);
|
pl->SetArenaTeamIdInvited(0);
|
||||||
|
|
@ -189,12 +189,12 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult)
|
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
|
||||||
{
|
{
|
||||||
if(!arenaTeamDataResult)
|
if (!arenaTeamDataResult)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Field *fields = arenaTeamDataResult->Fetch();
|
Field* fields = arenaTeamDataResult->Fetch();
|
||||||
|
|
||||||
m_TeamId = fields[0].GetUInt32();
|
m_TeamId = fields[0].GetUInt32();
|
||||||
m_Name = fields[1].GetCppString();
|
m_Name = fields[1].GetCppString();
|
||||||
|
|
@ -220,16 +220,16 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
||||||
{
|
{
|
||||||
if(!arenaTeamMembersResult)
|
if (!arenaTeamMembersResult)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool captainPresentInTeam = false;
|
bool captainPresentInTeam = false;
|
||||||
|
|
||||||
do
|
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
|
//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)
|
if (!fields)
|
||||||
break;
|
break;
|
||||||
|
|
@ -272,7 +272,8 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
||||||
captainPresentInTeam = true;
|
captainPresentInTeam = true;
|
||||||
|
|
||||||
m_members.push_back(newmember);
|
m_members.push_back(newmember);
|
||||||
} while (arenaTeamMembersResult->NextRow());
|
}
|
||||||
|
while (arenaTeamMembersResult->NextRow());
|
||||||
|
|
||||||
if (Empty() || !captainPresentInTeam)
|
if (Empty() || !captainPresentInTeam)
|
||||||
{
|
{
|
||||||
|
|
@ -287,7 +288,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
|
||||||
void ArenaTeam::SetCaptain(ObjectGuid guid)
|
void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
// disable remove/promote buttons
|
// disable remove/promote buttons
|
||||||
Player *oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
Player* oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
||||||
if (oldcaptain)
|
if (oldcaptain)
|
||||||
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
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);
|
CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", guid.GetCounter(), m_TeamId);
|
||||||
|
|
||||||
// enable remove/promote buttons
|
// enable remove/promote buttons
|
||||||
if (Player *newcaptain = sObjectMgr.GetPlayer(guid))
|
if (Player* newcaptain = sObjectMgr.GetPlayer(guid))
|
||||||
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
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);
|
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
|
||||||
// delete all info regarding this team
|
// 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);
|
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), guid.GetCounter());
|
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
|
// event
|
||||||
if (session)
|
if (session)
|
||||||
|
|
@ -347,9 +348,9 @@ void ArenaTeam::Disband(WorldSession *session)
|
||||||
sObjectMgr.RemoveArenaTeam(m_TeamId);
|
sObjectMgr.RemoveArenaTeam(m_TeamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::Roster(WorldSession *session)
|
void ArenaTeam::Roster(WorldSession* session)
|
||||||
{
|
{
|
||||||
Player *pl = NULL;
|
Player* pl = NULL;
|
||||||
|
|
||||||
uint8 unk308 = 0;
|
uint8 unk308 = 0;
|
||||||
|
|
||||||
|
|
@ -374,7 +375,7 @@ void ArenaTeam::Roster(WorldSession *session)
|
||||||
data << uint32(itr->games_season); // played this season
|
data << uint32(itr->games_season); // played this season
|
||||||
data << uint32(itr->wins_season); // wins this season
|
data << uint32(itr->wins_season); // wins this season
|
||||||
data << uint32(itr->personal_rating); // personal rating
|
data << uint32(itr->personal_rating); // personal rating
|
||||||
if(unk308)
|
if (unk308)
|
||||||
{
|
{
|
||||||
data << float(0.0); // 308 unk
|
data << float(0.0); // 308 unk
|
||||||
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");
|
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);
|
WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+GetName().size()+1);
|
||||||
data << uint32(GetId()); // team id
|
data << uint32(GetId()); // team id
|
||||||
|
|
@ -400,7 +401,7 @@ void ArenaTeam::Query(WorldSession *session)
|
||||||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE");
|
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);
|
WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7);
|
||||||
data << uint32(GetId()); // team id
|
data << uint32(GetId()); // team id
|
||||||
|
|
@ -417,18 +418,18 @@ void ArenaTeam::NotifyStatsChanged()
|
||||||
{
|
{
|
||||||
// this is called after a rated match ended
|
// this is called after a rated match ended
|
||||||
// updates arena team stats for every member of the team (not only the ones who participated!)
|
// 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);
|
Player* plr = sObjectMgr.GetPlayer(itr->guid);
|
||||||
if(plr)
|
if (plr)
|
||||||
Stats(plr->GetSession());
|
Stats(plr->GetSession());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::InspectStats(WorldSession *session, ObjectGuid guid)
|
void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
ArenaTeamMember* member = GetMember(guid);
|
ArenaTeamMember* member = GetMember(guid);
|
||||||
if(!member)
|
if (!member)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6);
|
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)
|
void ArenaTeam::SetStats(uint32 stat_type, uint32 value)
|
||||||
{
|
{
|
||||||
switch(stat_type)
|
switch (stat_type)
|
||||||
{
|
{
|
||||||
case STAT_TYPE_RATING:
|
case STAT_TYPE_RATING:
|
||||||
m_stats.rating = value;
|
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)
|
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||||
{
|
{
|
||||||
Player *player = sObjectMgr.GetPlayer(itr->guid);
|
Player* player = sObjectMgr.GetPlayer(itr->guid);
|
||||||
if(player)
|
if (player)
|
||||||
player->GetSession()->SendPacket(packet);
|
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");
|
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_2v2: return 0;
|
||||||
case ARENA_TYPE_3v3: return 1;
|
case ARENA_TYPE_3v3: return 1;
|
||||||
|
|
@ -545,7 +546,7 @@ uint8 ArenaTeam::GetSlotByType(ArenaType type )
|
||||||
bool ArenaTeam::HaveMember(ObjectGuid guid) const
|
bool ArenaTeam::HaveMember(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
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)
|
||||||
if(itr->guid == guid)
|
if (itr->guid == guid)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -572,7 +573,7 @@ uint32 ArenaTeam::GetPoints(uint32 MemberRating)
|
||||||
// type penalties for <5v5 teams
|
// type penalties for <5v5 teams
|
||||||
if (m_Type == ARENA_TYPE_2v2)
|
if (m_Type == ARENA_TYPE_2v2)
|
||||||
points *= 0.76f;
|
points *= 0.76f;
|
||||||
else if(m_Type == ARENA_TYPE_3v3)
|
else if (m_Type == ARENA_TYPE_3v3)
|
||||||
points *= 0.88f;
|
points *= 0.88f;
|
||||||
|
|
||||||
return (uint32) points;
|
return (uint32) points;
|
||||||
|
|
@ -601,7 +602,7 @@ void ArenaTeam::FinishGame(int32 mod)
|
||||||
// update team's rank
|
// update team's rank
|
||||||
m_stats.rank = 1;
|
m_stats.rank = 1;
|
||||||
ObjectMgr::ArenaTeamMap::const_iterator i = sObjectMgr.GetArenaTeamMapBegin();
|
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)
|
if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating)
|
||||||
++m_stats.rank;
|
++m_stats.rank;
|
||||||
|
|
@ -640,10 +641,10 @@ int32 ArenaTeam::LostAgainst(uint32 againstRating)
|
||||||
return mod;
|
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
|
// 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())
|
if (itr->guid == plr->GetObjectGuid())
|
||||||
{
|
{
|
||||||
|
|
@ -667,7 +668,7 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
|
||||||
void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstRating)
|
void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstRating)
|
||||||
{
|
{
|
||||||
// called for offline player after ending rated arena match!
|
// 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)
|
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
|
// 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())
|
if (itr->guid == plr->GetObjectGuid())
|
||||||
{
|
{
|
||||||
|
|
@ -723,7 +724,7 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
|
||||||
return;
|
return;
|
||||||
// to get points, a player has to participate in at least 30% of the matches
|
// 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);
|
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
|
// the player participated in enough games, update his points
|
||||||
uint32 points_to_add = 0;
|
uint32 points_to_add = 0;
|
||||||
|
|
@ -749,7 +750,7 @@ void ArenaTeam::SaveToDB()
|
||||||
// called after a match has ended, or when calculating arena_points
|
// called after a match has ended, or when calculating arena_points
|
||||||
CharacterDatabase.BeginTransaction();
|
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());
|
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());
|
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.games_week = 0; // played this week
|
||||||
m_stats.wins_week = 0; // wins 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->games_week = 0;
|
||||||
itr->wins_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)
|
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())
|
if (p->GetMap()->IsBattleArena())
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ class ArenaTeam
|
||||||
~ArenaTeam();
|
~ArenaTeam();
|
||||||
|
|
||||||
bool Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName);
|
bool Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName);
|
||||||
void Disband(WorldSession *session);
|
void Disband(WorldSession* session);
|
||||||
|
|
||||||
typedef std::list<ArenaTeamMember> MemberList;
|
typedef std::list<ArenaTeamMember> MemberList;
|
||||||
|
|
||||||
|
|
@ -173,13 +173,13 @@ class ArenaTeam
|
||||||
|
|
||||||
bool IsFighting() const;
|
bool IsFighting() const;
|
||||||
|
|
||||||
bool LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult);
|
bool LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult);
|
||||||
bool LoadMembersFromDB(QueryResult *arenaTeamMembersResult);
|
bool LoadMembersFromDB(QueryResult* arenaTeamMembersResult);
|
||||||
void LoadStatsFromDB(uint32 ArenaTeamId);
|
void LoadStatsFromDB(uint32 ArenaTeamId);
|
||||||
|
|
||||||
void SaveToDB();
|
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, 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)
|
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);
|
BroadcastEvent(event, ObjectGuid(), str1, str2, str3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Roster(WorldSession *session);
|
void Roster(WorldSession* session);
|
||||||
void Query(WorldSession *session);
|
void Query(WorldSession* session);
|
||||||
void Stats(WorldSession *session);
|
void Stats(WorldSession* session);
|
||||||
void InspectStats(WorldSession *session, ObjectGuid guid);
|
void InspectStats(WorldSession* session, ObjectGuid guid);
|
||||||
|
|
||||||
uint32 GetPoints(uint32 MemberRating);
|
uint32 GetPoints(uint32 MemberRating);
|
||||||
float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating);
|
float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating);
|
||||||
int32 WonAgainst(uint32 againstRating);
|
int32 WonAgainst(uint32 againstRating);
|
||||||
void MemberWon(Player * plr, uint32 againstRating);
|
void MemberWon(Player* plr, uint32 againstRating);
|
||||||
int32 LostAgainst(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 OfflineMemberLost(ObjectGuid guid, uint32 againstRating);
|
||||||
|
|
||||||
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
|
void UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints);
|
||||||
|
|
||||||
void NotifyStatsChanged();
|
void NotifyStatsChanged();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "SocialMgr.h"
|
#include "SocialMgr.h"
|
||||||
|
|
||||||
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("MSG_INSPECT_ARENA_TEAMS");
|
DEBUG_LOG("MSG_INSPECT_ARENA_TEAMS");
|
||||||
|
|
||||||
|
|
@ -34,84 +34,84 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
DEBUG_LOG("Inspect Arena stats %s", guid.GetString().c_str());
|
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)
|
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());
|
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;
|
uint32 ArenaTeamId;
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
|
|
||||||
if(ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||||
{
|
{
|
||||||
arenateam->Query(this);
|
arenateam->Query(this);
|
||||||
arenateam->Stats(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
|
uint32 ArenaTeamId; // arena team id
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
|
|
||||||
if(ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||||
arenateam->Roster(this);
|
arenateam->Roster(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("CMSG_ARENA_TEAM_INVITE");
|
DEBUG_LOG("CMSG_ARENA_TEAM_INVITE");
|
||||||
|
|
||||||
uint32 ArenaTeamId; // arena team id
|
uint32 ArenaTeamId; // arena team id
|
||||||
std::string Invitedname;
|
std::string Invitedname;
|
||||||
|
|
||||||
Player * player = NULL;
|
Player* player = NULL;
|
||||||
|
|
||||||
recv_data >> ArenaTeamId >> Invitedname;
|
recv_data >> ArenaTeamId >> Invitedname;
|
||||||
|
|
||||||
if(!Invitedname.empty())
|
if (!Invitedname.empty())
|
||||||
{
|
{
|
||||||
if(!normalizePlayerName(Invitedname))
|
if (!normalizePlayerName(Invitedname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
|
player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player)
|
if (!player)
|
||||||
{
|
{
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", Invitedname, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", Invitedname, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
|
||||||
return;
|
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);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArenaTeam *arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if(!arenateam)
|
if (!arenateam)
|
||||||
{
|
{
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK result but not send invite
|
// OK result but not send invite
|
||||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
|
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;
|
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);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player->GetArenaTeamIdInvited())
|
if (player->GetArenaTeamIdInvited())
|
||||||
{
|
{
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
|
||||||
return;
|
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);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, arenateam->GetName(), "", ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S);
|
||||||
return;
|
return;
|
||||||
|
|
@ -150,11 +150,11 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
||||||
DEBUG_LOG("WORLD: Sent SMSG_ARENA_TEAM_INVITE");
|
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
|
DEBUG_LOG("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
|
||||||
|
|
||||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
|
||||||
if (!at)
|
if (!at)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
|
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
|
||||||
_player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptainGuid()))
|
_player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(at->GetCaptainGuid()))
|
||||||
{
|
{
|
||||||
// not let enemies sign petition
|
// not let enemies sign petition
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||||
|
|
@ -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());
|
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
|
DEBUG_LOG("CMSG_ARENA_TEAM_DECLINE"); // empty opcode
|
||||||
|
|
||||||
_player->SetArenaTeamIdInvited(0); // no more invited
|
_player->SetArenaTeamIdInvited(0); // no more invited
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("CMSG_ARENA_TEAM_LEAVE");
|
DEBUG_LOG("CMSG_ARENA_TEAM_LEAVE");
|
||||||
|
|
||||||
uint32 ArenaTeamId; // arena team id
|
uint32 ArenaTeamId; // arena team id
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
|
|
||||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if (!at)
|
if (!at)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -226,14 +226,14 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, at->GetName(), "", 0);
|
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");
|
DEBUG_LOG("CMSG_ARENA_TEAM_DISBAND");
|
||||||
|
|
||||||
uint32 ArenaTeamId; // arena team id
|
uint32 ArenaTeamId; // arena team id
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
|
|
||||||
if (ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||||
{
|
{
|
||||||
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
||||||
return;
|
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");
|
DEBUG_LOG("CMSG_ARENA_TEAM_REMOVE");
|
||||||
|
|
||||||
|
|
@ -256,7 +256,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
recv_data >> name;
|
recv_data >> name;
|
||||||
|
|
||||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if (!at) // arena team not found
|
if (!at) // arena team not found
|
||||||
return;
|
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());
|
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");
|
DEBUG_LOG("CMSG_ARENA_TEAM_LEADER");
|
||||||
|
|
||||||
|
|
@ -298,7 +298,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
recv_data >> name;
|
recv_data >> name;
|
||||||
|
|
||||||
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if (!at) // arena team not found
|
if (!at) // arena team not found
|
||||||
return;
|
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
|
WorldPacket data(SMSG_ARENA_ERROR, 4+1); // 886 - You are not in a %uv%u arena team
|
||||||
uint32 unk = 0;
|
uint32 unk = 0;
|
||||||
data << uint32(unk); // 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...
|
data << uint8(type); // team type (2=2v2,3=3v3,5=5v5), can be used for custom types...
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class AHB_Seller_Config
|
||||||
uint32 GetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
|
uint32 GetItemsQuantityPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].Quantity; }
|
||||||
void SetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass, uint32 found)
|
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;
|
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems=m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
|
||||||
else
|
else
|
||||||
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
|
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
|
||||||
|
|
@ -191,7 +191,7 @@ class AuctionBotSeller : public AuctionBotAgent
|
||||||
void addNewAuctions(AHB_Seller_Config& config);
|
void addNewAuctions(AHB_Seller_Config& config);
|
||||||
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
||||||
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val);
|
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 SetItemsAmountForQuality(AuctionQuality quality, uint32 val);
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
|
|
||||||
|
|
@ -202,13 +202,13 @@ class AuctionBotSeller : public AuctionBotAgent
|
||||||
|
|
||||||
void LoadSellerValues(AHB_Seller_Config& config);
|
void LoadSellerValues(AHB_Seller_Config& config);
|
||||||
uint32 SetStat(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 );
|
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 SetPricesOfItem(ItemPrototype const* itemProto, AHB_Seller_Config& config, uint32& buyp, uint32& bidp, uint32 stackcnt, ItemQualities itemQuality);
|
||||||
void LoadItemsQuantity(AHB_Seller_Config& config);
|
void LoadItemsQuantity(AHB_Seller_Config& config);
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_SINGLETON_1( AuctionHouseBot );
|
INSTANTIATE_SINGLETON_1(AuctionHouseBot);
|
||||||
INSTANTIATE_SINGLETON_1( AuctionBotConfig );
|
INSTANTIATE_SINGLETON_1(AuctionBotConfig);
|
||||||
|
|
||||||
//== AuctionBotConfig functions ============================
|
//== AuctionBotConfig functions ============================
|
||||||
|
|
||||||
|
|
@ -238,7 +238,7 @@ bool AuctionBotConfig::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO)==0) &&
|
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO)==0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO)==0) &&
|
||||||
!getConfig(CONFIG_BOOL_AHBOT_BUYER_ALLIANCE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_HORDE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_NEUTRAL_ENABLED))
|
!getConfig(CONFIG_BOOL_AHBOT_BUYER_ALLIANCE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_HORDE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_NEUTRAL_ENABLED))
|
||||||
{
|
{
|
||||||
sLog.outString("All feature of AuctionHouseBot are disabled! (If you want to use it please set config in 'ahbot.conf')");
|
sLog.outString("All feature of AuctionHouseBot are disabled! (If you want to use it please set config in 'ahbot.conf')");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -486,19 +486,19 @@ bool AuctionBotBuyer::Initialize()
|
||||||
void AuctionBotBuyer::LoadBuyerValues(AHB_Buyer_Config& config)
|
void AuctionBotBuyer::LoadBuyerValues(AHB_Buyer_Config& config)
|
||||||
{
|
{
|
||||||
uint32 FactionChance;
|
uint32 FactionChance;
|
||||||
switch(config.GetHouseType())
|
switch (config.GetHouseType())
|
||||||
{
|
{
|
||||||
case AUCTION_HOUSE_ALLIANCE:
|
case AUCTION_HOUSE_ALLIANCE:
|
||||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO )+50;
|
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO)+50;
|
||||||
FactionChance = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE );
|
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_ALLIANCE);
|
||||||
break;
|
break;
|
||||||
case AUCTION_HOUSE_HORDE:
|
case AUCTION_HOUSE_HORDE:
|
||||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO )+50;
|
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_HORDE_PRICE_RATIO)+50;
|
||||||
FactionChance = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE );
|
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_HORDE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
config.BuyerPriceRatio = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO )+50;
|
config.BuyerPriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_PRICE_RATIO)+50;
|
||||||
FactionChance = sAuctionBotConfig.getConfig( CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL );
|
FactionChance = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_CHANCE_RATIO_NEUTRAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
config.FactionChance=5000*FactionChance;
|
config.FactionChance=5000*FactionChance;
|
||||||
|
|
@ -523,11 +523,11 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
|
||||||
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(config.GetHouseType())->GetAuctionsBounds();
|
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(config.GetHouseType())->GetAuctionsBounds();
|
||||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||||
{
|
{
|
||||||
AuctionEntry *Aentry = itr->second;
|
AuctionEntry* Aentry = itr->second;
|
||||||
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
ItemPrototype const *prototype = item->GetProto();
|
ItemPrototype const* prototype = item->GetProto();
|
||||||
if (prototype)
|
if (prototype)
|
||||||
{
|
{
|
||||||
++config.SameItemInfo[item->GetEntry()].ItemCount; // Structure constructor will make sure Element are correctly initialised if entry is created here.
|
++config.SameItemInfo[item->GetEntry()].ItemCount; // Structure constructor will make sure Element are correctly initialised if entry is created here.
|
||||||
|
|
@ -559,7 +559,7 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
|
||||||
{
|
{
|
||||||
if (Aentry->bid!=0)
|
if (Aentry->bid!=0)
|
||||||
{
|
{
|
||||||
if (Aentry->bidder)
|
if (Aentry->bidder)
|
||||||
{
|
{
|
||||||
config.CheckedEntry[Aentry->Id].LastExist=Now;
|
config.CheckedEntry[Aentry->Id].LastExist=Now;
|
||||||
config.CheckedEntry[Aentry->Id].AuctionId=Aentry->Id;
|
config.CheckedEntry[Aentry->Id].AuctionId=Aentry->Id;
|
||||||
|
|
@ -586,7 +586,7 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
|
||||||
{
|
{
|
||||||
time_t Now=time(NULL)-5;
|
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))
|
if (itr->second.LastExist < (Now-5))
|
||||||
config.CheckedEntry.erase(itr++);
|
config.CheckedEntry.erase(itr++);
|
||||||
|
|
@ -611,10 +611,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double InGame_BuyPrice,
|
||||||
|
|
||||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||||
{
|
{
|
||||||
ratio = buyoutPrice / MaxBuyablePrice;
|
ratio = buyoutPrice / MaxBuyablePrice;
|
||||||
if (ratio < 10)
|
if (ratio < 10)
|
||||||
Chance=MaxChance - (ratio*(MaxChance/10));
|
Chance=MaxChance - (ratio*(MaxChance/10));
|
||||||
else Chance=1;
|
else Chance=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -627,10 +627,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double InGame_BuyPrice,
|
||||||
|
|
||||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||||
{
|
{
|
||||||
ratio = buyoutPrice / MaxBuyablePrice;
|
ratio = buyoutPrice / MaxBuyablePrice;
|
||||||
if (ratio < 10)
|
if (ratio < 10)
|
||||||
Chance=(MaxChance/5) - (ratio*(MaxChance/50));
|
Chance=(MaxChance/5) - (ratio*(MaxChance/50));
|
||||||
else Chance=1;
|
else Chance=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -644,7 +644,7 @@ bool AuctionBotBuyer::IsBuyableEntry(uint32 buyoutPrice, double InGame_BuyPrice,
|
||||||
if (ratio < 10)
|
if (ratio < 10)
|
||||||
Chance=(MaxChance/5) - (ratio*(MaxChance/50));
|
Chance=(MaxChance/5) - (ratio*(MaxChance/50));
|
||||||
else Chance=0;
|
else Chance=0;
|
||||||
}
|
}
|
||||||
else Chance = 0;
|
else Chance = 0;
|
||||||
}
|
}
|
||||||
uint32 RandNum = urand(1,ChanceRatio);
|
uint32 RandNum = urand(1,ChanceRatio);
|
||||||
|
|
@ -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);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: WIN BID! Chance = %u, num = %u.",Chance, RandNum);
|
||||||
return true;
|
return true;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: LOOSE BID! Chance = %u, num = %u.",Chance, RandNum);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: LOOSE BID! Chance = %u, num = %u.",Chance, RandNum);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -714,7 +715,7 @@ void AuctionBotBuyer::PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice)
|
||||||
|
|
||||||
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction)
|
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction)
|
||||||
{
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Entry %u buyed at %.2fg", auction->Id, float(auction->buyout) / 10000.0f);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Entry %u buyed at %.2fg", auction->Id, float(auction->buyout) / 10000.0f);
|
||||||
auction->UpdateBid(auction->buyout);
|
auction->UpdateBid(auction->buyout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -740,7 +741,7 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
if (!auction || auction->moneyDeliveryTime) // is auction not active now
|
if (!auction || auction->moneyDeliveryTime) // is auction not active now
|
||||||
{
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Entry %u on ah %u doesn't exists, perhaps bought already?",
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Entry %u on ah %u doesn't exists, perhaps bought already?",
|
||||||
itr->second.AuctionId, auction->GetHouseId());
|
itr->second.AuctionId, auction->GetHouseId());
|
||||||
|
|
||||||
config.CheckedEntry.erase(itr++);
|
config.CheckedEntry.erase(itr++);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -758,19 +759,19 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
|
|
||||||
uint32 MaxChance=5000;
|
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
|
if (!item) // auction item not accessible, possible auction in payment pending mode
|
||||||
{
|
{
|
||||||
config.CheckedEntry.erase(itr++);
|
config.CheckedEntry.erase(itr++);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemPrototype const *prototype = item->GetProto();
|
ItemPrototype const* prototype = item->GetProto();
|
||||||
|
|
||||||
uint32 BasePrice = sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
|
uint32 BasePrice = sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_BUYER) ? prototype->BuyPrice : prototype->SellPrice;
|
||||||
BasePrice *= item->GetCount();
|
BasePrice *= item->GetCount();
|
||||||
|
|
||||||
double MaxBuyablePrice = ( BasePrice * config.BuyerPriceRatio )/100;
|
double MaxBuyablePrice = (BasePrice * config.BuyerPriceRatio)/100;
|
||||||
BuyerItemInfoMap::iterator sameitem_itr = config.SameItemInfo.find(item->GetEntry());
|
BuyerItemInfoMap::iterator sameitem_itr = config.SameItemInfo.find(item->GetEntry());
|
||||||
uint32 buyoutPrice = auction->buyout/item->GetCount();
|
uint32 buyoutPrice = auction->buyout/item->GetCount();
|
||||||
|
|
||||||
|
|
@ -801,13 +802,13 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
InGame_BidPrice=sameitem_itr->second.BidPrice/sameitem_itr->second.ItemCount;
|
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: Auction added with data:");
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, MaxBuyablePrice / 10000);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: MaxPrice of Entry %u is %.1fg.", itr->second.AuctionId, MaxBuyablePrice / 10000);
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: GamePrice buy=%.1fg, bid=%.1fg.",InGame_BuyPrice/10000, InGame_BidPrice / 10000);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: GamePrice buy=%.1fg, bid=%.1fg.",InGame_BuyPrice/10000, InGame_BidPrice / 10000);
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Minimal price see in AH Buy=%ug, Bid=%ug.",
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Minimal price see in AH Buy=%ug, Bid=%ug.",
|
||||||
sameitem_itr->second.MinBuyPrice / 10000,sameitem_itr->second.MinBidPrice / 10000);
|
sameitem_itr->second.MinBuyPrice / 10000,sameitem_itr->second.MinBidPrice / 10000);
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice/ 10000);
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Actual Entry price, Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice/ 10000);
|
||||||
|
|
||||||
if (!auction->owner) // Original auction owner
|
if (!auction->owner) // Original auction owner
|
||||||
|
|
@ -819,7 +820,7 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, sameitem_itr->second.MinBuyPrice, MaxChance, config.FactionChance))
|
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, sameitem_itr->second.MinBuyPrice, MaxChance, config.FactionChance))
|
||||||
{
|
{
|
||||||
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance/2, config.FactionChance))
|
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, sameitem_itr->second.MinBidPrice, MaxChance/2, config.FactionChance))
|
||||||
if (urand(0,5)==0) PlaceBidToEntry(auction, bidPrice); else BuyEntry(auction);
|
if (urand(0,5)==0) PlaceBidToEntry(auction, bidPrice); else BuyEntry(auction);
|
||||||
else
|
else
|
||||||
BuyEntry(auction);
|
BuyEntry(auction);
|
||||||
}
|
}
|
||||||
|
|
@ -903,7 +904,8 @@ bool AuctionBotSeller::Initialize()
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
npcItems.push_back(fields[0].GetUInt32());
|
npcItems.push_back(fields[0].GetUInt32());
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -916,16 +918,16 @@ bool AuctionBotSeller::Initialize()
|
||||||
|
|
||||||
sLog.outString("Loading loot items for filter..");
|
sLog.outString("Loading loot items for filter..");
|
||||||
if (QueryResult* result = WorldDatabase.PQuery(
|
if (QueryResult* result = WorldDatabase.PQuery(
|
||||||
"SELECT item FROM creature_loot_template UNION "
|
"SELECT item FROM creature_loot_template UNION "
|
||||||
"SELECT item FROM disenchant_loot_template UNION "
|
"SELECT item FROM disenchant_loot_template UNION "
|
||||||
"SELECT item FROM fishing_loot_template UNION "
|
"SELECT item FROM fishing_loot_template UNION "
|
||||||
"SELECT item FROM gameobject_loot_template UNION "
|
"SELECT item FROM gameobject_loot_template UNION "
|
||||||
"SELECT item FROM item_loot_template UNION "
|
"SELECT item FROM item_loot_template UNION "
|
||||||
"SELECT item FROM milling_loot_template UNION "
|
"SELECT item FROM milling_loot_template UNION "
|
||||||
"SELECT item FROM pickpocketing_loot_template UNION "
|
"SELECT item FROM pickpocketing_loot_template UNION "
|
||||||
"SELECT item FROM prospecting_loot_template UNION "
|
"SELECT item FROM prospecting_loot_template UNION "
|
||||||
"SELECT item FROM skinning_loot_template UNION "
|
"SELECT item FROM skinning_loot_template UNION "
|
||||||
"SELECT item FROM spell_loot_template"))
|
"SELECT item FROM spell_loot_template"))
|
||||||
{
|
{
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
do
|
do
|
||||||
|
|
@ -938,7 +940,8 @@ bool AuctionBotSeller::Initialize()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lootItems.push_back(fields[0].GetUInt32());
|
lootItems.push_back(fields[0].GetUInt32());
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1018,7 +1021,7 @@ bool AuctionBotSeller::Initialize()
|
||||||
// no price filter
|
// no price filter
|
||||||
if (sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_SELLER))
|
if (sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_SELLER))
|
||||||
{
|
{
|
||||||
if(prototype->BuyPrice == 0)
|
if (prototype->BuyPrice == 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1088,7 +1091,7 @@ bool AuctionBotSeller::Initialize()
|
||||||
continue;
|
continue;
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_SKILL_RANK))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_SKILL_RANK))
|
||||||
if (prototype->RequiredSkillRank < value)
|
if (prototype->RequiredSkillRank < value)
|
||||||
continue;
|
continue;
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_SKILL_RANK))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_SKILL_RANK))
|
||||||
if (prototype->RequiredSkillRank > value)
|
if (prototype->RequiredSkillRank > value)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1199,10 +1202,10 @@ bool AuctionBotSeller::Initialize()
|
||||||
sLog.outString("Items loaded \tGrey\tWhite\tGreen\tBlue\tPurple\tOrange\tYellow");
|
sLog.outString("Items loaded \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)
|
||||||
sLog.outString("%-18s\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD,
|
sLog.outString("%-18s\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD "\t" SIZEFMTD,
|
||||||
sAuctionBotConfig.GetItemClassName(ItemClass(i)),
|
sAuctionBotConfig.GetItemClassName(ItemClass(i)),
|
||||||
m_ItemPool[0][i].size(), m_ItemPool[1][i].size(), m_ItemPool[2][i].size(),
|
m_ItemPool[0][i].size(), m_ItemPool[1][i].size(), m_ItemPool[2][i].size(),
|
||||||
m_ItemPool[3][i].size(), m_ItemPool[4][i].size(), m_ItemPool[5][i].size(),
|
m_ItemPool[3][i].size(), m_ItemPool[4][i].size(), m_ItemPool[5][i].size(),
|
||||||
m_ItemPool[6][i].size());
|
m_ItemPool[6][i].size());
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString("AHBot seller configuration data loaded and initilized");
|
sLog.outString("AHBot seller configuration data loaded and initilized");
|
||||||
|
|
@ -1350,11 +1353,11 @@ void AuctionBotSeller::LoadItemsQuantity(AHB_Seller_Config& config)
|
||||||
for (uint32 j = 0; j < MAX_AUCTION_QUALITY; ++j)
|
for (uint32 j = 0; j < MAX_AUCTION_QUALITY; ++j)
|
||||||
{
|
{
|
||||||
uint32 indice = config.GetItemsAmountPerQuality(AuctionQuality(j)) /
|
uint32 indice = config.GetItemsAmountPerQuality(AuctionQuality(j)) /
|
||||||
(sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_CONSUMABLE_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_CONTAINER_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_WEAPON_AMOUNT) +
|
(sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_CONSUMABLE_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_CONTAINER_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_WEAPON_AMOUNT) +
|
||||||
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GEM_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_ARMOR_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_REAGENT_AMOUNT) +
|
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GEM_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_ARMOR_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_REAGENT_AMOUNT) +
|
||||||
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_PROJECTILE_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GENERIC_AMOUNT) +
|
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_PROJECTILE_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GENERIC_AMOUNT) +
|
||||||
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_RECIPE_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_QUIVER_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_QUEST_AMOUNT) +
|
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_RECIPE_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_QUIVER_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_QUEST_AMOUNT) +
|
||||||
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_KEY_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_AMOUNT));
|
sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_KEY_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_AMOUNT) + sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_AMOUNT));
|
||||||
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
|
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
|
||||||
config.SetItemsAmountPerClass(AuctionQuality(j), ItemClass(i), indice);
|
config.SetItemsAmountPerClass(AuctionQuality(j), ItemClass(i), indice);
|
||||||
}
|
}
|
||||||
|
|
@ -1364,7 +1367,7 @@ void AuctionBotSeller::LoadSellerValues(AHB_Seller_Config& config)
|
||||||
{
|
{
|
||||||
LoadItemsQuantity(config);
|
LoadItemsQuantity(config);
|
||||||
uint32 PriceRatio;
|
uint32 PriceRatio;
|
||||||
switch(config.GetHouseType())
|
switch (config.GetHouseType())
|
||||||
{
|
{
|
||||||
case AUCTION_HOUSE_ALLIANCE:
|
case AUCTION_HOUSE_ALLIANCE:
|
||||||
PriceRatio = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_PRICE_RATIO);
|
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();
|
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(config.GetHouseType())->GetAuctionsBounds();
|
||||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||||
{
|
{
|
||||||
AuctionEntry *Aentry = itr->second;
|
AuctionEntry* Aentry = itr->second;
|
||||||
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
ItemPrototype const *prototype = item->GetProto();
|
ItemPrototype const* prototype = item->GetProto();
|
||||||
if (prototype)
|
if (prototype)
|
||||||
{
|
{
|
||||||
if (!Aentry->owner) // Add only ahbot items
|
if (!Aentry->owner) // Add only ahbot items
|
||||||
|
|
@ -1428,7 +1431,7 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
|
||||||
uint32 count=0;
|
uint32 count=0;
|
||||||
for (uint32 j=0; j<MAX_AUCTION_QUALITY; ++j)
|
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]);
|
config.SetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i, ItemsInAH[j][i]);
|
||||||
count+=config.GetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i);
|
count+=config.GetMissedItemsPerClass((AuctionQuality) j, (ItemClass) i);
|
||||||
|
|
@ -1436,24 +1439,24 @@ uint32 AuctionBotSeller::SetStat(AHB_Seller_Config& config)
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: Missed Item \tGrey\tWhite\tGreen\tBlue\tPurple\tOrange\tYellow");
|
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",
|
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)),
|
sAuctionBotConfig.GetItemClassName(ItemClass(i)),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_GREY, (ItemClass) i),
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_GREY, (ItemClass) i),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_WHITE, (ItemClass) i),
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_WHITE, (ItemClass) i),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_GREEN, (ItemClass) i),
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_GREEN, (ItemClass) i),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_BLUE, (ItemClass) i),
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_BLUE, (ItemClass) i),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_PURPLE, (ItemClass) i),
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_PURPLE, (ItemClass) i),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_ORANGE, (ItemClass) i),
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_ORANGE, (ItemClass) i),
|
||||||
config.GetMissedItemsPerClass(AUCTION_QUALITY_YELLOW, (ItemClass) i));
|
config.GetMissedItemsPerClass(AUCTION_QUALITY_YELLOW, (ItemClass) i));
|
||||||
}
|
}
|
||||||
config.LastMissedItem = count;
|
config.LastMissedItem = count;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getRandomArray is used to make aviable the possibility to add any of missed item in place of first one to last one.
|
// 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();
|
ra.clear();
|
||||||
bool Ok=false;
|
bool Ok=false;
|
||||||
|
|
@ -1476,10 +1479,10 @@ bool AuctionBotSeller::getRandomArray( AHB_Seller_Config& config, RandomArray& r
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set items price. All important value are passed by address.
|
// 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 *
|
double temp_buyp = buyp * stackcnt *
|
||||||
(itemQuality < MAX_AUCTION_QUALITY ? config.GetPriceRatioPerQuality(AuctionQuality(itemQuality)) : 1) ;
|
(itemQuality < MAX_AUCTION_QUALITY ? config.GetPriceRatioPerQuality(AuctionQuality(itemQuality)) : 1) ;
|
||||||
|
|
||||||
double randrange = temp_buyp * 0.4;
|
double randrange = temp_buyp * 0.4;
|
||||||
buyp = (urand(temp_buyp-randrange, temp_buyp+randrange)/100)+1;
|
buyp = (urand(temp_buyp-randrange, temp_buyp+randrange)/100)+1;
|
||||||
|
|
@ -1513,7 +1516,7 @@ void AuctionBotSeller::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
||||||
LoadItemsQuantity(m_HouseConfig[house]);
|
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_GREY_AMOUNT, vals[AUCTION_QUALITY_GREY]);
|
||||||
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, vals[AUCTION_QUALITY_WHITE]);
|
sAuctionBotConfig.setConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT, vals[AUCTION_QUALITY_WHITE]);
|
||||||
|
|
@ -1579,7 +1582,7 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
|
||||||
--items;
|
--items;
|
||||||
|
|
||||||
// Select random position from missed items table
|
// Select random position from missed items table
|
||||||
uint32 pos = (urand(0,randArray.size()-1));
|
uint32 pos = (urand(0,randArray.size()-1));
|
||||||
|
|
||||||
// Set itemID with random item ID for selected categories and color, from m_ItemPool table
|
// Set itemID with random item ID for selected categories and color, from m_ItemPool table
|
||||||
uint32 itemID = m_ItemPool[randArray[pos].color][randArray[pos].itemclass][urand(0,m_ItemPool[randArray[pos].color][randArray[pos].itemclass].size()-1)];
|
uint32 itemID = m_ItemPool[randArray[pos].color][randArray[pos].itemclass][urand(0,m_ItemPool[randArray[pos].color][randArray[pos].itemclass].size()-1)];
|
||||||
|
|
@ -1689,7 +1692,7 @@ void AuctionHouseBot::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
||||||
seller->SetItemsRatioForHouse(house, 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))
|
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
|
||||||
seller->SetItemsAmount(vals);
|
seller->SetItemsAmount(vals);
|
||||||
|
|
@ -1725,10 +1728,10 @@ void AuctionHouseBot::PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo)
|
||||||
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(AuctionHouseType(i))->GetAuctionsBounds();
|
AuctionHouseObject::AuctionEntryMapBounds bounds = sAuctionMgr.GetAuctionsMap(AuctionHouseType(i))->GetAuctionsBounds();
|
||||||
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||||
{
|
{
|
||||||
AuctionEntry *Aentry = itr->second;
|
AuctionEntry* Aentry = itr->second;
|
||||||
if (Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow))
|
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 (!Aentry->owner) // Add only ahbot items
|
||||||
{
|
{
|
||||||
if (prototype->Quality < MAX_AUCTION_QUALITY)
|
if (prototype->Quality < MAX_AUCTION_QUALITY)
|
||||||
|
|
@ -1757,7 +1760,7 @@ void AuctionHouseBot::Update()
|
||||||
{
|
{
|
||||||
// nothing do...
|
// nothing do...
|
||||||
if (!m_Buyer && !m_Seller)
|
if (!m_Buyer && !m_Seller)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// scan all possible update cases until first success
|
// scan all possible update cases until first success
|
||||||
for (uint32 count = 0; count < 2*MAX_AUCTION_HOUSE_TYPE; ++count)
|
for (uint32 count = 0; count < 2*MAX_AUCTION_HOUSE_TYPE; ++count)
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ class AuctionHouseBot
|
||||||
// Followed method is mainly used by level3.cpp for ingame/console command
|
// Followed method is mainly used by level3.cpp for ingame/console command
|
||||||
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
void SetItemsRatio(uint32 al, uint32 ho, uint32 ne);
|
||||||
void SetItemsRatioForHouse(AuctionHouseType house, uint32 val);
|
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 SetItemsAmountForQuality(AuctionQuality quality, uint32 val);
|
||||||
bool ReloadAllConfig();
|
bool ReloadAllConfig();
|
||||||
void Rebuild(bool all);
|
void Rebuild(bool all);
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@
|
||||||
// post-incrementation is always slower than pre-incrementation !
|
// post-incrementation is always slower than pre-incrementation !
|
||||||
|
|
||||||
// void called when player click on auctioneer npc
|
// void called when player click on auctioneer npc
|
||||||
void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
ObjectGuid auctioneerGuid; // NPC guid
|
ObjectGuid auctioneerGuid; // NPC guid
|
||||||
recv_data >> auctioneerGuid;
|
recv_data >> auctioneerGuid;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(auctioneerGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(auctioneerGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: HandleAuctionHelloOpcode - %s not found or you can't interact with him.", auctioneerGuid.GetString().c_str());
|
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
|
// 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);
|
WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 16);
|
||||||
data << uint32(auc ? auc->Id : 0);
|
data << uint32(auc ? auc->Id : 0);
|
||||||
|
|
@ -149,13 +149,13 @@ void WorldSession::SendAuctionRemovedNotification(AuctionEntry* auction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function sends mail to old bidder
|
// 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);
|
ObjectGuid oldBidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||||
Player *oldBidder = sObjectMgr.GetPlayer(oldBidder_guid);
|
Player* oldBidder = sObjectMgr.GetPlayer(oldBidder_guid);
|
||||||
|
|
||||||
uint32 oldBidder_accId = 0;
|
uint32 oldBidder_accId = 0;
|
||||||
if(!oldBidder)
|
if (!oldBidder)
|
||||||
oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
|
oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
|
||||||
|
|
||||||
// old bidder exist
|
// old bidder exist
|
||||||
|
|
@ -168,8 +168,8 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction)
|
||||||
oldBidder->GetSession()->SendAuctionBidderNotification(auction);
|
oldBidder->GetSession()->SendAuctionBidderNotification(auction);
|
||||||
|
|
||||||
MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
|
MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
|
||||||
.SetMoney(auction->bid)
|
.SetMoney(auction->bid)
|
||||||
.SendMailTo(MailReceiver(oldBidder, oldBidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(MailReceiver(oldBidder, oldBidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction)
|
||||||
void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
||||||
{
|
{
|
||||||
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||||
Player *bidder = sObjectMgr.GetPlayer(bidder_guid);
|
Player* bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||||
|
|
||||||
uint32 bidder_accId = 0;
|
uint32 bidder_accId = 0;
|
||||||
if (!bidder)
|
if (!bidder)
|
||||||
|
|
@ -193,8 +193,8 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
||||||
bidder->GetSession()->SendAuctionRemovedNotification(auction);
|
bidder->GetSession()->SendAuctionRemovedNotification(auction);
|
||||||
|
|
||||||
MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
|
MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
|
||||||
.SetMoney(auction->bid)
|
.SetMoney(auction->bid)
|
||||||
.SendMailTo(MailReceiver(bidder, bidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(MailReceiver(bidder, bidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,7 +231,7 @@ AuctionHouseEntry const* WorldSession::GetCheckedAuctionHouseForAuctioneer(Objec
|
||||||
}
|
}
|
||||||
|
|
||||||
// this void creates new auction and adds auction to some auctionhouse
|
// 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");
|
DEBUG_LOG("WORLD: HandleAuctionSellItem");
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||||
if (!bid || !etime)
|
if (!bid || !etime)
|
||||||
return; // check for cheaters
|
return; // check for cheaters
|
||||||
|
|
||||||
Player *pl = GetPlayer();
|
Player* pl = GetPlayer();
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
|
@ -301,7 +301,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||||
|
|
||||||
uint32 stackSize = stackSizes[i];
|
uint32 stackSize = stackSizes[i];
|
||||||
|
|
||||||
Item *it = pl->GetItemByGuid(itemGuid);
|
Item* it = pl->GetItemByGuid(itemGuid);
|
||||||
|
|
||||||
// do not allow to sell already auctioned items
|
// do not allow to sell already auctioned items
|
||||||
if (sAuctionMgr.GetAItem(itemGuid.GetCounter()))
|
if (sAuctionMgr.GetAItem(itemGuid.GetCounter()))
|
||||||
|
|
@ -341,7 +341,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||||
if (GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
|
if (GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
|
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
|
||||||
GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount());
|
GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stackSize == 0)
|
if (stackSize == 0)
|
||||||
|
|
@ -353,7 +353,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||||
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Item *newItem = it->CloneItem(stackSize);
|
Item* newItem = it->CloneItem(stackSize);
|
||||||
|
|
||||||
pl->DestroyItemCount(it, stackSize, true);
|
pl->DestroyItemCount(it, stackSize, true);
|
||||||
|
|
||||||
|
|
@ -362,7 +362,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||||
AuctionEntry* AH = auctionHouse->AddAuction(auctionHouseEntry, newItem, etime, bid, buyout, deposit, pl);
|
AuctionEntry* AH = auctionHouse->AddAuction(auctionHouseEntry, newItem, etime, bid, buyout, deposit, pl);
|
||||||
|
|
||||||
DETAIL_LOG("selling %s to auctioneer %s with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
|
DETAIL_LOG("selling %s to auctioneer %s with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
|
||||||
itemGuid.GetString().c_str(), auctioneerGuid.GetString().c_str(), bid, buyout, etime, auctionHouseEntry->houseId);
|
itemGuid.GetString().c_str(), auctioneerGuid.GetString().c_str(), bid, buyout, etime, auctionHouseEntry->houseId);
|
||||||
|
|
||||||
SendAuctionCommandResult(AH, AUCTION_STARTED, AUCTION_OK);
|
SendAuctionCommandResult(AH, AUCTION_STARTED, AUCTION_OK);
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function is called when client bids or buys out auction
|
// 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");
|
DEBUG_LOG("WORLD: HandleAuctionPlaceBid");
|
||||||
|
|
||||||
|
|
@ -395,8 +395,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
AuctionEntry *auction = auctionHouse->GetAuction(auctionId);
|
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||||
Player *pl = GetPlayer();
|
Player* pl = GetPlayer();
|
||||||
|
|
||||||
if (!auction || auction->owner == pl->GetGUIDLow())
|
if (!auction || auction->owner == pl->GetGUIDLow())
|
||||||
{
|
{
|
||||||
|
|
@ -426,7 +426,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||||
|
|
||||||
// price too low for next bid if not buyout
|
// price too low for next bid if not buyout
|
||||||
if ((price < auction->buyout || auction->buyout == 0) &&
|
if ((price < auction->buyout || auction->buyout == 0) &&
|
||||||
price < auction->bid + auction->GetAuctionOutBid())
|
price < auction->bid + auction->GetAuctionOutBid())
|
||||||
{
|
{
|
||||||
// client test but possible in result lags
|
// client test but possible in result lags
|
||||||
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_ERR_BID_INCREMENT);
|
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_ERR_BID_INCREMENT);
|
||||||
|
|
@ -453,7 +453,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this void is called when auction_owner cancels his auction
|
// 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");
|
DEBUG_LOG("WORLD: HandleAuctionRemoveItem");
|
||||||
|
|
||||||
|
|
@ -474,8 +474,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
AuctionEntry *auction = auctionHouse->GetAuction(auctionId);
|
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||||
Player *pl = GetPlayer();
|
Player* pl = GetPlayer();
|
||||||
|
|
||||||
if (!auction || auction->owner != pl->GetGUIDLow())
|
if (!auction || auction->owner != pl->GetGUIDLow())
|
||||||
{
|
{
|
||||||
|
|
@ -484,7 +484,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item *pItem = sAuctionMgr.GetAItem(auction->itemGuidLow);
|
Item* pItem = sAuctionMgr.GetAItem(auction->itemGuidLow);
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
{
|
{
|
||||||
sLog.outError("Auction id: %u has nonexistent item (item guid : %u)!!!", auction->Id, auction->itemGuidLow);
|
sLog.outError("Auction id: %u has nonexistent item (item guid : %u)!!!", auction->Id, auction->itemGuidLow);
|
||||||
|
|
@ -509,8 +509,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||||
|
|
||||||
// item will deleted or added to received mail list
|
// item will deleted or added to received mail list
|
||||||
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
||||||
.AddItem(pItem)
|
.AddItem(pItem)
|
||||||
.SendMailTo(pl, auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(pl, auction, MAIL_CHECK_MASK_COPIED);
|
||||||
|
|
||||||
// inform player, that auction is removed
|
// inform player, that auction is removed
|
||||||
SendAuctionCommandResult(auction, AUCTION_REMOVED, AUCTION_OK);
|
SendAuctionCommandResult(auction, AUCTION_REMOVED, AUCTION_OK);
|
||||||
|
|
@ -525,7 +525,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when player lists his bids
|
// called when player lists his bids
|
||||||
void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: HandleAuctionListBidderItems");
|
DEBUG_LOG("WORLD: HandleAuctionListBidderItems");
|
||||||
|
|
||||||
|
|
@ -554,7 +554,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
||||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
|
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
|
||||||
Player *pl = GetPlayer();
|
Player* pl = GetPlayer();
|
||||||
data << uint32(0); // add 0 as count
|
data << uint32(0); // add 0 as count
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
uint32 totalcount = 0;
|
uint32 totalcount = 0;
|
||||||
|
|
@ -563,7 +563,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
||||||
--outbiddedCount;
|
--outbiddedCount;
|
||||||
uint32 outbiddedAuctionId;
|
uint32 outbiddedAuctionId;
|
||||||
recv_data >> outbiddedAuctionId;
|
recv_data >> outbiddedAuctionId;
|
||||||
AuctionEntry *auction = auctionHouse->GetAuction(outbiddedAuctionId);
|
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
|
||||||
if (auction && auction->BuildAuctionInfo(data))
|
if (auction && auction->BuildAuctionInfo(data))
|
||||||
{
|
{
|
||||||
++totalcount;
|
++totalcount;
|
||||||
|
|
@ -579,7 +579,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this void sends player info about his auctions
|
// this void sends player info about his auctions
|
||||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
|
void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: HandleAuctionListOwnerItems");
|
DEBUG_LOG("WORLD: HandleAuctionListOwnerItems");
|
||||||
|
|
||||||
|
|
@ -614,7 +614,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this void is called when player clicks on search button
|
// 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");
|
DEBUG_LOG("WORLD: HandleAuctionListItems");
|
||||||
|
|
||||||
|
|
@ -688,7 +688,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
|
||||||
wstrToLower(wsearchedname);
|
wstrToLower(wsearchedname);
|
||||||
|
|
||||||
BuildListAuctionItems(auctions, data, wsearchedname, listfrom, levelmin, levelmax, usable,
|
BuildListAuctionItems(auctions, data, wsearchedname, listfrom, levelmin, levelmax, usable,
|
||||||
auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount, isFull);
|
auctionSlotID, auctionMainCategory, auctionSubCategory, quality, count, totalcount, isFull);
|
||||||
|
|
||||||
data.put<uint32>(0, count);
|
data.put<uint32>(0, count);
|
||||||
data << uint32(totalcount);
|
data << uint32(totalcount);
|
||||||
|
|
@ -696,7 +696,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAuctionListPendingSales(WorldPacket & recv_data)
|
void WorldSession::HandleAuctionListPendingSales(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("CMSG_AUCTION_LIST_PENDING_SALES");
|
DEBUG_LOG("CMSG_AUCTION_LIST_PENDING_SALES");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,17 +44,17 @@ AuctionHouseMgr::AuctionHouseMgr()
|
||||||
|
|
||||||
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;
|
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];
|
return &mAuctions[AUCTION_HOUSE_NEUTRAL];
|
||||||
|
|
||||||
// team have linked auction houses
|
// team have linked auction houses
|
||||||
switch(GetAuctionHouseTeam(house))
|
switch (GetAuctionHouseTeam(house))
|
||||||
{
|
{
|
||||||
case ALLIANCE: return &mAuctions[AUCTION_HOUSE_ALLIANCE];
|
case ALLIANCE: return &mAuctions[AUCTION_HOUSE_ALLIANCE];
|
||||||
case HORDE: return &mAuctions[AUCTION_HOUSE_HORDE];
|
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));
|
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
|
// 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)
|
if (!pItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||||
Player *bidder = sObjectMgr.GetPlayer(bidder_guid);
|
Player* bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||||
|
|
||||||
uint32 bidder_accId = 0;
|
uint32 bidder_accId = 0;
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction)
|
||||||
uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid);
|
uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid);
|
||||||
|
|
||||||
sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
||||||
bidder_name.c_str(), bidder_accId, auction->itemTemplate, auction->itemCount, auction->bid, owner_name.c_str(), owner_accid);
|
bidder_name.c_str(), bidder_accId, auction->itemTemplate, auction->itemCount, auction->bid, owner_name.c_str(), owner_accid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!bidder)
|
else if (!bidder)
|
||||||
|
|
@ -162,8 +162,8 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction)
|
||||||
|
|
||||||
// will delete item or place to receiver mail list
|
// will delete item or place to receiver mail list
|
||||||
MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str())
|
MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str())
|
||||||
.AddItem(pItem)
|
.AddItem(pItem)
|
||||||
.SendMailTo(MailReceiver(bidder, bidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(MailReceiver(bidder, bidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
// receiver not exist
|
// receiver not exist
|
||||||
else
|
else
|
||||||
|
|
@ -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
|
// 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);
|
ObjectGuid owner_guid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
|
||||||
Player *owner = sObjectMgr.GetPlayer(owner_guid);
|
Player* owner = sObjectMgr.GetPlayer(owner_guid);
|
||||||
|
|
||||||
uint32 owner_accId = 0;
|
uint32 owner_accId = 0;
|
||||||
if (!owner)
|
if (!owner)
|
||||||
|
|
@ -211,15 +211,16 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction)
|
||||||
}
|
}
|
||||||
|
|
||||||
MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str())
|
MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str())
|
||||||
.SetMoney(profit)
|
.SetMoney(profit)
|
||||||
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// does not clear ram
|
// does not clear ram
|
||||||
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
||||||
{ // return an item in auction to its owner by mail
|
{
|
||||||
Item *pItem = GetAItem(auction->itemGuidLow);
|
// return an item in auction to its owner by mail
|
||||||
|
Item* pItem = GetAItem(auction->itemGuidLow);
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
{
|
{
|
||||||
sLog.outError("Auction item (GUID: %u) not found, and lost.", auction->itemGuidLow);
|
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);
|
ObjectGuid owner_guid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
|
||||||
Player *owner = sObjectMgr.GetPlayer(owner_guid);
|
Player* owner = sObjectMgr.GetPlayer(owner_guid);
|
||||||
|
|
||||||
uint32 owner_accId = 0;
|
uint32 owner_accId = 0;
|
||||||
if (!owner)
|
if (!owner)
|
||||||
|
|
@ -247,8 +248,8 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
||||||
|
|
||||||
// will delete item or place to receiver mail list
|
// will delete item or place to receiver mail list
|
||||||
MailDraft(subject.str(), "") // TODO: fix body
|
MailDraft(subject.str(), "") // TODO: fix body
|
||||||
.AddItem(pItem)
|
.AddItem(pItem)
|
||||||
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
// owner not found
|
// owner not found
|
||||||
else
|
else
|
||||||
|
|
@ -263,7 +264,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
||||||
void AuctionHouseMgr::LoadAuctionItems()
|
void AuctionHouseMgr::LoadAuctionItems()
|
||||||
{
|
{
|
||||||
// data needs to be at first place for Item::LoadFromDB 0 1 2 3
|
// 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)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -278,7 +279,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
Field *fields;
|
Field* fields;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
@ -287,7 +288,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||||
uint32 item_guid = fields[2].GetUInt32();
|
uint32 item_guid = fields[2].GetUInt32();
|
||||||
uint32 item_template = fields[3].GetUInt32();
|
uint32 item_template = fields[3].GetUInt32();
|
||||||
|
|
||||||
ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template);
|
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item_template);
|
||||||
|
|
||||||
if (!proto)
|
if (!proto)
|
||||||
{
|
{
|
||||||
|
|
@ -295,7 +296,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item *item = NewItemOrBag(proto);
|
Item* item = NewItemOrBag(proto);
|
||||||
|
|
||||||
if (!item->LoadFromDB(item_guid, fields))
|
if (!item->LoadFromDB(item_guid, fields))
|
||||||
{
|
{
|
||||||
|
|
@ -315,7 +316,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||||
|
|
||||||
void AuctionHouseMgr::LoadAuctions()
|
void AuctionHouseMgr::LoadAuctions()
|
||||||
{
|
{
|
||||||
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction");
|
QueryResult* result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -325,7 +326,7 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Field *fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 AuctionCount=fields[0].GetUInt32();
|
uint32 AuctionCount=fields[0].GetUInt32();
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
|
|
@ -359,7 +360,7 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
|
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
AuctionEntry *auction = new AuctionEntry;
|
AuctionEntry* auction = new AuctionEntry;
|
||||||
auction->Id = fields[0].GetUInt32();
|
auction->Id = fields[0].GetUInt32();
|
||||||
uint32 houseid = fields[1].GetUInt32();
|
uint32 houseid = fields[1].GetUInt32();
|
||||||
auction->itemGuidLow = fields[2].GetUInt32();
|
auction->itemGuidLow = fields[2].GetUInt32();
|
||||||
|
|
@ -410,8 +411,8 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
|
|
||||||
// overwrite by real item data
|
// overwrite by real item data
|
||||||
if ((auction->itemTemplate != pItem->GetEntry()) ||
|
if ((auction->itemTemplate != pItem->GetEntry()) ||
|
||||||
(auction->itemCount != pItem->GetCount()) ||
|
(auction->itemCount != pItem->GetCount()) ||
|
||||||
(auction->itemRandomPropertyId != pItem->GetItemRandomPropertyId()))
|
(auction->itemRandomPropertyId != pItem->GetItemRandomPropertyId()))
|
||||||
{
|
{
|
||||||
auction->itemTemplate = pItem->GetEntry();
|
auction->itemTemplate = pItem->GetEntry();
|
||||||
auction->itemCount = pItem->GetCount();
|
auction->itemCount = pItem->GetCount();
|
||||||
|
|
@ -419,7 +420,7 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
|
|
||||||
//No SQL injection (no strings)
|
//No SQL injection (no strings)
|
||||||
CharacterDatabase.PExecute("UPDATE auction SET item_template = %u, item_count = %u, item_randompropertyid = %i WHERE itemguid = %u",
|
CharacterDatabase.PExecute("UPDATE auction SET item_template = %u, item_count = %u, item_randompropertyid = %i WHERE itemguid = %u",
|
||||||
auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow);
|
auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,8 +444,8 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
|
|
||||||
// item will deleted or added to received mail list
|
// item will deleted or added to received mail list
|
||||||
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
||||||
.AddItem(pItem)
|
.AddItem(pItem)
|
||||||
.SendMailTo(MailReceiver(ObjectGuid(HIGHGUID_PLAYER, auction->owner)), auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(MailReceiver(ObjectGuid(HIGHGUID_PLAYER, auction->owner)), auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
auction->DeleteFromDB();
|
auction->DeleteFromDB();
|
||||||
|
|
@ -455,7 +456,8 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
|
|
||||||
GetAuctionsMap(auction->auctionHouseEntry)->AddAuction(auction);
|
GetAuctionsMap(auction->auctionHouseEntry)->AddAuction(auction);
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
|
|
@ -567,7 +569,7 @@ void AuctionHouseObject::Update()
|
||||||
{
|
{
|
||||||
time_t curTime = sWorld.GetGameTime();
|
time_t curTime = sWorld.GetGameTime();
|
||||||
///- Handle expired auctions
|
///- 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
|
if (itr->second->moneyDeliveryTime) // pending auction
|
||||||
{
|
{
|
||||||
|
|
@ -608,9 +610,9 @@ void AuctionHouseObject::Update()
|
||||||
|
|
||||||
void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount)
|
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
|
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||||
continue;
|
continue;
|
||||||
if (Aentry->bidder == player->GetGUIDLow())
|
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)
|
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
|
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||||
continue;
|
continue;
|
||||||
if (Aentry->owner == player->GetGUIDLow())
|
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)
|
switch (column)
|
||||||
{
|
{
|
||||||
|
|
@ -746,7 +748,7 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Pl
|
||||||
if (bid1 < bid2)
|
if (bid1 < bid2)
|
||||||
return -1;
|
return -1;
|
||||||
else if (bid1 > bid2)
|
else if (bid1 > bid2)
|
||||||
return +1;
|
return +1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: // quantity = 9
|
case 9: // quantity = 9
|
||||||
|
|
@ -771,7 +773,7 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Pl
|
||||||
return 0;
|
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
|
if (m_sort[0] == MAX_AUCTION_SORT) // not sorted
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -793,16 +795,16 @@ bool AuctionSorter::operator()(const AuctionEntry *auc1, const AuctionEntry *auc
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& auctions, WorldPacket& data, std::wstring const& wsearchedname, uint32 listfrom, uint32 levelmin,
|
void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& auctions, WorldPacket& data, std::wstring const& wsearchedname, uint32 listfrom, uint32 levelmin,
|
||||||
uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount, bool isFull)
|
uint32 levelmax, uint32 usable, uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount, bool isFull)
|
||||||
{
|
{
|
||||||
int loc_idx = _player->GetSession()->GetSessionDbLocaleIndex();
|
int loc_idx = _player->GetSession()->GetSessionDbLocaleIndex();
|
||||||
|
|
||||||
for (std::vector<AuctionEntry*>::const_iterator itr = auctions.begin(); itr != auctions.end(); ++itr)
|
for (std::vector<AuctionEntry*>::const_iterator itr = auctions.begin(); itr != auctions.end(); ++itr)
|
||||||
{
|
{
|
||||||
AuctionEntry *Aentry = *itr;
|
AuctionEntry* Aentry = *itr;
|
||||||
if (Aentry->moneyDeliveryTime)
|
if (Aentry->moneyDeliveryTime)
|
||||||
continue;
|
continue;
|
||||||
Item *item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||||
if (!item)
|
if (!item)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -813,7 +815,7 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemPrototype const *proto = item->GetProto();
|
ItemPrototype const* proto = item->GetProto();
|
||||||
|
|
||||||
if (itemClass != 0xffffffff && proto->Class != itemClass)
|
if (itemClass != 0xffffffff && proto->Class != itemClass)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -854,7 +856,7 @@ void AuctionHouseObject::BuildListPendingSales(WorldPacket& data, Player* player
|
||||||
{
|
{
|
||||||
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 not pending auctions
|
if (!Aentry->moneyDeliveryTime) // skip not pending auctions
|
||||||
continue;
|
continue;
|
||||||
if (Aentry->owner == player->GetGUIDLow())
|
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));
|
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->Id = sObjectMgr.GenerateAuctionID();
|
||||||
AH->itemGuidLow = newItem->GetObjectGuid().GetCounter();
|
AH->itemGuidLow = newItem->GetObjectGuid().GetCounter();
|
||||||
AH->itemTemplate = newItem->GetEntry();
|
AH->itemTemplate = newItem->GetEntry();
|
||||||
|
|
@ -920,9 +922,9 @@ AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHou
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function inserts to WorldPacket auction's data
|
// 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)
|
if (!pItem)
|
||||||
{
|
{
|
||||||
sLog.outError("auction to item, that doesn't exist !!!!");
|
sLog.outError("auction to item, that doesn't exist !!!!");
|
||||||
|
|
@ -977,8 +979,8 @@ void AuctionEntry::SaveToDB() const
|
||||||
{
|
{
|
||||||
//No SQL injection (no strings)
|
//No SQL injection (no strings)
|
||||||
CharacterDatabase.PExecute("INSERT INTO auction (id,houseid,itemguid,item_template,item_count,item_randompropertyid,itemowner,buyoutprice,time,moneyTime,buyguid,lastbid,startbid,deposit) "
|
CharacterDatabase.PExecute("INSERT INTO auction (id,houseid,itemguid,item_template,item_count,item_randompropertyid,itemowner,buyoutprice,time,moneyTime,buyguid,lastbid,startbid,deposit) "
|
||||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%i', '%u', '%u', '" UI64FMTD "', '" UI64FMTD "', '%u', '%u', '%u', '%u')",
|
"VALUES ('%u', '%u', '%u', '%u', '%u', '%i', '%u', '%u', '" UI64FMTD "', '" UI64FMTD "', '%u', '%u', '%u', '%u')",
|
||||||
Id, auctionHouseEntry->houseId, itemGuidLow, itemTemplate, itemCount, itemRandomPropertyId, owner, buyout, (uint64)expireTime, (uint64)moneyDeliveryTime, bidder, bid, startbid, deposit);
|
Id, auctionHouseEntry->houseId, itemGuidLow, itemTemplate, itemCount, itemRandomPropertyId, owner, buyout, (uint64)expireTime, (uint64)moneyDeliveryTime, bidder, bid, startbid, deposit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuctionEntry::AuctionBidWinning(Player* newbidder)
|
void AuctionEntry::AuctionBidWinning(Player* newbidder)
|
||||||
|
|
|
||||||
|
|
@ -76,13 +76,13 @@ struct AuctionEntry
|
||||||
uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
|
uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
|
||||||
uint32 GetAuctionCut() const;
|
uint32 GetAuctionCut() const;
|
||||||
uint32 GetAuctionOutBid() const;
|
uint32 GetAuctionOutBid() const;
|
||||||
bool BuildAuctionInfo(WorldPacket & data) const;
|
bool BuildAuctionInfo(WorldPacket& data) const;
|
||||||
void DeleteFromDB() const;
|
void DeleteFromDB() const;
|
||||||
void SaveToDB() const;
|
void SaveToDB() const;
|
||||||
void AuctionBidWinning(Player* bidder = NULL);
|
void AuctionBidWinning(Player* bidder = NULL);
|
||||||
|
|
||||||
// -1,0,+1 order result
|
// -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
|
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; }
|
AuctionEntryMap const& GetAuctions() const { return AuctionsMap; }
|
||||||
AuctionEntryMapBounds GetAuctionsBounds() const {return AuctionEntryMapBounds(AuctionsMap.begin(), AuctionsMap.end()); }
|
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;
|
AuctionsMap[ah->Id] = ah;
|
||||||
}
|
}
|
||||||
|
|
||||||
AuctionEntry* GetAuction(uint32 id) const
|
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;
|
return itr != AuctionsMap.end() ? itr->second : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ class AuctionHouseObject
|
||||||
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||||
void BuildListPendingSales(WorldPacket& data, Player* player, uint32& count);
|
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:
|
private:
|
||||||
AuctionEntryMap AuctionsMap;
|
AuctionEntryMap AuctionsMap;
|
||||||
};
|
};
|
||||||
|
|
@ -138,8 +138,8 @@ class AuctionSorter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AuctionSorter(AuctionSorter const& sorter) : m_sort(sorter.m_sort), m_viewPlayer(sorter.m_viewPlayer) {}
|
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) {}
|
AuctionSorter(uint8* sort, Player* viewPlayer) : m_sort(sort), m_viewPlayer(viewPlayer) {}
|
||||||
bool operator()(const AuctionEntry *auc1, const AuctionEntry *auc2) const;
|
bool operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8* m_sort;
|
uint8* m_sort;
|
||||||
|
|
@ -177,10 +177,10 @@ class AuctionHouseMgr
|
||||||
}
|
}
|
||||||
|
|
||||||
//auction messages
|
//auction messages
|
||||||
void SendAuctionWonMail( AuctionEntry * auction );
|
void SendAuctionWonMail(AuctionEntry* auction);
|
||||||
void SendAuctionSuccessfulMail( AuctionEntry * auction );
|
void SendAuctionSuccessfulMail(AuctionEntry* auction);
|
||||||
void SendAuctionExpiredMail( AuctionEntry * auction );
|
void SendAuctionExpiredMail(AuctionEntry* auction);
|
||||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
|
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem);
|
||||||
|
|
||||||
static uint32 GetAuctionHouseTeam(AuctionHouseEntry const* house);
|
static uint32 GetAuctionHouseTeam(AuctionHouseEntry const* house);
|
||||||
static AuctionHouseEntry const* GetAuctionHouseEntry(Unit* unit);
|
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)
|
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||||
if (m_bagslot[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();
|
count += m_bagslot[i]->GetCount();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class Bag : public Item
|
||||||
bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
|
bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void StoreItem(uint8 slot, Item *pItem, bool update);
|
void StoreItem(uint8 slot, Item* pItem, bool update);
|
||||||
void RemoveItem(uint8 slot, bool update);
|
void RemoveItem(uint8 slot, bool update);
|
||||||
|
|
||||||
Item* GetItemByPos(uint8 slot) const;
|
Item* GetItemByPos(uint8 slot) const;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace MaNGOS
|
||||||
va_copy(ap,*i_args);
|
va_copy(ap,*i_args);
|
||||||
|
|
||||||
char str [2048];
|
char str [2048];
|
||||||
vsnprintf(str,2048,text, ap );
|
vsnprintf(str,2048,text, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
do_helper(data,&str[0]);
|
do_helper(data,&str[0]);
|
||||||
|
|
@ -91,14 +91,14 @@ namespace MaNGOS
|
||||||
{
|
{
|
||||||
char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx);
|
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
|
// we need copy va_list before use or original va_list will corrupted
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_copy(ap,*i_args);
|
va_copy(ap,*i_args);
|
||||||
|
|
||||||
char str [2048];
|
char str [2048];
|
||||||
vsnprintf(str,2048,text, ap );
|
vsnprintf(str,2048,text, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
do_helper(data,&str[0]);
|
do_helper(data,&str[0]);
|
||||||
|
|
@ -141,7 +141,7 @@ namespace MaNGOS
|
||||||
char const* arg2str = i_arg2 ? sObjectMgr.GetMangosString(i_arg2,loc_idx) : "";
|
char const* arg2str = i_arg2 ? sObjectMgr.GetMangosString(i_arg2,loc_idx) : "";
|
||||||
|
|
||||||
char str [2048];
|
char str [2048];
|
||||||
snprintf(str,2048,text, arg1str, arg2str );
|
snprintf(str,2048,text, arg1str, arg2str);
|
||||||
|
|
||||||
ObjectGuid targetGuid = i_source ? i_source ->GetObjectGuid() : ObjectGuid();
|
ObjectGuid targetGuid = i_source ? i_source ->GetObjectGuid() : ObjectGuid();
|
||||||
|
|
||||||
|
|
@ -201,8 +201,8 @@ namespace MaNGOS
|
||||||
template<class Do>
|
template<class Do>
|
||||||
void BattleGround::BroadcastWorker(Do& _do)
|
void BattleGround::BroadcastWorker(Do& _do)
|
||||||
{
|
{
|
||||||
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 = ObjectAccessor::FindPlayer(itr->first))
|
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
|
||||||
_do(plr);
|
_do(plr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,7 +282,7 @@ BattleGround::~BattleGround()
|
||||||
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
|
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
|
||||||
|
|
||||||
int size = m_BgObjects.size();
|
int size = m_BgObjects.size();
|
||||||
for(int i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
DelObject(i);
|
DelObject(i);
|
||||||
|
|
||||||
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
|
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
|
||||||
|
|
@ -300,7 +300,7 @@ BattleGround::~BattleGround()
|
||||||
// remove from bg free slot queue
|
// remove from bg free slot queue
|
||||||
this->RemoveFromBGFreeSlotQueue();
|
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;
|
delete itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -462,7 +462,7 @@ void BattleGround::Update(uint32 diff)
|
||||||
|
|
||||||
PlaySoundToAll(SOUND_BG_START);
|
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))
|
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||||
//Announce BG starting
|
//Announce BG starting
|
||||||
|
|
@ -486,7 +486,7 @@ void BattleGround::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
m_EndTime = 0;
|
m_EndTime = 0;
|
||||||
BattleGroundPlayerMap::iterator itr, next;
|
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 = itr;
|
||||||
++next;
|
++next;
|
||||||
|
|
@ -510,28 +510,28 @@ void BattleGround::SetTeamStartLoc(Team team, float X, float Y, float Z, float O
|
||||||
m_TeamStartLocO[teamIdx] = 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)
|
if (itr->second.OfflineRemoveTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
|
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||||
plr->GetSession()->SendPacket(packet);
|
plr->GetSession()->SendPacket(packet);
|
||||||
else
|
else
|
||||||
sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str());
|
sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (itr->second.OfflineRemoveTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround:SendPacketToTeam: %s not found!", itr->first.GetString().c_str());
|
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;
|
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)
|
if (itr->second.OfflineRemoveTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround:PlaySoundToTeam: %s not found!", itr->first.GetString().c_str());
|
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;
|
Team team = itr->second.PlayerTeam;
|
||||||
if(!team) team = plr->GetTeam();
|
if (!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
{
|
{
|
||||||
|
|
@ -585,12 +585,12 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
||||||
|
|
||||||
void BattleGround::CastSpellOnTeam(uint32 SpellID, 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)
|
if (itr->second.OfflineRemoveTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
|
|
@ -599,7 +599,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if(!team) team = plr->GetTeam();
|
if (!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
plr->CastSpell(plr, SpellID, true);
|
plr->CastSpell(plr, SpellID, true);
|
||||||
|
|
@ -608,12 +608,12 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
||||||
|
|
||||||
void BattleGround::RewardHonorToTeam(uint32 Honor, 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)
|
if (itr->second.OfflineRemoveTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
|
|
@ -622,7 +622,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if(!team) team = plr->GetTeam();
|
if (!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
|
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
|
||||||
|
|
@ -636,12 +636,12 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||||
if (!factionEntry)
|
if (!factionEntry)
|
||||||
return;
|
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)
|
if (itr->second.OfflineRemoveTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
|
|
@ -650,7 +650,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if(!team) team = plr->GetTeam();
|
if (!team) team = plr->GetTeam();
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
|
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
|
||||||
|
|
@ -664,7 +664,7 @@ void BattleGround::UpdateWorldState(uint32 Field, uint32 Value)
|
||||||
SendPacketToAll(&data);
|
SendPacketToAll(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source)
|
void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source)
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value);
|
sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value);
|
||||||
|
|
@ -675,8 +675,8 @@ void BattleGround::EndBattleGround(Team winner)
|
||||||
{
|
{
|
||||||
this->RemoveFromBGFreeSlotQueue();
|
this->RemoveFromBGFreeSlotQueue();
|
||||||
|
|
||||||
ArenaTeam * winner_arena_team = NULL;
|
ArenaTeam* winner_arena_team = NULL;
|
||||||
ArenaTeam * loser_arena_team = NULL;
|
ArenaTeam* loser_arena_team = NULL;
|
||||||
uint32 loser_rating = 0;
|
uint32 loser_rating = 0;
|
||||||
uint32 winner_rating = 0;
|
uint32 winner_rating = 0;
|
||||||
WorldPacket data;
|
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;
|
Team team = itr->second.PlayerTeam;
|
||||||
|
|
||||||
|
|
@ -740,7 +740,7 @@ void BattleGround::EndBattleGround(Team winner)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround:EndBattleGround %s not found!", itr->first.GetString().c_str());
|
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
|
uint32 BattleGround::GetBattlemasterEntry() const
|
||||||
{
|
{
|
||||||
switch(GetTypeID())
|
switch (GetTypeID())
|
||||||
{
|
{
|
||||||
case BATTLEGROUND_AV: return 15972;
|
case BATTLEGROUND_AV: return 15972;
|
||||||
case BATTLEGROUND_WS: return 14623;
|
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:
|
case BATTLEGROUND_AV:
|
||||||
if (count == ITEM_WINNER_COUNT)
|
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
|
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||||
if(!spellInfo)
|
if (!spellInfo)
|
||||||
{
|
{
|
||||||
sLog.outError("Battleground reward casting spell %u not exist.",spell_id);
|
sLog.outError("Battleground reward casting spell %u not exist.",spell_id);
|
||||||
return;
|
return;
|
||||||
|
|
@ -896,7 +896,7 @@ void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id)
|
||||||
plr->CastSpell(plr, spellInfo, true);
|
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
|
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||||
|
|
@ -904,26 +904,26 @@ void BattleGround::RewardItem(Player *plr, uint32 item_id, uint32 count)
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint32 no_space_count = 0;
|
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);
|
sLog.outErrorDb("Battleground reward item (Entry %u) not exist in `item_template`.",item_id);
|
||||||
return;
|
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;
|
count -= no_space_count;
|
||||||
|
|
||||||
if( count != 0 && !dest.empty()) // can add some
|
if (count != 0 && !dest.empty()) // can add some
|
||||||
if (Item* item = plr->StoreNewItem( dest, item_id, true, 0))
|
if (Item* item = plr->StoreNewItem(dest, item_id, true, 0))
|
||||||
plr->SendNewItem(item,count,true,false);
|
plr->SendNewItem(item,count,true,false);
|
||||||
|
|
||||||
if (no_space_count > 0)
|
if (no_space_count > 0)
|
||||||
SendRewardMarkByMail(plr,item_id,no_space_count);
|
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();
|
uint32 bmEntry = GetBattlemasterEntry();
|
||||||
if (!bmEntry)
|
if (!bmEntry)
|
||||||
|
|
@ -950,15 +950,15 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
||||||
snprintf(textBuf, 300, textFormat.c_str(), GetName(), GetName());
|
snprintf(textBuf, 300, textFormat.c_str(), GetName(), GetName());
|
||||||
|
|
||||||
MailDraft(subject, textBuf)
|
MailDraft(subject, textBuf)
|
||||||
.AddItem(markItem)
|
.AddItem(markItem)
|
||||||
.SendMailTo(plr, MailSender(MAIL_CREATURE, bmEntry));
|
.SendMailTo(plr, MailSender(MAIL_CREATURE, bmEntry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::RewardQuestComplete(Player *plr)
|
void BattleGround::RewardQuestComplete(Player* plr)
|
||||||
{
|
{
|
||||||
uint32 quest;
|
uint32 quest;
|
||||||
switch(GetTypeID())
|
switch (GetTypeID())
|
||||||
{
|
{
|
||||||
case BATTLEGROUND_AV:
|
case BATTLEGROUND_AV:
|
||||||
quest = SPELL_AV_QUEST_REWARD;
|
quest = SPELL_AV_QUEST_REWARD;
|
||||||
|
|
@ -979,7 +979,7 @@ void BattleGround::RewardQuestComplete(Player *plr)
|
||||||
RewardSpellCast(plr, quest);
|
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()
|
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);
|
m_PlayerScores.erase(itr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *plr = sObjectMgr.GetPlayer(guid);
|
Player* plr = sObjectMgr.GetPlayer(guid);
|
||||||
|
|
||||||
if (plr)
|
if (plr)
|
||||||
{
|
{
|
||||||
|
|
@ -1024,7 +1024,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
||||||
|
|
||||||
RemovePlayer(plr, guid); // BG subclass specific code
|
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();
|
BattleGroundTypeId bgTypeId = GetTypeID();
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
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)
|
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||||
{
|
{
|
||||||
//left a rated match while the encounter was in progress, consider as loser
|
//left a rated match while the encounter was in progress, consider as loser
|
||||||
ArenaTeam * winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
ArenaTeam* winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||||
ArenaTeam * loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
ArenaTeam* loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||||
if (winner_arena_team && loser_arena_team)
|
if (winner_arena_team && loser_arena_team)
|
||||||
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
||||||
}
|
}
|
||||||
|
|
@ -1064,22 +1064,22 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
||||||
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// removing offline participant
|
// removing offline participant
|
||||||
{
|
{
|
||||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||||
{
|
{
|
||||||
//left a rated match while the encounter was in progress, consider as loser
|
//left a rated match while the encounter was in progress, consider as loser
|
||||||
ArenaTeam * others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
ArenaTeam* others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||||
ArenaTeam * players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
ArenaTeam* players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||||
if (others_arena_team && players_arena_team)
|
if (others_arena_team && players_arena_team)
|
||||||
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove from raid group if player is member
|
// 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);
|
SetBgRaid(team, NULL);
|
||||||
delete group;
|
delete group;
|
||||||
|
|
@ -1145,7 +1145,7 @@ void BattleGround::Reset()
|
||||||
|
|
||||||
m_Players.clear();
|
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;
|
delete itr->second;
|
||||||
m_PlayerScores.clear();
|
m_PlayerScores.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -1170,7 +1170,7 @@ void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 e
|
||||||
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
|
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::AddPlayer(Player *plr)
|
void BattleGround::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
// remove afk from player
|
// remove afk from player
|
||||||
if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
|
if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
|
||||||
|
|
@ -1218,14 +1218,14 @@ void BattleGround::AddPlayer(Player *plr)
|
||||||
plr->DestroyConjuredItems(true);
|
plr->DestroyConjuredItems(true);
|
||||||
plr->UnsummonPetTemporaryIfAny();
|
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_PREPARATION, true);
|
||||||
|
|
||||||
plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
|
plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
|
||||||
}
|
}
|
||||||
else
|
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_PREPARATION, true); // reduces all mana cost of spells.
|
||||||
|
|
||||||
plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
|
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 */
|
/* 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
|
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)
|
void BattleGround::EventPlayerLoggedIn(Player* player, ObjectGuid plr_guid)
|
||||||
{
|
{
|
||||||
// player is correct pointer
|
// 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)
|
if (*itr == plr_guid)
|
||||||
{
|
{
|
||||||
|
|
@ -1346,15 +1346,15 @@ bool BattleGround::HasFreeSlots() const
|
||||||
return GetPlayersSize() < GetMaxPlayers();
|
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
|
//this procedure is called from virtual function implemented in bg subclass
|
||||||
BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
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;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SCORE_KILLING_BLOWS: // Killing blows
|
case SCORE_KILLING_BLOWS: // Killing blows
|
||||||
itr->second->KillingBlows += value;
|
itr->second->KillingBlows += value;
|
||||||
|
|
@ -1392,37 +1392,37 @@ 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
|
// 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
|
// 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
|
// 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(),
|
if (!go->Create(GetBgMap()->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
|
||||||
PHASEMASK_NORMAL, x,y,z,o, QuaternionData(rotation0,rotation1,rotation2,rotation3)))
|
PHASEMASK_NORMAL, x,y,z,o, QuaternionData(rotation0,rotation1,rotation2,rotation3)))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
|
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
|
||||||
sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);
|
sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);
|
||||||
delete go;
|
delete go;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
uint32 guid = go->GetGUIDLow();
|
uint32 guid = go->GetGUIDLow();
|
||||||
|
|
||||||
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
|
// without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
|
||||||
// iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
|
// iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
|
||||||
GameObjectData& data = sObjectMgr.NewGOData(guid);
|
GameObjectData& data = sObjectMgr.NewGOData(guid);
|
||||||
|
|
||||||
data.id = entry;
|
data.id = entry;
|
||||||
data.mapid = GetMapId();
|
data.mapid = GetMapId();
|
||||||
data.posX = x;
|
data.posX = x;
|
||||||
data.posY = y;
|
data.posY = y;
|
||||||
data.posZ = z;
|
data.posZ = z;
|
||||||
data.orientation = o;
|
data.orientation = o;
|
||||||
data.rotation0 = rotation0;
|
data.rotation0 = rotation0;
|
||||||
data.rotation1 = rotation1;
|
data.rotation1 = rotation1;
|
||||||
data.rotation2 = rotation2;
|
data.rotation2 = rotation2;
|
||||||
data.rotation3 = rotation3;
|
data.rotation3 = rotation3;
|
||||||
data.spawntimesecs = respawnTime;
|
data.spawntimesecs = respawnTime;
|
||||||
data.spawnMask = 1;
|
data.spawnMask = 1;
|
||||||
data.animprogress = 100;
|
data.animprogress = 100;
|
||||||
data.go_state = 1;
|
data.go_state = 1;
|
||||||
*/
|
*/
|
||||||
// add to world, so it can be later looked up from HashMapHolder
|
// add to world, so it can be later looked up from HashMapHolder
|
||||||
go->AddToWorld();
|
go->AddToWorld();
|
||||||
m_BgObjects[type] = go->GetObjectGuid();
|
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
|
//it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
|
||||||
void BattleGround::DoorClose(ObjectGuid guid)
|
void BattleGround::DoorClose(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
GameObject *obj = GetBgMap()->GetGameObject(guid);
|
GameObject* obj = GetBgMap()->GetGameObject(guid);
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
//if doors are open, close it
|
//if doors are open, close it
|
||||||
|
|
@ -1450,7 +1450,7 @@ void BattleGround::DoorClose(ObjectGuid guid)
|
||||||
|
|
||||||
void BattleGround::DoorOpen(ObjectGuid guid)
|
void BattleGround::DoorOpen(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
GameObject *obj = GetBgMap()->GetGameObject(guid);
|
GameObject* obj = GetBgMap()->GetGameObject(guid);
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
//change state to be sure they will be opened
|
//change state to be sure they will be opened
|
||||||
|
|
@ -1524,7 +1524,7 @@ void BattleGround::OpenDoorEvent(uint8 event1, uint8 event2 /*=0*/)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
|
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);
|
DoorOpen(*itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1533,7 +1533,7 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
||||||
// stop if we want to spawn something which was already spawned
|
// stop if we want to spawn something which was already spawned
|
||||||
// or despawn something which was already despawned
|
// or despawn something which was already despawned
|
||||||
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|
||||||
|| (!spawn && m_ActiveEvents[event1] != event2))
|
|| (!spawn && m_ActiveEvents[event1] != event2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (spawn)
|
if (spawn)
|
||||||
|
|
@ -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
|
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();
|
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);
|
SpawnBGCreature(*itr, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||||
GuidVector::const_iterator itr2 = m_EventObjects[MAKE_PAIR32(event1, event2)].gameobjects.begin();
|
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);
|
SpawnBGObject(*itr2, (spawn) ? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1557,8 +1557,8 @@ void BattleGround::SpawnBGObject(ObjectGuid guid, uint32 respawntime)
|
||||||
{
|
{
|
||||||
Map* map = GetBgMap();
|
Map* map = GetBgMap();
|
||||||
|
|
||||||
GameObject *obj = map->GetGameObject(guid);
|
GameObject* obj = map->GetGameObject(guid);
|
||||||
if(!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
if (respawntime == 0)
|
if (respawntime == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1602,7 +1602,7 @@ bool BattleGround::DelObject(uint32 type)
|
||||||
if (!m_BgObjects[type])
|
if (!m_BgObjects[type])
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
|
GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
sLog.outError("Can't find gobject: %s", m_BgObjects[type].GetString().c_str());
|
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)
|
void BattleGround::SendYellToAll(int32 entry, uint32 language, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
Creature* source = GetBgMap()->GetCreature(guid);
|
Creature* source = GetBgMap()->GetCreature(guid);
|
||||||
if(!source)
|
if (!source)
|
||||||
return;
|
return;
|
||||||
MaNGOS::BattleGroundYellBuilder bg_builder(language, entry, source);
|
MaNGOS::BattleGroundYellBuilder bg_builder(language, entry, source);
|
||||||
MaNGOS::LocalizedPacketDo<MaNGOS::BattleGroundYellBuilder> bg_do(bg_builder);
|
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)
|
void BattleGround::SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid, int32 arg1, int32 arg2)
|
||||||
{
|
{
|
||||||
Creature* source = GetBgMap()->GetCreature(guid);
|
Creature* source = GetBgMap()->GetCreature(guid);
|
||||||
if(!source)
|
if (!source)
|
||||||
return;
|
return;
|
||||||
MaNGOS::BattleGround2YellBuilder bg_builder(language, entry, source, arg1, arg2);
|
MaNGOS::BattleGround2YellBuilder bg_builder(language, entry, source, arg1, arg2);
|
||||||
MaNGOS::LocalizedPacketDo<MaNGOS::BattleGround2YellBuilder> bg_do(bg_builder);
|
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)
|
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())
|
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1695,7 +1695,7 @@ void BattleGround::HandleTriggerBuff(ObjectGuid go_guid)
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround (Type: %u) has buff trigger %s GOType: %u but it hasn't that object in its internal data",
|
sLog.outError("BattleGround (Type: %u) has buff trigger %s GOType: %u but it hasn't that object in its internal data",
|
||||||
GetTypeID(), go_guid.GetString().c_str(), obj->GetGoType());
|
GetTypeID(), go_guid.GetString().c_str(), obj->GetGoType());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1720,7 +1720,7 @@ void BattleGround::HandleTriggerBuff(ObjectGuid go_guid)
|
||||||
SpawnBGObject(m_BgObjects[index], BUFF_RESPAWN_TIME);
|
SpawnBGObject(m_BgObjects[index], BUFF_RESPAWN_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
void BattleGround::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
// add +1 deaths
|
// add +1 deaths
|
||||||
UpdatePlayerScore(player, SCORE_DEATHS, 1);
|
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_HONORABLE_KILLS, 1);
|
||||||
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 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)
|
if (!plr || plr == killer)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1745,7 +1745,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
||||||
|
|
||||||
// to be able to remove insignia -- ONLY IN BattleGrounds
|
// to be able to remove insignia -- ONLY IN BattleGrounds
|
||||||
if (!isArena())
|
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
|
// return the player's team based on battlegroundplayer info
|
||||||
|
|
@ -1786,11 +1786,11 @@ void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
|
||||||
uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
|
uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
|
||||||
{
|
{
|
||||||
int count = 0;
|
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)
|
if (itr->second.PlayerTeam == team)
|
||||||
{
|
{
|
||||||
Player * pl = sObjectMgr.GetPlayer(itr->first);
|
Player* pl = sObjectMgr.GetPlayer(itr->first);
|
||||||
if (pl && pl->isAlive())
|
if (pl && pl->isAlive())
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
@ -1806,9 +1806,9 @@ void BattleGround::CheckArenaWinConditions()
|
||||||
EndBattleGround(ALLIANCE);
|
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)
|
if (old_raid)
|
||||||
old_raid->SetBattlegroundGroup(NULL);
|
old_raid->SetBattlegroundGroup(NULL);
|
||||||
|
|
@ -1819,7 +1819,7 @@ void BattleGround::SetBgRaid(Team team, Group *bg_raid)
|
||||||
old_raid = 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());
|
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;
|
return score >= minScore && score <= maxScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::SetBracket( PvPDifficultyEntry const* bracketEntry )
|
void BattleGround::SetBracket(PvPDifficultyEntry const* bracketEntry)
|
||||||
{
|
{
|
||||||
m_BracketId = bracketEntry->GetBracketId();
|
m_BracketId = bracketEntry->GetBracketId();
|
||||||
SetLevelRange(bracketEntry->minLevel,bracketEntry->maxLevel);
|
SetLevelRange(bracketEntry->minLevel,bracketEntry->maxLevel);
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ struct BattleGroundObjectInfo
|
||||||
{
|
{
|
||||||
BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {}
|
BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {}
|
||||||
|
|
||||||
GameObject *object;
|
GameObject* object;
|
||||||
int32 timer;
|
int32 timer;
|
||||||
uint32 spellid;
|
uint32 spellid;
|
||||||
};
|
};
|
||||||
|
|
@ -273,7 +273,7 @@ This class is used to:
|
||||||
*/
|
*/
|
||||||
class BattleGround
|
class BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Construction */
|
/* Construction */
|
||||||
|
|
@ -388,7 +388,7 @@ class BattleGround
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTeamStartLoc(Team team, float X, float Y, float Z, float O);
|
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);
|
BattleGroundTeamIndex idx = GetTeamIndexByTeamId(team);
|
||||||
X = m_TeamStartLocX[idx];
|
X = m_TeamStartLocX[idx];
|
||||||
|
|
@ -400,8 +400,8 @@ class BattleGround
|
||||||
/* Packet Transfer */
|
/* Packet Transfer */
|
||||||
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
||||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {}
|
virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {}
|
||||||
void SendPacketToTeam(Team team, WorldPacket *packet, Player *sender = NULL, bool self = true);
|
void SendPacketToTeam(Team team, WorldPacket* packet, Player* sender = NULL, bool self = true);
|
||||||
void SendPacketToAll(WorldPacket *packet);
|
void SendPacketToAll(WorldPacket* packet);
|
||||||
|
|
||||||
template<class Do>
|
template<class Do>
|
||||||
void BroadcastWorker(Do& _do);
|
void BroadcastWorker(Do& _do);
|
||||||
|
|
@ -411,29 +411,29 @@ class BattleGround
|
||||||
void CastSpellOnTeam(uint32 SpellID, Team team);
|
void CastSpellOnTeam(uint32 SpellID, Team team);
|
||||||
void RewardHonorToTeam(uint32 Honor, Team team);
|
void RewardHonorToTeam(uint32 Honor, Team team);
|
||||||
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, Team team);
|
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, Team team);
|
||||||
void RewardMark(Player *plr,uint32 count);
|
void RewardMark(Player* plr,uint32 count);
|
||||||
void SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count);
|
void SendRewardMarkByMail(Player* plr,uint32 mark, uint32 count);
|
||||||
void RewardItem(Player *plr, uint32 item_id, uint32 count);
|
void RewardItem(Player* plr, uint32 item_id, uint32 count);
|
||||||
void RewardQuestComplete(Player *plr);
|
void RewardQuestComplete(Player* plr);
|
||||||
void RewardSpellCast(Player *plr, uint32 spell_id);
|
void RewardSpellCast(Player* plr, uint32 spell_id);
|
||||||
void UpdateWorldState(uint32 Field, uint32 Value);
|
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);
|
virtual void EndBattleGround(Team winner);
|
||||||
void BlockMovement(Player *plr);
|
void BlockMovement(Player* plr);
|
||||||
|
|
||||||
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
|
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
|
||||||
void SendYellToAll(int32 entry, uint32 language, ObjectGuid guid);
|
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
|
// specialized version with 2 string id args
|
||||||
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
|
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);
|
void SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid, int32 arg1, int32 arg2);
|
||||||
|
|
||||||
/* Raid Group */
|
/* Raid Group */
|
||||||
Group *GetBgRaid(Team team) const { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
Group* GetBgRaid(Team team) const { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||||
void SetBgRaid(Team team, Group *bg_raid);
|
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; }
|
static BattleGroundTeamIndex GetTeamIndexByTeamId(Team team) { return team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
|
||||||
uint32 GetPlayersCountByTeam(Team team) const { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
uint32 GetPlayersCountByTeam(Team team) const { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
||||||
|
|
@ -457,7 +457,7 @@ class BattleGround
|
||||||
// must be implemented in BG subclass
|
// must be implemented in BG subclass
|
||||||
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
|
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
|
||||||
// must be implemented in BG subclass if need AND call base class generic code
|
// 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; };
|
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/) { return; };
|
||||||
|
|
||||||
/* Battleground events */
|
/* Battleground events */
|
||||||
|
|
@ -470,12 +470,12 @@ class BattleGround
|
||||||
/* Death related */
|
/* Death related */
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
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);
|
virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket);
|
||||||
// can be extended in in BG subclass
|
// can be extended in in BG subclass
|
||||||
|
|
||||||
/* event related */
|
/* event related */
|
||||||
// called when a creature gets added to map (NOTE: only triggered if
|
// called when a creature gets added to map (NOTE: only triggered if
|
||||||
|
|
@ -507,12 +507,12 @@ class BattleGround
|
||||||
void DoorOpen(ObjectGuid guid);
|
void DoorOpen(ObjectGuid guid);
|
||||||
void DoorClose(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
|
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
||||||
Team GetPlayerTeam(ObjectGuid guid);
|
Team GetPlayerTeam(ObjectGuid guid);
|
||||||
static Team GetOtherTeam(Team team){ return team ? ((team == ALLIANCE) ? HORDE : ALLIANCE) : TEAM_NONE; }
|
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 BattleGroundTeamIndex GetOtherTeamIndex(BattleGroundTeamIndex teamIdx) { return teamIdx == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; }
|
||||||
bool IsPlayerInBattleGround(ObjectGuid guid);
|
bool IsPlayerInBattleGround(ObjectGuid guid);
|
||||||
|
|
||||||
/* virtual score-array - get's used in bg-subclasses */
|
/* virtual score-array - get's used in bg-subclasses */
|
||||||
|
|
@ -543,7 +543,7 @@ class BattleGround
|
||||||
|
|
||||||
BattleGroundScoreMap m_PlayerScores; // Player scores
|
BattleGroundScoreMap m_PlayerScores; // Player scores
|
||||||
// must be implemented in BG subclass
|
// 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 */
|
/* Player lists, those need to be accessible by inherited classes */
|
||||||
BattleGroundPlayerMap m_Players;
|
BattleGroundPlayerMap m_Players;
|
||||||
|
|
@ -575,7 +575,7 @@ class BattleGround
|
||||||
bool m_IsRated; // is this battle rated?
|
bool m_IsRated; // is this battle rated?
|
||||||
bool m_PrematureCountDown;
|
bool m_PrematureCountDown;
|
||||||
uint32 m_PrematureCountDownTimer;
|
uint32 m_PrematureCountDownTimer;
|
||||||
char const *m_Name;
|
char const* m_Name;
|
||||||
|
|
||||||
/* Player lists */
|
/* Player lists */
|
||||||
typedef std::deque<ObjectGuid> OfflineQueue;
|
typedef std::deque<ObjectGuid> OfflineQueue;
|
||||||
|
|
@ -588,7 +588,7 @@ class BattleGround
|
||||||
uint32 m_InvitedHorde;
|
uint32 m_InvitedHorde;
|
||||||
|
|
||||||
/* Raid Group */
|
/* 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 */
|
/* Players count by team */
|
||||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||||
|
|
@ -645,7 +645,7 @@ struct WorldStatePair
|
||||||
|
|
||||||
inline void FillInitialWorldState(ByteBuffer& data, uint32& count, WorldStatePair const* array)
|
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->state);
|
||||||
data << uint32(itr->value);
|
data << uint32(itr->value);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void BattleGroundAA::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAA::AddPlayer(Player *plr)
|
void BattleGroundAA::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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;
|
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);
|
BattleGround::HandleKillPlayer(player, killer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
void BattleGroundAA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundAAScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundAA : public BattleGround
|
class BattleGroundAA : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundAA();
|
BattleGroundAA();
|
||||||
|
|
@ -38,13 +38,13 @@ class BattleGroundAA : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ void BattleGroundAB::StartingEventOpenDoors()
|
||||||
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AB_EVENT_START_BATTLE);
|
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AB_EVENT_START_BATTLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAB::AddPlayer(Player *plr)
|
void BattleGroundAB::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in the constructor
|
//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;
|
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.
|
case 3948: // Arathi Basin Alliance Exit.
|
||||||
if (Source->GetTeam() != ALLIANCE)
|
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 */
|
/* 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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -447,9 +447,9 @@ bool BattleGroundAB::SetupBattleGround()
|
||||||
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
|
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||||
{
|
{
|
||||||
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||||
)
|
)
|
||||||
sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!");
|
sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -522,7 +522,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||||
float mindist = 999999.0f;
|
float mindist = 999999.0f;
|
||||||
for (uint8 i = 0; i < nodes.size(); ++i)
|
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)
|
if (!entry)
|
||||||
continue;
|
continue;
|
||||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
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 not, place ghost on starting location
|
||||||
if (!good_entry)
|
if (!good_entry)
|
||||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] );
|
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex+5]);
|
||||||
|
|
||||||
return good_entry;
|
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());
|
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;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SCORE_BASES_ASSAULTED:
|
case SCORE_BASES_ASSAULTED:
|
||||||
((BattleGroundABScore*)itr->second)->BasesAssaulted += value;
|
((BattleGroundABScore*)itr->second)->BasesAssaulted += value;
|
||||||
|
|
@ -566,7 +566,7 @@ bool BattleGroundAB::IsAllNodesConrolledByTeam(Team team) const
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
|
for (int i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||||
if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
|
if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
|
||||||
(team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED))
|
(team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED))
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
return count == BG_AB_NODES_MAX;
|
return count == BG_AB_NODES_MAX;
|
||||||
|
|
|
||||||
|
|
@ -29,34 +29,34 @@ enum BG_AB_WorldStates
|
||||||
BG_AB_OP_RESOURCES_HORDE = 1777,
|
BG_AB_OP_RESOURCES_HORDE = 1777,
|
||||||
BG_AB_OP_RESOURCES_MAX = 1780,
|
BG_AB_OP_RESOURCES_MAX = 1780,
|
||||||
BG_AB_OP_RESOURCES_WARNING = 1955
|
BG_AB_OP_RESOURCES_WARNING = 1955
|
||||||
/*
|
/*
|
||||||
BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE)
|
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_ALIENCE = 1767, //Stable map state (ALIENCE)
|
||||||
BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE)
|
BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE)
|
||||||
BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE)
|
BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE)
|
||||||
BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE)
|
BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE)
|
||||||
BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE)
|
BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE)
|
||||||
BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE)
|
BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE)
|
||||||
BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE)
|
BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE)
|
||||||
BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE)
|
BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE)
|
||||||
BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE)
|
BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE)
|
||||||
|
|
||||||
BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE)
|
BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE)
|
||||||
BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE)
|
BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE)
|
||||||
BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE)
|
BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE)
|
||||||
BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE)
|
BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE)
|
||||||
BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE)
|
BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE)
|
||||||
BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE)
|
BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE)
|
||||||
BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE)
|
BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE)
|
||||||
BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE)
|
BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE)
|
||||||
BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE)
|
BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE)
|
||||||
BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE)
|
BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE)
|
||||||
BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE)
|
BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE)
|
||||||
BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE)
|
BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE)
|
||||||
BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE)
|
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_ALI = 1789, //Gold Mine map state (CON ALIENCE
|
||||||
BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE)
|
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};
|
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};
|
const uint32 BG_AB_GraveyardIds[7] = {895, 894, 893, 897, 896, 898, 899};
|
||||||
|
|
||||||
// x, y, z, o
|
// 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
|
{1185.71f, 1185.24f, -56.36f, 2.56f}, // stables
|
||||||
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
|
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
|
||||||
{817.66f, 843.34f, -56.54f, 3.01f}, // farm
|
{817.66f, 843.34f, -56.54f, 3.01f}, // farm
|
||||||
|
|
@ -175,30 +176,30 @@ class BattleGroundABScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundAB : public BattleGround
|
class BattleGroundAB : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundAB();
|
BattleGroundAB();
|
||||||
~BattleGroundAB();
|
~BattleGroundAB();
|
||||||
|
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
void AddPlayer(Player *plr);
|
void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
virtual bool SetupBattleGround();
|
virtual bool SetupBattleGround();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
void EndBattleGround(Team winner);
|
void EndBattleGround(Team winner);
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* 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);
|
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||||
|
|
||||||
/* Nodes occupying */
|
/* Nodes occupying */
|
||||||
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
|
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||||
|
|
||||||
/* achievement req. */
|
/* achievement req. */
|
||||||
bool IsAllNodesConrolledByTeam(Team team) const; // overwrited
|
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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -47,7 +47,7 @@ void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
|
||||||
UpdateScore(GetTeamIndexByTeamId(player->GetTeam()), -1);
|
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());
|
DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry());
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
|
@ -55,7 +55,7 @@ void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer)
|
||||||
uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
|
uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
|
||||||
if (event1 == BG_EVENT_NONE)
|
if (event1 == BG_EVENT_NONE)
|
||||||
return;
|
return;
|
||||||
switch(event1)
|
switch (event1)
|
||||||
{
|
{
|
||||||
case BG_AV_BOSS_A:
|
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
|
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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
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)
|
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)
|
// TODO add events (including quest not available anymore, next quest availabe, go/npc de/spawning)
|
||||||
sLog.outError("BattleGroundAV: Quest %i completed", questid);
|
sLog.outError("BattleGroundAV: Quest %i completed", questid);
|
||||||
switch(questid)
|
switch (questid)
|
||||||
{
|
{
|
||||||
case BG_AV_QUEST_A_SCRAPS1:
|
case BG_AV_QUEST_A_SCRAPS1:
|
||||||
case BG_AV_QUEST_A_SCRAPS2:
|
case BG_AV_QUEST_A_SCRAPS2:
|
||||||
|
|
@ -116,7 +116,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
||||||
case BG_AV_QUEST_H_SCRAPS2:
|
case BG_AV_QUEST_H_SCRAPS2:
|
||||||
m_Team_QuestStatus[teamIdx][0] += 20;
|
m_Team_QuestStatus[teamIdx][0] += 20;
|
||||||
reputation = 1;
|
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);
|
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)
|
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());
|
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
|
// 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
|
m_TeamScores[teamIdx] += points; // m_TeamScores is int32 - so no problems here
|
||||||
|
|
||||||
if (points < 0)
|
if (points < 0)
|
||||||
|
|
@ -242,7 +242,7 @@ void BattleGroundAV::Update(uint32 diff)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// add points from mine owning, and look if the neutral team can reclaim the mine
|
// 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)
|
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
|
// 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)
|
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);
|
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AV_EVENT_START_BATTLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAV::AddPlayer(Player *plr)
|
void BattleGroundAV::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
// create score and add it to map, default values are set in constructor
|
// 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 graves_owned[BG_TEAMS_COUNT] = {0, 0};
|
||||||
uint32 mines_owned[BG_TEAMS_COUNT] = {0, 0};
|
uint32 mines_owned[BG_TEAMS_COUNT] = {0, 0};
|
||||||
// towers all not destroyed:
|
// 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].State == POINT_CONTROLLED)
|
||||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE)
|
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE)
|
||||||
++tower_survived[BG_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].State == POINT_CONTROLLED)
|
||||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE)
|
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE)
|
||||||
++tower_survived[BG_TEAM_HORDE];
|
++tower_survived[BG_TEAM_HORDE];
|
||||||
|
|
||||||
// graves all controlled
|
// 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)
|
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL)
|
||||||
++graves_owned[m_Nodes[i].Owner];
|
++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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
switch(Trigger)
|
switch (Trigger)
|
||||||
{
|
{
|
||||||
case 95:
|
case 95:
|
||||||
case 2608:
|
case 2608:
|
||||||
|
|
@ -395,10 +395,10 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||||
{
|
{
|
||||||
|
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
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;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||||
((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted += value;
|
((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted += value;
|
||||||
|
|
@ -474,8 +474,8 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx
|
||||||
PlaySoundToAll((teamIdx == BG_AV_TEAM_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_GOOD : BG_AV_SOUND_HORDE_GOOD);
|
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;
|
m_Mine_Reclaim_Timer[mine] = BG_AV_MINE_RECLAIM_TIMER;
|
||||||
SendYell2ToAll(LANG_BG_AV_MINE_TAKEN , LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
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);
|
(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)
|
if (IsGrave(node) && teamIdx != BG_AV_TEAM_NEUTRAL)
|
||||||
{
|
{
|
||||||
uint32 graveDefenderType;
|
uint32 graveDefenderType;
|
||||||
if (m_Team_QuestStatus[teamIdx][0] < 500 )
|
if (m_Team_QuestStatus[teamIdx][0] < 500)
|
||||||
graveDefenderType = 0;
|
graveDefenderType = 0;
|
||||||
else if (m_Team_QuestStatus[teamIdx][0] < 1000 )
|
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
||||||
graveDefenderType = 1;
|
graveDefenderType = 1;
|
||||||
else if (m_Team_QuestStatus[teamIdx][0] < 1500 )
|
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
||||||
graveDefenderType = 2;
|
graveDefenderType = 2;
|
||||||
else
|
else
|
||||||
graveDefenderType = 3;
|
graveDefenderType = 3;
|
||||||
|
|
@ -514,7 +514,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// called when using a banner
|
/// 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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
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)
|
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
|
||||||
return;
|
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
|
// 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
|
// for neutral nodes.. but doing this just for snowfall will be a bit to much i think
|
||||||
|
|
@ -566,19 +566,19 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
|
||||||
|
|
||||||
if (IsTower(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),
|
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);
|
UpdatePlayerScore(player, SCORE_TOWERS_DEFENDED, 1);
|
||||||
PlaySoundToAll(BG_AV_SOUND_BOTH_TOWER_DEFEND);
|
PlaySoundToAll(BG_AV_SOUND_BOTH_TOWER_DEFEND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendYell2ToAll(LANG_BG_AV_GRAVE_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
SendYell2ToAll(LANG_BG_AV_GRAVE_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||||
GetNodeName(node),
|
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);
|
UpdatePlayerScore(player, SCORE_GRAVEYARDS_DEFENDED, 1);
|
||||||
// update the statistic for the defending player
|
// update the statistic for the defending player
|
||||||
PlaySoundToAll((teamIdx == BG_TEAM_ALLIANCE)?BG_AV_SOUND_ALLIANCE_GOOD:BG_AV_SOUND_HORDE_GOOD);
|
PlaySoundToAll((teamIdx == BG_TEAM_ALLIANCE)?BG_AV_SOUND_ALLIANCE_GOOD:BG_AV_SOUND_HORDE_GOOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -598,15 +598,15 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node)
|
||||||
if (IsTower(node))
|
if (IsTower(node))
|
||||||
{
|
{
|
||||||
SendYell2ToAll(LANG_BG_AV_TOWER_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
SendYell2ToAll(LANG_BG_AV_TOWER_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||||
GetNodeName(node),
|
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);
|
UpdatePlayerScore(player, SCORE_TOWERS_ASSAULTED, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendYell2ToAll(LANG_BG_AV_GRAVE_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
SendYell2ToAll(LANG_BG_AV_GRAVE_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
|
||||||
GetNodeName(node),
|
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
|
// update the statistic for the assaulting player
|
||||||
UpdatePlayerScore(player, SCORE_GRAVEYARDS_ASSAULTED, 1);
|
UpdatePlayerScore(player, SCORE_GRAVEYARDS_ASSAULTED, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -623,18 +623,18 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
{
|
{
|
||||||
stateok = (m_Nodes[i].State == j);
|
stateok = (m_Nodes[i].State == j);
|
||||||
FillInitialWorldState(data, count, BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_AV_TEAM_ALLIANCE)],
|
FillInitialWorldState(data, count, BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_AV_TEAM_ALLIANCE)],
|
||||||
m_Nodes[i].Owner == BG_AV_TEAM_ALLIANCE && stateok);
|
m_Nodes[i].Owner == BG_AV_TEAM_ALLIANCE && stateok);
|
||||||
FillInitialWorldState(data, count, BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_AV_TEAM_HORDE)],
|
FillInitialWorldState(data, count, BG_AV_NodeWorldStates[i][GetWorldStateType(j, BG_AV_TEAM_HORDE)],
|
||||||
m_Nodes[i].Owner == BG_AV_TEAM_HORDE && stateok);
|
m_Nodes[i].Owner == BG_AV_TEAM_HORDE && stateok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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, AV_SNOWFALL_N, 1);
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[BG_TEAM_ALLIANCE]);
|
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[BG_TEAM_ALLIANCE]);
|
||||||
FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[BG_TEAM_HORDE]);
|
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_A_SCORE, 1);
|
||||||
FillInitialWorldState(data, count, BG_AV_SHOW_H_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)
|
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||||
{
|
{
|
||||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)], 1);
|
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);
|
UpdateWorldState(AV_SNOWFALL_N, 0);
|
||||||
else
|
else
|
||||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)], 0);
|
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);
|
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 x = plr->GetPositionX();
|
||||||
float y = plr->GetPositionY();
|
float y = plr->GetPositionY();
|
||||||
|
|
@ -682,11 +682,11 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player *plr)
|
||||||
{
|
{
|
||||||
// Is there any occupied node for this team?
|
// Is there any occupied node for this team?
|
||||||
float mindist = 9999999.0f;
|
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)
|
if (m_Nodes[i].Owner != teamIdx || m_Nodes[i].State != POINT_CONTROLLED)
|
||||||
continue;
|
continue;
|
||||||
WorldSafeLocsEntry const * entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] );
|
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
continue;
|
continue;
|
||||||
float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
|
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 not, place ghost in the starting-cave
|
||||||
if (!good_entry)
|
if (!good_entry)
|
||||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[teamIdx + 7] );
|
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[teamIdx + 7]);
|
||||||
|
|
||||||
return good_entry;
|
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_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;
|
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_Team_QuestStatus[i][j] = 0;
|
||||||
m_TeamScores[i] = BG_AV_SCORE_INITIAL_POINTS;
|
m_TeamScores[i] = BG_AV_SCORE_INITIAL_POINTS;
|
||||||
m_IsInformedNearLose[i] = false;
|
m_IsInformedNearLose[i] = false;
|
||||||
m_ActiveEvents[BG_AV_NodeEventCaptainDead_A + i] = BG_EVENT_NONE;
|
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_Owner[i] = BG_AV_TEAM_NEUTRAL;
|
||||||
m_Mine_PrevOwner[i] = m_Mine_Owner[i];
|
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_HERALD] = 0;
|
||||||
m_ActiveEvents[BG_AV_BOSS_A] = 0;
|
m_ActiveEvents[BG_AV_BOSS_A] = 0;
|
||||||
m_ActiveEvents[BG_AV_BOSS_H] = 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;
|
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);
|
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);
|
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);
|
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(i, BG_AV_TEAM_HORDE, true);
|
||||||
|
|
||||||
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_TEAM_NEUTRAL, false); // give snowfall neutral owner
|
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
|
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_AID,
|
||||||
BG_AV_GRAVE_STORM_GRAVE,
|
BG_AV_GRAVE_STORM_GRAVE,
|
||||||
BG_AV_GRAVE_STONE_GRAVE,
|
BG_AV_GRAVE_STONE_GRAVE,
|
||||||
|
|
@ -216,13 +217,15 @@ enum BattleGroundAVTeamIndex
|
||||||
#define BG_AV_TEAMS_COUNT 3
|
#define BG_AV_TEAMS_COUNT 3
|
||||||
|
|
||||||
// alliance_control horde_control neutral_control
|
// 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},
|
{1358, 1359, 1360},
|
||||||
{1355, 1356, 1357}
|
{1355, 1356, 1357}
|
||||||
};
|
};
|
||||||
|
|
||||||
// alliance_control alliance_assault h_control h_assault
|
// 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
|
// Stormpike first aid station
|
||||||
{1326,1325,1328,1327},
|
{1326,1325,1328,1327},
|
||||||
// Stormpike Graveyard
|
// Stormpike Graveyard
|
||||||
|
|
@ -294,7 +297,7 @@ struct BG_AV_NodeInfo
|
||||||
bool Tower;
|
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);
|
return i = BG_AV_Nodes(i + 1);
|
||||||
}
|
}
|
||||||
|
|
@ -313,7 +316,7 @@ class BattleGroundAVScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundAV : public BattleGround
|
class BattleGroundAV : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundAV();
|
BattleGroundAV();
|
||||||
|
|
@ -321,31 +324,31 @@ class BattleGroundAV : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
|
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
// world states
|
// world states
|
||||||
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
/*general stuff*/
|
/*general stuff*/
|
||||||
void UpdateScore(BattleGroundTeamIndex teamIdx, int32 points);
|
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
|
/*handle stuff*/ // these are functions which get called from extern scripts
|
||||||
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
|
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
void HandleKillUnit(Creature *creature, Player *killer);
|
void HandleKillUnit(Creature* creature, Player* killer);
|
||||||
void HandleQuestComplete(uint32 questid, Player *player);
|
void HandleQuestComplete(uint32 questid, Player* player);
|
||||||
bool PlayerCanDoMineQuest(int32 GOId, Team team);
|
bool PlayerCanDoMineQuest(int32 GOId, Team team);
|
||||||
|
|
||||||
void EndBattleGround(Team winner);
|
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)); }
|
static BattleGroundAVTeamIndex GetAVTeamIndexByTeamId(Team team) { return BattleGroundAVTeamIndex(GetTeamIndexByTeamId(team)); }
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void BattleGroundBE::StartingEventOpenDoors()
|
||||||
OpenDoorEvent(BG_EVENT_DOOR);
|
OpenDoorEvent(BG_EVENT_DOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundBE::AddPlayer(Player *plr)
|
void BattleGroundBE::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundBE::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -102,13 +102,13 @@ void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||||
CheckArenaWinConditions();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
bool BattleGroundBE::HandlePlayerUnderMap(Player* player)
|
||||||
{
|
{
|
||||||
player->TeleportTo(GetMapId(),6238.930176f,262.963470f,0.889519f,player->GetOrientation(),false);
|
player->TeleportTo(GetMapId(),6238.930176f,262.963470f,0.889519f,player->GetOrientation(),false);
|
||||||
return true;
|
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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
|
@ -116,7 +116,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||||
|
|
||||||
//uint32 SpellId = 0;
|
//uint32 SpellId = 0;
|
||||||
//uint64 buff_guid = 0;
|
//uint64 buff_guid = 0;
|
||||||
switch(Trigger)
|
switch (Trigger)
|
||||||
{
|
{
|
||||||
case 4538: // buff trigger?
|
case 4538: // buff trigger?
|
||||||
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1];
|
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1];
|
||||||
|
|
@ -134,7 +134,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||||
// HandleTriggerBuff(buff_guid,Source);
|
// 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, 0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
FillInitialWorldState(data, count, 0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
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());
|
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;
|
return;
|
||||||
|
|
||||||
//there is nothing special in this score
|
//there is nothing special in this score
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class BattleGroundBEScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundBE : public BattleGround
|
class BattleGroundBE : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundBE();
|
BattleGroundBE();
|
||||||
|
|
@ -37,19 +37,19 @@ class BattleGroundBE : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d, uint32& count);
|
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
bool HandlePlayerUnderMap(Player * plr);
|
bool HandlePlayerUnderMap(Player* plr);
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void BattleGroundDS::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundDS::AddPlayer(Player *plr)
|
void BattleGroundDS::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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;
|
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);
|
BattleGround::HandleKillPlayer(player, killer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundDS::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
void BattleGroundDS::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundDSScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundDS : public BattleGround
|
class BattleGroundDS : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundDS();
|
BattleGroundDS();
|
||||||
|
|
@ -38,13 +38,13 @@ class BattleGroundDS : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ void BattleGroundEY::StartingEventOpenDoors()
|
||||||
// eye-doors are despawned, not opened
|
// eye-doors are despawned, not opened
|
||||||
SpawnEvent(BG_EVENT_DOOR, 0, false);
|
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
|
//randomly spawn buff
|
||||||
uint8 buff = urand(0, 2);
|
uint8 buff = urand(0, 2);
|
||||||
|
|
@ -119,7 +119,7 @@ void BattleGroundEY::AddPoints(Team team, uint32 Points)
|
||||||
BattleGroundTeamIndex team_index = GetTeamIndexByTeamId(team);
|
BattleGroundTeamIndex team_index = GetTeamIndexByTeamId(team);
|
||||||
m_TeamScores[team_index] += Points;
|
m_TeamScores[team_index] += Points;
|
||||||
m_HonorScoreTics[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);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), team);
|
||||||
m_HonorScoreTics[team_index] -= m_HonorTics;
|
m_HonorScoreTics[team_index] -= m_HonorTics;
|
||||||
|
|
@ -134,7 +134,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
||||||
uint8 j = 0;
|
uint8 j = 0;
|
||||||
while (j < m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].size())
|
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)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: %s not found!", m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j].GetString().c_str());
|
sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: %s not found!", m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS][j].GetString().c_str());
|
||||||
|
|
@ -142,7 +142,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plr->CanUseCapturePoint() &&
|
if (plr->CanUseCapturePoint() &&
|
||||||
plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS))
|
plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS))
|
||||||
{
|
{
|
||||||
//player joined point!
|
//player joined point!
|
||||||
//show progress bar
|
//show progress bar
|
||||||
|
|
@ -165,12 +165,12 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||||
//reset current point counts
|
//reset current point counts
|
||||||
for (uint8 i = 0; i < 2*BG_EY_NODES_MAX; ++i)
|
for (uint8 i = 0; i < 2*BG_EY_NODES_MAX; ++i)
|
||||||
m_CurrentPointPlayersCount[i] = 0;
|
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;
|
uint8 j = 0;
|
||||||
while (j < m_PlayersNearPoint[i].size())
|
while (j < m_PlayersNearPoint[i].size())
|
||||||
{
|
{
|
||||||
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
Player* plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint %s not found!", m_PlayersNearPoint[i][j].GetString().c_str());
|
sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint %s not found!", m_PlayersNearPoint[i][j].GetString().c_str());
|
||||||
|
|
@ -181,7 +181,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!plr->CanUseCapturePoint() ||
|
if (!plr->CanUseCapturePoint() ||
|
||||||
!plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS))
|
!plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS))
|
||||||
//move player out of point (add him to players that are out of points
|
//move player out of point (add him to players that are out of points
|
||||||
{
|
{
|
||||||
m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(m_PlayersNearPoint[i][j]);
|
m_PlayersNearPoint[BG_EY_PLAYERS_OUT_OF_POINTS].push_back(m_PlayersNearPoint[i][j]);
|
||||||
|
|
@ -200,7 +200,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||||
|
|
||||||
void BattleGroundEY::UpdatePointStatuses()
|
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())
|
if (m_PlayersNearPoint[point].empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -225,10 +225,10 @@ void BattleGroundEY::UpdatePointStatuses()
|
||||||
|
|
||||||
for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i)
|
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);
|
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
|
||||||
//if point owner changed we must evoke event!
|
//if point owner changed we must evoke event!
|
||||||
if (pointOwnerTeamId != m_PointOwnedByTeam[point])
|
if (pointOwnerTeamId != m_PointOwnedByTeam[point])
|
||||||
{
|
{
|
||||||
//point was uncontrolled and player is from team which captured point
|
//point was uncontrolled and player is from team which captured point
|
||||||
|
|
@ -303,7 +303,7 @@ void BattleGroundEY::UpdatePointsIcons(Team team, uint32 Point)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::AddPlayer(Player *plr)
|
void BattleGroundEY::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map
|
//create score and add it to map
|
||||||
|
|
@ -314,12 +314,12 @@ void BattleGroundEY::AddPlayer(Player *plr)
|
||||||
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
m_PlayerScores[plr->GetObjectGuid()] = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::RemovePlayer(Player *plr, ObjectGuid guid)
|
void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
// sometimes flag aura not removed :(
|
// sometimes flag aura not removed :(
|
||||||
for (int j = BG_EY_NODES_MAX; j >= 0; --j)
|
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)
|
if (m_PlayersNearPoint[j][i] == guid)
|
||||||
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
|
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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!Source->isAlive()) //hack code, must be removed later
|
if (!Source->isAlive()) //hack code, must be removed later
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(Trigger)
|
switch (Trigger)
|
||||||
{
|
{
|
||||||
case TR_BLOOD_ELF_POINT:
|
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())
|
if (m_PointState[BG_EY_NODE_BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BG_EY_NODE_BLOOD_ELF] == Source->GetTeam())
|
||||||
|
|
@ -399,9 +399,9 @@ bool BattleGroundEY::SetupBattleGround()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||||
)
|
)
|
||||||
sLog.outError("BattleGroundEY: Cannot spawn buff");
|
sLog.outError("BattleGroundEY: Cannot spawn buff");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -427,7 +427,7 @@ void BattleGroundEY::Reset()
|
||||||
bool isBGWeekend = BattleGroundMgr::IsBGWeekend(GetTypeID());
|
bool isBGWeekend = BattleGroundMgr::IsBGWeekend(GetTypeID());
|
||||||
m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks;
|
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_PointOwnedByTeam[i] = TEAM_NONE;
|
||||||
m_PointState[i] = EY_POINT_STATE_UNCONTROLLED;
|
m_PointState[i] = EY_POINT_STATE_UNCONTROLLED;
|
||||||
|
|
@ -462,7 +462,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
||||||
{
|
{
|
||||||
RespawnFlag(true);
|
RespawnFlag(true);
|
||||||
|
|
||||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
||||||
if (obj)
|
if (obj)
|
||||||
obj->Delete();
|
obj->Delete();
|
||||||
else
|
else
|
||||||
|
|
@ -471,7 +471,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
||||||
ClearDroppedFlagGuid();
|
ClearDroppedFlagGuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -480,7 +480,7 @@ void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||||
EventPlayerDroppedFlag(player);
|
EventPlayerDroppedFlag(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
void BattleGroundEY::EventPlayerDroppedFlag(Player* Source)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
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);
|
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))
|
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||||
return;
|
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());
|
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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -584,7 +584,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
||||||
UpdatePointsCount(team);
|
UpdatePointsCount(team);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
void BattleGroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -608,7 +608,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||||
UpdatePointsCount(team);
|
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())
|
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGuid() != Source->GetObjectGuid())
|
||||||
return;
|
return;
|
||||||
|
|
@ -646,13 +646,13 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node)
|
||||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
|
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());
|
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;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SCORE_FLAG_CAPTURES: // flags captured
|
case SCORE_FLAG_CAPTURES: // flags captured
|
||||||
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
|
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
|
||||||
|
|
@ -700,11 +700,11 @@ void BattleGroundEY::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
FillInitialWorldState(data, count, 0xc0d, 0x17b);
|
FillInitialWorldState(data, count, 0xc0d, 0x17b);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
WorldSafeLocsEntry const* BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||||
{
|
{
|
||||||
uint32 g_id = 0;
|
uint32 g_id = 0;
|
||||||
|
|
||||||
switch(player->GetTeam())
|
switch (player->GetTeam())
|
||||||
{
|
{
|
||||||
case ALLIANCE: g_id = EY_GRAVEYARD_MAIN_ALLIANCE; break;
|
case ALLIANCE: g_id = EY_GRAVEYARD_MAIN_ALLIANCE; break;
|
||||||
case HORDE: g_id = EY_GRAVEYARD_MAIN_HORDE; 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);
|
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;
|
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)
|
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
|
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)
|
if (m_PointState[i] != EY_POINT_UNDER_CONTROL || m_PointOwnedByTeam[i] != team)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ enum BG_EY_Nodes
|
||||||
|
|
||||||
// x, y, z
|
// x, y, z
|
||||||
// used to check, when player is in range of a node
|
// 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
|
{2024.600708f, 1742.819580f, 1195.157715f}, // BG_EY_NODE_FEL_REAVER
|
||||||
{2050.493164f, 1372.235962f, 1194.563477f}, // BG_EY_NODE_BLOOD_ELF
|
{2050.493164f, 1372.235962f, 1194.563477f}, // BG_EY_NODE_BLOOD_ELF
|
||||||
{2301.010498f, 1386.931641f, 1197.183472f}, // BG_EY_NODE_DRAENEI_RUINS
|
{2301.010498f, 1386.931641f, 1197.183472f}, // BG_EY_NODE_DRAENEI_RUINS
|
||||||
|
|
@ -235,14 +236,14 @@ const BattleGroundEYCapturingPointStruct CapturingPointTypes[BG_EY_NODES_MAX] =
|
||||||
class BattleGroundEYScore : public BattleGroundScore
|
class BattleGroundEYScore : public BattleGroundScore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BattleGroundEYScore () : FlagCaptures(0) {};
|
BattleGroundEYScore() : FlagCaptures(0) {};
|
||||||
virtual ~BattleGroundEYScore() {};
|
virtual ~BattleGroundEYScore() {};
|
||||||
uint32 FlagCaptures;
|
uint32 FlagCaptures;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BattleGroundEY : public BattleGround
|
class BattleGroundEY : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundEY();
|
BattleGroundEY();
|
||||||
|
|
@ -250,7 +251,7 @@ class BattleGroundEY : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
|
|
@ -263,31 +264,31 @@ class BattleGroundEY : public BattleGround
|
||||||
void RespawnFlag(bool send_message);
|
void RespawnFlag(bool send_message);
|
||||||
void RespawnFlagAfterDrop();
|
void RespawnFlagAfterDrop();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
void HandleKillPlayer(Player *player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||||
virtual bool SetupBattleGround();
|
virtual bool SetupBattleGround();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
void UpdateTeamScore(Team team);
|
void UpdateTeamScore(Team team);
|
||||||
void EndBattleGround(Team winner);
|
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);
|
virtual void FillInitialWorldStates(WorldPacket& data, uint32& count);
|
||||||
void SetDroppedFlagGuid(ObjectGuid guid) { m_DroppedFlagGuid = guid;}
|
void SetDroppedFlagGuid(ObjectGuid guid) { m_DroppedFlagGuid = guid;}
|
||||||
void ClearDroppedFlagGuid() { m_DroppedFlagGuid.Clear();}
|
void ClearDroppedFlagGuid() { m_DroppedFlagGuid.Clear();}
|
||||||
ObjectGuid const& GetDroppedFlagGuid() const { return m_DroppedFlagGuid;}
|
ObjectGuid const& GetDroppedFlagGuid() const { return m_DroppedFlagGuid;}
|
||||||
|
|
||||||
/* Battleground Events */
|
/* Battleground Events */
|
||||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||||
virtual void EventPlayerDroppedFlag(Player *Source);
|
virtual void EventPlayerDroppedFlag(Player* Source);
|
||||||
|
|
||||||
/* achievement req. */
|
/* achievement req. */
|
||||||
bool IsAllNodesConrolledByTeam(Team team) const;
|
bool IsAllNodesConrolledByTeam(Team team) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EventPlayerCapturedFlag(Player *Source, BG_EY_Nodes node);
|
void EventPlayerCapturedFlag(Player* Source, BG_EY_Nodes node);
|
||||||
void EventTeamCapturedPoint(Player *Source, uint32 Point);
|
void EventTeamCapturedPoint(Player* Source, uint32 Point);
|
||||||
void EventTeamLostPoint(Player *Source, uint32 Point);
|
void EventTeamLostPoint(Player* Source, uint32 Point);
|
||||||
void UpdatePointsCount(Team team);
|
void UpdatePointsCount(Team team);
|
||||||
void UpdatePointsIcons(Team team, uint32 Point);
|
void UpdatePointsIcons(Team team, uint32 Point);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
DEBUG_LOG("WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from %s", guid.GetString().c_str());
|
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)
|
if (!pCreature)
|
||||||
return;
|
return;
|
||||||
|
|
@ -68,21 +68,21 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
|
||||||
SendBattlegGroundList(guid, bgTypeId);
|
SendBattlegGroundList(guid, bgTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendBattlegGroundList( ObjectGuid guid, BattleGroundTypeId bgTypeId )
|
void WorldSession::SendBattlegGroundList(ObjectGuid guid, BattleGroundTypeId bgTypeId)
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId, 0);
|
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;
|
ObjectGuid guid;
|
||||||
uint32 bgTypeId_;
|
uint32 bgTypeId_;
|
||||||
uint32 instanceId;
|
uint32 instanceId;
|
||||||
uint8 joinAsGroup;
|
uint8 joinAsGroup;
|
||||||
bool isPremade = false;
|
bool isPremade = false;
|
||||||
Group * grp;
|
Group* grp;
|
||||||
|
|
||||||
recv_data >> guid; // battlemaster guid
|
recv_data >> guid; // battlemaster guid
|
||||||
recv_data >> bgTypeId_; // battleground type id (DBC id)
|
recv_data >> bgTypeId_; // battleground type id (DBC id)
|
||||||
|
|
@ -97,7 +97,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
|
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
|
// can do this, since it's battleground, not arena
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, ARENA_TYPE_NONE);
|
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, ARENA_TYPE_NONE);
|
||||||
|
|
@ -107,7 +107,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get bg instance or bg template if instance not found
|
// get bg instance or bg template if instance not found
|
||||||
BattleGround *bg = NULL;
|
BattleGround* bg = NULL;
|
||||||
if (instanceId)
|
if (instanceId)
|
||||||
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
|
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||||
isPremade = sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH) &&
|
isPremade = sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH) &&
|
||||||
(grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
(grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||||
}
|
}
|
||||||
// if we're here, then the conditions to join a bg are met. We can proceed in joining.
|
// if we're here, then the conditions to join a bg are met. We can proceed in joining.
|
||||||
|
|
||||||
|
|
@ -164,22 +164,22 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
GroupQueueInfo* ginfo = NULL;
|
GroupQueueInfo* ginfo = NULL;
|
||||||
uint32 avgTime = 0;
|
uint32 avgTime = 0;
|
||||||
|
|
||||||
if(err > 0)
|
if (err > 0)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Battleground: the following players are joining as group:");
|
DEBUG_LOG("Battleground: the following players are joining as group:");
|
||||||
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, ARENA_TYPE_NONE, false, isPremade, 0);
|
||||||
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
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();
|
Player* member = itr->getSource();
|
||||||
if(!member)
|
if (!member)
|
||||||
continue; // this should never happen
|
continue; // this should never happen
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
||||||
if(err <= 0)
|
if (err <= 0)
|
||||||
{
|
{
|
||||||
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||||
member->GetSession()->SendPacket(&data);
|
member->GetSession()->SendPacket(&data);
|
||||||
|
|
@ -200,13 +200,13 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
else
|
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());
|
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||||
// already checked if queueSlot is valid, now just get it
|
// already checked if queueSlot is valid, now just get it
|
||||||
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
// send status packet (in queue)
|
// send status packet (in queue)
|
||||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->arenaType);
|
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->arenaType);
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
DEBUG_LOG("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
|
DEBUG_LOG("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
|
||||||
|
|
@ -214,79 +214,79 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
|
||||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ )
|
void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket& /*recv_data*/)
|
||||||
{
|
{
|
||||||
// empty opcode
|
// empty opcode
|
||||||
DEBUG_LOG("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
|
DEBUG_LOG("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
|
||||||
|
|
||||||
BattleGround *bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if(!bg) // can't be received if player not in battleground
|
if (!bg) // can't be received if player not in battleground
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( bg->GetTypeID() )
|
switch (bg->GetTypeID())
|
||||||
{
|
{
|
||||||
case BATTLEGROUND_WS:
|
case BATTLEGROUND_WS:
|
||||||
|
{
|
||||||
|
uint32 count1 = 0; // always constant zero?
|
||||||
|
uint32 count2 = 0; // count of next fields
|
||||||
|
|
||||||
|
Player* ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGuid());
|
||||||
|
if (ali_plr)
|
||||||
|
++count2;
|
||||||
|
|
||||||
|
Player* horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGuid());
|
||||||
|
if (horde_plr)
|
||||||
|
++count2;
|
||||||
|
|
||||||
|
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
|
||||||
|
data << count1; // alliance flag holders count - obsolete, now always 0
|
||||||
|
/*for(uint8 i = 0; i < count1; ++i)
|
||||||
{
|
{
|
||||||
uint32 count1 = 0; // always constant zero?
|
data << ObjectGuid(0); // guid
|
||||||
uint32 count2 = 0; // count of next fields
|
data << (float)0; // x
|
||||||
|
data << (float)0; // y
|
||||||
Player *ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGuid());
|
}*/
|
||||||
if (ali_plr)
|
data << count2; // horde flag holders count - obsolete, now count of next fields
|
||||||
++count2;
|
if (ali_plr)
|
||||||
|
{
|
||||||
Player *horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGuid());
|
data << ObjectGuid(ali_plr->GetObjectGuid());
|
||||||
if (horde_plr)
|
data << float(ali_plr->GetPositionX());
|
||||||
++count2;
|
data << float(ali_plr->GetPositionY());
|
||||||
|
|
||||||
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
|
|
||||||
data << count1; // alliance flag holders count - obsolete, now always 0
|
|
||||||
/*for(uint8 i = 0; i < count1; ++i)
|
|
||||||
{
|
|
||||||
data << ObjectGuid(0); // guid
|
|
||||||
data << (float)0; // x
|
|
||||||
data << (float)0; // y
|
|
||||||
}*/
|
|
||||||
data << count2; // horde flag holders count - obsolete, now count of next fields
|
|
||||||
if (ali_plr)
|
|
||||||
{
|
|
||||||
data << ObjectGuid(ali_plr->GetObjectGuid());
|
|
||||||
data << float(ali_plr->GetPositionX());
|
|
||||||
data << float(ali_plr->GetPositionY());
|
|
||||||
}
|
|
||||||
if (horde_plr)
|
|
||||||
{
|
|
||||||
data << ObjectGuid(horde_plr->GetObjectGuid());
|
|
||||||
data << float(horde_plr->GetPositionX());
|
|
||||||
data << float(horde_plr->GetPositionY());
|
|
||||||
}
|
|
||||||
|
|
||||||
SendPacket(&data);
|
|
||||||
}
|
}
|
||||||
break;
|
if (horde_plr)
|
||||||
|
{
|
||||||
|
data << ObjectGuid(horde_plr->GetObjectGuid());
|
||||||
|
data << float(horde_plr->GetPositionX());
|
||||||
|
data << float(horde_plr->GetPositionY());
|
||||||
|
}
|
||||||
|
|
||||||
|
SendPacket(&data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BATTLEGROUND_EY:
|
case BATTLEGROUND_EY:
|
||||||
//TODO : fix me!
|
//TODO : fix me!
|
||||||
break;
|
break;
|
||||||
case BATTLEGROUND_AB:
|
case BATTLEGROUND_AB:
|
||||||
case BATTLEGROUND_AV:
|
case BATTLEGROUND_AV:
|
||||||
{
|
{
|
||||||
//for other BG types - send default
|
//for other BG types - send default
|
||||||
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4));
|
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4));
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//maybe it is sent also in arena - do nothing
|
//maybe it is sent also in arena - do nothing
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (!bg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -298,12 +298,12 @@ void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ )
|
||||||
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
|
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
|
||||||
SendPacket(&data);
|
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;
|
uint32 bgTypeId;
|
||||||
recv_data >> bgTypeId; // id from DBC
|
recv_data >> bgTypeId; // id from DBC
|
||||||
|
|
@ -323,12 +323,12 @@ void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data )
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, ObjectGuid(), _player, BattleGroundTypeId(bgTypeId), fromWhere);
|
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 type; // arenatype if arena
|
||||||
uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1
|
uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||||
|
|
@ -374,7 +374,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
||||||
return;
|
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
|
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||||
if (!bg && action == 0)
|
if (!bg && action == 0)
|
||||||
|
|
@ -407,13 +407,13 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
||||||
if (_player->getLevel() > bg->GetMaxLevel())
|
if (_player->getLevel() > bg->GetMaxLevel())
|
||||||
{
|
{
|
||||||
sLog.outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
|
sLog.outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
|
||||||
_player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());
|
_player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());
|
||||||
action = 0;
|
action = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);
|
uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
switch( action )
|
switch (action)
|
||||||
{
|
{
|
||||||
case 1: // port to battleground
|
case 1: // port to battleground
|
||||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||||
|
|
@ -441,7 +441,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
||||||
bgQueue.RemovePlayer(_player->GetObjectGuid(), false);
|
bgQueue.RemovePlayer(_player->GetObjectGuid(), false);
|
||||||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
// 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
|
// 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);
|
currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true);
|
||||||
|
|
||||||
// set the destination instance id
|
// 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 player leaves rated arena match before match start, it is counted as he played but he lost
|
||||||
if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
|
if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
|
||||||
{
|
{
|
||||||
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ginfo.ArenaTeamId);
|
||||||
if (at)
|
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);
|
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>(); // unk1
|
||||||
recv_data.read_skip<uint8>(); // unk2
|
recv_data.read_skip<uint8>(); // unk2
|
||||||
|
|
@ -502,14 +502,14 @@ void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket& recv_data )
|
||||||
_player->LeaveBattleground();
|
_player->LeaveBattleground();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recv_data*/)
|
||||||
{
|
{
|
||||||
// empty opcode
|
// empty opcode
|
||||||
DEBUG_LOG( "WORLD: Battleground status" );
|
DEBUG_LOG("WORLD: Battleground status");
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
// we must update all queues here
|
// we must update all queues here
|
||||||
BattleGround *bg = NULL;
|
BattleGround* bg = NULL;
|
||||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||||
{
|
{
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(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");
|
DEBUG_LOG("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
|
||||||
|
|
||||||
BattleGround *bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!unit->isSpiritService()) // it's not spirit service
|
if (!unit->isSpiritService()) // it's not spirit service
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
|
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
|
DEBUG_LOG("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
|
||||||
|
|
||||||
BattleGround *bg = _player->GetBattleGround();
|
BattleGround* bg = _player->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!unit->isSpiritService()) // it's not spirit service
|
if (!unit->isSpiritService()) // it's not spirit service
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sScriptMgr.OnGossipHello(GetPlayer(), unit);
|
sScriptMgr.OnGossipHello(GetPlayer(), unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
|
DEBUG_LOG("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
|
||||||
//recv_data.hexlike();
|
//recv_data.hexlike();
|
||||||
|
|
@ -625,17 +625,17 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
if (_player->InBattleGround())
|
if (_player->InBattleGround())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!unit->isBattleMaster()) // it's not battle master
|
if (!unit->isBattleMaster()) // it's not battle master
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ArenaType arenatype;
|
ArenaType arenatype;
|
||||||
uint32 arenaRating = 0;
|
uint32 arenaRating = 0;
|
||||||
|
|
||||||
switch(arenaslot)
|
switch (arenaslot)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
arenatype = ARENA_TYPE_2v2;
|
arenatype = ARENA_TYPE_2v2;
|
||||||
|
|
@ -667,7 +667,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
|
|
||||||
GroupJoinBattlegroundResult err;
|
GroupJoinBattlegroundResult err;
|
||||||
|
|
||||||
Group * grp = NULL;
|
Group* grp = NULL;
|
||||||
|
|
||||||
// check queue conditions
|
// check queue conditions
|
||||||
if (!asGroup)
|
if (!asGroup)
|
||||||
|
|
@ -702,7 +702,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
ateamId = _player->GetArenaTeamId(arenaslot);
|
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)
|
// 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)
|
if (!at)
|
||||||
{
|
{
|
||||||
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
|
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
|
||||||
|
|
@ -714,7 +714,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
// get the personal ratings for queue
|
// get the personal ratings for queue
|
||||||
uint32 avg_pers_rating = 0;
|
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);
|
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
|
||||||
if (!at_member) // group member joining to arena must be in leader arena team
|
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;
|
arenaRating = avg_pers_rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||||
if (asGroup)
|
if (asGroup)
|
||||||
{
|
{
|
||||||
uint32 avgTime = 0;
|
uint32 avgTime = 0;
|
||||||
|
|
||||||
if(err > 0)
|
if (err > 0)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Battleground: arena join as group start");
|
DEBUG_LOG("Battleground: arena join as group start");
|
||||||
if (isRated)
|
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);
|
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());
|
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();
|
Player* member = itr->getSource();
|
||||||
if(!member)
|
if (!member)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
||||||
if(err <= 0)
|
if (err <= 0)
|
||||||
{
|
{
|
||||||
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||||
member->GetSession()->SendPacket(&data);
|
member->GetSession()->SendPacket(&data);
|
||||||
|
|
@ -775,7 +775,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
else
|
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 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||||
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
|
||||||
|
|
||||||
|
|
@ -788,11 +788,11 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||||
sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data )
|
void WorldSession::HandleReportPvPAFK(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
ObjectGuid playerGuid;
|
ObjectGuid playerGuid;
|
||||||
recv_data >> playerGuid;
|
recv_data >> playerGuid;
|
||||||
Player *reportedPlayer = sObjectMgr.GetPlayer(playerGuid);
|
Player* reportedPlayer = sObjectMgr.GetPlayer(playerGuid);
|
||||||
|
|
||||||
if (!reportedPlayer)
|
if (!reportedPlayer)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void BattleGroundIC::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundIC::AddPlayer(Player *plr)
|
void BattleGroundIC::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
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());
|
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;
|
return;
|
||||||
|
|
||||||
BattleGround::UpdatePlayerScore(Source,type,value);
|
BattleGround::UpdatePlayerScore(Source,type,value);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundICScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundIC : public BattleGround
|
class BattleGroundIC : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundIC();
|
BattleGroundIC();
|
||||||
|
|
@ -38,16 +38,16 @@ class BattleGroundIC : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
//bool SetupBattleGround();
|
//bool SetupBattleGround();
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -43,7 +43,7 @@ struct GroupQueueInfo; // type predefinitio
|
||||||
struct PlayerQueueInfo // stores information for players in queue
|
struct PlayerQueueInfo // stores information for players in queue
|
||||||
{
|
{
|
||||||
uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes
|
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;
|
typedef std::map<ObjectGuid, PlayerQueueInfo*> GroupQueueInfoPlayers;
|
||||||
|
|
@ -85,7 +85,7 @@ class BattleGroundQueue
|
||||||
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||||
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||||
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
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);
|
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
|
||||||
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
|
||||||
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
|
||||||
|
|
@ -117,21 +117,21 @@ class BattleGroundQueue
|
||||||
// class to select and invite groups to bg
|
// class to select and invite groups to bg
|
||||||
class SelectionPool
|
class SelectionPool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
bool AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount);
|
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||||
bool KickGroup(uint32 size);
|
bool KickGroup(uint32 size);
|
||||||
uint32 GetPlayerCount() const {return PlayerCount;}
|
uint32 GetPlayerCount() const {return PlayerCount;}
|
||||||
public:
|
public:
|
||||||
GroupsQueueType SelectedGroups;
|
GroupsQueueType SelectedGroups;
|
||||||
private:
|
private:
|
||||||
uint32 PlayerCount;
|
uint32 PlayerCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
//one selection pool for horde, other one for alliance
|
//one selection pool for horde, other one for alliance
|
||||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
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_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_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||||
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||||
|
|
@ -145,9 +145,9 @@ class BGQueueInviteEvent : public BasicEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, ArenaType arenaType, uint32 removeTime) :
|
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, ArenaType arenaType, uint32 removeTime) :
|
||||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
virtual ~BGQueueInviteEvent() {};
|
virtual ~BGQueueInviteEvent() {};
|
||||||
|
|
||||||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||||
|
|
@ -193,14 +193,14 @@ class BattleGroundMgr
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* Packet Building */
|
/* Packet Building */
|
||||||
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
|
void BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* plr);
|
||||||
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, ObjectGuid guid);
|
void BuildPlayerLeftBattleGroundPacket(WorldPacket* data, ObjectGuid guid);
|
||||||
void BuildBattleGroundListPacket(WorldPacket *data, ObjectGuid guid, Player *plr, BattleGroundTypeId bgTypeId, uint8 fromWhere);
|
void BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere);
|
||||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result);
|
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||||
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
|
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
|
||||||
void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg);
|
void BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg);
|
||||||
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
void BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype);
|
||||||
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
|
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||||
|
|
||||||
/* Battlegrounds */
|
/* Battlegrounds */
|
||||||
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
|
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
|
||||||
|
|
@ -222,7 +222,7 @@ class BattleGroundMgr
|
||||||
void CreateInitialBattleGrounds();
|
void CreateInitialBattleGrounds();
|
||||||
void DeleteAllBattleGrounds();
|
void DeleteAllBattleGrounds();
|
||||||
|
|
||||||
void SendToBattleGround(Player *pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
void SendToBattleGround(Player* pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
|
||||||
|
|
||||||
/* Battleground queues */
|
/* Battleground queues */
|
||||||
//these queues are instantiated when creating BattlegroundMrg
|
//these queues are instantiated when creating BattlegroundMrg
|
||||||
|
|
@ -253,14 +253,14 @@ class BattleGroundMgr
|
||||||
const BattleGroundEventIdx GetCreatureEventIndex(uint32 dbTableGuidLow) const
|
const BattleGroundEventIdx GetCreatureEventIndex(uint32 dbTableGuidLow) const
|
||||||
{
|
{
|
||||||
CreatureBattleEventIndexesMap::const_iterator itr = m_CreatureBattleEventIndexMap.find(dbTableGuidLow);
|
CreatureBattleEventIndexesMap::const_iterator itr = m_CreatureBattleEventIndexMap.find(dbTableGuidLow);
|
||||||
if(itr != m_CreatureBattleEventIndexMap.end())
|
if (itr != m_CreatureBattleEventIndexMap.end())
|
||||||
return itr->second;
|
return itr->second;
|
||||||
return m_CreatureBattleEventIndexMap.find(-1)->second;
|
return m_CreatureBattleEventIndexMap.find(-1)->second;
|
||||||
}
|
}
|
||||||
const BattleGroundEventIdx GetGameObjectEventIndex(uint32 dbTableGuidLow) const
|
const BattleGroundEventIdx GetGameObjectEventIndex(uint32 dbTableGuidLow) const
|
||||||
{
|
{
|
||||||
GameObjectBattleEventIndexesMap::const_iterator itr = m_GameObjectBattleEventIndexMap.find(dbTableGuidLow);
|
GameObjectBattleEventIndexesMap::const_iterator itr = m_GameObjectBattleEventIndexMap.find(dbTableGuidLow);
|
||||||
if(itr != m_GameObjectBattleEventIndexMap.end())
|
if (itr != m_GameObjectBattleEventIndexMap.end())
|
||||||
return itr->second;
|
return itr->second;
|
||||||
return m_GameObjectBattleEventIndexMap.find(-1)->second;
|
return m_GameObjectBattleEventIndexMap.find(-1)->second;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void BattleGroundNA::StartingEventOpenDoors()
|
||||||
OpenDoorEvent(BG_EVENT_DOOR);
|
OpenDoorEvent(BG_EVENT_DOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundNA::AddPlayer(Player *plr)
|
void BattleGroundNA::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundNA::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -103,20 +103,20 @@ void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||||
CheckArenaWinConditions();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
bool BattleGroundNA::HandlePlayerUnderMap(Player* player)
|
||||||
{
|
{
|
||||||
player->TeleportTo(GetMapId(),4055.504395f,2919.660645f,13.611241f,player->GetOrientation(),false);
|
player->TeleportTo(GetMapId(),4055.504395f,2919.660645f,13.611241f,player->GetOrientation(),false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
void BattleGroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//uint32 SpellId = 0;
|
//uint32 SpellId = 0;
|
||||||
//uint64 buff_guid = 0;
|
//uint64 buff_guid = 0;
|
||||||
switch(Trigger)
|
switch (Trigger)
|
||||||
{
|
{
|
||||||
case 4536: // buff trigger?
|
case 4536: // buff trigger?
|
||||||
case 4537: // buff trigger?
|
case 4537: // buff trigger?
|
||||||
|
|
@ -131,7 +131,7 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||||
// HandleTriggerBuff(buff_guid,Source);
|
// 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, 0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
FillInitialWorldState(data, count, 0xa10, GetAlivePlayersCountByTeam(HORDE));
|
FillInitialWorldState(data, count, 0xa10, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundNAScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundNA : public BattleGround
|
class BattleGroundNA : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundNA();
|
BattleGroundNA();
|
||||||
|
|
@ -38,16 +38,16 @@ class BattleGroundNA : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d, uint32& count);
|
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
bool HandlePlayerUnderMap(Player * plr);
|
bool HandlePlayerUnderMap(Player* plr);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void BattleGroundRB::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRB::AddPlayer(Player *plr)
|
void BattleGroundRB::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
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());
|
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;
|
return;
|
||||||
|
|
||||||
BattleGround::UpdatePlayerScore(Source,type,value);
|
BattleGround::UpdatePlayerScore(Source,type,value);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundABGScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundRB : public BattleGround
|
class BattleGroundRB : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundRB();
|
BattleGroundRB();
|
||||||
|
|
@ -38,16 +38,16 @@ class BattleGroundRB : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
//bool SetupBattleGround();
|
//bool SetupBattleGround();
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void BattleGroundRL::StartingEventOpenDoors()
|
||||||
OpenDoorEvent(BG_EVENT_DOOR);
|
OpenDoorEvent(BG_EVENT_DOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRL::AddPlayer(Player *plr)
|
void BattleGroundRL::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundRL::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -102,13 +102,13 @@ void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||||
CheckArenaWinConditions();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
bool BattleGroundRL::HandlePlayerUnderMap(Player* player)
|
||||||
{
|
{
|
||||||
player->TeleportTo(GetMapId(),1285.810547f,1667.896851f,39.957642f,player->GetOrientation(),false);
|
player->TeleportTo(GetMapId(),1285.810547f,1667.896851f,39.957642f,player->GetOrientation(),false);
|
||||||
return true;
|
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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
|
@ -116,7 +116,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||||
|
|
||||||
//uint32 SpellId = 0;
|
//uint32 SpellId = 0;
|
||||||
//uint64 buff_guid = 0;
|
//uint64 buff_guid = 0;
|
||||||
switch(Trigger)
|
switch (Trigger)
|
||||||
{
|
{
|
||||||
case 4696: // buff trigger?
|
case 4696: // buff trigger?
|
||||||
case 4697: // buff trigger?
|
case 4697: // buff trigger?
|
||||||
|
|
@ -131,7 +131,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||||
// HandleTriggerBuff(buff_guid,Source);
|
// 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, 0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
FillInitialWorldState(data, count, 0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
FillInitialWorldState(data, count, 0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundRLScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundRL : public BattleGround
|
class BattleGroundRL : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundRL();
|
BattleGroundRL();
|
||||||
|
|
@ -38,16 +38,16 @@ class BattleGroundRL : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
virtual void FillInitialWorldStates(WorldPacket &d, uint32& count);
|
virtual void FillInitialWorldStates(WorldPacket& d, uint32& count);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
bool HandlePlayerUnderMap(Player * plr);
|
bool HandlePlayerUnderMap(Player* plr);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void BattleGroundRV::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRV::AddPlayer(Player *plr)
|
void BattleGroundRV::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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;
|
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);
|
BattleGround::HandleKillPlayer(player, killer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRV::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
void BattleGroundRV::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class BattleGroundRVScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundRV : public BattleGround
|
class BattleGroundRV : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundRV();
|
BattleGroundRV();
|
||||||
|
|
@ -38,13 +38,13 @@ class BattleGroundRV : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
void HandleKillPlayer(Player* player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void BattleGroundSA::StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundSA::AddPlayer(Player *plr)
|
void BattleGroundSA::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
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());
|
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;
|
return;
|
||||||
|
|
||||||
BattleGround::UpdatePlayerScore(Source,type,value);
|
BattleGround::UpdatePlayerScore(Source,type,value);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class BattleGroundSAScore : public BattleGroundScore
|
||||||
|
|
||||||
class BattleGroundSA : public BattleGround
|
class BattleGroundSA : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BattleGroundSA();
|
BattleGroundSA();
|
||||||
|
|
@ -41,16 +41,16 @@ class BattleGroundSA : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
//bool SetupBattleGround();
|
//bool SetupBattleGround();
|
||||||
|
|
||||||
/* Scorekeeping */
|
/* Scorekeeping */
|
||||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ void BattleGroundWS::StartingEventOpenDoors()
|
||||||
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_WS_EVENT_START_BATTLE);
|
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_WS_EVENT_START_BATTLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::AddPlayer(Player *plr)
|
void BattleGroundWS::AddPlayer(Player* plr)
|
||||||
{
|
{
|
||||||
BattleGround::AddPlayer(plr);
|
BattleGround::AddPlayer(plr);
|
||||||
//create score and add it to map, default values are set in constructor
|
//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);
|
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||||
|
|
||||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
||||||
if (obj)
|
if (obj)
|
||||||
obj->Delete();
|
obj->Delete();
|
||||||
else
|
else
|
||||||
|
|
@ -188,7 +188,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(Team team)
|
||||||
ClearDroppedFlagGuid(team);
|
ClearDroppedFlagGuid(team);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
void BattleGroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -203,9 +203,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||||
if (!IsHordeFlagPickedup())
|
if (!IsHordeFlagPickedup())
|
||||||
return;
|
return;
|
||||||
ClearHordeFlagPicker(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
ClearHordeFlagPicker(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||||
// horde flag in base (but not respawned yet)
|
// horde flag in base (but not respawned yet)
|
||||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||||
// Drop Horde Flag from Player
|
// Drop Horde Flag from Player
|
||||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||||
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||||
AddPoint(ALLIANCE, 1);
|
AddPoint(ALLIANCE, 1);
|
||||||
|
|
@ -217,9 +217,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||||
if (!IsAllianceFlagPickedup())
|
if (!IsAllianceFlagPickedup())
|
||||||
return;
|
return;
|
||||||
ClearAllianceFlagPicker(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
ClearAllianceFlagPicker(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||||
// alliance flag in base (but not respawned yet)
|
// alliance flag in base (but not respawned yet)
|
||||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||||
// Drop Alliance Flag from Player
|
// Drop Alliance Flag from Player
|
||||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||||
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||||
AddPoint(HORDE, 1);
|
AddPoint(HORDE, 1);
|
||||||
|
|
@ -264,7 +264,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
void BattleGroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
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)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -353,8 +353,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||||
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
||||||
|
|
||||||
//alliance flag picked up from base
|
//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)
|
&& event == WS_EVENT_FLAG_A)
|
||||||
{
|
{
|
||||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||||
|
|
@ -370,7 +370,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||||
|
|
||||||
//horde flag picked up from base
|
//horde flag picked up from base
|
||||||
if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
||||||
&& event == WS_EVENT_FLAG_H)
|
&& event == WS_EVENT_FLAG_H)
|
||||||
{
|
{
|
||||||
message_id = LANG_BG_WS_PICKEDUP_HF;
|
message_id = LANG_BG_WS_PICKEDUP_HF;
|
||||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||||
|
|
@ -447,7 +447,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
||||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
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 :(
|
// sometimes flag aura not removed :(
|
||||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
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));
|
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.
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
|
@ -498,7 +498,7 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||||
|
|
||||||
//uint32 SpellId = 0;
|
//uint32 SpellId = 0;
|
||||||
//uint64 buff_guid = 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 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().
|
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_A] = BG_EVENT_NONE;
|
||||||
m_ActiveEvents[WS_EVENT_FLAG_H] = 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_DroppedFlagGuid[i].Clear();
|
||||||
m_FlagKeepers[i].Clear();
|
m_FlagKeepers[i].Clear();
|
||||||
|
|
@ -574,7 +574,7 @@ void BattleGroundWS::EndBattleGround(Team winner)
|
||||||
BattleGround::EndBattleGround(winner);
|
BattleGround::EndBattleGround(winner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
return;
|
return;
|
||||||
|
|
@ -584,14 +584,14 @@ void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
||||||
BattleGround::HandleKillPlayer(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());
|
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;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SCORE_FLAG_CAPTURES: // flags captured
|
case SCORE_FLAG_CAPTURES: // flags captured
|
||||||
((BattleGroundWGScore*)itr->second)->FlagCaptures += value;
|
((BattleGroundWGScore*)itr->second)->FlagCaptures += value;
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ enum BG_WS_Events
|
||||||
|
|
||||||
class BattleGroundWS : public BattleGround
|
class BattleGroundWS : public BattleGround
|
||||||
{
|
{
|
||||||
friend class BattleGroundMgr;
|
friend class BattleGroundMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Construction */
|
/* Construction */
|
||||||
|
|
@ -105,12 +105,12 @@ class BattleGroundWS : public BattleGround
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
/* inherited from BattlegroundClass */
|
/* inherited from BattlegroundClass */
|
||||||
virtual void AddPlayer(Player *plr);
|
virtual void AddPlayer(Player* plr);
|
||||||
virtual void StartingEventCloseDoors();
|
virtual void StartingEventCloseDoors();
|
||||||
virtual void StartingEventOpenDoors();
|
virtual void StartingEventOpenDoors();
|
||||||
|
|
||||||
/* BG Flags */
|
/* 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]; }
|
ObjectGuid GetHordeFlagPickerGuid() const { return m_FlagKeepers[BG_TEAM_HORDE]; }
|
||||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
|
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
|
||||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[BG_TEAM_HORDE] = 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)]; }
|
uint8 GetFlagState(Team team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
|
||||||
|
|
||||||
/* Battleground Events */
|
/* Battleground Events */
|
||||||
virtual void EventPlayerDroppedFlag(Player *Source);
|
virtual void EventPlayerDroppedFlag(Player* Source);
|
||||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||||
virtual void EventPlayerCapturedFlag(Player *Source);
|
virtual void EventPlayerCapturedFlag(Player* Source);
|
||||||
|
|
||||||
void RemovePlayer(Player *plr, ObjectGuid guid);
|
void RemovePlayer(Player* plr, ObjectGuid guid);
|
||||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||||
void HandleKillPlayer(Player *player, Player *killer);
|
void HandleKillPlayer(Player* player, Player* killer);
|
||||||
bool SetupBattleGround();
|
bool SetupBattleGround();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
void EndBattleGround(Team winner);
|
void EndBattleGround(Team winner);
|
||||||
|
|
@ -138,7 +138,7 @@ class BattleGroundWS : public BattleGround
|
||||||
|
|
||||||
void UpdateFlagState(Team team, uint32 value);
|
void UpdateFlagState(Team team, uint32 value);
|
||||||
void UpdateTeamScore(Team team);
|
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 SetDroppedFlagGuid(ObjectGuid guid, Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)] = guid;}
|
||||||
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
|
void ClearDroppedFlagGuid(Team team) { m_DroppedFlagGuid[GetTeamIndexByTeamId(team)].Clear();}
|
||||||
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
|
ObjectGuid const& GetDroppedFlagGuid(Team team) const { return m_DroppedFlagGuid[GetTeamIndexByTeamId(team)];}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue