[6844] Daily quest fixes.
[getmangos.git] / src / game / ArenaTeam.h
blob0d26b00cfd0e5cc50d29c1141ac7d8346db8997d
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOSSERVER_ARENATEAM_H
20 #define MANGOSSERVER_ARENATEAM_H
22 enum ArenaTeamCommandTypes
24 ERR_ARENA_TEAM_CREATE_S = 0x00,
25 ERR_ARENA_TEAM_INVITE_SS = 0x01,
26 //ERR_ARENA_TEAM_QUIT_S = 0x02,
27 ERR_ARENA_TEAM_QUIT_S = 0x03,
28 ERR_ARENA_TEAM_FOUNDER_S = 0x0C // need check, probably wrong...
31 enum ArenaTeamCommandErrors
33 //ARENA_TEAM_PLAYER_NO_MORE_IN_ARENA_TEAM = 0x00,
34 ERR_ARENA_TEAM_INTERNAL = 0x01,
35 ERR_ALREADY_IN_ARENA_TEAM = 0x02,
36 ERR_ALREADY_IN_ARENA_TEAM_S = 0x03,
37 ERR_INVITED_TO_ARENA_TEAM = 0x04,
38 ERR_ALREADY_INVITED_TO_ARENA_TEAM_S = 0x05,
39 ERR_ARENA_TEAM_NAME_INVALID = 0x06,
40 ERR_ARENA_TEAM_NAME_EXISTS_S = 0x07,
41 ERR_ARENA_TEAM_LEADER_LEAVE_S = 0x08,
42 ERR_ARENA_TEAM_PERMISSIONS = 0x08,
43 ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM = 0x09,
44 ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM_SS = 0x0A,
45 ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S = 0x0B,
46 ERR_ARENA_TEAM_NOT_ALLIED = 0x0C
49 enum ArenaTeamEvents
51 ERR_ARENA_TEAM_JOIN_SS = 3, // player name + arena team name
52 ERR_ARENA_TEAM_LEAVE_SS = 4, // player name + arena team name
53 ERR_ARENA_TEAM_REMOVE_SSS = 5, // player name + arena team name + captain name
54 ERR_ARENA_TEAM_LEADER_IS_SS = 6, // player name + arena team name
55 ERR_ARENA_TEAM_LEADER_CHANGED_SSS = 7, // old captain + new captain + arena team name
56 ERR_ARENA_TEAM_DISBANDED_S = 8 // captain name + arena team name
60 need info how to send these ones:
61 ERR_ARENA_TEAM_YOU_JOIN_S - client show it automatically when accept invite
62 ERR_ARENA_TEAM_TARGET_TOO_LOW_S
63 ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S
64 ERR_ARENA_TEAM_LEVEL_TOO_LOW_I
67 enum ArenaTeamStatTypes
69 STAT_TYPE_RATING = 0,
70 STAT_TYPE_GAMES = 1,
71 STAT_TYPE_WINS = 2,
72 STAT_TYPE_PLAYED = 3,
73 STAT_TYPE_WINS2 = 4,
74 STAT_TYPE_RANK = 5
77 enum ArenaTeamTypes
79 ARENA_TEAM_2v2 = 2,
80 ARENA_TEAM_3v3 = 3,
81 ARENA_TEAM_5v5 = 5
84 struct ArenaTeamMember
86 uint64 guid;
87 std::string name;
88 //uint32 unk2;
89 //uint8 unk1;
90 uint8 Class;
91 uint32 played_week;
92 uint32 wons_week;
93 uint32 played_season;
94 uint32 wons_season;
97 struct ArenaTeamStats
99 uint32 rating;
100 uint32 games;
101 uint32 wins;
102 uint32 played;
103 uint32 wins2;
104 uint32 rank;
107 #define MAX_ARENA_SLOT 3 // 0..2 slots
109 class ArenaTeam
111 public:
112 ArenaTeam();
113 ~ArenaTeam();
115 bool create(uint64 CaptainGuid, uint32 type, std::string ArenaTeamName);
116 void Disband(WorldSession *session);
118 typedef std::list<ArenaTeamMember> MemberList;
120 uint32 GetId() const { return Id; }
121 uint32 GetType() const { return Type; }
122 uint8 GetSlot() const;
123 static uint8 GetSlotByType(uint32 type);
124 const uint64& GetCaptain() const { return CaptainGuid; }
125 std::string GetName() const { return Name; }
126 ArenaTeamStats GetStats() const { return stats; }
127 void SetStats(uint32 stat_type, uint32 value);
128 uint32 GetRating() const { return stats.rating; }
130 uint32 GetEmblemStyle() const { return EmblemStyle; }
131 uint32 GetEmblemColor() const { return EmblemColor; }
132 uint32 GetBorderStyle() const { return BorderStyle; }
133 uint32 GetBorderColor() const { return BorderColor; }
134 uint32 GetBackgroundColor() const { return BackgroundColor; }
136 void SetCaptain(uint64 guid);
137 bool AddMember(uint64 PlayerGuid);
138 void DelMember(uint64 guid);
140 void SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor);
142 uint32 GetMembersSize() const { return members.size(); }
143 MemberList::iterator membersbegin(){ return members.begin(); }
144 MemberList::iterator membersEnd(){ return members.end(); }
145 bool HaveMember(uint64 guid) const;
147 bool LoadArenaTeamFromDB(uint32 ArenaTeamId);
148 void LoadMembersFromDB(uint32 ArenaTeamId);
149 void LoadStatsFromDB(uint32 ArenaTeamId);
150 void LoadPlayerStats(ArenaTeamMember* member);
152 void BroadcastPacket(WorldPacket *packet);
154 void Roster(WorldSession *session);
155 void Query(WorldSession *session);
156 void Stats(WorldSession *session);
157 void InspectStats(WorldSession *session, uint64 guid);
159 protected:
161 uint32 Id;
162 uint32 Type;
163 std::string Name;
164 uint64 CaptainGuid;
166 uint32 BackgroundColor; // ARGB format
167 uint32 EmblemStyle; // icon id
168 uint32 EmblemColor; // ARGB format
169 uint32 BorderStyle; // border image id
170 uint32 BorderColor; // ARGB format
172 MemberList members;
173 ArenaTeamStats stats;
175 #endif