diff options
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Battlegrounds/Battleground.cpp | 59 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/BattlegroundScore.h | 13 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/Zones/BattlegroundAB.h | 3 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/Zones/BattlegroundAV.h | 6 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/Zones/BattlegroundEY.h | 2 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/Zones/BattlegroundIC.h | 3 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/Zones/BattlegroundSA.h | 3 | ||||
| -rw-r--r-- | src/server/game/Battlegrounds/Zones/BattlegroundWS.h | 3 | ||||
| -rw-r--r-- | src/server/game/World/World.cpp | 1 | ||||
| -rw-r--r-- | src/server/game/World/World.h | 1 |
10 files changed, 94 insertions, 0 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index ed39c3fd6b2..69d43d4f40f 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -748,6 +748,24 @@ void Battleground::EndBattleground(uint32 winner) int32 winmsg_id = 0; bool guildAwarded = false; + PreparedStatement* stmt; + PreparedQueryResult result; + uint64 battleground_id = 1; + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID); + result = CharacterDatabase.Query(stmt); + + if (result) + { + Field* fields = result->Fetch(); + battleground_id = fields[0].GetInt64() + 1; + } + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND); + } + if (winner == ALLIANCE) { winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; @@ -755,6 +773,9 @@ void Battleground::EndBattleground(uint32 winner) PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound SetWinner(BG_TEAM_ALLIANCE); + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + stmt->setUInt8(1, BG_TEAM_ALLIANCE); } else if (winner == HORDE) { @@ -763,10 +784,24 @@ void Battleground::EndBattleground(uint32 winner) PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound SetWinner(BG_TEAM_HORDE); + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + stmt->setUInt8(1, BG_TEAM_HORDE); } else { SetWinner(BG_TEAM_NEUTRAL); + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + stmt->setUInt8(1, BG_TEAM_NEUTRAL); + } + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + { + stmt->setUInt64(0, battleground_id); + stmt->setUInt8(2, m_BracketId + 1); + stmt->setUInt8(3, GetTypeID()); + CharacterDatabase.Execute(stmt); } SetStatus(STATUS_WAIT_LEAVE); @@ -809,6 +844,30 @@ void Battleground::EndBattleground(uint32 winner) uint32 winnerKills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST); uint32 loserKills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_PLAYER); + BattlegroundScoreMap::const_iterator score = PlayerScores.find(player->GetGUIDLow()); + + // battleground_id, character_guid, score_killing_blows, score_deaths, score_honorable_kills, score_bonus_honor, score_damage_done, score_healing_done + + stmt->setUInt32(0, battleground_id); + stmt->setUInt32(1, player->GetGUIDLow()); + stmt->setUInt32(2, score->second->GetKillingBlows()); + stmt->setUInt32(3, score->second->GetDeaths()); + stmt->setUInt32(4, score->second->GetHonorableKills()); + stmt->setUInt32(5, score->second->GetBonusHonor()); + stmt->setUInt32(6, score->second->GetDamageDone()); + stmt->setUInt32(7, score->second->GetHealingDone()); + stmt->setUInt32(8, score->second->GetAttr1()); + stmt->setUInt32(9, score->second->GetAttr2()); + stmt->setUInt32(10, score->second->GetAttr3()); + stmt->setUInt32(11, score->second->GetAttr4()); + stmt->setUInt32(12, score->second->GetAttr5()); + + CharacterDatabase.Execute(stmt); + } + // Reward winner team if (team == winner) { diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h index 23e06693e56..6cb0aaadb73 100644 --- a/src/server/game/Battlegrounds/BattlegroundScore.h +++ b/src/server/game/Battlegrounds/BattlegroundScore.h @@ -159,6 +159,19 @@ struct BattlegroundScore // For Logging purpose virtual std::string ToString() const { return ""; } + 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; } + ObjectGuid PlayerGuid; uint8 TeamId; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 91bb7104d66..d99c206e0c8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -267,6 +267,9 @@ struct BattlegroundABScore final : public BattlegroundScore content << uint32(BasesDefended); } + uint32 GetAttr1() const final override { return BasesAssaulted; } + uint32 GetAttr2() const final override { return BasesDefended; } + uint32 BasesAssaulted; uint32 BasesDefended; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index a93929672c7..a4f1dddcd2c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1568,6 +1568,12 @@ struct BattlegroundAVScore final : public BattlegroundScore content << uint32(MinesCaptured); } + 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; } + uint32 GraveyardsAssaulted; uint32 GraveyardsDefended; uint32 TowersAssaulted; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 9867d878b41..e1eaa6dd5fe 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -349,6 +349,8 @@ struct BattlegroundEYScore final : public BattlegroundScore content << uint32(FlagCaptures); } + uint32 GetAttr1() const final override { return FlagCaptures; } + uint32 FlagCaptures; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index a0f03f5727d..8a7995cf2c1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -878,6 +878,9 @@ struct BattlegroundICScore final : public BattlegroundScore content << uint32(BasesDefended); } + uint32 GetAttr1() const final override { return BasesAssaulted; } + uint32 GetAttr2() const final override { return BasesDefended; } + uint32 BasesAssaulted; uint32 BasesDefended; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 7019d785503..6f5363aeaa8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -538,6 +538,9 @@ struct BattlegroundSAScore final : public BattlegroundScore content << uint32(GatesDestroyed); } + uint32 GetAttr1() const final override { return DemolishersDestroyed; } + uint32 GetAttr2() const final override { return GatesDestroyed; } + uint32 DemolishersDestroyed; uint32 GatesDestroyed; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 2fdb6dd120e..5691b42d4e9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -177,6 +177,9 @@ struct BattlegroundWGScore final : public BattlegroundScore content << uint32(FlagReturns); } + uint32 GetAttr1() const final override { return FlagCaptures; } + uint32 GetAttr2() const final override { return FlagReturns; } + uint32 FlagCaptures; uint32 FlagReturns; }; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f66c693098b..5cd9e052e2f 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1055,6 +1055,7 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true); m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false); m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false); + m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.StoreStatistics.Enable", false); m_int_configs[CONFIG_BATTLEGROUND_INVITATION_TYPE] = sConfigMgr->GetIntDefault ("Battleground.InvitationType", 0); m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetIntDefault ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS); m_int_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfigMgr->GetIntDefault ("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 51a5f726051..74f10f91d51 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -129,6 +129,7 @@ enum WorldBoolConfigs CONFIG_BATTLEGROUND_CAST_DESERTER, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, + CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE, CONFIG_BG_XP_FOR_KILL, CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE, CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY, |
