TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BattlegroundScore.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRINITY_BATTLEGROUND_SCORE_H
19 #define TRINITY_BATTLEGROUND_SCORE_H
20 
21 #include "WorldPacket.h"
22 #include "Player.h"
23 #include "ObjectAccessor.h"
24 
26 {
33 
34  // WS, EY and TP
37 
38  // AB and IC
41 
42  // AV
48 
49  // SOTA
52 };
53 
55 {
56  friend class Arena;
57  friend class Battleground;
58 
59  protected:
60  BattlegroundScore(ObjectGuid playerGuid, uint32 team) : PlayerGuid(playerGuid), TeamId(team == ALLIANCE ? 1 : 0),
62 
63  virtual ~BattlegroundScore() { }
64 
65  virtual void UpdateScore(uint32 type, uint32 value)
66  {
67  switch (type)
68  {
69  case SCORE_KILLING_BLOWS: // Killing blows
71  break;
72  case SCORE_DEATHS: // Deaths
73  Deaths += value;
74  break;
75  case SCORE_HONORABLE_KILLS: // Honorable kills
77  break;
78  case SCORE_BONUS_HONOR: // Honor bonus
79  BonusHonor += value;
80  break;
81  case SCORE_DAMAGE_DONE: // Damage Done
82  DamageDone += value;
83  break;
84  case SCORE_HEALING_DONE: // Healing Done
85  HealingDone += value;
86  break;
87  default:
88  ASSERT(false && "Not implemented Battleground score type!");
89  break;
90  }
91  }
92 
93  virtual void BuildObjectivesBlock(std::vector<int32>& /*stats*/) = 0;
94 
95  // For Logging purpose
96  virtual std::string ToString() const { return ""; }
97 
98  uint32 GetKillingBlows() const { return KillingBlows; }
99  uint32 GetDeaths() const { return Deaths; }
101  uint32 GetBonusHonor() const { return BonusHonor; }
102  uint32 GetDamageDone() const { return DamageDone; }
103  uint32 GetHealingDone() const { return HealingDone; }
104 
105  virtual uint32 GetAttr1() const { return 0; }
106  virtual uint32 GetAttr2() const { return 0; }
107  virtual uint32 GetAttr3() const { return 0; }
108  virtual uint32 GetAttr4() const { return 0; }
109  virtual uint32 GetAttr5() const { return 0; }
110 
113 
114  // Default score, present in every type
121 };
122 
123 #endif // TRINITY_BATTLEGROUND_SCORE_H
uint32 GetHealingDone() const
Definition: BattlegroundScore.h:103
Definition: BattlegroundScore.h:35
uint8 TeamId
Definition: BattlegroundScore.h:112
virtual uint32 GetAttr2() const
Definition: BattlegroundScore.h:106
Definition: BattlegroundScore.h:51
uint32 HealingDone
Definition: BattlegroundScore.h:120
uint32 HonorableKills
Definition: BattlegroundScore.h:117
virtual void UpdateScore(uint32 type, uint32 value)
Definition: BattlegroundScore.h:65
uint32 DamageDone
Definition: BattlegroundScore.h:119
virtual void BuildObjectivesBlock(std::vector< int32 > &)=0
virtual ~BattlegroundScore()
Definition: BattlegroundScore.h:63
Definition: BattlegroundScore.h:46
virtual uint32 GetAttr3() const
Definition: BattlegroundScore.h:107
uint32 BonusHonor
Definition: BattlegroundScore.h:118
uint32 GetBonusHonor() const
Definition: BattlegroundScore.h:101
Definition: BattlegroundScore.h:50
uint32 Deaths
Definition: BattlegroundScore.h:116
Definition: BattlegroundScore.h:29
ScoreType
Definition: BattlegroundScore.h:25
Definition: BattlegroundScore.h:44
Definition: SharedDefines.h:1000
Definition: BattlegroundScore.h:54
uint32 KillingBlows
Definition: BattlegroundScore.h:115
Definition: BattlegroundScore.h:36
Definition: BattlegroundScore.h:47
uint32 GetDeaths() const
Definition: BattlegroundScore.h:99
virtual std::string ToString() const
Definition: BattlegroundScore.h:96
Definition: Arena.h:39
virtual uint32 GetAttr4() const
Definition: BattlegroundScore.h:108
Definition: BattlegroundScore.h:31
uint32 GetHonorableKills() const
Definition: BattlegroundScore.h:100
Definition: BattlegroundScore.h:39
uint32_t uint32
Definition: Define.h:150
Definition: BattlegroundScore.h:27
Definition: BattlegroundScore.h:45
BattlegroundScore(ObjectGuid playerGuid, uint32 team)
Definition: BattlegroundScore.h:60
virtual uint32 GetAttr5() const
Definition: BattlegroundScore.h:109
TeamId
Definition: SharedDefines.h:990
virtual uint32 GetAttr1() const
Definition: BattlegroundScore.h:105
Definition: BattlegroundScore.h:30
uint32 GetDamageDone() const
Definition: BattlegroundScore.h:102
Definition: BattlegroundScore.h:43
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55
Definition: Battleground.h:235
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: ObjectGuid.h:189
Definition: BattlegroundScore.h:28
Definition: BattlegroundScore.h:32
uint32 GetKillingBlows() const
Definition: BattlegroundScore.h:98
ObjectGuid PlayerGuid
Definition: BattlegroundScore.h:111
Definition: BattlegroundScore.h:40