public ActionResult Index(string steamId = "76561198257065483") { var modelFaceitmatch = new Faceitmatch(); var _faceitAbstraction = new SimpleFaceitAverageStats(); var _client = new SimpleFaceitLiveMatch(); var _Lifetime = new SimpleFaceitLifetimeStats(); var providerFaceitDetails = _faceitAbstraction.FaceitUserDetails(steamId); // Get FaceitGUID & FaceitNickname if (providerFaceitDetails != null) { modelFaceitmatch = _client.getFaceitMatchDetails(providerFaceitDetails.Item1, providerFaceitDetails.Item2); FacaeitLifetimeStats LifetimeStats = _Lifetime.getFaceitLifetimeStats(providerFaceitDetails.Item1, providerFaceitDetails.Item2); FaceitUserStats providerFaceitStats = _faceitAbstraction.FaceitAvgElo(providerFaceitDetails.Item1); if (modelFaceitmatch != null) { Plugin = new Streamplugin(modelFaceitmatch, LifetimeStats, providerFaceitStats); Plugin.Live = 1; } else { Plugin = new Streamplugin(null, LifetimeStats, providerFaceitStats); Plugin.Live = 0; } return(View(Plugin)); } else { ViewData["Name"] = steamId; return(View("noFaceit")); } }
// GET: /<controller>/ public IActionResult Index(string steamId = "76561198257065483") { var modelFaceitmatch = new Faceitmatch(); var _faceitAbstraction = new SimpleFaceitAverageStats(); var _client = new SimpleFaceitLiveMatch(); var providerFaceitDetails = _faceitAbstraction.FaceitUserDetails(steamId); // Get FaceitGUID & FaceitNickname if (providerFaceitDetails != null) { modelFaceitmatch = _client.getFaceitMatchDetails(providerFaceitDetails.Item1, providerFaceitDetails.Item2); if (modelFaceitmatch != null) { ViewData["name"] = providerFaceitDetails.Item2; ViewData["enemyTeamElo"] = modelFaceitmatch.enemyTeamElo; ViewData["enemyTeamName"] = modelFaceitmatch.enemyTeamName; ViewData["enemyTeamWinElo"] = modelFaceitmatch.enemyTeamWinElo; ViewData["ownTeamElo"] = modelFaceitmatch.ownTeamElo; ViewData["ownTeamName"] = modelFaceitmatch.ownTeamName; ViewData["ownTeamWinElo"] = modelFaceitmatch.ownTeamWinElo; return(View()); } else { ViewData["name"] = providerFaceitDetails.Item2; return(View("noLive")); } } else { ViewData["Name"] = steamId; return(View("noFaceit")); } }
/// <summary> /// /// </summary> /// <param name="playerID"></param> /// <param name="nickname"></param> /// <returns>Last FaceitMatch</returns> public FaceitLastMatch[] getFaceitLastMatchDetails(string playerID, string nickname) { var model = new Faceitmatch(); var _faceitApi = new Faceitapi(); FaceitLastMatch[] LastMatch = _faceitApi.getFaceitHistory(playerID); return(LastMatch); }
/// <summary> /// /// </summary> /// <param name="faceitId"></param> /// <param name="historyLength"></param> /// <param name="calculationLength"></param> /// <returns></returns> public Faceitmatch getFaceitMatchDetails(string playerID, string nickname) { var model = new Faceitmatch(); var _faceitApi = new Faceitapi(); FaceitLiveMatchModel LiveMatch = _faceitApi.getFaceitLiveMatch(playerID); var x = LiveMatch; if (LiveMatch.payload.STATE != null) { var test = LiveMatch.payload.STATE[0].teams.faction1.roster; int ownNumber = (CheckFaction(LiveMatch.payload.STATE[0].teams.faction1.roster, playerID)) ? 1 : 2; int enemyNumber = (ownNumber == 1) ? 2 : 1; int Rostercount = LiveMatch.payload.STATE[0].teams.faction1.roster.Count; foreach (dynamic User in LiveMatch.payload.STATE[0].teams.faction1.roster) { if (ownNumber == 1) { var FaceitUs = new FaceitUserInfos(); model.ownTeamName = LiveMatch.payload.STATE[0].teams.faction1.name; model.ownTeamElo += _faceitApi.getFaceitUserDetails(User.nickname).payload.games.csgo.faceit_elo; } else { var FaceitUs = new FaceitUserInfos(); model.ownTeamName = LiveMatch.payload.STATE[0].teams.faction2.name; model.ownTeamElo += _faceitApi.getFaceitUserDetails(User.nickname).payload.games.csgo.faceit_elo; } } foreach (dynamic User in LiveMatch.payload.STATE[0].teams.faction2.roster) { if (ownNumber == 2) { var FaceitUs = new FaceitUserInfos(); model.enemyTeamName = LiveMatch.payload.STATE[0].teams.faction1.name; model.enemyTeamElo += _faceitApi.getFaceitUserDetails(User.nickname).payload.games.csgo.faceit_elo; } else { var FaceitUs = new FaceitUserInfos(); model.enemyTeamName = LiveMatch.payload.STATE[0].teams.faction2.name; model.enemyTeamElo += _faceitApi.getFaceitUserDetails(User.nickname).payload.games.csgo.faceit_elo; } } model.ownTeamElo = model.ownTeamElo / Rostercount; model.enemyTeamElo = model.enemyTeamElo / Rostercount; model.ownTeamWinElo = calculateRating(model.ownTeamElo, model.enemyTeamElo); model.enemyTeamWinElo = 50 - model.ownTeamWinElo; return(model); } return(null); }
public FacaeitLifetimeStats getFaceitLifetimeStats(string faceitId, string faceitName) { var model = new Faceitmatch(); var _faceitApi = new Faceitapi(); FacaeitLifetimeStats LastMatch = _faceitApi.getFaceitLifetimeStats(faceitId); LastMatch.lifetime.Elo = _faceitApi.getFaceitUserDetails(faceitName).payload.games.csgo.faceit_elo; LastMatch.lifetime.Level = _faceitApi.getFaceitUserDetails(faceitName).payload.games.csgo.skill_level; return(LastMatch); }
public Streamplugin(Faceitmatch model, FacaeitLifetimeStats lifetime, FaceitUserStats stats) : this() { if (model != null) { _ownTeamName = model.ownTeamName; _ownTeamElo = model.ownTeamElo; _ownTeamWinElo = model.ownTeamWinElo; _enemyTeamName = model.enemyTeamName; _enemyTeamElo = model.enemyTeamElo; _enemyTeamWinElo = model.enemyTeamWinElo; } _elo = lifetime.lifetime.Elo; _WonMatches = lifetime.lifetime.WonMatches; _PlayedMatches = lifetime.lifetime.PlayedMatches; _WinPercentage = lifetime.lifetime.WinPercentage; _avgKills = stats.avgKills; _avgHs = stats.avgHs; _avgKd = stats.avgKd; _avgKr = stats.avgKr; }