public string Queue(IParty party, params int[] ids) { Unqueue(party); StringBuilder sb = new StringBuilder(); if (!party.IsSyncd) { sb.Append(AutoLevelSyncParty(party)); } IList <IAdventure> adventures = repository.Get(a => { return(ids.Contains(a.ID) && AdventureUtils.GetAllRequirementsPredicate(party).Invoke(a)); }); if (adventures.Count != 0) { sb.Append(Queue(party, adventures)); } else { sb.Append("The party does not match the requirements for any dungeons "); sb.Append("currently available!"); } return(sb.ToString()); }
public string QueueIgnoringRequirements(IParty party) { Unqueue(party); int minLevel = PartyUtils.GetLowestLevelPlayer(party).Level; IList <IAdventure> adventures = repository .Get(a => { return(a.MinimumLevel <= minLevel && AdventureUtils.GetCostRequirementPredicate(party).Invoke(a)); }); if (adventures.Count == 0) { return("A member in your party is either too low a level or cannot afford, " + "and dungeons!"); } Random rnd = new Random(); IAdventure adventure = adventures[rnd.Next(0, adventures.Count - 1)]; adventureQueue.Add(new KeyValuePair <IParty, IAdventure>(party, adventure)); return(string.Format("Your party has joined the adventure queue for {0}, which " + "will start shortly. Maximum level requirements have been ignored, Xp is capped at " + "the adventures maximum level ({1}). ", adventure.Name, adventure.MaximumLevel)); }
public string Queue(IParty party) { Unqueue(party); StringBuilder sb = new StringBuilder(); if (!party.IsSyncd) { sb.Append(AutoLevelSyncParty(party)); } var adventures = new List <IAdventure>((repository .GetByLevel(party.Level) .Where(AdventureUtils.GetCostRequirementPredicate(party)))); if (adventures.Count != 0) { sb.Append(Queue(party, adventures)); } else { sb.Append("The party does not match the requirements for any dungeons "); sb.Append("currently available!"); } return(sb.ToString()); }
public string Queue(IPlayer player) { if (IsQueued(player)) { return("You are already queued..." + Waiting(player)); } IList <IAdventure> adventures = new List <IAdventure>(repository .GetByLevel(player.CharClass.Level) .Where(AdventureUtils.GetGeneralRequirementsPredicate(player))); if (adventures.Count == 0) { return("You do not meet the level requirements needed to run a dungeon!"); } return(Queue(player, adventures)); }
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)); }