Esempio n. 1
0
        protected virtual void OnTransferStatistics(
            PlayerMobile pm,
            PvPProfileHistoryEntry profileStats,
            PvPProfileHistoryEntry battleStats)
        {
            if (!Ranked || profileStats == null || battleStats == null)
            {
                return;
            }

            profileStats.Battles       += battleStats.Battles;
            profileStats.Wins          += battleStats.Wins;
            profileStats.Losses        += battleStats.Losses;
            profileStats.Kills         += battleStats.Kills;
            profileStats.Deaths        += battleStats.Deaths;
            profileStats.Resurrections += battleStats.Resurrections;
            profileStats.DamageTaken   += battleStats.DamageTaken;
            profileStats.DamageDone    += battleStats.DamageDone;
            profileStats.HealingTaken  += battleStats.HealingTaken;
            profileStats.HealingDone   += battleStats.HealingDone;

            foreach (var kvp in battleStats.MiscStats)
            {
                profileStats[kvp.Key] += kvp.Value;
            }
        }
Esempio n. 2
0
 protected virtual void OnTransferStatistics(PvPProfile profile, PvPProfileHistoryEntry stats)
 {
     if (Ranked && profile != null && stats != null)
     {
         stats.AddTo(profile.Statistics, true);
     }
 }
Esempio n. 3
0
        private void TransferStatistics(PlayerMobile pm, PvPProfileHistoryEntry e)
        {
            var profile = AutoPvP.EnsureProfile(pm);

            OnTransferStatistics(profile, e);
            OnTransferPoints(profile, e.Points);
        }
Esempio n. 4
0
        public virtual PvPProfileHistoryEntry EnsureEntry(PvPSeason season, bool replace = false)
        {
            PvPProfileHistoryEntry entry;

            if (!Entries.TryGetValue(season.Number, out entry) || entry == null || replace)
            {
                Entries[season.Number] = entry = new PvPProfileHistoryEntry(season.Number);
            }

            return(entry);
        }
Esempio n. 5
0
        public PvPProfileHistoryEntry GetStatistics(PlayerMobile pm)
        {
            var e = Statistics.GetValue(pm);

            if (e == null && IsMember(pm))
            {
                Statistics[pm] = e = new PvPProfileHistoryEntry(AutoPvP.CurrentSeason.Number);
            }

            return(e);
        }
Esempio n. 6
0
        public PvPProfileHistoryEntry EnsureStatistics(PlayerMobile pm, bool replace)
        {
            PvPProfileHistoryEntry entry;

            if (!Statistics.TryGetValue(pm, out entry) || entry == null || replace)
            {
                Statistics[pm] = entry = new PvPProfileHistoryEntry(AutoPvP.CurrentSeason.Number);
            }

            StatisticsCache[pm] = entry;

            return(entry);
        }
Esempio n. 7
0
        public void TransferStatistics(PlayerMobile pm)
        {
            if (!Ranked)
            {
                Statistics.Remove(pm);
                return;
            }

            PvPProfile             profile = AutoPvP.EnsureProfile(pm);
            PvPProfileHistoryEntry entry   = EnsureStatistics(pm);

            OnTransferStatistics(pm, profile.Statistics, entry);

            Statistics.Remove(pm);
        }
Esempio n. 8
0
        public virtual void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
                Entries = reader.ReadBlockDictionary(
                    r =>
                {
                    PvPProfileHistoryEntry e = r.ReadTypeCreate <PvPProfileHistoryEntry>(r);
                    return(new KeyValuePair <int, PvPProfileHistoryEntry>(e.Season, e));
                });
                break;
            }
        }
Esempio n. 9
0
        public PvPProfileHistoryEntry EnsureStatistics(PlayerMobile pm, bool replace)
        {
            PvPProfileHistoryEntry entry;

            if (!Statistics.TryGetValue(pm, out entry))
            {
                Statistics.Add(pm, entry = new PvPProfileHistoryEntry(AutoPvP.CurrentSeason.Number));
            }
            else if (entry == null || replace)
            {
                Statistics[pm] = entry = new PvPProfileHistoryEntry(AutoPvP.CurrentSeason.Number);
            }

            if (!StatisticsCache.ContainsKey(pm))
            {
                StatisticsCache.Add(pm, entry);
            }
            else
            {
                StatisticsCache[pm] = entry;
            }

            return(entry);
        }
Esempio n. 10
0
 public PvPStatistics(PlayerMobile m, PvPProfileHistoryEntry entry)
 {
     Player = m;
     Entry  = entry;
 }