Example #1
0
        private string Queue(IParty party, IList <IAdventure> adventures)
        {
            if (adventures.Any(AdventureUtils.GetPartySizeRequirementPredicate(party)))
            {
                IEnumerable <IAdventure> matches = adventures
                                                   .Where(AdventureUtils.GetPartySizeRequirementPredicate(party));
                Random     rnd       = new Random();
                IAdventure adventure = matches.ElementAt(rnd.Next(0, matches.Count()));
                adventureQueue.Add(new KeyValuePair <IParty, IAdventure>(party, adventure));
                return(string.Format("Your party has joined the adventure queue for {0}, which " +
                                     "will start shortly.", adventure.Name));
            }

            var ticket = new AdventureTicket(adventures, party.Players.ToArray());

            tickets.Add(ticket.TimeIn, ticket);
            TryToBuildParty();
            return(string.Format("You have joined the group finder! The estimated " +
                                 "waiting time is {0} mins", GetAverageWaitTime().Minutes));
        }