diff options
Diffstat (limited to 'src/game/BattleGround.h')
-rw-r--r-- | src/game/BattleGround.h | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 007f7a642dd..cb19fd92525 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -17,21 +17,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef __BATTLEGROUND_H #define __BATTLEGROUND_H - #include "Common.h" #include "SharedDefines.h" - class Creature; class GameObject; class Group; class Player; class WorldPacket; - struct WorldSafeLocsEntry; - enum BattleGroundSounds { SOUND_HORDE_WINS = 8454, @@ -39,7 +34,6 @@ enum BattleGroundSounds SOUND_BG_START = 3439, SOUND_BG_START_L70ETC = 11803, }; - enum BattleGroundQuests { SPELL_WS_QUEST_REWARD = 43483, @@ -50,7 +44,6 @@ enum BattleGroundQuests SPELL_AB_QUEST_REWARD_4_BASES = 24061, SPELL_AB_QUEST_REWARD_5_BASES = 24064 }; - enum BattleGroundMarks { SPELL_WS_MARK_LOSER = 24950, @@ -64,19 +57,16 @@ enum BattleGroundMarks ITEM_AB_MARK_OF_HONOR = 20559, ITEM_EY_MARK_OF_HONOR = 29024 }; - enum BattleGroundMarksCount { ITEM_WINNER_COUNT = 3, ITEM_LOSER_COUNT = 1 }; - enum BattleGroundCreatures { BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117, // horde }; - enum BattleGroundSpells { SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect @@ -93,7 +83,6 @@ enum BattleGroundSpells SPELL_RECENTLY_DROPPED_FLAG = 42792, // Recently Dropped Flag SPELL_AURA_PLAYER_INACTIVE = 43681 // Inactive }; - enum BattleGroundTimeIntervals { RESURRECTION_INTERVAL = 30000, // ms @@ -106,7 +95,6 @@ enum BattleGroundTimeIntervals RESPAWN_IMMEDIATELY = 0, // secs BUFF_RESPAWN_TIME = 180, // secs }; - enum BattleGroundStartTimeIntervals { BG_START_DELAY_2M = 120000, // ms (2 minutes) @@ -115,16 +103,13 @@ enum BattleGroundStartTimeIntervals BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena BG_START_DELAY_NONE = 0, // ms }; - enum BattleGroundBuffObjects { BG_OBJECTID_SPEEDBUFF_ENTRY = 179871, BG_OBJECTID_REGENBUFF_ENTRY = 179904, BG_OBJECTID_BERSERKERBUFF_ENTRY = 179905 }; - const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY }; - enum BattleGroundStatus { STATUS_NONE = 0, // first status, should mean bg is not instance @@ -133,22 +118,18 @@ enum BattleGroundStatus STATUS_IN_PROGRESS = 3, // means bg is running STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending }; - struct BattleGroundPlayer { time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes uint32 Team; // Player's team }; - struct BattleGroundObjectInfo { BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {} - GameObject *object; int32 timer; uint32 spellid; }; - // handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time enum BattleGroundQueueTypeId { @@ -163,7 +144,6 @@ enum BattleGroundQueueTypeId BATTLEGROUND_QUEUE_5v5 = 8 }; #define MAX_BATTLEGROUND_QUEUE_TYPES 9 - enum BGQueueIdBasedOnLevel // queue_id for level ranges { QUEUE_ID_MAX_LEVEL_19 = 0, @@ -176,7 +156,6 @@ enum BGQueueIdBasedOnLevel // queue_id for level ranges QUEUE_ID_MAX_LEVEL_80 = 7 }; #define MAX_BATTLEGROUND_QUEUES 8 - enum ScoreType { SCORE_KILLING_BLOWS = 1, @@ -202,34 +181,29 @@ enum ScoreType SCORE_SECONDARY_OBJECTIVES = 17 // TODO : implement them }; - enum ArenaType { ARENA_TYPE_2v2 = 2, ARENA_TYPE_3v3 = 3, ARENA_TYPE_5v5 = 5 }; - enum BattleGroundType { TYPE_BATTLEGROUND = 3, TYPE_ARENA = 4 }; - enum BattleGroundWinner { WINNER_HORDE = 0, WINNER_ALLIANCE = 1, WINNER_NONE = 2 }; - enum BattleGroundTeamId { BG_TEAM_ALLIANCE = 0, BG_TEAM_HORDE = 1 }; #define BG_TEAMS_COUNT 2 - enum BattleGroundStartingEvents { BG_STARTING_EVENT_NONE = 0x00, @@ -238,7 +212,6 @@ enum BattleGroundStartingEvents BG_STARTING_EVENT_3 = 0x04, BG_STARTING_EVENT_4 = 0x08 }; - enum BattleGroundStartingEventsIds { BG_STARTING_EVENT_FIRST = 0, @@ -247,7 +220,6 @@ enum BattleGroundStartingEventsIds BG_STARTING_EVENT_FOURTH = 3 }; #define BG_STARTING_EVENT_COUNT 4 - enum BattleGroundJoinError { BG_JOIN_ERR_OK = 0, @@ -261,7 +233,6 @@ enum BattleGroundJoinError BG_JOIN_ERR_ALL_QUEUES_USED = 8, BG_JOIN_ERR_GROUP_NOT_ENOUGH = 9 }; - class BattleGroundScore { public: @@ -269,7 +240,6 @@ class BattleGroundScore BonusHonor(0), DamageDone(0), HealingDone(0) {} virtual ~BattleGroundScore() {} //virtual destructor is used when deleting score from scores map - uint32 KillingBlows; uint32 Deaths; uint32 HonorableKills; @@ -277,14 +247,12 @@ class BattleGroundScore uint32 DamageDone; uint32 HealingDone; }; - enum BGHonorMode { BG_NORMAL = 0, BG_HOLIDAY, BG_HONOR_MODE_NUM }; - /* This class is used to: 1. Add player to battleground @@ -295,7 +263,6 @@ This class is used to: class BattleGround { friend class BattleGroundMgr; - public: /* Construction */ BattleGround(); @@ -312,11 +279,9 @@ class BattleGround virtual void ResetBGSubclass() // must be implemented in BG subclass { } - /* achievement req. */ virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; } bool IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const; - /* Battleground */ // Get methods: char const* GetName() const { return m_Name; } @@ -330,19 +295,15 @@ class BattleGround uint32 GetLastResurrectTime() const { return m_LastResurrectTime; } uint32 GetMaxPlayers() const { return m_MaxPlayers; } uint32 GetMinPlayers() const { return m_MinPlayers; } - uint32 GetMinLevel() const { return m_LevelMin; } uint32 GetMaxLevel() const { return m_LevelMax; } - uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; } uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; } - int32 GetStartDelayTime() const { return m_StartDelayTime; } uint8 GetArenaType() const { return m_ArenaType; } uint8 GetWinner() const { return m_Winner; } uint32 GetBattlemasterEntry() const; uint32 GetBonusHonorFromKill(uint32 kills) const; - // Set methods: void SetName(char const* Name) { m_Name = Name; } void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; } @@ -366,16 +327,12 @@ class BattleGround void SetArenaType(uint8 type) { m_ArenaType = type; } void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; } void SetWinner(uint8 winner) { m_Winner = winner; } - void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; } void SetStartDelayTime(int Time) { m_StartDelayTime = Time; } - void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; } void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; } - void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available - void DecreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; } void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; } uint32 GetInvitedCount(uint32 team) const @@ -387,33 +344,25 @@ class BattleGround } bool HasFreeSlots() const; uint32 GetFreeSlotsForTeam(uint32 Team) const; - bool isArena() const { return m_IsArena; } bool isBattleGround() const { return !m_IsArena; } bool isRated() const { return m_IsRated; } - typedef std::map<uint64, BattleGroundPlayer> BattleGroundPlayerMap; BattleGroundPlayerMap const& GetPlayers() const { return m_Players; } uint32 GetPlayersSize() const { return m_Players.size(); } - typedef std::map<uint64, BattleGroundScore*> BattleGroundScoreMap; BattleGroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); } BattleGroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); } uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); } - uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); } - void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); void RemovePlayerFromResurrectQueue(uint64 player_guid); - void StartBattleGround(); - GameObject* GetBGObject(uint32 type); Creature* GetBGCreature(uint32 type); /* Location */ void SetMapId(uint32 MapID) { m_MapId = MapID; } uint32 GetMapId() const { return m_MapId; } - void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O); void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const { @@ -423,17 +372,14 @@ class BattleGround Z = m_TeamStartLocZ[idx]; O = m_TeamStartLocO[idx]; } - /* Packet Transfer */ // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} void SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender = NULL, bool self = true); void SendPacketToAll(WorldPacket *packet); void YellToAll(Creature* creature, const char* text, uint32 language); - template<class Do> void BroadcastWorker(Do& _do); - void PlaySoundToTeam(uint32 SoundID, uint32 TeamID); void PlaySoundToAll(uint32 SoundID); void CastSpellOnTeam(uint32 SpellID, uint32 TeamID); @@ -448,19 +394,14 @@ class BattleGround void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source); void EndBattleGround(uint32 winner); void BlockMovement(Player *plr); - void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL); void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ... ); - // specialized version with 2 string id args void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0); - /* Raid Group */ Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } void SetBgRaid(uint32 TeamID, Group *bg_raid); - virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); - static BattleGroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; } uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; } uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases @@ -471,41 +412,32 @@ class BattleGround else ++m_PlayersCount[GetTeamIndexByTeamId(Team)]; } - // used for rated arena battles void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; } uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; } void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; } int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; } void CheckArenaWinConditions(); - /* Triggers handle */ // must be implemented in BG subclass virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {} // must be implemented in BG subclass if need AND call base class generic code virtual void HandleKillPlayer(Player *player, Player *killer); virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/); - /* Battleground events */ virtual void EventPlayerDroppedFlag(Player* /*player*/) {} virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {} virtual void EventPlayerCapturedFlag(Player* /*player*/) {} void EventPlayerLoggedIn(Player* player, uint64 plr_guid); void EventPlayerLoggedOut(Player* player); - /* Death related */ virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - virtual void AddPlayer(Player *plr); // must be implemented in BG subclass - void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team); - virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); // can be extended in in BG subclass - void HandleTriggerBuff(uint64 const& go_guid); void SetHoliday(bool is_holiday); - // TODO: make this protected: typedef std::vector<uint64> BGObjects; typedef std::vector<uint64> BGCreatures; @@ -519,40 +451,30 @@ class BattleGround bool DelObject(uint32 type); bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team); int32 GetObjectType(uint64 guid); - void DoorOpen(uint32 type); void DoorClose(uint32 type); //to be removed const char *GetTrinityString(int32 entry); - virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; } - // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player uint32 GetPlayerTeam(uint64 guid); uint32 GetOtherTeam(uint32 teamId); bool IsPlayerInBattleGround(uint64 guid); - void SetDeleteThis() {m_SetDeleteThis = true;} - /* virtual score-array - get's used in bg-subclasses */ int32 m_TeamScores[BG_TEAMS_COUNT]; - protected: //this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends BattleGround void EndNow(); void PlayerAddedToBGCheckIfBGIsRunning(Player* plr); - /* Scorekeeping */ - BattleGroundScoreMap m_PlayerScores; // Player scores // must be implemented in BG subclass virtual void RemovePlayer(Player * /*player*/, uint64 /*guid*/) {} - /* Player lists, those need to be accessible by inherited classes */ BattleGroundPlayerMap m_Players; // Spirit Guide guid + Player list GUIDS std::map<uint64, std::vector<uint64> > m_ReviveQueue; - /* these are important variables used for starting messages */ @@ -560,9 +482,7 @@ class BattleGround BattleGroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT]; //this must be filled in constructors! uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT]; - bool m_BuffChange; - BGHonorMode m_HonorMode; private: /* Battleground */ @@ -584,28 +504,21 @@ class BattleGround bool m_PrematureCountDown; uint32 m_PrematureCountDownTimer; char const *m_Name; - /* Player lists */ std::vector<uint64> m_ResurrectQueue; // Player GUID std::deque<uint64> m_OfflineQueue; // Player GUID - /* Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction */ /* Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG */ /* Invited players counters*/ uint32 m_InvitedAlliance; uint32 m_InvitedHorde; - /* Raid Group */ Group *m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde - /* Players count by team */ uint32 m_PlayersCount[BG_TEAMS_COUNT]; - /* Arena team ids by team */ uint32 m_ArenaTeamIds[BG_TEAMS_COUNT]; - int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT]; - /* Limits */ uint32 m_LevelMin; uint32 m_LevelMax; @@ -613,7 +526,6 @@ class BattleGround uint32 m_MaxPlayers; uint32 m_MinPlayersPerTeam; uint32 m_MinPlayers; - /* Start location */ uint32 m_MapId; float m_TeamStartLocX[BG_TEAMS_COUNT]; |