public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, //broadcaster.Broadcast( Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You do not have permission to kick a player from the game."); 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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Send(cmd.Sender.Username, "You need to specify what to toggle, like: helm or pet"); 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.Send(cmd.Sender.Username, cmd.Arguments + " cannot be toggled."); } }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" ")) { broadcaster.Send(cmd.Sender.Username, cmd.Command + " <item> (optional: <amount>, default 1) <price per item>"); 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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, //broadcaster.Broadcast( Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You do not have permission to kick a player from the game."); return; } var targetPlayerName = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(targetPlayerName)) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You are kicking who? Provide a username"); return; } var targetPlayer = playerProvider.Get(targetPlayerName); await game.KickAsync(targetPlayer); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(ServerPort)) { //broadcaster.Broadcast( broadcaster.Send(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.Send(cmd.Sender.Username, $"You need to specify a skill to train, currently supported skills: " + 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( broadcaster.Send(cmd.Sender.Username, $"You cannot train '{skill}'."); } else { await game.SendPlayerTaskAsync(player, (PlayerTask)value, skill); } } }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var arg = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(arg)) { return; } if (arg.StartsWith("help")) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "The commands are available in the panels below the stream :-) Too many commands."); 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( broadcaster.Send(cmd.Sender.Username, $"You need to specify a task, currently supported tasks: {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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, //broadcaster.Broadcast( Localization.GAME_NOT_STARTED); return; } if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You do not have permission to set the currently observed player."); 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}, You must wait another {Math.Floor(timeLeft.TotalSeconds)} secs to use that command."); 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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(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; } if (!string.IsNullOrEmpty(cmd.Arguments)) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator && !cmd.Sender.IsSubscriber) { broadcaster.Send(cmd.Sender.Username, Localization.PERMISSION_DENIED); return; } //if (cmd.Arguments.Contains("start", StringComparison.OrdinalIgnoreCase)) //{ // var isSubscriber = cmd.Sender.IsSubscriber && !cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator; // if (isSubscriber) // { // var user = userStore.Get(cmd.Sender.Username); // var command = nameof(RaidCommandProcessor); // if (!user.CanUseCommand(command)) // { // var timeLeft = user.GetCooldown(command); // broadcaster.Broadcast($"{cmd.Sender.Username}, You must wait another {Math.Floor(timeLeft.TotalSeconds)} secs to use that command."); // return; // } // user.UseCommand(command, TimeSpan.FromHours(1)); // } // await this.game.RaidStartAsync(player); // return; //} } }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); if (player == null) { broadcaster.Send(cmd.Sender.Username, "Uh oh, bug when trying to leave :("); } await game.LeaveAsync(player); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" ")) { broadcaster.Send(cmd.Sender.Username, cmd.Command + " <playername> <item> (optional: <amount>, default 1)"); return; } var player = playerProvider.Get(cmd.Sender); await this.game.GiftItemAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); var destination = cmd.Arguments?.ToLower(); if (string.IsNullOrEmpty(destination)) { broadcaster.Send(cmd.Sender.Username, "You must specify a destination, !travel <destination>"); return; } await game.TravelAsync(player, destination); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } if (string.IsNullOrEmpty(cmd.Arguments)) { broadcaster.Send(cmd.Sender.Username, cmd.Command + "<item>"); return; } var player = playerProvider.Get(cmd.Sender); await this.game.ValueItemAsync(player, cmd.Arguments); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); await game.PlayerCountAsync(player); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var sub = cmd.Arguments?.Trim(); if (string.IsNullOrEmpty(sub)) { //broadcaster.Broadcast( broadcaster.Send(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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, Localization.GAME_NOT_STARTED); return; } var player = playerProvider.Get(cmd.Sender); var skill = cmd.Arguments; await this.game.RequestHighestSkillAsync(player, skill); }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(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(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { //broadcaster.Broadcast( broadcaster.Send(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/customization"); return; } await this.game.PlayerAppearanceUpdateAsync(player, cmd.Arguments); }
public Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { //if (string.IsNullOrEmpty(cmd.Arguments)) //{ // return Task.CompletedTask; //} var command = cmd.Arguments.Trim().ToLower(); if (command.StartsWith("add")) { if (!cmd.Sender.IsModerator && !cmd.Sender.IsBroadcaster) { broadcaster.Send(cmd.Sender.Username, //broadcaster.Broadcast( "Sorry, this command is restricted to mods and broadcaster."); return Task.CompletedTask; } var data = command.Split(' '); if (data.Length <= 1) { broadcaster.Broadcast("Insufficient parameters, use: !credits add <user> <amount>"); return Task.CompletedTask; } var name = data[1]; var amountStr = data[2]; if (int.TryParse(amountStr, out var val)) { var user = this.userStore.Get(name); user.AddCredits(val); broadcaster.Broadcast($"{val} credits was added to {name}'s stash."); } } else if (command.StartsWith("remove")) { if (!cmd.Sender.IsModerator && !cmd.Sender.IsBroadcaster) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "Sorry, this command is restricted to mods and broadcaster."); return Task.CompletedTask; } var data = command.Split(' '); if (data.Length <= 1) { broadcaster.Broadcast("Insufficient parameters, use: !credits remove <user> <amount>"); return Task.CompletedTask; } var name = data[1]; var amountStr = data[2]; if (int.TryParse(amountStr, out var val)) { var user = this.userStore.Get(name); user.RemoveCredits(val); broadcaster.Broadcast($"{val} credits was removed from {name}'s stash."); } } else { var user = this.userStore.Get(cmd.Sender.Username); broadcaster.Send(cmd.Sender.Username, //broadcaster.Broadcast( $"{cmd.Sender.Username}, you have {user.Credits} credits left."); } return Task.CompletedTask; }
public override async Task ProcessAsync(IMessageBroadcaster broadcaster, ICommand cmd) { if (!await this.game.ProcessAsync(Settings.UNITY_SERVER_PORT)) { broadcaster.Send(cmd.Sender.Username, //broadcaster.Broadcast( Localization.GAME_NOT_STARTED); return; } var query = cmd.Arguments?.Trim(); //var categories = Enum.GetNames(typeof(CraftableCategory)); ////var types = Enum.GetNames(typeof(ItemType)); //if (string.IsNullOrEmpty(query)) //{ // //broadcaster.Broadcast( // broadcaster.Send(cmd.Sender.Username, // $"You must specify an item or category to craft. Currently supported item categories: {string.Join(", ", categories)}"); // return; //} var player = playerProvider.Get(cmd.Sender); await game.CraftAsync(player, query); // !craft weapon // !craft amulet // !craft helm // !craft chest //var types = categoryAndType.Split(" "); //if (categories.Any(x => x.Equals(categoryAndType, StringComparison.InvariantCultureIgnoreCase)) // /*types.Any(x => x.Equals(categoryAndType, StringComparison.InvariantCultureIgnoreCase))*/) //{ // var player = playerProvider.Get(cmd.Sender); // if (Enum.TryParse(typeof(CraftableCategory), categoryAndType, true, out var item)) // { // var category = ItemCategory.Weapon; // switch ((CraftableCategory)item) // { // case CraftableCategory.Weapon: // category = ItemCategory.Weapon; // break; // case CraftableCategory.Armor: // case CraftableCategory.Helm: // case CraftableCategory.Chest: // case CraftableCategory.Gloves: // case CraftableCategory.Leggings: // case CraftableCategory.Boots: // category = ItemCategory.Armor; // break; // case CraftableCategory.Ring: // category = ItemCategory.Ring; // break; // case CraftableCategory.Amulet: // category = ItemCategory.Amulet; // break; // } // await game.CraftAsync(player, category.ToString(), categoryAndType); // return; // } // else if (Enum.TryParse(typeof(ItemCategory), categoryAndType, true, out var weapon)) // { // await game.CraftAsync(player, categoryAndType, ""); // return; // } //} }
public override async Task ProcessAsync(IMessageBroadcaster 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.Send(cmd.Sender.Username, "You do not have permission to force start the arena."); //broadcaster.Broadcast("You do not have permission to force start the arena."); return; } await game.StartArenaAsync(player); } else if (command.Equals("cancel") || command.Equals("end")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You do not have permission to cancel the arena."); return; } await game.CancelArenaAsync(player); } else { var targetPlayerName = command.Split(' ').LastOrDefault(); if (command.StartsWith("kick ")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You do not have permission to kick a player from the arena."); return; } var targetPlayer = playerProvider.Get(cmd.Sender); await game.KickPlayerFromArenaAsync(player, targetPlayer); } else if (command.StartsWith("add ")) { if (!cmd.Sender.IsBroadcaster && !cmd.Sender.IsModerator) { //broadcaster.Broadcast( broadcaster.Send(cmd.Sender.Username, "You do not have permission to add a player to the arena."); return; } var targetPlayer = playerProvider.Get(cmd.Sender); await game.AddPlayerToArenaAsync(player, targetPlayer); } } }