public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { if (string.IsNullOrEmpty(cmd.Arguments)) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.VALUE_NO_ARG, cmd.Command); return; } var player = session.Get(cmd.Sender); if (cmd.Arguments.Contains("helm", StringComparison.OrdinalIgnoreCase)) { await connection.ToggleHelmetAsync(player); } else if (cmd.Arguments.Contains("pet", StringComparison.OrdinalIgnoreCase)) { await connection.TogglePetAsync(player); } else { twitch.Broadcast(channel, cmd.Sender.Username, Localization.TOGGLE_INVALID, cmd.Arguments); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var destination = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(destination)) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.TRAVEL_NO_ARG); return; } var player = session.Get(cmd.Sender); if (player != null) { await connection.TravelAsync(player, destination); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (player == null) { return; } var item = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(item)) { twitch.Broadcast(channel, cmd.Sender.Username, "You have to use !equip <item name> or !equip all for equipping your best items."); return; } await connection.EquipAsync(player, item); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.OBSERVE_PERM); return; } var targetPlayerName = cmd.Arguments?.Trim(); var player = string.IsNullOrEmpty(targetPlayerName) ? session.Get(cmd.Sender) : session.GetUserByName(targetPlayerName); await connection.ObservePlayerAsync(player); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { await connection.ActivateTicTacToeAsync(player); return; } if (cmd.Arguments.Trim().Equals("reset", System.StringComparison.OrdinalIgnoreCase)) { await connection.ResetTicTacToeAsync(player); return; } if (int.TryParse(cmd.Arguments.Trim(), out var num)) { await connection.PlayTicTacToeAsync(player, num); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { if (!string.IsNullOrEmpty(cmd.Arguments) && (cmd.Sender.IsBroadcaster || cmd.Sender.IsModerator)) { var player = session.GetUserByName(cmd.Arguments); if (player != null) { await connection.UnstuckAsync(player); } } else { var player = session.Get(cmd.Sender); await connection.UnstuckAsync(player); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { await connection.JoinDungeonAsync(player); return; } else if (cmd.Arguments.Contains("stop", System.StringComparison.OrdinalIgnoreCase)) { if (player.IsBroadcaster || player.IsModerator) { await connection.StopDungeonAsync(player); } } else { await connection.DungeonStartAsync(player); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (player == null) { return; } var pet = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(pet)) { await connection.GetPetAsync(player); return; } await connection.SetPetAsync(player, pet); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); var numOfSubs = 1; if (!string.IsNullOrEmpty(cmd.Arguments)) { int.TryParse(cmd.Arguments, out numOfSubs); } if (numOfSubs < 15) { return; } await connection.SetExpMultiplierLimitAsync(player, numOfSubs); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); var destination = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(destination)) { await connection.EmbarkFerryAsync(player); return; } if (destination.StartsWith("stop")) { await connection.DisembarkFerryAsync(player); return; } await connection.TravelAsync(player, destination); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.KICK_PERM); return; } var targetPlayerName = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(targetPlayerName)) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.KICK_NO_USER); return; } await connection.KickAsync(session.GetUserByName(targetPlayerName)); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var targetPlayerName = cmd.Arguments?.Trim(); Player player = null; if ((cmd.Sender.IsBroadcaster || cmd.Sender.IsModerator) && !string.IsNullOrEmpty(targetPlayerName)) { player = session.GetUserByName(targetPlayerName); } else { player = session.Get(cmd.Sender); } await connection.TurnIntoMonsterAsync(player); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (GetCombatTypeFromString(cmd.Command) != -1) { await connection.SendPlayerTaskAsync(player, PlayerTask.Fighting, cmd.Command); return; } var commandSkillTarget = GetSkillTypeFromString(cmd.Command); if (commandSkillTarget != -1) { await connection.SendPlayerTaskAsync(player, (PlayerTask)commandSkillTarget, cmd.Command); return; } var arg = cmd.Arguments?.ToLower(); var skill = arg?.Split(' ').LastOrDefault(); if (string.IsNullOrEmpty(skill)) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.TRAIN_NO_ARG, string.Join(", ", trainableSkills)); return; } if (GetCombatTypeFromString(skill) != -1) { await connection.SendPlayerTaskAsync(player, PlayerTask.Fighting, skill); } else { var value = GetSkillTypeFromString(skill); if (value == -1) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.TRAIN_INVALID, skill); } else { await connection.SendPlayerTaskAsync(player, (PlayerTask)value, skill); } } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); await connection.RequestPlayerResourcesAsync(player); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Join(cmd.Sender, cmd.Arguments); await connection.JoinAsync(player); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (player != null) { await connection.SetTimeOfDayAsync(player, 230, 30); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (!string.IsNullOrEmpty(cmd.Arguments)) { player = session.GetUserByName(cmd.Arguments); } await connection.InspectPlayerAsync(player); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.REDEEM_NO_ARG); return; } await connection.RedeemStreamerTokenAsync(player, cmd.Arguments); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" ")) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.TRADE_NO_ARG, cmd.Command); return; } await connection.BuyItemAsync(player, cmd.Arguments); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var session = game.GetSession(cmd.Channel); if (session == null) { return; } // client might not accept a leave. //session.Leave(cmd.Sender.UserId); var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (player != null) { await connection.LeaveAsync(player); } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { var player = session.Get(cmd.Sender); if (string.IsNullOrWhiteSpace(cmd.Arguments)) { //twitch.Broadcast(cmd.Sender.Username, "To duel a player you need to specify their name. ex: '!duel JohnDoe', to accept or decline a duel request use '!duel accept' or '!duel decline'. You may also cancel an ongoing request by using '!duel cancel'"); return; } var sub = cmd.Arguments?.Trim(); if (sub.Equals("cancel", StringComparison.InvariantCultureIgnoreCase)) { await connection.CancelDuelRequestAsync(player); } else if (sub.Equals("accept", StringComparison.InvariantCultureIgnoreCase)) { await connection.AcceptDuelRequestAsync(player); } else if (sub.Equals("decline", StringComparison.InvariantCultureIgnoreCase)) { await connection.DeclineDuelRequestAsync(player); } else { await connection.DuelRequestAsync(player, session.GetUserByName(sub)); } } } }
public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { if (string.IsNullOrEmpty(cmd.Arguments)) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.VALUE_NO_ARG, cmd.Command); return; } var player = session.Get(cmd.Sender); if (player != null) { await connection.CraftRequirementAsync(player, cmd.Arguments); } } } }