Beispiel #1
0
        public async Task ConfirmSkills(SocketReaction reaction, IUserMessage msg)
        {
            if (reaction.Emote.ToString() == ok)
            {
                player.health  = player.Health();
                player.stamina = player.Stamina();
                player.SaveFileMongo();
                await TryMSGDel(msg);

                await CharacterCommands.ChooseRace(player, reaction.Channel);
            }
            else if (reaction.Emote.ToString() == cancel)
            {
                int[] rolls = Utils.JSON <int[]>(data.Split(';')[0]);
                player.stats.endurance    = 0;
                player.stats.intelligence = 0;
                player.stats.strength     = 0;
                player.stats.charisma     = 0;
                player.stats.dexterity    = 0;
                player.stats.perception   = 0;
                player.SaveFileMongo();
                await TryMSGDel(msg);

                await CharacterCommands.SetSkills(player, reaction.Channel, 0, rolls, new bool[6]);
            }
        }
Beispiel #2
0
        public async Task SetSkill(SocketReaction reaction, IUserMessage msg)
        {
            int result = GetLetter(reaction.Emote.ToString()) + 1;

            string[] arrays = data.Split(';');
            bool[]   rused  = Utils.JSON <bool[]>(arrays[1]);
            if (!rused[result - 1])
            {
                await CharacterCommands.SetSkills(player, reaction.Channel, result,
                                                  Utils.JSON <int[]>(arrays[0]), rused, true);
            }
        }
Beispiel #3
0
        public async Task AutoNewCharacter(SocketReaction reaction, IUserMessage msg)
        {
            switch (reaction.Emote.ToString())
            {
            case ok:
                await CharacterCommands.AutoCharacter(player, reaction.Channel, false);

                break;

            case next:
                await CharacterCommands.SetSkills(player, reaction.Channel, 0, null, new[] { false, false, false, false, false, false });

                break;

            case info:
                EmbedBuilder em = DUtils.BuildEmbed("Character Creation",
                                                    $"{EUI.ok} - Randomize {Environment.NewLine} {EUI.next} - Manual (Advanced)", null, default,
                                                    DUtils.NewField("Use the reactions to make your choice", "Making a character can be complicated for new users, use this to skip this step and start playing."
                                                                    + Environment.NewLine + "You can always make another new character once you are more comfortable with the system."));
                await EditMessage(null, em.Build(), removeReactions : false);

                break;
            }
        }
        internal static async Task <bool> SpecialExceptions(NeitsilliaError error, IMessageChannel chan, Player player)
        {
            switch (error.ErrorType)
            {
            case NeitsilliaErrorType.ReplyError:
                await chan.SendMessageAsync(error.ExtraMessage);

                return(true);

            case NeitsilliaErrorType.ReplyUI:
            {
                await chan.SendMessageAsync(error.ExtraMessage);

                switch (error.uitype)
                {
                case MsgType.CardGame:
                {
                    Type type = Neitsillia.Gambling.Games.GamblingGame.GetGameType(player.ui.data);
                    Neitsillia.Gambling.Games.IGamblingGame game = Neitsillia.Gambling.Games.GamblingGame.CreateInstance(type, player);
                    var embed = ((Neitsillia.Gambling.Games.GamblingGame)game).GetEmbed(player).Build();
                    await player.NewUI(null, embed, await player.DMChannel(), player.ui.type, player.ui.data);
                }
                break;
                }
                return(true);
            }

            case NeitsilliaErrorType.CharacterIsNotSetUp:
                if (player != null)
                {
                    if (player.ui.type == MsgType.AutoNewCharacter)
                    {
                        await CharacterCommands.AutoCharacter(player, chan, true);
                    }
                    else if (player.ui.type == MsgType.SetSkill ||
                             player.ui.type == MsgType.ConfirmSkills)
                    {
                        string[] arrays = player.ui.data.Split(';');
                        await CharacterCommands.SetSkills(player, chan, 0, Utils.JSON <int[]>(arrays[0]), Utils.JSON <bool[]>(arrays[1]));
                    }
                    else if (!await CharacterCommands.Set_Race(chan, player))
                    {
                        await CharacterCommands.StarterAbilities(player, chan, 1);
                    }
                    return(true);
                }
                return(false);

            case NeitsilliaErrorType.CharacterAdventuring:
                if (player != null)
                {
                    await Areas.AdventureStat(player, chan);

                    return(true);
                }
                return(false);

            case NeitsilliaErrorType.CharacterIsResting:
                if (player != null)
                {
                    await Areas.RestStat(player, chan);

                    return(true);
                }
                return(false);

            default: return(false);
            }
        }