Exemple #1
0
        public async Task DiceGame(SocketReaction reaction, IUserMessage _)
        {
            string[] d = data.Split(';');
            //$"{coins};{streak}
            int.TryParse(d[0], out int coins);
            int.TryParse(d[1], out int streak);

            int i = EUI.Dice(reaction.Emote.ToString());

            if (i != -1)
            {
                await GamblingCommands.DiceGame_EvenOdd(player, reaction.Channel, i, coins, streak);
            }
            switch (reaction.Emote.ToString())
            {
            case EUI.cancel: await GameCommands.ShortStatsDisplay(player, reaction.Channel); break;

            case EUI.prev: await GamblingCommands.DiceGame_EvenOdd(player, reaction.Channel, -1, Math.Max(coins - 10, 10), streak); break;

            case EUI.next: await GamblingCommands.DiceGame_EvenOdd(player, reaction.Channel, -1, coins + 10, streak); break;

            case EUI.two: await GamblingCommands.DiceGame_EvenOdd(player, reaction.Channel, -1, coins * 2, streak); break;

            case EUI.five: await GamblingCommands.DiceGame_EvenOdd(player, reaction.Channel, -1, coins * 5, streak); break;

            case EUI.zero: await GamblingCommands.DiceGame_EvenOdd(player, reaction.Channel, -1, coins * 10, streak); break;
            }
        }
Exemple #2
0
        internal static async Task EndRest(Player player, ISocketMessageChannel chan)
        {
            if (player.IsResting)
            {
                EmbedBuilder rest         = new EmbedBuilder();
                DateTime     restDateTime = player.userTimers.restTime;
                if ((player.ui != null && (player.ui.type == MsgType.Rest || player.ui.type == MsgType.EndRest) &&
                     player.ui.data != null && player.ui.data != ""))
                {
                    string jsonTime = player.ui.data;
                    restDateTime = JsonConvert.DeserializeObject <DateTime>(jsonTime);
                }
                TimeSpan restTime = (DateTime.UtcNow - restDateTime);

                if (player.Party != null)
                {
                    foreach (PartyMember m in player.Party.members)
                    {
                        Player p = m.id == player.userid ? player : m.LoadPlayer();
                        rest.AddField(RestRecover(p, restTime.TotalSeconds));

                        p.userTimers.EndRest();
                        p.SaveFileMongo();
                    }
                    foreach (NPCSystems.NPC n in player.Party.NPCMembers)
                    {
                        rest.AddField(RestRecover(n, restTime.TotalSeconds));
                    }

                    await player.Party.SaveData();
                }
                else
                {
                    rest.AddField(RestRecover(player, restTime.TotalSeconds));
                    player.userTimers.EndRest();
                }

                await player.NewUI(await chan.SendMessageAsync(embed: rest.Build()), MsgType.Main);
            }
            else
            {
                await GameCommands.ShortStatsDisplay(player, chan);
            }
        }
Exemple #3
0
        public async Task Click(SocketReaction reaction, IUserMessage msg, Player argplayer)
        {
            this.player   = argplayer;
            this._channel = reaction.Channel;
            this.message  = msg;

            switch (reaction.Emote.ToString())
            {
            case inv:
                await GameCommands.DisplayInventory(player, reaction.Channel, 0);

                break;

            case sheet:
                await GameCommands.SheetDisplay(player, reaction.Channel);

                break;

            case xp:
                await GameCommands.ViewXP(player, reaction.Channel);

                break;

            case explore:
                await Commands.Areas.Exploration(player, reaction.Channel);

                break;

            case tpost:
                await Commands.Areas.ViewJunctions(player, reaction.Channel, 0);

                break;

            case ability:
                await GameCommands.Abilities(player, reaction.Channel);

                break;

            case enterFloor:
                await EnterFloor(null, reaction.Channel);

                break;

            case loot:
            {
                if (type == MsgType.Loot)
                {
                    await Loot(reaction, msg);
                }
                else
                {
                    int.TryParse(data, out int page);
                    await InventoryCommands.Inventory.ViewLoot(player, reaction.Channel, page);
                }
            } break;

            case schem:
                await GameCommands.ViewSchems(player, reaction.Channel);

                break;

            case stats:
                await GameCommands.ShortStatsDisplay(player, reaction.Channel);

                break;

            default:
                await Click2(reaction, msg);

                break;
            }
        }