public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.TOGGLE_NO_ARG); return; } if (cmd.Arguments.Contains("helm", StringComparison.OrdinalIgnoreCase)) { var player = playerProvider.Get(cmd.Sender); await game.ToggleHelmetAsync(player); } else if (cmd.Arguments.Contains("pet", StringComparison.OrdinalIgnoreCase)) { var player = playerProvider.Get(cmd.Sender); await game.TogglePetAsync(player); } else { broadcaster.Broadcast(cmd.Sender.Username, Localization.TOGGLE_INVALID, cmd.Arguments); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" ")) { broadcaster.Broadcast(cmd.Sender.Username, Localization.TRADE_NO_ARG, cmd.Command); return; } var player = playerProvider.Get(cmd.Sender); if (cmd.Command.Equals("sell", StringComparison.OrdinalIgnoreCase)) { await this.game.SellItemAsync(player, cmd.Arguments); } else if (cmd.Command.Equals("buy", StringComparison.OrdinalIgnoreCase)) { await this.game.BuyItemAsync(player, cmd.Arguments); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_PERM); return; } var targetPlayerName = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(targetPlayerName)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.KICK_NO_USER); return; } var targetPlayer = playerProvider.Get(targetPlayerName); await game.KickAsync(targetPlayer); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(ServerPort)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (GetCombatTypeFromString(cmd.Command) != -1) { await game.SendPlayerTaskAsync(player, PlayerTask.Fighting, cmd.Command); return; } var commandSkillTarget = GetSkillTypeFromString(cmd.Command); if (commandSkillTarget != -1) { await game.SendPlayerTaskAsync(player, (PlayerTask)commandSkillTarget, cmd.Command); return; } var arg = cmd.Arguments?.ToLower(); var skill = arg?.Split(' ').LastOrDefault(); if (string.IsNullOrEmpty(skill)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.TRAIN_NO_ARG, string.Join(", ", trainableSkills)); return; } if (GetCombatTypeFromString(skill) != -1) { await game.SendPlayerTaskAsync(player, PlayerTask.Fighting, skill); } else { var value = GetSkillTypeFromString(skill); if (value == -1) { broadcaster.Broadcast(cmd.Sender.Username, Localization.TRAIN_INVALID, skill); } else { await game.SendPlayerTaskAsync(player, (PlayerTask)value, skill); } } }
public override Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (cmd.Arguments == null || cmd.Arguments.Length == 0) { broadcaster.Broadcast("", "Ravenfall is a Twitch idle game where you can train, craft, fight together against huge raid bosses or fight against eachother."); } else if (cmd.Arguments.Contains("help", System.StringComparison.OrdinalIgnoreCase)) { broadcaster.Broadcast("", "Please see https://www.ravenfall.stream/how-to-play on how to play Ravenfall. This guide is still being updated so make sure to check it out frequently."); } return(Task.CompletedTask); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var arg = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(arg)) { return; } if (arg.StartsWith("help")) { broadcaster.Broadcast(cmd.Sender.Username, Localization.HELP); return; } if (arg.StartsWith("join")) { var player = playerProvider.Get(cmd.Sender); await game.JoinAsync(player); } if (arg.StartsWith("task")) { var player = playerProvider.Get(cmd.Sender); var task = arg.Split(' ').LastOrDefault(); var availableTasks = Enum.GetValues(typeof(PlayerTask)) .Cast <PlayerTask>() .ToList(); if (string.IsNullOrEmpty(task)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.TASK_NO_ARG, string.Join(", ", availableTasks.Select(x => x.ToString()))); return; } var targetTask = availableTasks.FirstOrDefault(x => x.ToString().Equals(task, StringComparison.InvariantCultureIgnoreCase)); await game.SendPlayerTaskAsync(player, targetTask); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { await this.game.JoinDungeonAsync(player); return; } else if (cmd.Arguments.Contains("stop", System.StringComparison.OrdinalIgnoreCase)) { if (player.IsBroadcaster || player.IsModerator) { await this.game.StopDungeonAsync(player); } } else { await this.game.DungeonStartAsync(player); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (cmd.Command.StartsWith("disembark")) { await game.DisembarkFerryAsync(player); return; } var destination = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(destination)) { await game.EmbarkFerryAsync(player); return; } if (destination.StartsWith("stop")) { await game.DisembarkFerryAsync(player); return; } await game.TravelAsync(player, destination); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { await game.ActivateTicTacToeAsync(player); return; } if (cmd.Arguments.Trim().Equals("reset", System.StringComparison.OrdinalIgnoreCase)) { await game.ResetTicTacToeAsync(player); return; } if (int.TryParse(cmd.Arguments.Trim(), out var num)) { await game.PlayTicTacToeAsync(player, num); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster || !cmd.Sender.DisplayName.ToLower().Equals("zerratar")) { return; } if (string.IsNullOrEmpty(cmd.Arguments)) { return; } var values = cmd.Arguments.Split(' '); if (values.Length <= 1) { return; } var player = playerProvider.Get(values[0], values[1]); await game.JoinAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Broadcast("", "You can customize your character here https://www.ravenfall.stream/characters"); return; } await this.game.PlayerAppearanceUpdateAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.VALUE_NO_ARG, cmd.Command); return; } var player = playerProvider.Get(cmd.Sender); await this.game.ValueItemAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" ")) { broadcaster.Broadcast(cmd.Sender.Username, Localization.CRAFT_HELP, cmd.Command); return; } var player = playerProvider.Get(cmd.Sender); await this.game.CraftRequirementAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.REDEEM_NO_ARG); return; } await game.RedeemStreamerTokenAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Broadcast(cmd.Sender.Username, "{command} <item> (optional: <amount>, default 1)", cmd.Command); return; } var player = playerProvider.Get(cmd.Sender); await this.game.VendorItemAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); await game.ToggleItemRequirementsAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber) { broadcaster.Broadcast(cmd.Sender.Username, Localization.OBSERVE_PERM); return; } var isSubscriber = cmd.Sender.IsSubscriber && !cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator; if (isSubscriber) { var user = userStore.Get(cmd.Sender.Username); var command = nameof(ObserveCommandProcessor); if (!user.CanUseCommand(command)) { var timeLeft = user.GetCooldown(command); broadcaster.Broadcast(cmd.Sender.Username, Localization.COMMAND_COOLDOWN, Math.Floor(timeLeft.TotalSeconds)); return; } user.UseCommand(command, TimeSpan.FromSeconds(120)); } var targetPlayerName = cmd.Arguments?.Trim(); Models.Player player = null; if (!string.IsNullOrEmpty(targetPlayerName)) { player = playerProvider.Get(targetPlayerName); } else { player = playerProvider.Get(cmd.Sender); } await game.ObservePlayerAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); var isRaidWar = cmd.Command.Contains("war", StringComparison.OrdinalIgnoreCase); if (string.IsNullOrEmpty(cmd.Arguments)) { if (isRaidWar) { return; } await this.game.JoinRaidAsync(player); return; } if (!string.IsNullOrEmpty(cmd.Arguments)) { if (cmd.Arguments.Contains("start", StringComparison.OrdinalIgnoreCase)) { await this.game.RaidStartAsync(player); return; } if (!cmd.Sender.IsBroadcaster) { broadcaster.Broadcast(cmd.Sender.Username, Localization.PERMISSION_DENIED); return; } var target = playerProvider.Get(cmd.Arguments); await this.game.RaidStreamerAsync(target, isRaidWar); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); var skill = cmd.Arguments; await this.game.RequestHighscoreAsync(player, skill); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var query = cmd.Arguments?.Trim(); var player = playerProvider.Get(cmd.Sender); await game.CraftAsync(player, query); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); var item = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(item)) { broadcaster.Broadcast(cmd.Sender.Username, "You have to use !unequip <item name> or !unequip all for unequipping all your items."); return; } await game.UnequipAsync(player, item); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var sub = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(sub)) { broadcaster.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 player = playerProvider.Get(cmd.Sender); if (sub.Equals("cancel", StringComparison.InvariantCultureIgnoreCase)) { await this.game.CancelDuelRequestAsync(player); } else if (sub.Equals("accept", StringComparison.InvariantCultureIgnoreCase)) { await this.game.AcceptDuelRequestAsync(player); } else if (sub.Equals("decline", StringComparison.InvariantCultureIgnoreCase)) { await this.game.DeclineDuelRequestAsync(player); } else { await this.game.DuelRequestAsync(player, playerProvider.Get(sub)); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (cmd.Sender.IsVerifiedBot) { return; } if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender, cmd.Arguments); await game.JoinAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (player == null) { return; } await game.RequestIslandInfoAsync(player); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var numOfSubs = 1; if (!string.IsNullOrEmpty(cmd.Arguments)) { int.TryParse(cmd.Arguments, out numOfSubs); } var player = playerProvider.Get(cmd.Sender); await game.SetExpMultiplierAsync(player, numOfSubs); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!string.IsNullOrEmpty(cmd.Arguments) && (cmd.Sender.IsBroadcaster || cmd.Sender.IsModerator)) { var player = playerProvider.Get(cmd.Arguments); if (player != null) { await game.UnstuckAsync(player); } } else { var player = playerProvider.Get(cmd.Sender, cmd.Arguments); await game.UnstuckAsync(player); } }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); var pet = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(pet)) { await game.GetPetAsync(player); return; } await game.SetPetAsync(player, pet); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster) { return; } var item = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(item)) { return; } var player = playerProvider.Get(cmd.Sender); await game.ItemDropEventAsync(player, item); }
public override async Task ProcessAsync(IMessageChat broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Broadcast("", Localization.GAME_NOT_STARTED); return; } // --- PLayers only --- //!arena leave //!arena, !arena join // --- Broadcaster Only --- //!arena start,begin //!arena cancel,cancel //!arena kick <player> //!arena add <player> var command = cmd.Arguments?.Trim().ToLower(); var player = playerProvider.Get(cmd.Sender); if (string.IsNullOrEmpty(command) || command.Equals("join")) { await game.JoinArenaAsync(player); } else if (command.Equals("leave")) { await game.LeaveArenaAsync(player); } else if (command.Equals("start") || command.Equals("begin")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { broadcaster.Broadcast(cmd.Sender.Username, Localization.ARENA_PERM_FORCE); return; } await game.StartArenaAsync(player); } else if (command.Equals("cancel") || command.Equals("end")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { broadcaster.Broadcast(cmd.Sender.Username, Localization.ARENA_PERM_CANCEL); return; } await game.CancelArenaAsync(player); } else { if (command.StartsWith("kick ")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { broadcaster.Broadcast(cmd.Sender.Username, Localization.ARENA_PERM_KICK); return; } var targetPlayerName = command.Split(' ').LastOrDefault(); var targetPlayer = playerProvider.Get(targetPlayerName); await game.KickPlayerFromArenaAsync(player, targetPlayer); } else if (command.StartsWith("add ")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { //broadcaster.Broadcast( broadcaster.Broadcast(cmd.Sender.Username, Localization.ARENA_PERM_ADD); return; } var targetPlayer = playerProvider.Get(cmd.Sender); await game.AddPlayerToArenaAsync(player, targetPlayer); } } }