public SpellBookDTO GetSpellBook(double summonerId) { int Id = Invoke("spellBookService", "getSpellBook", new object[] { summonerId }); while (!results.ContainsKey(Id)) System.Threading.Thread.Sleep(10); TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); SpellBookDTO result = new SpellBookDTO(messageBody); results.Remove(Id); return result; }
/// <summary> /// Initializes all data required for champion select. Also retrieves latest GameDTO /// </summary> private async void StartChampSelect() { //Force client to popup once in champion select Client.FocusClient(); //Get champions and sort alphabetically ChampList = new List<ChampionDTO>(Client.PlayerChampions); ChampList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName)); //Retrieve masteries and runes MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook; MyRunes = Client.LoginPacket.AllSummonerData.SpellBook; //Put masteries & runes into combo boxes int i = 0; foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages) { string MasteryPageName = MasteryPage.Name; //Stop garbage mastery names if (MasteryPageName.StartsWith("@@")) { MasteryPageName = "Mastery Page " + ++i; } MasteryComboBox.Items.Add(MasteryPageName); if (MasteryPage.Current) MasteryComboBox.SelectedValue = MasteryPageName; } i = 0; foreach (SpellBookPageDTO RunePage in MyRunes.BookPages) { string RunePageName = RunePage.Name; //Stop garbage rune names if (RunePageName.StartsWith("@@")) { RunePageName = "Rune Page " + ++i; } RuneComboBox.Items.Add(RunePageName); if (RunePage.Current) RuneComboBox.SelectedValue = RunePageName; } //Allow runes & masteries to be changed QuickLoad = true; //Signal to the server we are in champion select await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT"); //Retrieve the latest GameDTO GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn); //Find the game config for timers configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId); if (configType == null) //Invalid config... abort! { Client.QuitCurrentGame(); MessageOverlay overlay = new MessageOverlay(); overlay.MessageTextBox.Text = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Snowl [https://github.com/Snowl/LegendaryClient/issues/new]"; overlay.MessageTitle.Content = "Invalid Config"; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } counter = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide CountdownTimer = new System.Windows.Forms.Timer(); CountdownTimer.Tick += new EventHandler(CountdownTimer_Tick); CountdownTimer.Interval = 1000; // 1 second CountdownTimer.Start(); LatestDto = latestDTO; //Get the champions for the other team to ban & sort alpabetically ChampionBanInfoDTO[] ChampsForBan = await Client.PVPNet.GetChampionsForBan(); ChampionsForBan = new List<ChampionBanInfoDTO>(ChampsForBan); ChampionsForBan.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName)); //Join champion select chatroom string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false); Chatroom = Client.ConfManager.GetRoom(new jabber.JID(JID)); Chatroom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name; Chatroom.OnRoomMessage += Chatroom_OnRoomMessage; Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin; Chatroom.Join(latestDTO.RoomPassword); //Render our champions RenderChamps(false); //Start recieving champ select ChampSelect_OnMessageReceived(this, latestDTO); Client.OnFixChampSelect += ChampSelect_OnMessageReceived; Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived; }
//gameService tradeChampion exists... not sure if in use though public SpellBookDTO SaveSpellBook(SpellBookDTO Spellbook) { int Id = Invoke("spellBookService", "saveSpellBook", new object[] { Spellbook.GetBaseTypedObject() }); while (!results.ContainsKey(Id)) System.Threading.Thread.Sleep(10); TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); SpellBookDTO result = new SpellBookDTO(messageBody); results.Remove(Id); return result; }
/// 36.) public void GetSpellBook(double summonerId, SpellBookDTO.Callback callback) { SpellBookDTO cb = new SpellBookDTO(callback); InvokeWithCallback("spellBookService", "getSpellBook", new object[] { summonerId }, cb); }
public async Task<SpellBookDTO> GetSpellBook(Double summonerId) { int Id = Invoke("spellBookService", "getSpellBook", new object[] { summonerId }); while (!results.ContainsKey(Id)) await Task.Delay(10); TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); SpellBookDTO result = new SpellBookDTO(messageBody); results.Remove(Id); return result; }
//gameService tradeChampion exists... not sure if in use though public async Task<SpellBookDTO> SaveSpellBook(SpellBookDTO Spellbook) { int Id = Invoke("spellBookService", "saveSpellBook", new object[] { Spellbook.GetBaseTypedObject() }); while (!results.ContainsKey(Id)) await Task.Delay(10); TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); SpellBookDTO result = new SpellBookDTO(messageBody); results.Remove(Id); return result; }
//TeamBuilder is just a little insane. This code is very messy too. :P public TeamBuilderPage(bool iscreater) { InitializeComponent(); if (iscreater == false) { Invite.IsEnabled = false; } //Start teambuilder CallWithArgs(Guid.NewGuid().ToString(), "cap", "retrieveFeatureToggles", "{}"); MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook; MyRunes = Client.LoginPacket.AllSummonerData.SpellBook; //StartTeambuilder(); LoadStats(); Client.PVPNet.OnMessageReceived += PVPNet_OnMessageReceived; AddPlayer(); }
private void StartTeambuilder() { ListViewItem item = new ListViewItem(); Image skinImage = new Image(); ChampList = new List<ChampionDTO>(Client.PlayerChampions); champions Champion = champions.GetChampion(ChampionId); string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", Champion.portraitPath); //Retrieve masteries and runes MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook; MyRunes = Client.LoginPacket.AllSummonerData.SpellBook; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { //Allow all champions to be selected (reset our modifications) ListViewItem[] ChampionArray = new ListViewItem[ChampionSelectListView.Items.Count]; ChampionSelectListView.Items.CopyTo(ChampionArray, 0); foreach (ListViewItem y in ChampionArray) { y.IsHitTestVisible = true; y.Opacity = 1; } })); foreach (ChampionDTO champ in ChampList) { if (champ.ChampionId == ChampionId) { foreach (ChampionSkinDTO skin in champ.ChampionSkins) { if (skin.Owned) { item = new ListViewItem(); skinImage = new Image(); uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", championSkins.GetSkin(skin.SkinId).portraitPath); skinImage.Source = Client.GetImage(uriSource); skinImage.Width = 191; skinImage.Stretch = Stretch.UniformToFill; item.Tag = skin.SkinId; item.Content = skinImage; SkinSelectListView.Items.Add(item); } } } } skinImage.Source = Client.GetImage(uriSource); skinImage.Width = 191; skinImage.Stretch = Stretch.UniformToFill; item.Tag = "0:" + ChampionId; //Hack item.Content = skinImage; SkinSelectListView.Items.Add(item); }
private async void StartChampSelect() { Client.FocusClient(); Champions = Client.PlayerChampions; MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook; MyRunes = Client.LoginPacket.AllSummonerData.SpellBook; int i = 0; foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages) { string MasteryPageName = MasteryPage.Name; if (MasteryPageName.StartsWith("@@")) { MasteryPageName = "Mastery Page " + ++i; } MasteryComboBox.Items.Add(MasteryPageName); if (MasteryPage.Current) MasteryComboBox.SelectedValue = MasteryPageName; } i = 0; foreach (SpellBookPageDTO RunePage in MyRunes.BookPages) { string RunePageName = RunePage.Name; if (RunePageName.StartsWith("@@")) { RunePageName = "Rune Page " + ++i; } RuneComboBox.Items.Add(RunePageName); if (RunePage.Current) RuneComboBox.SelectedValue = RunePageName; } QuickLoad = true; await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT"); GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn); configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId); if (configType == null) //Invalid config... abort! { Client.PVPNet.OnMessageReceived -= ChampSelect_OnMessageReceived; await Client.PVPNet.QuitGame(); Client.ClearPage(this); Client.SwitchPage(new MainPage()); MessageOverlay overlay = new MessageOverlay(); overlay.MessageTextBox.Text = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Snowl [https://github.com/Snowl/LegendaryClient/issues/new]"; overlay.MessageTitle.Content = "Invalid Config"; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } counter = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide CountdownTimer = new System.Windows.Forms.Timer(); CountdownTimer.Tick += new EventHandler(CountdownTimer_Tick); CountdownTimer.Interval = 1000; // 1 second CountdownTimer.Start(); LatestDto = latestDTO; string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false); Chatroom = Client.ConfManager.GetRoom(new jabber.JID(JID)); Chatroom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name; Chatroom.OnRoomMessage += Chatroom_OnRoomMessage; Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin; Chatroom.Join(latestDTO.RoomPassword); List<ChampionDTO> champList = new List<ChampionDTO>(Champions); champList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName)); foreach (ChampionDTO champ in champList) { if (champ.Owned || champ.FreeToPlay) { MyChamps.Add(champ); //Add to ListView ListViewItem item = new ListViewItem(); ChampionImage championImage = new ChampionImage(); championImage.ChampImage.Source = champions.GetChampion(champ.ChampionId).icon; if (champ.FreeToPlay) championImage.FreeToPlayLabel.Visibility = Visibility.Visible; championImage.Width = 64; championImage.Height = 64; item.Tag = champ.ChampionId; item.Content = championImage.Content; ChampionSelectListView.Items.Add(item); } } ChampSelect_OnMessageReceived(this, latestDTO); Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived; }