[11794] Add support to start timed achievements in BGs

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Feanordev 2011-09-16 21:42:10 +02:00 committed by Schmoozerd
parent 0eff04c161
commit dc5595a91f
12 changed files with 30 additions and 1 deletions

View file

@ -1165,6 +1165,13 @@ void BattleGround::StartBattleGround()
sBattleGroundMgr.AddBattleGround(GetInstanceID(), GetTypeID(), this);
}
void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 entry)
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* pPlayer = GetBgMap()->GetPlayer(itr->first))
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
}
void BattleGround::AddPlayer(Player *plr)
{
// remove afk from player

View file

@ -381,6 +381,8 @@ class BattleGround
void StartBattleGround();
void StartTimedAchievement(AchievementCriteriaTypes type, uint32 entry);
/* Location */
void SetMapId(uint32 MapID) { m_MapId = MapID; }
uint32 GetMapId() const { return m_MapId; }

View file

@ -174,6 +174,9 @@ void BattleGroundAB::StartingEventOpenDoors()
SpawnBGObject(m_BgObjects[BG_AB_OBJECT_SPEEDBUFF_STABLES + buff + i * 3], RESPAWN_IMMEDIATELY);
}
OpenDoorEvent(BG_EVENT_DOOR);
// Players that join battleground after start are not eligible to get achievement.
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AB_EVENT_START_BATTLE);
}
void BattleGroundAB::AddPlayer(Player *plr)

View file

@ -139,6 +139,7 @@ enum BG_AB_Sounds
#define BG_AB_ABBGWeekendHonorTicks 200
#define BG_AB_NotABBGWeekendReputationTicks 200
#define BG_AB_ABBGWeekendReputationTicks 150
#define BG_AB_EVENT_START_BATTLE 9158
// Tick intervals and given points: case 0,1,2,3,4,5 captured nodes
const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000};

View file

@ -282,6 +282,9 @@ void BattleGroundAV::StartingEventOpenDoors()
UpdateWorldState(BG_AV_SHOW_A_SCORE, 1);
OpenDoorEvent(BG_EVENT_DOOR);
// Players that join battleground after start are not available to get achievement.
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AV_EVENT_START_BATTLE);
}
void BattleGroundAV::AddPlayer(Player *plr)

View file

@ -68,6 +68,8 @@
#define BG_AV_REP_OWNED_MINE 24
#define BG_AV_REP_OWNED_MINE_HOLIDAY 36
#define BG_AV_EVENT_START_BATTLE 9166
enum BG_AV_Sounds
{
BG_AV_SOUND_NEAR_LOSE = 8456, // not confirmed yet

View file

@ -109,6 +109,9 @@ void BattleGroundEY::StartingEventOpenDoors()
uint8 buff = urand(0, 2);
SpawnBGObject(m_BgObjects[BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + buff + i * 3], RESPAWN_IMMEDIATELY);
}
// Players that join battleground after start are not eligible to get achievement.
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_EY_EVENT_START_BATTLE);
}
void BattleGroundEY::AddPoints(Team team, uint32 Points)

View file

@ -154,6 +154,7 @@ enum EYBattleGroundObjectTypes
#define BG_EY_NotEYWeekendHonorTicks 330
#define BG_EY_EYWeekendHonorTicks 200
#define BG_EY_EVENT_START_BATTLE 13180
enum BG_EY_Score
{

View file

@ -21,6 +21,9 @@
class BattleGround;
#define BG_SA_EVENT_START_BATTLE_1 23748 // Ally / Horde likely
#define BG_SA_EVENT_START_BATTLE_2 21702
class BattleGroundSAScore : public BattleGroundScore
{
public:

View file

@ -127,6 +127,9 @@ void BattleGroundWS::StartingEventOpenDoors()
SpawnEvent(WS_EVENT_SPIRITGUIDES_SPAWN, 0, true);
SpawnEvent(WS_EVENT_FLAG_A, 0, true);
SpawnEvent(WS_EVENT_FLAG_H, 0, true);
// Players that join battleground after start are not eligible to get achievement.
StartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_WS_EVENT_START_BATTLE);
}
void BattleGroundWS::AddPlayer(Player *plr)

View file

@ -25,6 +25,7 @@
#define BG_WS_FLAG_RESPAWN_TIME (23*IN_MILLISECONDS)
#define BG_WS_FLAG_DROP_TIME (10*IN_MILLISECONDS)
#define BG_WS_TIME_LIMIT (25*MINUTE*IN_MILLISECONDS)
#define BG_WS_EVENT_START_BATTLE 8563
enum BG_WS_Sound
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11793"
#define REVISION_NR "11794"
#endif // __REVISION_NR_H__