[CORE] Imported PVP stats , special thanks to Mik & Shin

This commit is contained in:
Yehonal
2016-08-08 11:23:30 +02:00
parent 895558c85c
commit e358c0bb74
16 changed files with 138 additions and 1 deletions

View File

@@ -762,6 +762,27 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
else
SetWinner(TEAM_NEUTRAL);
PreparedStatement* stmt = NULL;
uint64 battlegroundId = 1;
if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
battlegroundId = fields[0].GetUInt64() + 1;
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND);
stmt->setUInt64(0, battlegroundId);
stmt->setUInt8(1, GetWinner());
stmt->setUInt8(2, GetUniqueBracketId());
stmt->setUInt8(3, GetBgTypeID());
CharacterDatabase.Execute(stmt);
}
//we must set it this way, because end time is sent in packet!
m_EndTime = TIME_TO_AUTOREMOVE;

View File

@@ -45,6 +45,15 @@ class BattlegroundIC;
struct PvPDifficultyEntry;
struct WorldSafeLocsEntry;
enum BattlegroundDesertionType
{
BG_DESERTION_TYPE_LEAVE_BG = 0, // player leaves the BG
BG_DESERTION_TYPE_OFFLINE = 1, // player is kicked from BG because offline
BG_DESERTION_TYPE_LEAVE_QUEUE = 2, // player is invited to join and refuses to do it
BG_DESERTION_TYPE_NO_ENTER_BUTTON = 3, // player is invited to join and do nothing (time expires)
BG_DESERTION_TYPE_INVITE_LOGOUT = 4, // player is invited to join and logs out
};
enum BattlegroundSounds
{
SOUND_HORDE_WINS = 8454,
@@ -267,6 +276,19 @@ struct BattlegroundScore
uint32 DamageDone;
uint32 HealingDone;
Player* player;
uint32 GetKillingBlows() const { return KillingBlows; }
uint32 GetDeaths() const { return Deaths; }
uint32 GetHonorableKills() const { return HonorableKills; }
uint32 GetBonusHonor() const { return BonusHonor; }
uint32 GetDamageDone() const { return DamageDone; }
uint32 GetHealingDone() const { return HealingDone; }
virtual uint32 GetAttr1() const { return 0; }
virtual uint32 GetAttr2() const { return 0; }
virtual uint32 GetAttr3() const { return 0; }
virtual uint32 GetAttr4() const { return 0; }
virtual uint32 GetAttr5() const { return 0; }
};
class ArenaLogEntryData
@@ -310,6 +332,14 @@ This class is used to:
3. some certain cases, same for all battlegrounds
4. It has properties same for all battlegrounds
*/
enum BattlegroundQueueInvitationType
{
BG_QUEUE_INVITATION_TYPE_NO_BALANCE = 0, // no balance: N+M vs N players
BG_QUEUE_INVITATION_TYPE_BALANCED = 1, // teams balanced: N+1 vs N players
BG_QUEUE_INVITATION_TYPE_EVEN = 2 // teams even: N vs N players
};
class Battleground
{
public:
@@ -570,6 +600,9 @@ class Battleground
virtual TeamId GetPrematureWinner();
// because BattleGrounds with different types and same level range has different m_BracketId
uint8 GetUniqueBracketId() const;
BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID() == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return NULL; }
BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID() == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return NULL; }

View File

@@ -216,6 +216,9 @@ struct BattlegroundABScore : public BattlegroundScore
~BattlegroundABScore() { }
uint32 BasesAssaulted;
uint32 BasesDefended;
uint32 GetAttr1() const final override { return BasesAssaulted; }
uint32 GetAttr2() const final override { return BasesDefended; }
};
class BattlegroundAB : public Battleground

View File

@@ -1565,6 +1565,12 @@ struct BattlegroundAVScore : public BattlegroundScore
uint32 MinesCaptured;
uint32 LeadersKilled;
uint32 SecondaryObjectives;
uint32 GetAttr1() const final override { return GraveyardsAssaulted; }
uint32 GetAttr2() const final override { return GraveyardsDefended; }
uint32 GetAttr3() const final override { return TowersAssaulted; }
uint32 GetAttr4() const final override { return TowersDefended; }
uint32 GetAttr5() const final override { return MinesCaptured; }
};
class BattlegroundAV : public Battleground

View File

@@ -310,6 +310,8 @@ struct BattlegroundEYScore : public BattlegroundScore
BattlegroundEYScore(Player* player) : BattlegroundScore(player), FlagCaptures(0) { }
~BattlegroundEYScore() { }
uint32 FlagCaptures;
uint32 GetAttr1() const final override { return FlagCaptures; }
};
class BattlegroundEY : public Battleground

View File

@@ -894,6 +894,9 @@ struct BattlegroundICScore : public BattlegroundScore
~BattlegroundICScore() { }
uint32 BasesAssaulted;
uint32 BasesDefended;
uint32 GetAttr1() const final override { return BasesAssaulted; }
uint32 GetAttr2() const final override { return BasesDefended; }
};
class BattlegroundIC : public Battleground

View File

@@ -27,6 +27,9 @@ struct BattlegroundSAScore : public BattlegroundScore
~BattlegroundSAScore() { }
uint8 demolishers_destroyed;
uint8 gates_destroyed;
uint32 GetAttr1() const final override { return demolishers_destroyed; }
uint32 GetAttr2() const final override { return gates_destroyed; }
};
#define BG_SA_FLAG_AMOUNT 3

View File

@@ -142,6 +142,9 @@ struct BattlegroundWGScore : public BattlegroundScore
~BattlegroundWGScore() { }
uint32 FlagCaptures;
uint32 FlagReturns;
uint32 GetAttr1() const final override { return FlagCaptures; }
uint32 GetAttr2() const final override { return FlagReturns; }
};
class BattlegroundWS : public Battleground