예제 #1
0
        public void SetMid(DSReplay replay, string Breakpoint)
        {
            double bpgameloop = BreakpointMid[Breakpoint];

            if (replay.Middle == null || !replay.Middle.Any())
            {
                DSPlayer mpl1 = replay.DSPlayer.FirstOrDefault(f => f.TEAM == 0);
                if (mpl1 != null)
                {
                    DbBreakpoint bp = mpl1.Breakpoints.FirstOrDefault(x => x.Breakpoint == Breakpoint);
                    if (bp != null)
                    {
                        Mid[0] = Math.Round(bp.Mid * 100 / bpgameloop, 2).ToString("00.00") + "%";
                    }
                }
                DSPlayer mpl2 = replay.DSPlayer.FirstOrDefault(f => f.TEAM == 1);
                if (mpl2 != null)
                {
                    DbBreakpoint bp = mpl2.Breakpoints.FirstOrDefault(x => x.Breakpoint == Breakpoint);
                    if (bp != null)
                    {
                        Mid[1] = Math.Round(bp.Mid * 100 / bpgameloop, 2).ToString("00.00") + "%";
                    }
                }
            }
            else
            {
                int midt1 = replay.GetMiddle((int)bpgameloop, 0);
                int midt2 = replay.GetMiddle((int)bpgameloop, 1);
                Mid[0] = Math.Round(midt1 * 100 / bpgameloop, 2).ToString("00.00") + "%";
                Mid[1] = Math.Round(midt2 * 100 / bpgameloop, 2).ToString("00.00") + "%";
            }
        }
예제 #2
0
        public void Init(DSReplay replay, DSoptions _options)
        {
            DSPlayer pl = null;

            if (DSdata.Config.Players.Any())
            {
                List <string> activePlayers = _options.Players.Where(x => x.Value == true).Select(s => s.Key).ToList();
                pl = replay.DSPlayer.Where(x => activePlayers.Contains(x.NAME)).FirstOrDefault();
            }
            else
            {
                pl = replay.DSPlayer.Where(x => x.NAME.Length == 64).FirstOrDefault();
            }



            Id       = $"ID {replay.ID} - {replay.GAMETIME.ToString("yyyy/MM/dd")}";
            Duration = "Duration " + (TimeSpan.FromSeconds(replay.DURATION).Hours > 0 ? TimeSpan.FromSeconds(replay.DURATION).ToString(@"hh\:mm\:ss") + " h" : TimeSpan.FromSeconds(replay.DURATION).ToString(@"mm\:ss") + " min");
            if (pl != null)
            {
                Player = "Player #" + pl.REALPOS;
            }
            MVP  = "MVP #" + replay.DSPlayer.Where(x => x.KILLSUM == replay.MAXKILLSUM).First().REALPOS;
            Mode = "Mode: " + replay.GAMEMODE.Substring(8);



            BreakpointMid        = new Dictionary <string, double>(DSdata.BreakpointMid);
            BreakpointMid["ALL"] = replay.DURATION * 22.4;
            SetMid(replay, _options.GameBreakpoint);
            _options.GameBreakpoint = "ALL";
            foreach (DSPlayer bpl in replay.DSPlayer)
            {
                HashSet <string> ups = new HashSet <string>();
                Upgrades[bpl.REALPOS] = new Dictionary <string, HashSet <string> >();
                Units[bpl.REALPOS]    = new Dictionary <string, Dictionary <string, int> >();
                List <string> bpdelete = new List <string>();
                foreach (var ent in BreakpointMid.OrderBy(o => o.Value))
                {
                    if (ent.Value > BreakpointMid["ALL"])
                    {
                        bpdelete.Add(ent.Key);
                        continue;
                    }
                    ups.UnionWith(GetUpgrades(bpl.Breakpoints.FirstOrDefault(f => f.Breakpoint == ent.Key)).ToHashSet());
                    Upgrades[bpl.REALPOS][ent.Key] = new HashSet <string>(ups);
                    Units[bpl.REALPOS][ent.Key]    = new Dictionary <string, int>(GetUnits(bpl.Breakpoints.FirstOrDefault(f => f.Breakpoint == ent.Key)));
                }
                foreach (string dkey in bpdelete)
                {
                    BreakpointMid.Remove(dkey);
                }
            }
        }
예제 #3
0
 public DbMiddle(int gameloop, int team, DSReplay replay) : this()
 {
     Gameloop = gameloop;
     Team     = (byte)team;
     Replay   = replay;
 }