コード例 #1
0
        public async Task Invite(IUser targetUser)
        {
            Player player = GetPlayer();
            Player target = GetPlayer(targetUser);

            if (player.party == null)
            {
                await ReplyMentionAsync("You are not in a party!");
            }
            else if (target.party == player.party)
            {
                await ReplyMentionAsync($"{targetUser.Mention} is already in {player.party.SafeName()}!");
            }
            else if (player.party.invited.Contains(target))
            {
                await ReplyMentionAsync($"{targetUser.Mention} is already invited!");
            }
            else if (player.party.invited.Count + player.party.currentUnits.Count + player.party.deadUnits.Count + player.party.fledUnits.Count > Party.MaximumUnits)
            {
                await ReplyMentionAsync($"{player.party.SafeName(true)} already has {Party.MaximumUnits} joined or invited members.");
            }
            else
            {
                player.party.invited.Add(target);

                IUserMessage message = await ReplyMentionAsync($"{targetUser.Mention} has been invited to join {player.party.SafeName()}!");

                Criteria <SocketReaction> criteria = new Criteria <SocketReaction>();

                EmojiResponse emojiResponse = new EmojiResponse(Context, criteria, inviteResponses, TimeSpan.FromMinutes(10));

                await EmojiOption(message, emojiResponse, TimeSpan.FromMinutes(10), Emojis.Tick);
            }
        }
コード例 #2
0
        public async Task Explore()
        {
            Player player = GetPlayer();

            if (player.party != null)
            {
                await ReplyMentionAsync("You must leave your party to explore alone!");

                return;
            }

            Location current = player.currentLocation;

            if (current == null)
            {
                current = ChatCraft.Instance.State.locations[0];
                player.currentLocation = current;
            }

            float luck = player.GetLuck();

            Encounter encounter;
            Location  location;
            ItemCount item;

            string message = Explore("You", current, luck, player.locations.Contains, out encounter, out location, out item);

            if (location != null)
            {
                player.locations.Add(location);
            }

            if (encounter != null)
            {
            }

            IUserMessage response = await ReplyMentionBlockAsync(message);

            if (item != null)
            {
                LootOpportunity loot = new ChatCraftTravel.LootOpportunity()
                {
                    item     = item,
                    player   = player,
                    location = player.party?.location ?? player.currentLocation
                };

                loots.Add(response.Id, loot);

                await response.AddReactionAsync(Emojis.Gem);
            }

            Criteria <SocketReaction> criteria = new Criteria <SocketReaction>();

            EmojiResponse emojiResponse = new EmojiResponse(Context, criteria, exploreResponses, TimeSpan.FromMinutes(10));

            await EmojiOption(response, emojiResponse, TimeSpan.FromMinutes(10), Emojis.Repeat);
        }
コード例 #3
0
        public async Task Explore()
        {
            Player player = GetPlayer();

            if (player.party == null)
            {
                await ReplyMentionAsync("You are not in a party!");

                return;
            }

            Location current = player.party.location;

            float luck = player.GetLuck();

            Encounter encounter;
            Location  location;
            ItemCount item;

            Predicate <Location> allKnowLocation = test =>
            {
                return(player.party.AllUnits.All(unit => !(unit is Player) || ((Player)unit).locations.Contains(test)));
            };

            string message = ChatCraftTravel.Explore(player.party.SafeName(), current, luck, allKnowLocation, out encounter, out location, out item);

            if (location != null)
            {
                foreach (Unit unit in player.party.AllUnits)
                {
                    if (unit is Player member && !member.locations.Contains(location))
                    {
                        member.locations.Add(location);

                        message += $"\n{member.name} discovered a new location!";
                    }
                }
            }

            if (encounter != null)
            {
            }

            IUserMessage response = await ReplyMentionBlockAsync(message);

            if (item != null)
            {
                ChatCraftTravel.LootOpportunity loot = new ChatCraftTravel.LootOpportunity()
                {
                    item     = item,
                    party    = player.party,
                    location = player.party.location
                };

                await response.AddReactionAsync(Emojis.Gem);

                ChatCraftTravel.loots.Add(response.Id, loot);
            }

            Criteria <SocketReaction> criteria = new Criteria <SocketReaction>();

            EmojiResponse emojiResponse = new EmojiResponse(Context, criteria, ChatCraftTravel.exploreResponses, TimeSpan.FromMinutes(10));

            await EmojiOption(response, emojiResponse, TimeSpan.FromMinutes(10), Emojis.Repeat);
        }