示例#1
0
 public StatsTableCreator_SummonerSpells(LeagueAPISettingsFile leagueAPISettingsFile) : base(leagueAPISettingsFile)
 {
     SummonerSpellCollection             = leagueAPISettingsFile.GetSummonerSpellCollection();
     AddDataToDictionaryAction           = AddSpellDataToDictionary;
     InsertExtraColumnsInDataTableAction = InsertExtraSpellColumnsInDataTable;
     GetEntityFullNameFromKey            = GetSpellFullNameFromKey;
 }
示例#2
0
 public StatsTableCreator_Items(LeagueAPISettingsFile leagueAPISettings) : base(leagueAPISettings)
 {
     ItemCollection                      = leagueAPISettings.GetItemCollection();
     AddDataToDictionaryAction           = AddItemDataToDictionary;
     InsertExtraColumnsInDataTableAction = InsertExtraItemColumnsInDataTable;
     GetEntityFullNameFromKey            = GetItemFullNameFromKey;
 }
示例#3
0
 public StatsTableCreator_Runes(LeagueAPISettingsFile leagueAPISettingsFile) : base(leagueAPISettingsFile)
 {
     RuneCollection                      = leagueAPISettingsFile.GetRuneCollection();
     AddDataToDictionaryAction           = AddRuneDataToDictionary;
     InsertExtraColumnsInDataTableAction = InsertExtraRuneColumnsInDataTable;
     GetEntityFullNameFromKey            = GetRuneFullNameFromKey;
 }
 public StatsTableCreator_Champions(LeagueAPISettingsFile leagueAPISettingsFile) : base(leagueAPISettingsFile)
 {
     ChampionCollection                  = leagueAPISettingsFile.GetChampionCollection();
     AddDataToDictionaryAction           = AddChampionDataToDictionary;
     InsertExtraColumnsInDataTableAction = InsertExtraChampionColumnsInDataTable;
     GetEntityFullNameFromKey            = GetChampionFullNameFromKey;
 }
 private void SetUpNonAPIClientSettings(LeagueAPISettingsFile leagueAPISettingsFile, string gameVersionToLookFor, int queueToLookFor)
 {
     LeagueAPISettingsFile = leagueAPISettingsFile;
     if (!Regex.IsMatch(gameVersionToLookFor, @"^\d+\.\d+$"))
     {
         throw new ArgumentException(@"Game version argument must be like '^\d+\.\d+$'");
     }
     GameVersionToLookFor = gameVersionToLookFor;
     QueueToLookFor       = queueToLookFor;
 }
 public LeagueAPI_DataCollector(LeagueAPIClient leagueAPIClient, LeagueAPISettingsFile leagueAPISettingsFile, string gameVersionToLookFor, int queueToLookFor)
 {
     LeagueAPIClient = leagueAPIClient;
     SetUpNonAPIClientSettings(leagueAPISettingsFile, gameVersionToLookFor, queueToLookFor);
 }
 public LeagueAPI_DataCollector(string apiKey, LeagueAPISettingsFile leagueAPISettingsFile, string gameVersion, int queue)
 {
     LeagueAPIClient = new LeagueAPIClient(apiKey);
     SetUpNonAPIClientSettings(leagueAPISettingsFile, gameVersion, queue);
 }
        private void WriteItemSetJsonFile(List <Champion> champs)
        {
            // put champs file here
            ItemSet set = new ItemSet
            {
                title          = $"ItemSet_{ExtensionsAndStaticFunctions.GetDateTimeNowString()}",
                associatedMaps = new List <int>()
                {
                    11, 12
                },
                associatedChampions = new List <object>(),
                blocks = new List <ItemSet_Block>()
            };
            ItemSet_Block mythics50PlusWR = new ItemSet_Block()
            {
                type = "Mythics 50+ WR", items = new List <Block_Item>()
            };

            set.blocks.Add(mythics50PlusWR);
            ItemSet_Block mythics50MinusWR = new ItemSet_Block()
            {
                type = "Mythics 50- WR", items = new List <Block_Item>()
            };

            set.blocks.Add(mythics50MinusWR);
            ItemSet_Block legendaries50PlusWR = new ItemSet_Block()
            {
                type = "Legendaries 50+ WR", items = new List <Block_Item>()
            };

            set.blocks.Add(legendaries50PlusWR);
            ItemSet_Block legendaries50MinusWR = new ItemSet_Block()
            {
                type = "Legendaries 50- WR", items = new List <Block_Item>()
            };

            set.blocks.Add(legendaries50MinusWR);

            DataTable stats = GetItemStatsFromChamps(champs);
            List <ItemSet_ItemEntry> itemEntries = new List <ItemSet_ItemEntry>();

            ItemCollection itemCollection = LeagueAPISettingsFile.GetItemCollection();


            for (int i = 0; i < stats.Rows.Count; i++)
            {
                DataRow row = stats.Rows[i];
                int     id  = (int)row[10];
                if (!itemCollection.data.ContainsKey(id))
                {
                    continue;
                }

                ItemSet_ItemEntry itemEntry = new ItemSet_ItemEntry()
                {
                    id = id, name = (string)row[0], winRate = (double)row[5], moreThan2000G = (bool)row[7]
                };
                if (!itemEntry.moreThan2000G)
                {
                    continue;
                }

                itemEntries.Add(itemEntry);
            }

            itemEntries = itemEntries.OrderByDescending(i => i.winRate).ToList();
            foreach (var itemEntry in itemEntries)
            {
                Block_Item item = new Block_Item()
                {
                    id = itemEntry.id.ToString(), count = 1
                };
                if (itemEntry.winRate > 50)
                {
                    if (Globals.MythicItems.Contains((ItemEnum)itemEntry.id))
                    {
                        mythics50PlusWR.items.Add(item);
                    }
                    else
                    {
                        legendaries50PlusWR.items.Add(item);
                    }
                }
                else
                {
                    if (Globals.MythicItems.Contains((ItemEnum)itemEntry.id))
                    {
                        mythics50MinusWR.items.Add(item);
                    }
                    else
                    {
                        legendaries50MinusWR.items.Add(item);
                    }
                }
            }
            File.WriteAllText($"{LeagueAPISettingsFile.APIResultsPath}\\{$@"itemSet_{ExtensionsAndStaticFunctions.GetDateTimeNowString()}.json"}", JsonConvert.SerializeObject(set, Formatting.None));
        }
 protected StatsTableCreator(LeagueAPISettingsFile leagueAPISettingsFile)
 {
     LeagueAPISettingsFile = leagueAPISettingsFile;
 }