private static async Task HandleSettingsCommand(string cmd, long chatId) { switch (cmd) { default: break; case MarkerBack: //the user changed his mind await CheckAndSendAsync(chatId, "Hello again!", new ReplyKeyboardRemove()); GameCore.RemovePlayerInDialogue(chatId); break; case MarkerModpack: //the user decided to install a modification await CheckAndSendAsync(chatId, "Send a modification file named \"cells.csv\", " + "\"items.csv\" or \"effects.csv\" depending on the resource you want to modify", new ReplyKeyboardMarkup(new KeyboardButton(MarkerBack))); GameCore.AddPlayerInDialogue(new Player(chatId)); break; case MarkerStandardModpack: //the user needs to be sent the pack of the default resources await CheckAndSendAsync(chatId, "You will be sent the files with the " + "default resources in csv format.", new ReplyKeyboardRemove()); await SendDefaultResources(chatId); break; case MarkerSetStandardModpack: //the user wants to delete his modpacks await CheckAndSendAsync(chatId, "Your resource packs will be set to " + "default. If you've got modified packs, they'll be deleted.", new ReplyKeyboardRemove()); GameCore.SetDefaultResources(chatId); break; } }
private static async Task HandleInGameCommands(string cmd, Player curPlayer) { var chatId = curPlayer.Id; //a separate part for performing dialogues if (GameCore.GetPlayerInDialogue(chatId) != null) { switch (cmd) { default: break; case MarkerAskDirection: CharacterAnswer(curPlayer, AnswerModes.DirectionAnswer); break; case MarkerAskAround: break; case MarkerTrade: break; case MarkerBack: GameCore.RemovePlayerInDialogue(chatId); curPlayer.AskedDirection = false; curPlayer.AskedNeighbourhood = false; AskForAction(chatId); break; } } else { switch (cmd) { default: break; case MarkerLoadGame: //if the user wants to load his last saved game GameCore.UpdatePlayerTimestamp(curPlayer); AskForAction(chatId); break; case MarkerUp: curPlayer.DirectAction(0, -1); break; case MarkerUpRight: curPlayer.DirectAction(1, -1); break; case MarkerRight: curPlayer.DirectAction(1, 0); break; case MarkerDownRight: curPlayer.DirectAction(1, 1); break; case MarkerDown: curPlayer.DirectAction(0, 1); break; case MarkerDownLeft: curPlayer.DirectAction(-1, 1); break; case MarkerLeft: curPlayer.DirectAction(-1, 0); break; case MarkerUpLeft: curPlayer.DirectAction(-1, -1); break; } if (cmd == MarkerChangeMode + curPlayer.Mode.ToString()) { curPlayer.Mode = (PlayerModes)Math.Abs((int)curPlayer.Mode - 1); //since there are only 2 modes //available, we can change them //with this magic await CheckAndSendAsync(curPlayer.Id, $"I will {curPlayer.Mode} now"); AskForAction(curPlayer.Id, false); } } }