internal static async Task Initialise(Player player, string name, int bet, IMessageChannel chan) { Type gameClass = GetGameType(name); IGamblingGame game = CreateInstance(gameClass, player); await game.StartGame(player.ui.Channel, bet); ((GamblingGame)game).deck.Channel = chan; }
public async Task CardGame(SocketReaction reaction, IUserMessage msg) { if (reaction.Emote.ToString() == EUI.cancel) { await QuitCardGame(reaction); return; } if (player.GamblingHand.turn != null) { await reaction.Channel.SendMessageAsync( $"You've already played your turn for this round: {player.GamblingHand.turn}"); return; } Type type = GamblingGame.GetGameType(data); Dictionary <string, string> actions = Utils.GetVar <Dictionary <string, string> >(type, "Actions", true); if (actions == null) { return; } actions.TryGetValue(reaction.Emote.ToString(), out string action); if (action != null) { IGamblingGame game = GamblingGame.CreateInstance(type, player); game.Action(action); player.GamblingHand.turn = action; player.GamblingHandKey.Save(); await game.EndTurn(); } }