More refactoring of code.

This commit is contained in:
hondacrx
2019-09-23 21:41:13 -04:00
parent 2418715800
commit 570aebce26
176 changed files with 2261 additions and 2265 deletions
+22 -22
View File
@@ -116,7 +116,7 @@ namespace Game.BattleGrounds
_ProcessOfflineQueue();
_ProcessPlayerPositionBroadcast(diff);
// after 47 Time.Minutes without one team losing, the arena closes with no winner and no rating change
if (isArena())
if (IsArena())
{
if (GetElapsedTime() >= 47 * Time.Minute * Time.InMilliseconds)
{
@@ -298,7 +298,7 @@ namespace Game.BattleGrounds
EndBattleground(GetPrematureWinner());
m_PrematureCountDown = false;
}
else if (!Global.BattlegroundMgr.isTesting())
else if (!Global.BattlegroundMgr.IsTesting())
{
uint newtime = m_PrematureCountDownTimer - diff;
// announce every Time.Minute
@@ -324,7 +324,7 @@ namespace Game.BattleGrounds
// *********************************************************
ModifyStartDelayTime((int)diff);
if (!isArena())
if (!IsArena())
SetRemainingTime(300000);
if (m_ResetStatTimer > 5000)
@@ -341,7 +341,7 @@ namespace Game.BattleGrounds
// Send packet every 10 seconds until the 2nd field reach 0
if (m_CountdownTimer >= 10000)
{
uint countdownMaxForBGType = isArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
StartTimer timer = new StartTimer();
timer.Type = TimerType.Pvp;
@@ -409,7 +409,7 @@ namespace Game.BattleGrounds
SetStartDelayTime(StartDelayTimes[BattlegroundConst.EventIdFourth]);
// Remove preparation
if (isArena())
if (IsArena())
{
//todo add arena sound PlaySoundToAll(SOUND_ARENA_START);
foreach (var guid in GetPlayers().Keys)
@@ -655,7 +655,7 @@ namespace Game.BattleGrounds
if (winner == Team.Alliance)
{
if (isBattleground())
if (IsBattleground())
SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.AllianceWins);
@@ -663,7 +663,7 @@ namespace Game.BattleGrounds
}
else if (winner == Team.Horde)
{
if (isBattleground())
if (IsBattleground())
SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.HordeWins);
@@ -676,7 +676,7 @@ namespace Game.BattleGrounds
PreparedStatement stmt = null;
ulong battlegroundId = 1;
if (isBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PVPSTATS_MAXID);
SQLResult result = DB.Characters.Query(stmt);
@@ -722,7 +722,7 @@ namespace Game.BattleGrounds
{
//needed cause else in av some creatures will kill the players at the end
player.CombatStop();
player.GetHostileRefManager().deleteReferences();
player.GetHostileRefManager().DeleteReferences();
}
// remove temporary currency bonus auras before rewarding player
@@ -732,7 +732,7 @@ namespace Game.BattleGrounds
uint winnerKills = player.GetRandomWinner() ? WorldConfig.GetUIntValue(WorldCfg.BgRewardWinnerHonorLast) : WorldConfig.GetUIntValue(WorldCfg.BgRewardWinnerHonorFirst);
uint loserKills = player.GetRandomWinner() ? WorldConfig.GetUIntValue(WorldCfg.BgRewardLoserHonorLast) : WorldConfig.GetUIntValue(WorldCfg.BgRewardLoserHonorFirst);
if (isBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PVPSTATS_PLAYER);
var score = PlayerScores.LookupByKey(player.GetGUID());
@@ -810,7 +810,7 @@ namespace Game.BattleGrounds
{
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
uint maxLevel = Math.Min(GetMaxLevel(), 80U);
return Formulas.hk_honor_at_level(maxLevel, kills);
return Formulas.HKHonorAtLevel(maxLevel, kills);
}
void BlockMovement(Player player)
@@ -867,7 +867,7 @@ namespace Game.BattleGrounds
player.ClearAfkReports();
// if arena, remove the specific arena auras
if (isArena())
if (IsArena())
{
bgTypeId = BattlegroundTypeId.AA; // set the bg type to all arenas (it will be used for queue refreshing)
@@ -895,7 +895,7 @@ namespace Game.BattleGrounds
}
DecreaseInvitedCount(team);
//we should update Battleground queue, but only if bg isn't ending
if (isBattleground() && GetStatus() < BattlegroundStatus.WaitLeave)
if (IsBattleground() && GetStatus() < BattlegroundStatus.WaitLeave)
{
// a player has left the Battleground, so there are free slots . add to queue
AddToBGFreeSlotQueue();
@@ -1007,7 +1007,7 @@ namespace Game.BattleGrounds
player.RemoveAurasByType(AuraType.Mounted);
// add arena specific auras
if (isArena())
if (IsArena())
{
player.RemoveArenaEnchantments(EnchantmentSlot.Temp);
@@ -1026,7 +1026,7 @@ namespace Game.BattleGrounds
{
player.CastSpell(player, BattlegroundConst.SpellPreparation, true); // reduces all mana cost of spells.
uint countdownMaxForBGType = isArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
StartTimer timer = new StartTimer();
timer.Type = TimerType.Pvp;
timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000);
@@ -1120,7 +1120,7 @@ namespace Game.BattleGrounds
RemovePlayer(player, guid, GetPlayerTeam(guid));
// 1 player is logging out, if it is the last, then end arena!
if (isArena())
if (IsArena())
if (GetAlivePlayersCountByTeam(player.GetBGTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player.GetBGTeam())) != 0)
EndBattleground(GetOtherTeam(player.GetBGTeam()));
}
@@ -1129,7 +1129,7 @@ namespace Game.BattleGrounds
// This method should be called only once ... it adds pointer to queue
void AddToBGFreeSlotQueue()
{
if (!m_InBGFreeSlotQueue && isBattleground())
if (!m_InBGFreeSlotQueue && IsBattleground())
{
Global.BattlegroundMgr.AddToBGFreeSlotQueue(m_TypeID, this);
m_InBGFreeSlotQueue = true;
@@ -1251,7 +1251,7 @@ namespace Game.BattleGrounds
if (bgScore == null) // player not found...
return false;
if (type == ScoreType.BonusHonor && doAddHonor && isBattleground())
if (type == ScoreType.BonusHonor && doAddHonor && IsBattleground())
player.RewardHonor(null, 1, (int)value);
else
bgScore.UpdateScore(type, value);
@@ -1640,7 +1640,7 @@ namespace Game.BattleGrounds
}
}
if (!isArena())
if (!IsArena())
{
// To be able to remove insignia -- ONLY IN Battlegrounds
victim.AddUnitFlag(UnitFlags.Skinnable);
@@ -1869,9 +1869,9 @@ namespace Game.BattleGrounds
public void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
uint GetInvitedCount(Team team) { return (team == Team.Alliance) ? m_InvitedAlliance : m_InvitedHorde; }
public bool isArena() { return m_IsArena; }
public bool isBattleground() { return !m_IsArena; }
public bool isRated() { return m_IsRated; }
public bool IsArena() { return m_IsArena; }
public bool IsBattleground() { return !m_IsArena; }
public bool IsRated() { return m_IsRated; }
public Dictionary<ObjectGuid, BattlegroundPlayer> GetPlayers() { return m_Players; }
uint GetPlayersSize() { return (uint)m_Players.Count; }