public override IQuestAction Create( IEntity questor, IEntity provider, IWorldInstance overworld, IEnumerable <string> tags) { List <IWorldInstance> worlds = overworld.GetWorlds(overworld); List <string> myTags = new List <string>(tags); worlds = worlds.Where(instance => questor.HasDataKey(instance.Name) == false).ToList(); if (worlds.Any() == false) { GlobalConstants.ActionLog.Log(questor + " has explored the whole world!", LogLevel.Warning); worlds = overworld.GetWorlds(overworld); } int result = this.Roller.Roll(0, worlds.Count); return(new ExploreQuestAction( new List <Guid>(), new List <Guid>(), new List <Guid> { worlds[result].Guid }, myTags)); }
public override bool ExecutedSuccessfully(IJoyAction action) { if (action.Name.Equals("enterworldaction", StringComparison.OrdinalIgnoreCase) == false) { return(false); } foreach (object obj in action.LastArgs) { if (obj is IWorldInstance world) { if (this.Areas.Contains(world.Guid) == false) { return(false); } } } IWorldInstance overworld = GlobalConstants.GameManager.Player.MyWorld.GetOverworld(); List <IWorldInstance> worlds = overworld.GetWorlds(overworld) .Where(instance => this.Areas.Contains(instance.Guid)) .ToList(); return(worlds.All(world => action.LastParticipants.First().HasDataKey(world.Name)) && action.Successful); }
public override string AssembleDescription() { StringBuilder builder = new StringBuilder(); IWorldInstance overworld = GlobalConstants.GameManager.Player.MyWorld.GetOverworld(); List <IWorldInstance> worlds = overworld.GetWorlds(overworld) .Where(instance => this.Areas.Contains(instance.Guid)) .ToList(); for (int i = 0; i < this.Areas.Count; i++) { if (i > 0 && i < this.Items.Count - 1) { builder.Append(", "); } if (this.Items.Count > 1 && i == this.Items.Count - 1) { builder.Append("and "); } builder.Append(worlds[i].Name); } return("Go to " + builder + "."); }