Esempio n. 1
0
        public static Match GetMatch(MatchRecord matchRecord)
        {
            var response = (JToken)Get($"match/all/matchid/{matchRecord.Id}");

            if (response == null)
            {
                return(null);
            }

            return(new Match(response, matchRecord));
        }
Esempio n. 2
0
        public Match(JToken token, MatchRecord matchRecord)
        {
            var settings    = token[0].Single(t => CheckMatchId(t, matchRecord.Id));
            var inventories = token[1].Where(t => CheckMatchId(t, matchRecord.Id));
            var statistics  = token[2].Where(t => CheckMatchId(t, matchRecord.Id));
            var summary     = token[3].Single(t => CheckMatchId(t, matchRecord.Id));

            Id            = matchRecord.Id;
            Time          = TimeZoneInfo.ConvertTimeToUtc((DateTime)summary["mdt"], HonApi.TimeZone);
            Duration      = TimeSpan.FromSeconds((int)summary["time_played"]);
            Map           = ((string)summary["map"]).ToMap();
            PlayerResults = statistics.Select(t => new PlayerResult(t)).ToList();

            GameNight = this.CalcGameNight();
            Type      = this.CalcMatchType();
        }
Esempio n. 3
0
 public static bool CheckMatchId(JToken token, MatchRecord matchRecord)
 {
     return(token[0].Any(t => CheckMatchId(t, matchRecord.Id)));
 }