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); }
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); }