Show
Ignore:
Timestamp:
11/19/08 13:22:41 (17 years ago)
Author:
yumileroy
Message:

[svn] -enabled instantiated battlegrounds
-enabled arena matches
-rewritten battleground queuing to support joining as group
-removed queue announcements

Original author: w12x
Date: 2008-10-05 08:48:32-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/BattleGround.h

    r2 r9  
    142142    BATTLEGROUND_EY     = 7, 
    143143    BATTLEGROUND_RL     = 8 
     144}; 
     145 
     146// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time 
     147enum BattleGroundQueueTypeId 
     148{ 
     149    BATTLEGROUND_QUEUE_AV     = 1, 
     150    BATTLEGROUND_QUEUE_WS     = 2, 
     151    BATTLEGROUND_QUEUE_AB     = 3, 
     152    BATTLEGROUND_QUEUE_EY     = 4, 
     153    BATTLEGROUND_QUEUE_2v2     = 5, 
     154    BATTLEGROUND_QUEUE_3v3     = 6, 
     155    BATTLEGROUND_QUEUE_5v5     = 7, 
    144156}; 
    145157 
     
    196208}; 
    197209 
     210enum BattleGroundJoinError 
     211{ 
     212    BG_JOIN_ERR_OK = 0, 
     213    BG_JOIN_ERR_OFFLINE_MEMBER = 1, 
     214    BG_JOIN_ERR_GROUP_TOO_MANY = 2, 
     215    BG_JOIN_ERR_MIXED_FACTION = 3, 
     216    BG_JOIN_ERR_MIXED_LEVELS = 4, 
     217    BG_JOIN_ERR_MIXED_ARENATEAM = 5, 
     218    BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE = 6, 
     219    BG_JOIN_ERR_GROUP_DESERTER = 7, 
     220    BG_JOIN_ERR_ALL_QUEUES_USED = 8, 
     221    BG_JOIN_ERR_GROUP_NOT_ENOUGH = 9 
     222}; 
     223 
    198224class BattleGroundScore 
    199225{ 
     
    297323        bool HasFreeSlotsForTeam(uint32 Team) const; 
    298324        bool HasFreeSlots() const; 
     325        uint32 GetFreeSlotsForTeam(uint32 Team) const; 
    299326 
    300327        bool isArena() const        { return m_IsArena; } 
     
    367394        uint8 GetTeamIndexByTeamId(uint32 Team) const { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; } 
    368395        uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; } 
     396        uint32 GetAlivePlayersCountByTeam(uint32 Team) const;   // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases 
    369397        void UpdatePlayersCountByTeam(uint32 Team, bool remove) 
    370398        { 
     
    375403        } 
    376404 
     405        // used for rated arena battles 
     406        void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; } 
     407        uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; } 
     408        void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; } 
     409        int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; } 
     410 
    377411        /* Triggers handle */ 
    378412        // must be implemented in BG subclass 
     
    391425 
    392426        virtual void AddPlayer(Player *plr);                // must be implemented in BG subclass 
     427 
    393428        virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); 
    394429                                                            // can be extended in in BG subclass 
     
    403438        void SpawnBGObject(uint32 type, uint32 respawntime); 
    404439        bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); 
    405         Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o); 
     440//        void SpawnBGCreature(uint32 type, uint32 respawntime); 
     441        Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0); 
    406442        bool DelCreature(uint32 type); 
    407443        bool DelObject(uint32 type); 
     
    411447        void DoorClose(uint32 type); 
    412448        const char *GetMangosString(int32 entry); 
     449 
     450        virtual bool HandlePlayerUnderMap(Player * plr) {return false;} 
     451 
     452        // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player 
     453        uint32 GetPlayerTeam(uint64 guid); 
     454 
     455        void SetDeleteThis() {m_SetDeleteThis = true;} 
    413456 
    414457    protected: 
     
    444487        uint32 m_Queue_type; 
    445488        uint8  m_ArenaType;                                 // 2=2v2, 3=3v3, 5=5v5 
     489        bool   m_InBGFreeSlotQueue;                         // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque 
     490        bool   m_SetDeleteThis;                             // used for safe deletion of the bg after end / all players leave 
    446491        // this variable is not used .... it can be found in many other ways... but to store it in BG object instance is useless 
    447492        //uint8  m_BattleGroundType;                        // 3=BG, 4=arena 
     
    451496        int32  m_StartDelayTime; 
    452497        bool   m_IsRated;                                   // is this battle rated? 
     498        bool   m_PrematureCountDown; 
     499        uint32 m_PrematureCountDownTimer; 
    453500        char const *m_Name; 
    454501 
     
    468515        /* Players count by team */ 
    469516        uint32 m_PlayersCount[2]; 
     517 
     518        /* Arena team ids by team */ 
     519        uint32 m_ArenaTeamIds[2]; 
     520 
     521        int32 m_ArenaTeamRatingChanges[2]; 
    470522 
    471523        /* Limits */