SegmentEligiblePlayers( IEnumerable <KeyValuePair <uint, int> > allContributingPlayers, Realms lockingRealm, IContributionManager contributionManager, bool updateHonor = true, bool updateAnalytics = true) { var winningRealmPlayers = new ConcurrentDictionary <Player, int>(); var losingRealmPlayers = new ConcurrentDictionary <Player, int>(); var allEligiblePlayerDictionary = new ConcurrentDictionary <Player, int>(); // Partition the players by winning realm. foreach (var contributingPlayer in allContributingPlayers) { var player = Player.GetPlayer(contributingPlayer.Key); if (player != null) { if (updateHonor) { // Update the Honor Points of the Contributing Players var oldHonorPoints = player.Info.HonorPoints; player.Info.HonorPoints += (ushort)contributingPlayer.Value; Logger.Debug($"Updating honor for {player.Info.Name} ({player.Info.CharacterId}) {oldHonorPoints} => {player.Info.HonorPoints} ({player.Info.HonorRank})"); CharMgr.Database.SaveObject(player.Info); PlayerUtil.RecordHonorHistory(oldHonorPoints, player.Info.HonorPoints, player.CharacterId, player.Name); } if (player.Realm == lockingRealm) { winningRealmPlayers.TryAdd(player, contributingPlayer.Value); } else { losingRealmPlayers.TryAdd(player, contributingPlayer.Value); } allEligiblePlayerDictionary.TryAdd(player, contributingPlayer.Value); if (updateAnalytics) { // Get the contribution list for this player var contributionDictionary = contributionManager.GetContributionStageDictionary(contributingPlayer.Key); // Record the contribution types and values for the player for analytics PlayerContributionManager.RecordContributionAnalytics(player, contributionDictionary); } } } // Update and inform players of change in Honor Rank. UpdateHonorRankAllPlayers(false); return(new Tuple <ConcurrentDictionary <Player, int>, ConcurrentDictionary <Player, int>, ConcurrentDictionary <Player, int> >(allEligiblePlayerDictionary, winningRealmPlayers, losingRealmPlayers)); }
public BattleFrontStatus(ImpactMatrixManager impactMatrixManager, int battleFrontId) { ImpactMatrixManagerInstance = impactMatrixManager; BattleFrontId = battleFrontId; ContributionManagerInstance = PlayerContributionManager.LoadPlayerContribution(battleFrontId); RewardManagerInstance = new RewardManager(ContributionManagerInstance, new StaticWrapper(), RewardService._RewardPlayerKills, ImpactMatrixManagerInstance); KeepList = new List <Keep_Info>(); BattlefieldObjectives = new List <BattleFront_Objective>(); if (battleFrontId != 0) { BattleFrontId = battleFrontId; } }