Пример #1
0
        private async void RuneComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!QuickLoad) //Make loading quicker
            {
                return;
            }

            SpellBookPageDTO SelectedRunePage = new SpellBookPageDTO();
            int  i          = 0;
            bool HasChanged = false;

            foreach (SpellBookPageDTO RunePage in MyRunes.BookPages)
            {
                string RunePageName = RunePage.Name;
                if (RunePageName.StartsWith("@@"))
                {
                    RunePageName = "Rune Page " + ++i;
                }
                RunePage.Current = false;
                if (RunePageName == (string)RuneComboBox.SelectedItem)
                {
                    RunePage.Current = true;
                    SelectedRunePage = RunePage;
                    HasChanged       = true;
                    TextRange tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
                    tr.Text = "Selected " + RunePageName + " as Rune Page" + Environment.NewLine;
                    tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White);
                }
            }
            if (HasChanged)
            {
                await Client.PVPNet.SelectDefaultSpellBookPage(SelectedRunePage);
            }
        }
Пример #2
0
 private void LoadPage(SpellBookPageDTO page)
 {
     this.page        = page;
     unedited         = new List <SlotEntry>(page.SlotEntries);
     Changed.Text     = "";
     unsaved          = false;
     PageNameBox.Text = page.Name;
     UpdateRunes();
     Session.Current.Account.SelectRunePage(page);
 }
Пример #3
0
        public async Task <SpellBookPageDTO> SelectDefaultSpellBookPage(SpellBookPageDTO spellBookPage)
        {
            int Id = Invoke("spellBookService", "selectDefaultSpellBookPage", new object[] { spellBookPage.GetBaseTypedObject() });

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }
            TypedObject      messageBody = results[Id].GetTO("data").GetTO("body");
            SpellBookPageDTO result      = new SpellBookPageDTO(messageBody);

            results.Remove(Id);
            return(result);
        }
Пример #4
0
 private void RunePageListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     foreach (SpellBookPageDTO SpellPage in Client.LoginPacket.AllSummonerData.SpellBook.BookPages)
     {
         if (SpellPage.Current)
         {
             SpellPage.Current = false;
         }
     }
     Client.LoginPacket.AllSummonerData.SpellBook.BookPages[RunePageListBox.SelectedIndex].Current = true;
     SelectedBook     = Client.LoginPacket.AllSummonerData.SpellBook.BookPages[RunePageListBox.SelectedIndex];
     RuneTextBox.Text = SelectedBook.Name;
     RefreshAvailableRunes();
     RenderRunes();
 }
Пример #5
0
        /// <summary>
        /// Selects a rune page as the default selected page for your account and
        /// updates the contents of the local and server-side spell books
        /// </summary>
        /// <param name="page">The page to select</param>
        public async void SelectRunePage(SpellBookPageDTO page)
        {
            if (page == SelectedRunePage)
            {
                return;
            }

            foreach (var item in Runes.BookPages)
            {
                item.Current = false;
            }
            page.Current     = true;
            SelectedRunePage = page;
            await RiotServices.SpellBookService.SelectDefaultSpellBookPage(page);

            await RiotServices.SpellBookService.SaveSpellBook(Runes);
        }
Пример #6
0
        /// 53.)
        public void SelectDefaultSpellBookPage(SpellBookPageDTO spellBookPage, SpellBookPageDTO.Callback callback)
        {
            SpellBookPageDTO cb = new SpellBookPageDTO(callback);

            InvokeWithCallback("spellBookService", "selectDefaultSpellBookPage", new object[] { spellBookPage.GetBaseTypedObject() }, cb);
        }
Пример #7
0
 /// <summary>
 /// Selects a rune page for use
 /// </summary>
 /// <param name="SpellbookPage">The spellbook page the player wants to use</param>
 /// <returns>The selected spellbook page</returns>
 public static Task <SpellBookPageDTO> SelectDefaultSpellBookPage(SpellBookPageDTO SpellbookPage)
 {
     return(InvokeAsync <SpellBookPageDTO>("spellBookService", "selectDefaultSpellBookPage", SpellbookPage));
 }
Пример #8
0
 private static SpellBookPageDTO ToSpellBookPage(InventoryHelper.RuneSetup setup)
 {
     List<SlotEntry> slotEntries = new List<SlotEntry>();
     IGrouping<RuneType, InventoryHelper.Rune>[] array = (
         from x in (IEnumerable<InventoryHelper.Rune>)setup.Runes
         group x by InventoryHelper.GetRuneType(x.Id) into x
         orderby x.Key
         select x).ToArray<IGrouping<RuneType, InventoryHelper.Rune>>();
     for (int i = 0; i < (int)array.Length; i++)
     {
         IGrouping<RuneType, InventoryHelper.Rune> runeTypes = array[i];
         RuneType key = runeTypes.Key;
         InventoryHelper.Rune[] runeArray = runeTypes.ToArray<InventoryHelper.Rune>();
         int num = (byte)key * 9 + (byte)RuneType.Yellow;
         for (int j = 0; j < (int)runeArray.Length; j++)
         {
             InventoryHelper.Rune rune = runeArray[j];
             for (int k = 0; k < rune.Count; k++)
             {
                 SlotEntry slotEntry = new SlotEntry()
                 {
                     RuneId = rune.Id,
                     RuneSlotId = num
                 };
                 slotEntries.Add(slotEntry);
                 num++;
             }
         }
     }
     SpellBookPageDTO spellBookPageDTO = new SpellBookPageDTO()
     {
         PageId = setup.Id,
         Name = setup.Name,
         SlotEntries = slotEntries.ToList<SlotEntry>(),
         Current = true
     };
     return spellBookPageDTO;
 }
