private static async Task CreateJson() { if (!Directory.Exists("pages")) { Directory.CreateDirectory("pages"); } var ret = new List <SimpleSearchItemModel>(); var current = 1; var max = -1; while (true) { var path = Path.Combine(Directory.GetCurrentDirectory(), "pages\\" + current + ".json"); if (!File.Exists(path)) { Console.WriteLine("Downloading page " + current + " from " + max); await Task.Delay(1000); var dl = await DownloadPageAsync(current); File.WriteAllText(path, dl, Encoding.UTF8); } var txt = File.ReadAllText(path); var json = JsonConvert.DeserializeObject <EADatabaseResultJson>(txt); max = json.totalPages; foreach (var item in json.items) { var obj = new SimpleSearchItemModel(); obj.Type = FUTSearchParameterType.Player; obj.ClubID = item.club.id; obj.LeagueID = item.league.id; obj.NationID = item.nation.id; obj.RareFlag = 0; obj.Rating = item.rating; var revID = ResourceIDManager.GetRevID(int.Parse(item.id)); var assetID = ResourceIDManager.GetAssetID(int.Parse(item.id)); obj.id = assetID; obj.RevisionID = revID; obj.c = item.commonName; obj.f = item.firstName; obj.l = item.lastName; obj.n = item.nation.id; obj.r = item.rating; ret.Add(obj); } current++; if (current > max) { break; } } File.WriteAllText("players.json", JsonConvert.SerializeObject(ret)); }
public override string BuildUriString() { var str = ""; str += "?type=player"; if (MaxBuyNow > 0) { str += "&maxb=" + MaxBuyNow; } if (MinBuyNow > 0) { str += "&minb=" + MinBuyNow; } if (MaxBid > 0) { str += "¯=" + MaxBid; } if (MinBid > 0) { str += "&micr=" + MinBid; } if (AssetID > 0) { var maskedDefId = ResourceIDManager.AssetIDToDefinitionID(AssetID, RevisionID); str += "&maskedDefId=" + maskedDefId; } if (!string.IsNullOrEmpty(Level)) { str += "&lev=" + Level; } if (!string.IsNullOrEmpty(Rare)) { str += "&rare=" + Rare; } return(str); }
public override string BuildUriString() { var str = ""; if (Type == FUTSearchParameterType.Player) { str += "?type=player"; } else if (Type == FUTSearchParameterType.Contract) { str += "?type=development"; } else if (Type == FUTSearchParameterType.Fitness) { str += "?type=development"; } else if (Type == FUTSearchParameterType.Healing) { str += "?type=development"; } else if (Type == FUTSearchParameterType.Training) { str += "?type=training"; } else if (Type == FUTSearchParameterType.Manager) { str += "?type=staff"; } else if (Type == FUTSearchParameterType.Kit) { str += "?type=clubInfo"; } else if (Type == FUTSearchParameterType.Badge) { str += "?type=clubInfo"; } else if (Type == FUTSearchParameterType.Stadium) { str += "?type=stadium"; } else if (Type == FUTSearchParameterType.Development) { str += "?type=development"; } else { str += "?type="; } if (ChemistryStyle != ChemistryStyle.All) { str += "&playStyle=" + (int)ChemistryStyle; } if (Position != Models.Position.Any) { str += "&pos=" + Position; } if (AssetID > 0) { var maskedDefId = ResourceIDManager.AssetIDToDefinitionID(AssetID, RevisionID); str += "&maskedDefId=" + maskedDefId; } if (MinBuyNow > 0) { str += "&minb=" + MinBuyNow; } if (BuyPrice > 0) { str += "&maxb=" + BuyPrice; } if (FUTSettings.Instance.UseRandomRequests) { var playerInfo = FUTItemManager.GetItemByAssetRevisionID(AssetID, RevisionID); if (playerInfo.Type == FUTSearchParameterType.Player) { str += RandomParameters(); } } return(str); }
public ItemStatistic() { this.RequiresAuthentication(); Get("/itemstatistic", args => { var model = new ItemStatisticModel(); model.ItemStatistic = new List <SimpleItemStatistic>(); var listItems = ItemListManager.GetFUTListItems(); var allProfits = FUTLogsDatabase.GetFUTProfitLogs(); var allTpItems = Fifa.Managers.BotManager.GetTradepileItems(); foreach (var futListItem in listItems) { var profits = new List <FUTItemProfit>(); var tpValue = 0; if (futListItem.ChemistryStyle == ChemistryStyle.All && futListItem.Position == Position.Any) { profits = allProfits.Where(x => x.AssetID == futListItem.AssetID && x.RevisionID == futListItem.RevisionID).ToList(); tpValue = (int)allTpItems.Where( x => ResourceIDManager.GetAssetID(x.itemData.resourceId) == futListItem.AssetID && ResourceIDManager.GetRevID(x.itemData.resourceId) == futListItem.RevisionID) .Sum(x => x.buyNowPrice * 0.95); } else if (futListItem.ChemistryStyle == ChemistryStyle.All && futListItem.Position != Position.Any) { profits = allProfits.Where(x => x.AssetID == futListItem.AssetID && x.RevisionID == futListItem.RevisionID && x.Position == futListItem.Position).ToList(); tpValue = (int)allTpItems.Where( x => ResourceIDManager.GetAssetID(x.itemData.resourceId) == futListItem.AssetID && ResourceIDManager.GetRevID(x.itemData.resourceId) == futListItem.RevisionID && x.itemData.preferredPosition == futListItem.Position) .Sum(x => x.buyNowPrice * 0.95); } else if (futListItem.ChemistryStyle != ChemistryStyle.All && futListItem.Position == Position.Any) { profits = allProfits.Where(x => x.AssetID == futListItem.AssetID && x.RevisionID == futListItem.RevisionID && x.ChemistryStyle == futListItem.ChemistryStyle).ToList(); tpValue = (int)allTpItems.Where( x => ResourceIDManager.GetAssetID(x.itemData.resourceId) == futListItem.AssetID && ResourceIDManager.GetRevID(x.itemData.resourceId) == futListItem.RevisionID && x.itemData.playStyle == (int)futListItem.ChemistryStyle) .Sum(x => x.buyNowPrice * 0.95); } else if (futListItem.ChemistryStyle != ChemistryStyle.All && futListItem.Position == Position.Any) { profits = allProfits.Where(x => x.AssetID == futListItem.AssetID && x.RevisionID == futListItem.RevisionID && x.ChemistryStyle == futListItem.ChemistryStyle && x.Position == futListItem.Position).ToList(); tpValue = (int)allTpItems.Where( x => ResourceIDManager.GetAssetID(x.itemData.resourceId) == futListItem.AssetID && ResourceIDManager.GetRevID(x.itemData.resourceId) == futListItem.RevisionID && x.itemData.playStyle == (int)futListItem.ChemistryStyle && x.itemData.preferredPosition == futListItem.Position) .Sum(x => x.buyNowPrice * 0.95); } var statistic = new SimpleItemStatistic(profits); statistic.TradepileValue = tpValue; statistic.ItemsLeftOnTradepile = profits.Count(x => x.SellTimestamp == 0); statistic.Name = futListItem.DisplayName; statistic.RevisionID = futListItem.RevisionID; statistic.AssetID = futListItem.AssetID; statistic.TotalSearched = futListItem.TimesSearched + 1; statistic.RPMProfit = (int)(statistic.TotalProfit / (futListItem.TimesSearched + 1)); model.ItemStatistic.Add(statistic); } return(View["ItemStatistic", model]); }); }