mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
[CORE] Imported PVP stats , special thanks to Mik & Shin
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -505,7 +505,7 @@ inline void KillRewarder::_InitXP(Player* player)
|
||||
// * otherwise, not in PvP;
|
||||
// * not if killer is on vehicle.
|
||||
if (_isBattleGround || (!_isPvP && !_killer->GetVehicle()))
|
||||
_xp = Trinity::XP::Gain(player, _victim);
|
||||
_xp = Trinity::XP::Gain(player, _victim, _isBattleGround);
|
||||
|
||||
if (_xp && !_isBattleGround && _victim) // pussywizard: npcs with relatively low hp give lower exp
|
||||
if (_victim->GetTypeId() == TYPEID_UNIT)
|
||||
@@ -22172,6 +22172,16 @@ void Player::LeaveBattleground(Battleground* bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
// Deserter tracker - leave BG
|
||||
if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS)
|
||||
&& (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_BG);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
// xinef: reset corpse reclaim time
|
||||
m_deathExpireTime = time(NULL);
|
||||
|
||||
|
||||
@@ -455,6 +455,15 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
|
||||
{
|
||||
bgQueue.RemovePlayer(_player->GetGUID(), false, queueSlot);
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
// track if player refuses to join the BG after being invited
|
||||
if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS) &&
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_QUEUE);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -463,6 +463,14 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
{
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId).RemovePlayer(_player->GetGUID(), false, i);
|
||||
// track if player logs out after invited to join BG
|
||||
if(_player->IsInvitedForBattlegroundInstance() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_INVITE_LOGOUT);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
|
||||
|
||||
@@ -1057,6 +1057,8 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true);
|
||||
m_bool_configs[CONFIG_BATTLEGROUND_RANDOM_CROSSFACTION] = sConfigMgr->GetBoolDefault("Battleground.RandomCrossFaction.Enable", true); // [AZTH] RBG Crossfaction
|
||||
m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false);
|
||||
m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.StoreStatistics.Enable", false);
|
||||
m_bool_configs[CONFIG_BATTLEGROUND_TRACK_DESERTERS] = sConfigMgr->GetBoolDefault("Battleground.TrackDeserters.Enable", false);
|
||||
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);
|
||||
m_bool_configs[CONFIG_BG_XP_FOR_KILL] = sConfigMgr->GetBoolDefault("Battleground.GiveXPForKills", false);
|
||||
|
||||
@@ -129,6 +129,8 @@ enum WorldBoolConfigs
|
||||
CONFIG_BATTLEGROUND_CAST_DESERTER,
|
||||
CONFIG_BATTLEGROUND_RANDOM_CROSSFACTION, // [AZTH] RBG Crossfaction
|
||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE,
|
||||
CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE,
|
||||
CONFIG_BATTLEGROUND_TRACK_DESERTERS,
|
||||
CONFIG_BG_XP_FOR_KILL,
|
||||
CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS,
|
||||
CONFIG_ARENA_SEASON_IN_PROGRESS,
|
||||
|
||||
Reference in New Issue
Block a user