Пример #9
0
 public static async Task<object> GetRuneSetups(string realm, double summonerId)
 {
     RiotAccount[] all = JsApiService.AccountBag.GetAll();
     RiotAccount riotAccount = JsApiService.AccountBag.Get(realm);
     SpellBookDTO spellBookDTO = await riotAccount.InvokeCachedAsync<SpellBookDTO>("spellBookService", "getSpellBook", summonerId);
     SpellBookDTO spellBookDTO1 = spellBookDTO;
     List<SpellBookPageDTO> bookPages = spellBookDTO1.BookPages;
     SpellBookPageDTO spellBookPageDTO = bookPages.FirstOrDefault<SpellBookPageDTO>((SpellBookPageDTO x) => x.Current);
     if (spellBookPageDTO == null)
     {
         spellBookPageDTO = new SpellBookPageDTO();
     }
     SpellBookPageDTO spellBookPageDTO1 = spellBookPageDTO;
     bool flag = all.Any<RiotAccount>((RiotAccount x) =>
     {
         if (!string.Equals(x.RealmId, realm, StringComparison.OrdinalIgnoreCase))
         {
             return false;
         }
         return (double)x.SummonerId == summonerId;
     });
     double pageId = spellBookPageDTO1.PageId;
     List<SpellBookPageDTO> spellBookPageDTOs = spellBookDTO1.BookPages;
     IOrderedEnumerable<SpellBookPageDTO> pageId1 =
         from page in spellBookPageDTOs
         orderby page.PageId
         select page;
     object variable = new
     {
         Local = flag,
         ActiveId = pageId,
         Setups =
             from page in pageId1
             select new
             {
                 Id = page.PageId,
                 Name = page.Name,
                 Runes =
                     from entry in page.SlotEntries
                     group entry by entry.RuneId into entries
                     select new { Id = entries.Key, Count = entries.Count<SlotEntry>() }
             }
     };
     return variable;
 }
Пример #10
0
 public Task <SpellBookPageDTO> SelectDefaultSpellBookPage(SpellBookPageDTO spellbookPage)
 {
     return(this.InvokeAsync <SpellBookPageDTO>("spellBookService", "selectDefaultSpellBookPage", (object)spellbookPage));
 }
 private static SpellBookPageDTO ToSpellBookPage(InventoryHelper.RuneSetup setup)
 {
   List<SlotEntry> list = new List<SlotEntry>();
   foreach (IGrouping<RuneType, InventoryHelper.Rune> grouping in Enumerable.ToArray<IGrouping<RuneType, InventoryHelper.Rune>>((IEnumerable<IGrouping<RuneType, InventoryHelper.Rune>>) Enumerable.OrderBy<IGrouping<RuneType, InventoryHelper.Rune>, RuneType>(Enumerable.GroupBy<InventoryHelper.Rune, RuneType>((IEnumerable<InventoryHelper.Rune>) setup.Runes, (Func<InventoryHelper.Rune, RuneType>) (x => InventoryHelper.GetRuneType(x.Id))), (Func<IGrouping<RuneType, InventoryHelper.Rune>, RuneType>) (x => x.Key))))
   {
     RuneType key = grouping.Key;
     InventoryHelper.Rune[] runeArray = Enumerable.ToArray<InventoryHelper.Rune>((IEnumerable<InventoryHelper.Rune>) grouping);
     int num = (int) key * 9 + 1;
     for (int index1 = 0; index1 < runeArray.Length; ++index1)
     {
       InventoryHelper.Rune rune = runeArray[index1];
       for (int index2 = 0; index2 < rune.Count; ++index2)
       {
         list.Add(new SlotEntry()
         {
           RuneId = rune.Id,
           RuneSlotId = num
         });
         ++num;
       }
     }
   }
   SpellBookPageDTO spellBookPageDto = new SpellBookPageDTO();
   spellBookPageDto.PageId = setup.Id;
   spellBookPageDto.Name = setup.Name;
   spellBookPageDto.SlotEntries = Enumerable.ToList<SlotEntry>((IEnumerable<SlotEntry>) list);
   spellBookPageDto.Current = true;
   return spellBookPageDto;
 }
Пример #12
0
 /// <summary>
 /// Selects a rune page for use
 /// </summary>
 /// <param name="spellbookPage">The spellbook page the player wants to use</param>
 /// <returns>The selected spellbook page</returns>
 public Task <object> SelectDefaultSpellBookPage(SpellBookPageDTO spellbookPage)
 {
     return(InvokeAsync <object>("selectDefaultSpellBookPage", spellbookPage));
 }