public ApiPlayer(PlayerView db) { Id = db.PlayerId; TeamId = db.TeamId; LastUpdate = db.Timestamp; Position = db.Position; RosterIndex = db.RosterIndex; Data = db.Data; Stars = ((IPlayerData)db).Stars; Forbidden = db.IsForbidden; }
// public string perm_attr { get; set; } // public string seas_attr { get; set; } // public string week_attr { get; set; } // public string game_attr { get; set; } public SqlitePlayerBase(JsonElement data) { var stars = PlayerStars.CalculateStars(data); name = data.GetProperty("name").GetString(); batting_stars = stars.Batting; pitching_stars = stars.Pitching; baserunning_stars = stars.Baserunning; defense_stars = stars.Defense; anticapitalism = data.Value <double>("anticapitalism"); base_thirst = data.Value <double>("baseThirst"); buoyancy = data.Value <double>("buoyancy"); chasiness = data.Value <double>("chasiness"); coldness = data.Value <double>("coldness"); continuation = data.Value <double>("continuation"); cinnamon = data.Value <double?>("cinnamon"); divinity = data.Value <double>("divinity"); ground_friction = data.Value <double>("groundFriction"); indulgence = data.Value <double>("indulgence"); laserlikeness = data.Value <double>("laserlikeness"); martyrdom = data.Value <double>("martyrdom"); moxie = data.Value <double>("moxie"); musclitude = data.Value <double>("musclitude"); omniscience = data.Value <double>("omniscience"); overpowerment = data.Value <double>("overpowerment"); patheticism = data.Value <double>("patheticism"); pressurization = data.Value <double>("pressurization"); ruthlessness = data.Value <double>("ruthlessness"); shakespearianism = data.Value <double>("shakespearianism"); suppression = data.Value <double>("suppression"); tenaciousness = data.Value <double>("tenaciousness"); thwackability = data.Value <double>("thwackability"); tragicness = data.Value <double>("tragicness"); unthwackability = data.Value <double>("unthwackability"); watchfulness = data.Value <double>("watchfulness"); bat = data.Value <string>("bat").NullIfEmpty(); armor = data.Value <string>("armor").NullIfEmpty(); ritual = data.Value <string>("ritual").NullIfEmpty(); coffee = data.Value <int?>("coffee"); blood = data.Value <int?>("blood"); peanut_allergy = data.Value <bool?>("peanutAllergy"); total_fingers = data.Value <int>("totalFingers"); soul = data.Value <int>("soul"); // perm_attr = string.Join(";", data.Value("permAttr", new string[0])); // seas_attr = string.Join(";", data.Value("seasAttr", new string[0])); // week_attr = string.Join(";", data.Value("weekAttr", new string[0])); // game_attr = string.Join(";", data.Value("gameAttr", new string[0])); }