public virtual void SendMessage(string message) { dynamic json = new JObject(); json.body = message; QsoApi.Call("/lol-chat/v1/conversations/{0}/messages", HttpMethod.Post, json.ToString(), ID); }
/// <summary> /// Sets the users status message. The client maximum is 25 characters, however the endpoint maximum is 50 characters. /// </summary> public void SetStatusMessage(string message) { dynamic json = new JObject(); json.statusMessage = message; QsoApi.Call("/lol-chat/v1/me", HttpMethod.Put, json.ToString()); }
public void SetWardSkin(int id) { dynamic json = new JObject(); json.wardSkinId = id; QsoApi.Call("/lol-champ-select/v1/session/my-selection", new HttpMethod("PATCH"), json.ToString()); }
public void SetAvailability(string avail) { dynamic json = new JObject(); json.availability = avail; QsoApi.Call("/lol-chat/v1/me", HttpMethod.Put, json.ToString()); }
private void updateLootBtn_Click(object sender, EventArgs e) { SetLootInput(false); uiLoot = QsoApi.GetMyPlayerLoot(); allLootCombo.DataSource = uiLoot; SetLootInput(true); }
private void inviteSummonerBtn_Click(object sender, EventArgs e) { Lobby lobby = null; try { lobby = QsoApi.GetMyLobby(); } catch (QsoEndpointException) { } Summoner sum = null; try { var found = QsoApi.GetSummonerByName(inviteSummonerTextbox.Text); if (found.Length <= 0) { MessageBox.Show("Unable to find summoner", "Missing", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } sum = found[0]; } catch (QsoEndpointException ex) { MessageBox.Show($"Error trying to find summoner:\n{ex.ErrorResponse.Message}", "Endpoint Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } lobby.Invite(sum.ID); }
private void addBotBtn_Click(object sender, EventArgs e) { if (botChampionCombo.SelectedItem == null || botTeamCombo.SelectedItem == null || botDifficultyCombo.SelectedItem == null) { return; } Lobby lobby = null; try { lobby = QsoApi.GetMyLobby(); } catch (QsoEndpointException) { return; // lobby doesn't exist, no need for user response. } try { lobby.AddBot((ChampionID)Enum.Parse(typeof(ChampionID), (string)botChampionCombo.SelectedItem), (TeamID)Enum.Parse(typeof(TeamID), (string)botTeamCombo.SelectedItem), (string)botDifficultyCombo.SelectedItem); } catch (QsoEndpointException ex) { MessageBox.Show($"Unable to add bot to lobby with such configuration:\n{ex.ErrorResponse.Message}", "Endpoint Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void SetSpell2(SummonerSpell id) { dynamic json = new JObject(); json.spell2Id = id; QsoApi.Call("/lol-champ-select/v1/session/my-selection", new HttpMethod("PATCH"), json.ToString()); }
// TODO: Should we not call if it is already completed, or allow calling it anyway? public void Execute(ChampionID champ, bool completed = true) { dynamic json = new JObject(); json.championId = champ; json.completed = completed; QsoApi.Call("/lol-champ-select/v1/session/actions/{0}", new HttpMethod("PATCH"), json.ToString(), ID); }
private void forceLeaveLobbyBtn_Click(object sender, EventArgs e) { try { QsoApi.LeaveMyLobby(); } catch (QsoEndpointException) { } }
private void forceStartLobbyBtn_Click(object sender, EventArgs e) { try { QsoApi.GetMyLobby().StartChampSelect(); } catch (QsoEndpointException) { } }
public LobbyInvitation[] Invite(long id) { dynamic obj = new JObject(); obj.toSummonerId = id; dynamic json = new JArray(obj); return(QsoApi.GetDTO <LobbyInvitation[]>("/lol-lobby/v2/lobby/invitations", HttpMethod.Post, json.ToString())); }
public void AddBot(ChampionID champion, TeamID team, string difficulty) { dynamic json = new JObject(); json.championId = champion; json.teamId = Convert.ToString((int)team); // bullshit. the API expects a string, but can't use ToString cause enums are stupid, so I'm forced to cast it to an int to make it a string. json.botDifficulty = difficulty; QsoApi.Call("/lol-lobby/v1/lobby/custom/bots", HttpMethod.Post, json.ToString()); }
/// <summary> /// This will reset the position you do not specify. Specify both at once to set both. /// </summary> public void SetPositionPreferences(string primary = null, string secondary = null) { dynamic json = new JObject(); if (primary != null) { json.firstPreference = primary; } if (secondary != null) { json.secondPreference = secondary; } QsoApi.Call("/lol-lobby/v2/lobby/members/localMember/position-preferences", HttpMethod.Put, json.ToString()); }
private void MainWindow_Load(object sender, EventArgs e) { uiLoot = QsoApi.GetMyPlayerLoot(); allLootCombo.DataSource = uiLoot; recipesCombo.DataSource = uiRecipes; contentFilterTextbox.Text = string.Join(Environment.NewLine, QsoApi.GetContentFilters()); gameTypeCombo.Items.AddRange(Enum.GetNames(typeof(GameType))); mapCombo.Items.AddRange(Enum.GetNames(typeof(MapID))); botChampionCombo.Items.AddRange(Enum.GetNames(typeof(ChampionID))); botChampionCombo.Sorted = true; botTeamCombo.Items.AddRange(Enum.GetNames(typeof(TeamID))); queues = QsoApi.GetQueues(); queueTypesCombo.DataSource = queues; queueTypesCombo.DisplayMember = "Name"; }
private void queueBtn_Click(object sender, EventArgs e) { var selectedQueue = queues[queueTypesCombo.SelectedIndex]; if (selectedQueue != null) { try { QsoApi.CreateLobby((QueueType)selectedQueue.ID); } catch (QsoEndpointException ex) { MessageBox.Show($"Unable to create a lobby with that queue:\n{ex.ErrorResponse.Message}", "Endpoint Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void disenchantAllBtn_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you wish to continue? All this loot will be lost forever! (a long time!)", "Verify", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { return; } var be = 0; var oe = 0; foreach (var loot in uiLoot) { if (loot.Type == "CHAMPION_RENTAL" && disenChampionsCheckbox.Checked) { be += loot.DisenchantValue; try { QsoApi.CraftRecipe(loot.Name, "CHAMPION_RENTAL_disenchant"); } catch (QsoEndpointException) { if (MessageBox.Show($"Failed disenchanting loot item {loot.Name}. Continue?", "Disenchant Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No) { return; } } } else if (loot.Type == "SKIN_RENTAL" && disenSkinsCheckbox.Checked) { oe += loot.DisenchantValue; try { QsoApi.CraftRecipe(loot.Name, "SKIN_RENTAL_disenchant"); } catch (QsoEndpointException) { if (MessageBox.Show($"Failed disenchanting loot item {loot.Name}. Continue?", "Disenchant Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No) { return; } } } // TODO: Wards } MessageBox.Show($"Finished! The total disenchant was worth {be}BE and {oe}OE.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void CraftRecipeUI(bool many) { if (uiRecipes == null || uiLoot == null) { MessageBox.Show("You must select an item and a recipe first.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { var item = uiLoot[allLootCombo.SelectedIndex]; var recipe = uiRecipes[recipesCombo.SelectedIndex]; var repeat = many ? 10 : 0; var update = QsoApi.CraftRecipe(item, recipe, repeat); } catch (QsoEndpointException ex) { MessageBox.Show($"Unable to craft {uiLoot[allLootCombo.SelectedIndex]}: {ex.ErrorResponse.Message}"); } }
private static bool AttemptInitializeQso() { try { QsoApi.Initialize(); } catch (QsoException e) { if (MessageBox.Show(e.Message, "Exception initializing Qso", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry) { return(AttemptInitializeQso()); } else { return(false); } } return(true); }
private void createLobbyBtn_Click(object sender, EventArgs e) { if (gameModeCombo.SelectedItem == null || gameTypeCombo.SelectedItem == null || mapCombo.SelectedItem == null || lobbyNameTextbox.Text == "") { MessageBox.Show("Missing required lobby configuration option.", "Value Missing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Lobby lobby = null; try { lobby = QsoApi.BuildLobby(lobbyNameTextbox.Text, gameModeCombo.Text, (GameType)Enum.Parse(typeof(GameType), (string)gameTypeCombo.SelectedItem), (MapID)Enum.Parse(typeof(MapID), (string)mapCombo.SelectedItem), Convert.ToInt32(teamSizeUpDown.Value)).Create(); } catch (QsoEndpointException ex) { MessageBox.Show($"Unable to create a lobby with such configuration:\n{ex.ErrorResponse.Message}", "Endpoint Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void OnEndpointEvent(object src, EndpointEventArgs args) { if (args.EventType == "Update" && args.URI == "/lol-gameflow/v1/session") { var phase = args.JSON["phase"].Value <string>(); if (phase == "EndOfGame" && downloadAllReplaysCheckbox.Checked) { var gameId = args.JSON["gameData"]["gameId"].Value <long>(); try { QsoApi.DownloadReplay(gameId); Console.WriteLine($"Downloading replay for game {gameId}"); trayIcon.ShowBalloonTip(2500, "Qso Client", "Downloading replay of your latest game!", ToolTipIcon.Info); if (alertWhenManyReplaysCheckbox.Checked) { DirectoryInfo d = new DirectoryInfo(QsoApi.GetReplaysPath()); if (d.GetFiles().Length >= 50) { long size = 0; d.GetFiles().Select(f => f.Length).ToList().ForEach(s => size += s); MessageBox.Show($"Your replay folder currently contains {d.GetFiles().Length} files, sitting at {size / 1048576}MB. You should clean it out to save space on your drive.", "Replay Folder Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (QsoEndpointException) { trayIcon.ShowBalloonTip(2500, "Qso Client", "Failed to download latest replay.", ToolTipIcon.Error); } } else if (phase == "ReadyCheck" && autoAcceptQueueCheckbox.Checked) { QsoApi.AcceptQueue(); } } }
public Lobby Create() { Console.WriteLine(JSON.ToString()); return(QsoApi.GetDTO <Lobby>("/lol-lobby/v2/lobby", HttpMethod.Post, JSON.ToString())); }
public void RemoveBot(ChampionID champ, TeamID team) { QsoApi.Call("/lol-lobby/v1/lobby/custom/bots/{0}", HttpMethod.Delete, null, $"bot_{Enum.GetName( typeof( ChampionID ), champ )}_{team}"); }
public void Promote(int id) { QsoApi.Call("/lol-lobby/v2/lobby/members/{0}/promote", HttpMethod.Post, null, id); }
public void Kick(int id) { QsoApi.Call("/lol-lobby/v2/lobby/members/{0}/kick", HttpMethod.Post, null, id); }
public void Promote(Summoner s) { QsoApi.Call("/lol-lobby/v2/lobby/members/{0}/promote", HttpMethod.Post, null, s.ID); }
public void Kick(Summoner s) { QsoApi.Call("/lol-lobby/v2/lobby/members/{0}/kick", HttpMethod.Post, null, s.ID); }
public void StopChampSelect() { QsoApi.Call("/lol-lobby/v1/lobby/custom/cancel-champ-select", HttpMethod.Post); }
public void StartChampSelect() { QsoApi.Call("/lol-lobby/v1/lobby/custom/start-champ-select", HttpMethod.Post); }
public LobbyInvitation[] GetInvitations() { return(QsoApi.GetDTO <LobbyInvitation[]>("/lol-lobby/v2/lobby/invitations", HttpMethod.Get)); }