/// <summary> /// Render this as being show inside a container /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public ILexicalParagraph RenderAsContents(IEntity viewer, MessagingType[] sensoryTypes) { if (sensoryTypes == null || sensoryTypes.Count() == 0) { sensoryTypes = new MessagingType[] { MessagingType.Audible, MessagingType.Olefactory, MessagingType.Psychic, MessagingType.Tactile, MessagingType.Taste, MessagingType.Visible }; } IList <ISensoryEvent> Messages = new List <ISensoryEvent>(); //Self becomes the first sense in the list foreach (MessagingType sense in sensoryTypes) { ISensoryEvent me = GetSelf(sense); switch (sense) { case MessagingType.Audible: case MessagingType.Olefactory: case MessagingType.Psychic: case MessagingType.Tactile: case MessagingType.Taste: continue; case MessagingType.Visible: me.Strength = GetVisibleDelta(viewer); me.TryModify(GetVisibleDescriptives(viewer)); me.Event.Context = new LexicalContext(viewer) { Determinant = true, Perspective = NarrativePerspective.None, Plural = false, Position = LexicalPosition.InsideOf, Tense = LexicalTense.Present }; LexicalContext skyContext = new LexicalContext(viewer) { Determinant = true, Perspective = NarrativePerspective.None, Plural = false, Position = LexicalPosition.None, Tense = LexicalTense.Present }; me.TryModify(new Lexica(LexicalType.Noun, GrammaticalType.DirectObject, "sky", skyContext)); break; } if (me.Event.Modifiers.Count() > 0) { Messages.Add(me); } } return(new LexicalParagraph(Messages)); }
/// <summary> /// Render this in a short descriptive style /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public virtual ILexicalParagraph GetFullDescription(IEntity viewer, MessagingType[] sensoryTypes = null) { if (sensoryTypes == null || sensoryTypes.Count() == 0) { sensoryTypes = new MessagingType[] { MessagingType.Audible, MessagingType.Olefactory, MessagingType.Psychic, MessagingType.Tactile, MessagingType.Taste, MessagingType.Visible }; } IList <ISensoryEvent> Messages = new List <ISensoryEvent>(); //Self becomes the first sense in the list foreach (MessagingType sense in sensoryTypes) { ISensoryEvent self = GetSelf(sense); switch (sense) { case MessagingType.Audible: self.Strength = GetAudibleDelta(viewer); self.TryModify(GetAudibleDescriptives(viewer)); break; case MessagingType.Olefactory: self.Strength = GetOlefactoryDelta(viewer); self.TryModify(GetOlefactoryDescriptives(viewer)); break; case MessagingType.Psychic: case MessagingType.Taste: break; case MessagingType.Tactile: self.Strength = GetTactileDelta(viewer); self.TryModify(GetTouchDescriptives(viewer)); break; case MessagingType.Visible: self.Strength = GetVisibleDelta(viewer); self.TryModify(GetVisibleDescriptives(viewer)); break; } if (self.Event.Modifiers.Count() > 0) { Messages.Add(self); } } return(new LexicalParagraph(Messages)); }
/// <summary> /// Render this in a short descriptive style /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public ISensoryEvent GetImmediateDescription(IEntity viewer, MessagingType sensoryType) { ISensoryEvent me = GetSelf(sensoryType); switch (sensoryType) { case MessagingType.Audible: case MessagingType.Olefactory: case MessagingType.Psychic: case MessagingType.Tactile: case MessagingType.Taste: break; case MessagingType.Visible: me.Strength = GetVisibleDelta(viewer); me.TryModify(GetVisibleDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; } if (me.Event.Modifiers.Any()) { return(me); } return(new SensoryEvent(sensoryType)); }
/// <summary> /// Render this to a look command (what something sees when it 'look's at this) /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public virtual ILexicalParagraph RenderToOlefactory(IEntity viewer) { ISensoryEvent self = GetSelf(MessagingType.Olefactory); self.Strength = GetOlefactoryDelta(viewer); self.TryModify(GetOlefactoryDescriptives(viewer)); return(new LexicalParagraph(self)); }
/// <summary> /// Render this to a look command (what something sees when it 'look's at this) /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public virtual ILexicalParagraph RenderToTouch(IEntity viewer) { ISensoryEvent self = GetSelf(MessagingType.Tactile); self.Strength = GetTactileDelta(viewer); self.TryModify(GetTouchDescriptives(viewer)); return(new LexicalParagraph(self)); }
/// <summary> /// Render this in a short descriptive style /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public virtual ISensoryEvent GetImmediateDescription(IEntity viewer, MessagingType sense) { ISensoryEvent me = GetSelf(sense); switch (sense) { case MessagingType.Audible: me.Strength = GetAudibleDelta(viewer); me.TryModify(GetAudibleDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; case MessagingType.Olefactory: me.Strength = GetOlefactoryDelta(viewer); me.TryModify(GetOlefactoryDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; case MessagingType.Taste: case MessagingType.Psychic: break; case MessagingType.Tactile: me.Strength = GetTactileDelta(viewer); me.TryModify(GetTouchDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; case MessagingType.Visible: me.Strength = GetVisibleDelta(viewer); me.TryModify(GetVisibleDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; } return(me); }
public virtual ILexicalParagraph RenderResourceCollection(IEntity viewer, int amount) { LexicalContext collectiveContext = new LexicalContext(viewer) { Determinant = true, Perspective = NarrativePerspective.SecondPerson, Plural = false, Position = LexicalPosition.Around, Tense = LexicalTense.Present }; ISensoryEvent me = GetImmediateDescription(viewer, MessagingType.Visible); me.TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, amount.ToString(), collectiveContext)); return(new LexicalParagraph(me)); }
/// <summary> /// Render this as being show inside a container /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public virtual ILexicalParagraph RenderAsContents(IEntity viewer, MessagingType[] sensoryTypes) { if (sensoryTypes == null || sensoryTypes.Count() == 0) { sensoryTypes = new MessagingType[] { MessagingType.Audible, MessagingType.Olefactory, MessagingType.Psychic, MessagingType.Tactile, MessagingType.Taste, MessagingType.Visible }; } //Add the existential modifiers ISensoryEvent me = GetImmediateDescription(viewer, sensoryTypes[0]); me.TryModify(LexicalType.Noun, GrammaticalType.DirectObject, "ground") .TryModify( new Tuple <LexicalType, GrammaticalType, string>[] { new Tuple <LexicalType, GrammaticalType, string>(LexicalType.Article, GrammaticalType.IndirectObject, "in") } ); return(new LexicalParagraph(me)); }
/// <summary> /// Render this in a short descriptive style /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public override ILexicalParagraph GetFullDescription(IEntity viewer, MessagingType[] sensoryTypes = null) { if (sensoryTypes == null || sensoryTypes.Count() == 0) { sensoryTypes = new MessagingType[] { MessagingType.Audible, MessagingType.Olefactory, MessagingType.Psychic, MessagingType.Tactile, MessagingType.Taste, MessagingType.Visible }; } LexicalContext collectiveContext = new LexicalContext(viewer) { Determinant = true, Perspective = NarrativePerspective.SecondPerson, Plural = false, Position = LexicalPosition.None, Tense = LexicalTense.Present }; LexicalContext discreteContext = new LexicalContext(viewer) { Determinant = false, Perspective = NarrativePerspective.ThirdPerson, Plural = false, Position = LexicalPosition.Far, Tense = LexicalTense.Present }; //Self becomes the first sense in the list List <ISensoryEvent> sensoryOutput = new List <ISensoryEvent>(); foreach (MessagingType sense in sensoryTypes) { ISensoryEvent me = GetSelf(sense); switch (sense) { case MessagingType.Audible: me.Strength = GetAudibleDelta(viewer); IEnumerable <ISensoryEvent> aDescs = GetAudibleDescriptives(viewer); if (aDescs.Count() == 0) { continue; } me.TryModify(aDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); ILexica uberSounds = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "hear", collectiveContext); uberSounds.TryModify(aDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in aDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberSounds.TryModify(newDesc); } if (uberSounds.Modifiers.Any()) { me.TryModify(uberSounds); } break; case MessagingType.Olefactory: me.Strength = GetOlefactoryDelta(viewer); IEnumerable <ISensoryEvent> oDescs = GetOlefactoryDescriptives(viewer); if (oDescs.Count() == 0) { continue; } me.TryModify(oDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); ILexica uberSmells = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "smell", collectiveContext); uberSmells.TryModify(oDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in oDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberSmells.TryModify(newDesc); } if (uberSmells.Modifiers.Any()) { me.TryModify(uberSmells); } break; case MessagingType.Psychic: me.Strength = GetPsychicDelta(viewer); IEnumerable <ISensoryEvent> pDescs = GetPsychicDescriptives(viewer); if (pDescs.Count() == 0) { continue; } me.TryModify(pDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica collectivePsy = new Lexica(LexicalType.Pronoun, GrammaticalType.Subject, "you", collectiveContext); ILexica uberPsy = collectivePsy.TryModify(LexicalType.Verb, GrammaticalType.Verb, "sense"); uberPsy.TryModify(pDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in pDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberPsy.TryModify(newDesc); } if (uberPsy.Modifiers.Any()) { me.TryModify(collectivePsy); } break; case MessagingType.Taste: continue; case MessagingType.Tactile: me.Strength = GetTactileDelta(viewer); //Add the temperature me.TryModify(LexicalType.Verb, GrammaticalType.Verb, "feels").TryModify(new Lexica[] { new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, MeteorologicalUtilities.ConvertHumidityToType(EffectiveHumidity()).ToString(), collectiveContext), new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, MeteorologicalUtilities.ConvertTemperatureToType(EffectiveTemperature()).ToString(), collectiveContext) }); break; case MessagingType.Visible: me.Strength = GetVisibleDelta(viewer); IEnumerable <ISensoryEvent> vDescs = GetVisibleDescriptives(viewer); if (vDescs.Count() > 0) { me.TryModify(vDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica collectiveSight = new Lexica(LexicalType.Pronoun, GrammaticalType.Subject, "you", collectiveContext); ILexica uberSight = collectiveSight.TryModify(LexicalType.Verb, GrammaticalType.Verb, "see"); uberSight.TryModify(vDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in vDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberSight.TryModify(newDesc); } if (uberSight.Modifiers.Any()) { me.TryModify(collectiveSight); } } //Describe the size and population of this zone DimensionalSizeDescription zoneSize = GeographicalUtilities.ConvertSizeToType(GetModelDimensions(), GetType()); me.TryModify(LexicalType.Adjective, GrammaticalType.Descriptive, zoneSize.ToString()); //Render people in the zone CrowdSizeDescription populationSize = GeographicalUtilities.GetCrowdSize(GetContents <IMobile>().Count()); string crowdSize = "abandoned"; if ((short)populationSize > (short)zoneSize) { crowdSize = "crowded"; } else if (populationSize > CrowdSizeDescription.Intimate) { crowdSize = "sparsely populated"; } me.TryModify(LexicalType.Adjective, GrammaticalType.Descriptive, crowdSize); break; } if (me != null) { sensoryOutput.Add(me); } } foreach (ICelestial celestial in GetVisibileCelestials(viewer)) { sensoryOutput.AddRange(celestial.RenderAsContents(viewer, sensoryTypes).Events); } foreach (IWeatherEvent wEvent in WeatherEvents) { sensoryOutput.AddRange(wEvent.RenderAsContents(viewer, sensoryTypes).Events); } foreach (INaturalResourceSpawn <IFlora> resource in FloraNaturalResources) { sensoryOutput.AddRange(resource.Resource.RenderResourceCollection(viewer, resource.RateFactor).Events); } foreach (INaturalResourceSpawn <IFauna> resource in FaunaNaturalResources) { sensoryOutput.AddRange(resource.Resource.RenderResourceCollection(viewer, resource.RateFactor).Events); } foreach (INaturalResourceSpawn <IMineral> resource in MineralNaturalResources) { sensoryOutput.AddRange(resource.Resource.RenderResourceCollection(viewer, resource.RateFactor).Events); } //render our locales out foreach (ILocale locale in LiveCache.GetAll <ILocale>().Where(loc => loc.ParentLocation?.TemplateId == TemplateId)) { sensoryOutput.AddRange(locale.RenderAsContents(viewer, sensoryTypes).Events); } //render our locales out foreach (IPathway path in GetPathways()) { sensoryOutput.AddRange(path.RenderAsContents(viewer, sensoryTypes).Events); } return(new LexicalParagraph(sensoryOutput)); }
/// <summary> /// Render this in a short descriptive style /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public override ILexicalParagraph GetFullDescription(IEntity viewer, MessagingType[] sensoryTypes = null) { if (sensoryTypes == null || sensoryTypes.Count() == 0) { sensoryTypes = new MessagingType[] { MessagingType.Audible, MessagingType.Olefactory, MessagingType.Psychic, MessagingType.Tactile, MessagingType.Taste, MessagingType.Visible }; } LexicalContext collectiveContext = new LexicalContext(viewer) { Determinant = true, Perspective = NarrativePerspective.SecondPerson, Plural = false, Position = LexicalPosition.Around, Tense = LexicalTense.Present }; LexicalContext discreteContext = new LexicalContext(viewer) { Determinant = true, Perspective = NarrativePerspective.ThirdPerson, Plural = false, Position = LexicalPosition.Attached, Tense = LexicalTense.Present }; //Self becomes the first sense in the list List <ISensoryEvent> messages = new List <ISensoryEvent>(); foreach (MessagingType sense in sensoryTypes) { ISensoryEvent me = GetSelf(sense); switch (sense) { case MessagingType.Audible: me.Strength = GetAudibleDelta(viewer); IEnumerable <ISensoryEvent> aDescs = GetAudibleDescriptives(viewer); me.TryModify(aDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); ILexica uberSounds = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "hear", collectiveContext); uberSounds.TryModify(aDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in aDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.Subject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); me.TryModify(newDesc); } if (uberSounds.Modifiers.Any(mod => mod.Role == GrammaticalType.Subject)) { me.TryModify(uberSounds); } break; case MessagingType.Olefactory: me.Strength = GetOlefactoryDelta(viewer); IEnumerable <ISensoryEvent> oDescs = GetOlefactoryDescriptives(viewer); me.TryModify(oDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica uberSmells = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "smell", collectiveContext); uberSmells.TryModify(oDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in oDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberSmells.TryModify(newDesc); } if (uberSmells.Modifiers.Any(mod => mod.Role == GrammaticalType.Subject)) { me.TryModify(uberSmells); } break; case MessagingType.Psychic: me.Strength = GetPsychicDelta(viewer); IEnumerable <ISensoryEvent> pDescs = GetPsychicDescriptives(viewer); me.TryModify(pDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica collectivePsy = new Lexica(LexicalType.Pronoun, GrammaticalType.Subject, "you", collectiveContext); ILexica uberPsy = collectivePsy.TryModify(LexicalType.Verb, GrammaticalType.Verb, "sense"); uberPsy.TryModify(pDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in pDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberPsy.TryModify(newDesc); } if (uberPsy.Modifiers.Any(mod => mod.Role == GrammaticalType.Subject)) { me.TryModify(collectivePsy); } break; case MessagingType.Taste: me.Strength = GetTasteDelta(viewer); IEnumerable <ISensoryEvent> taDescs = GetTasteDescriptives(viewer); me.TryModify(taDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica uberTaste = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "taste", collectiveContext); uberTaste.TryModify(taDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in taDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberTaste.TryModify(newDesc); } if (uberTaste.Modifiers.Any(mod => mod.Role == GrammaticalType.Subject)) { me.TryModify(uberTaste); } break; case MessagingType.Tactile: me.Strength = GetTactileDelta(viewer); IEnumerable <ISensoryEvent> tDescs = GetOlefactoryDescriptives(viewer); me.TryModify(tDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica uberTouch = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "feel", collectiveContext); uberTouch.TryModify(tDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in tDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberTouch.TryModify(newDesc); } if (uberTouch.Modifiers.Any(mod => mod.Role == GrammaticalType.Subject)) { me.TryModify(uberTouch); } break; case MessagingType.Visible: me.Strength = GetVisibleDelta(viewer); IEnumerable <ISensoryEvent> vDescs = GetVisibleDescriptives(viewer); me.TryModify(vDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Descriptive)); Lexica uberSight = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "appears", collectiveContext); uberSight.TryModify(vDescs.Where(adesc => adesc.Event.Role == GrammaticalType.DirectObject).Select(adesc => adesc.Event)); foreach (ISensoryEvent desc in vDescs.Where(adesc => adesc.Event.Role == GrammaticalType.Subject)) { Lexica newDesc = new Lexica(desc.Event.Type, GrammaticalType.DirectObject, desc.Event.Phrase, discreteContext); newDesc.TryModify(desc.Event.Modifiers); uberSight.TryModify(newDesc); } if (uberSight.Modifiers.Any(mod => mod.Role == GrammaticalType.Subject)) { me.TryModify(uberSight); } //Describe the size and population of this zone DimensionalSizeDescription objectSize = GeographicalUtilities.ConvertSizeToType(GetModelDimensions(), GetType()); me.TryModify(LexicalType.Adjective, GrammaticalType.Descriptive, objectSize.ToString()); //Render people in the zone ObjectContainmentSizeDescription bulgeSizeAdjective = GeographicalUtilities.GetObjectContainmentSize(GetContents <IInanimate>().Sum(obj => obj.GetModelVolume()), GetModelVolume()); me.TryModify(LexicalType.Adjective, GrammaticalType.Descriptive, bulgeSizeAdjective.ToString()); break; } messages.Add(me); } return(new LexicalParagraph(messages)); }