private static void SendMessage(float value, string targetName, MessagingType type) { switch (type) { case MessagingType.OwnDelayInfo: Chat.Print("<font color=\"#0cf006\">" + targetName + "=> My ult cast delay: " + value + " ms</font>"); break; case MessagingType.DelayTooSmall: string msg2 = "<font color=\"#D01616\">" + "Regeneration delay too small: " + value + "</font>"; Chat.Print(msg2); //AllyMessaging.SendMessageToAllies("Regeneration delay too small: " + value); break; case MessagingType.NotEnoughTime: Chat.Print("<font color=\"#D01616\">" + "Not enough time for me. Target: " + targetName + "</font>"); break; case MessagingType.NotEnougDamage: string msg4 = "<font color=\"#D01616\">" + "Not enough damage at all: " + value + "</font>"; Chat.Print(msg4); //AllyMessaging.SendMessageToAllies("Not enough damage at all: " + value); break; } }
public async Task <IActionResult> Edit(int id, [Bind("Id,MethodName")] MessagingType messagingType) { if (id != messagingType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(messagingType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MessagingTypeExists(messagingType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(messagingType)); }
/// <summary> /// Alter the lex entirely including all of its sublex /// </summary> /// <param name="context">Contextual nature of the request.</param> /// <param name="obfuscationLevel">-100 to 100 range.</param> /// <returns>the new lex</returns> private ILexica Mutate(MessagingType sensoryType, short obfuscationLevel = 0) { IDictata dict = GetDictata(); ILexica newLex = Clone(); if (dict != null) { IDictata newDict = null; if (obfuscationLevel != 0) { newDict = Thesaurus.ObscureWord(dict, obfuscationLevel); } else if (Type != LexicalType.ProperNoun && (Context.Severity + Context.Elegance + Context.Quality > 0 || Context.Language != dict.Language || Context.Plural != dict.Plural || Context.Possessive != dict.Possessive || Context.Tense != dict.Tense || Context.Perspective != dict.Perspective || Context.Determinant != dict.Determinant || Context.GenderForm.Feminine != dict.Feminine)) { newDict = Thesaurus.GetSynonym(dict, Context); } if (newDict != null) { newLex.Phrase = newDict.Name; } } return(newLex); }
/// <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 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> /// Prints ult castDelay in chat /// </summary> /// <value name="taretName">Champion name</value> /// <value name="type"></value> /// <value name="param">time parameter</value> public static void ProcessInfo(string targetName, MessagingType type, float param) { bool spam = CheckSpam(type); if (spam) return; SetLastSendTime(type); SendMessage(param, targetName, type); }
/// <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 return(new LexicalParagraph(GetImmediateDescription(viewer, sensoryTypes[0]))); }
private void BindPrivateMessaging() { var selectedMessagingType = drpMessagingType.Items.FindByValue(MessagingType.ToString()); if (selectedMessagingType != null) { selectedMessagingType.Selected = true; } BindPrivateMessagingTab(); }
public async Task <IActionResult> Create([Bind("Id,MethodName")] MessagingType messagingType) { if (ModelState.IsValid) { _context.Add(messagingType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(messagingType)); }
internal ISensoryEvent GetSelf(MessagingType type, short strength = 30) { return(new SensoryEvent() { SensoryType = type, Strength = strength, Event = new Lexica() { Phrase = TemplateName, Type = LexicalType.ProperNoun, Role = GrammaticalType.Subject } }); }
/// <summary> /// Prints ult castDelay in chat /// </summary> /// <value name="taretName">Champion name</value> /// <value name="type"></value> /// <value name="param">time parameter</value> public static void ProcessInfo(string targetName, MessagingType type, float param) { bool spam = CheckSpam(type); if (spam) { return; } SetLastSendTime(type); SendMessage(param, targetName, type); }
public string GetText(MessagingType type, ConcreteKey key) { var template = GetAll().FirstOrDefault(x => x.MessagingType == type && x.Key == key.ToString()); if (template == null) { FileLoger.Info($"Sms Tempalte With Key {key} Been Removed From Database"); return("sms template is removed"); } return(template.Text); }
/// <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)); }
public MessagingFormatter(MessagingType type, IApplicationInformation appInfo) { _module = typeof(TEvent).Name.Replace("Event", string.Empty); // module; _type = type; _appInfo = appInfo; switch (_type) { case MessagingType.Email: _bodyTemplatePath = AppConstants.MessageTemplatesPath.EmailBody; _subjectTemplatePath = AppConstants.MessageTemplatesPath.EmailSubject; break; } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } MessagingType = await _context.MessagingType.FirstOrDefaultAsync(m => m.Id == id); if (MessagingType == null) { return(NotFound()); } return(Page()); }
private static bool CheckSpam(MessagingType type) { switch (type) { case MessagingType.OwnDelayInfo: return Environment.TickCount - last_DelayInfo < 15000; case MessagingType.DelayTooSmall: return Environment.TickCount - last_DelayTooSmall < 15000; case MessagingType.NotEnoughTime: return Environment.TickCount - last_NotEnoughTime < 15000; case MessagingType.NotEnougDamage: return Environment.TickCount - last_NotEnoughDamage < 15000; } return false; }
public static IMessagingStrategy GetInstance(MessagingType type, IUnitOfWork unitOfWork) { switch (type) { case MessagingType.RoboTele: return(new RoboTeleStrategy(unitOfWork)); case MessagingType.Sms: return(new SmsStrategy(unitOfWork)); case MessagingType.Email: return(new EmailStrategy(unitOfWork)); default: return(new NullObjectStrategy(unitOfWork)); } }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } MessagingType = await _context.MessagingType.FindAsync(id); if (MessagingType != null) { _context.MessagingType.Remove(MessagingType); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
/// <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.Psychic: me.Strength = GetPsychicDelta(viewer); me.TryModify(GetPsychicDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; case MessagingType.Tactile: me.Strength = GetTactileDelta(viewer); me.TryModify(GetTouchDescriptives(viewer).Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); break; case MessagingType.Taste: me.Strength = GetTasteDelta(viewer); me.TryModify(GetTasteDescriptives(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); }
private static void SetLastSendTime(MessagingType type) { switch (type) { case MessagingType.OwnDelayInfo: last_DelayInfo = Environment.TickCount; break; case MessagingType.DelayTooSmall: last_DelayTooSmall = Environment.TickCount; break; case MessagingType.NotEnoughTime: last_NotEnoughTime = Environment.TickCount; break; case MessagingType.NotEnougDamage: last_NotEnoughDamage = Environment.TickCount; break; } }
/// <summary> /// This observer method allows for the Academics.Sorting class to update this class with /// the internal state of array values. /// </summary> /// <param name="the_args">the information sent from the Academics.Sorting class.</param> public void update(object[] the_args) { MessagingType type = (MessagingType)the_args[0]; //if we are drawing and a drawing message was sent if (my_cross_thread_draw != null && type == MessagingType.Drawing) { Bitmap buffer_write; Bitmap buffer_draw; getBuffers(out buffer_write, out buffer_draw); //find which sort is active and callback accordingly switch (my_sort) { case Sorts.ShellSort: //shell sort draws gap values (a set of highlights) drawShellSort(buffer_write, buffer_draw, the_args); break; case Sorts.HeapSort: //heap sort needs to gain access to the internal heap array on the first iteration drawHeapSort(buffer_write, buffer_draw, the_args); break; case Sorts.MergeSort: //merge sort draws two markers (the high/low values) drawBars(buffer_write, buffer_draw, my_input_values, new DSInteger[] { new DSInteger((int)the_args[1]), new DSInteger((int)the_args[2]) }); break; default: //all others drawn with a marker and array drawBars(buffer_write, buffer_draw, my_input_values, new DSInteger[] { new DSInteger((int)the_args[1]) }); break; } } else if (type == MessagingType.PercentDone) { //lock percentage complete lock (this) { percentage_complete = Convert.ToDouble(the_args[1]); } } }
/// <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)); }
private static bool CheckSpam(MessagingType type) { switch (type) { case MessagingType.OwnDelayInfo: return(Environment.TickCount - last_DelayInfo < 15000); case MessagingType.DelayTooSmall: return(Environment.TickCount - last_DelayTooSmall < 15000); case MessagingType.NotEnoughTime: return(Environment.TickCount - last_NotEnoughTime < 15000); case MessagingType.NotEnougDamage: return(Environment.TickCount - last_NotEnoughDamage < 15000); } return(false); }
/// <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> /// Unpacks this applying language rules to expand and add articles/verbs where needed /// </summary> /// <param name="overridingContext">The full lexical context</param> /// <returns>A long description</returns> public IEnumerable <ILexica> Unpack(MessagingType sensoryType, short strength, LexicalContext overridingContext = null) { if (overridingContext != null) { IGlobalConfig globalConfig = ConfigDataCache.Get <IGlobalConfig>(new ConfigDataCacheKey(typeof(IGlobalConfig), "LiveSettings", ConfigDataType.GameWorld)); //Sentence must maintain the same language, tense and personage Context.Language = overridingContext.Language ?? Context.Language ?? globalConfig.BaseLanguage; Context.Tense = overridingContext.Tense; Context.Perspective = overridingContext.Perspective; Context.Elegance = overridingContext.Elegance; Context.Severity = overridingContext.Severity; Context.Quality = overridingContext.Quality; } ILexica newLex = Mutate(sensoryType, strength); foreach (IWordRule wordRule in Context.Language.WordRules.Where(rul => rul.Matches(newLex)) .OrderByDescending(rul => rul.RuleSpecificity())) { if (wordRule.NeedsArticle && (!wordRule.WhenPositional || Context.Position != LexicalPosition.None) && !newLex.Modifiers.Any(mod => (mod.Type == LexicalType.Article && !wordRule.WhenPositional && mod.Context.Position == LexicalPosition.None) || (mod.Type == LexicalType.Preposition && wordRule.WhenPositional && mod.Context.Position != LexicalPosition.None))) { LexicalContext articleContext = Context.Clone(); //Make it determinant if the word is plural articleContext.Determinant = Context.Plural || articleContext.Determinant; IDictata article = null; if (wordRule.SpecificAddition != null) { article = wordRule.SpecificAddition; } else { article = Thesaurus.GetWord(articleContext, wordRule.WhenPositional ? LexicalType.Preposition : LexicalType.Article); } if (article != null && !newLex.Modifiers.Any(lx => article.Name.Equals(lx.Phrase, StringComparison.InvariantCultureIgnoreCase))) { ILexica newArticle = newLex.TryModify(wordRule.WhenPositional ? LexicalType.Preposition : LexicalType.Article , GrammaticalType.Descriptive, article.Name, false); if (!wordRule.WhenPositional) { newArticle.Context.Position = LexicalPosition.None; } } } else if (wordRule.SpecificAddition != null && !newLex.Modifiers.Any(lx => wordRule.SpecificAddition.Equals(lx.GetDictata()))) { newLex.TryModify(wordRule.SpecificAddition.WordType, GrammaticalType.Descriptive, wordRule.SpecificAddition.Name); } if (!string.IsNullOrWhiteSpace(wordRule.AddPrefix) && !newLex.Phrase.StartsWith(wordRule.AddPrefix)) { newLex.Phrase = string.Format("{0}{1}", wordRule.AddPrefix, newLex.Phrase.Trim()); } if (!string.IsNullOrWhiteSpace(wordRule.AddSuffix) && !newLex.Phrase.EndsWith(wordRule.AddSuffix)) { newLex.Phrase = string.Format("{1}{0}", wordRule.AddSuffix, newLex.Phrase.Trim()); } } //Placement ordering List <Tuple <ILexica, int> > modifierList = new List <Tuple <ILexica, int> > { new Tuple <ILexica, int>(newLex, 0) }; //modification rules ordered by specificity List <ILexica> currentModifiers = new List <ILexica>(newLex.Modifiers); foreach (ILexica modifier in currentModifiers) { foreach (IWordPairRule wordRule in Context.Language.WordPairRules.Where(rul => rul.Matches(newLex, modifier)) .OrderByDescending(rul => rul.RuleSpecificity())) { if (wordRule.NeedsArticle && (!wordRule.WhenPositional || Context.Position != LexicalPosition.None) && !newLex.Modifiers.Any(mod => (mod.Type == LexicalType.Article && !wordRule.WhenPositional && mod.Context.Position == LexicalPosition.None) || (mod.Type == LexicalType.Preposition && wordRule.WhenPositional && mod.Context.Position != LexicalPosition.None))) { LexicalContext articleContext = Context.Clone(); //Make it determinant if the word is plural articleContext.Determinant = Context.Plural || articleContext.Determinant; IDictata article = null; if (wordRule.SpecificAddition != null) { article = wordRule.SpecificAddition; } else { article = Thesaurus.GetWord(articleContext, wordRule.WhenPositional ? LexicalType.Preposition : LexicalType.Article); } if (article != null && !newLex.Modifiers.Any(lx => article.Name.Equals(lx.Phrase, StringComparison.InvariantCultureIgnoreCase))) { ILexica newArticle = newLex.TryModify(wordRule.WhenPositional ? LexicalType.Preposition : LexicalType.Article , GrammaticalType.Descriptive, article.Name, false); if (!wordRule.WhenPositional) { newArticle.Context.Position = LexicalPosition.None; } } } else if (wordRule.SpecificAddition != null && !newLex.Modifiers.Any(lx => wordRule.SpecificAddition.Equals(lx.GetDictata()))) { newLex.TryModify(wordRule.SpecificAddition.WordType, GrammaticalType.Descriptive, wordRule.SpecificAddition.Name); } if (!string.IsNullOrWhiteSpace(wordRule.AddPrefix) && !newLex.Phrase.StartsWith(wordRule.AddPrefix)) { newLex.Phrase = string.Format("{0}{1}", wordRule.AddPrefix, newLex.Phrase.Trim()); } if (!string.IsNullOrWhiteSpace(wordRule.AddSuffix) && !newLex.Phrase.EndsWith(wordRule.AddSuffix)) { newLex.Phrase = string.Format("{1}{0}", wordRule.AddSuffix, newLex.Phrase.Trim()); } } } foreach (ILexica modifier in newLex.Modifiers) { IWordPairRule rule = Context.Language.WordPairRules.OrderByDescending(rul => rul.RuleSpecificity()) .FirstOrDefault(rul => rul.Matches(newLex, modifier)); if (rule != null) { int i = 0; foreach (ILexica subModifier in modifier.Unpack(sensoryType, strength, overridingContext ?? Context).Distinct()) { modifierList.Add(new Tuple <ILexica, int>(subModifier, rule.ModificationOrder + i++)); } } } return(modifierList.OrderBy(tup => tup.Item2).Select(tup => tup.Item1)); }
public async Task MessagingType_Test( int iterations, MessagingType messagingType) { var primaryServices = new ServiceCollection(); primaryServices.AddSingleton(Configuration); primaryServices.AddL1L2RedisCache(options => { Configuration.Bind("L1L2RedisCache", options); options.MessagingType = messagingType; }); var primaryL1L2Cache = primaryServices .BuildServiceProvider() .GetRequiredService <IDistributedCache>(); var primaryL1L2CacheOptions = primaryServices .BuildServiceProvider() .GetRequiredService <IOptions <L1L2RedisCacheOptions> >() .Value; var primaryDatabase = (await primaryL1L2CacheOptions .ConnectionMultiplexerFactory()) .GetDatabase( primaryL1L2CacheOptions .ConfigurationOptions? .DefaultDatabase ?? -1); await primaryDatabase.ExecuteAsync( "config", "set", "notify-keyspace-events", NotifyKeyspaceEventsConfig[messagingType]); var secondaryServices = new ServiceCollection(); secondaryServices.AddSingleton(Configuration); secondaryServices.AddL1L2RedisCache(options => { Configuration.Bind("L1L2RedisCache", options); options.MessagingType = messagingType; }); var secondaryL1L2Cache = secondaryServices .BuildServiceProvider() .GetRequiredService <IDistributedCache>(); for (var iteration = 0; iteration < iterations; iteration++) { var key = Guid.NewGuid().ToString(); var value = Guid.NewGuid().ToString(); await primaryL1L2Cache.SetStringAsync( key, value); Assert.Equal( value, await secondaryL1L2Cache .GetStringAsync(key)); await primaryL1L2Cache.RemoveAsync(key); await Task.Delay(25); Assert.Null( await secondaryL1L2Cache .GetStringAsync(key)); } }
/// <summary> /// Render this as being show inside a container /// </summary> /// <param name="viewer">The entity looking</param> /// <returns>the output strings</returns> public override 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 }; } 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 }; List <ISensoryEvent> sensoryOutput = new List <ISensoryEvent>(); foreach (MessagingType sense in sensoryTypes) { SensoryEvent me = new SensoryEvent(new Lexica(LexicalType.Pronoun, GrammaticalType.Subject, "you", collectiveContext), 0, sense); ILexica senseVerb = null; IEnumerable <ISensoryEvent> senseDescs = Enumerable.Empty <ISensoryEvent>(); switch (sense) { case MessagingType.Audible: me.Strength = GetAudibleDelta(viewer); senseVerb = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "hear", collectiveContext); IEnumerable <ISensoryEvent> audibleDescs = GetAudibleDescriptives(viewer); if (audibleDescs.Count() == 0) { continue; } ISensoryEvent audibleNoun = null; if (!audibleDescs.Any(desc => desc.Event.Role == GrammaticalType.DirectObject)) { audibleNoun = new SensoryEvent(new Lexica(LexicalType.Noun, GrammaticalType.DirectObject, "noise", discreteContext), me.Strength, sense); } else { audibleNoun = audibleDescs.FirstOrDefault(desc => desc.Event.Role == GrammaticalType.DirectObject); } audibleNoun.TryModify(audibleDescs.Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); senseDescs = new List <ISensoryEvent>() { audibleNoun }; break; case MessagingType.Olefactory: me.Strength = GetOlefactoryDelta(viewer); senseVerb = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "smell", collectiveContext); IEnumerable <ISensoryEvent> smellDescs = GetOlefactoryDescriptives(viewer); if (smellDescs.Count() == 0) { continue; } ISensoryEvent smellNoun = null; if (!smellDescs.Any(desc => desc.Event.Role == GrammaticalType.DirectObject)) { smellNoun = new SensoryEvent(new Lexica(LexicalType.Noun, GrammaticalType.DirectObject, "odor", discreteContext), me.Strength, sense); } else { smellNoun = smellDescs.FirstOrDefault(desc => desc.Event.Role == GrammaticalType.DirectObject); } smellNoun.TryModify(smellDescs.Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); senseDescs = new List <ISensoryEvent>() { smellNoun }; break; case MessagingType.Psychic: me.Strength = GetPsychicDelta(viewer); senseVerb = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "sense", collectiveContext); IEnumerable <ISensoryEvent> psyDescs = GetPsychicDescriptives(viewer); if (psyDescs.Count() == 0) { continue; } ISensoryEvent psyNoun = null; if (!psyDescs.Any(desc => desc.Event.Role == GrammaticalType.DirectObject)) { psyNoun = new SensoryEvent(new Lexica(LexicalType.Noun, GrammaticalType.DirectObject, "presence", discreteContext), me.Strength, sense); } else { psyNoun = psyDescs.FirstOrDefault(desc => desc.Event.Role == GrammaticalType.DirectObject); } psyNoun.TryModify(psyDescs.Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); senseDescs = new List <ISensoryEvent>() { psyNoun }; break; case MessagingType.Tactile: case MessagingType.Taste: continue; case MessagingType.Visible: me.Strength = GetVisibleDelta(viewer); senseVerb = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "see", collectiveContext); IEnumerable <ISensoryEvent> seeDescs = GetVisibleDescriptives(viewer); if (seeDescs.Count() == 0) { continue; } ISensoryEvent seeNoun = null; if (!seeDescs.Any(desc => desc.Event.Role == GrammaticalType.DirectObject)) { seeNoun = new SensoryEvent(new Lexica(LexicalType.Noun, GrammaticalType.DirectObject, "thing", discreteContext), me.Strength, sense); } else { seeNoun = seeDescs.FirstOrDefault(desc => desc.Event.Role == GrammaticalType.DirectObject); } seeNoun.TryModify(seeDescs.Where(desc => desc.Event.Role == GrammaticalType.Descriptive)); senseDescs = new List <ISensoryEvent>() { seeNoun }; break; } if (senseVerb != null && senseDescs.Count() > 0) { IEnumerable <ILexica> senseEvents = senseDescs.Select(desc => desc.Event); foreach (ILexica evt in senseEvents) { evt.Context = discreteContext; senseVerb.TryModify(evt); } me.TryModify(senseVerb); sensoryOutput.Add(me); } } return(new LexicalParagraph(sensoryOutput)); }
/// <summary> /// Make a sentence out of this /// </summary> /// <param name="type">the sentence type</param> /// <returns>the sentence</returns> public ILexicalSentence MakeSentence(SentenceType type, MessagingType sensoryType, short strength = 30) { return(new LexicalSentence(new SensoryEvent(this, strength, sensoryType))); }
private ILexica RunObscura(MessagingType sensoryType, IEntity observer, bool over) { ILexica message = null; LexicalContext context = new LexicalContext(observer) { Determinant = true, Perspective = NarrativePerspective.FirstPerson, Position = LexicalPosition.Around }; switch (sensoryType) { case MessagingType.Audible: if (!over) { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "hear", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "sounds", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "soft", context)); } else { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "hear", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "sounds", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "loud", context)); } break; case MessagingType.Olefactory: if (!over) { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "smell", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "something", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "subtle", context)); } else { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "smell", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "something", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "pungent", context)); } break; case MessagingType.Psychic: if (!over) { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "sense", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "presence", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "vague", context)); } else { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "sense", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "presence", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "disturbing", context)); } break; case MessagingType.Tactile: context.Position = LexicalPosition.Attached; if (!over) { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "brushes", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "skin", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "lightly", context)); } else { context.Elegance = -5; message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "rubs", observer, observer) .TryModify(new Lexica(LexicalType.Pronoun, GrammaticalType.Subject, "you", context)); } break; case MessagingType.Taste: context.Position = LexicalPosition.InsideOf; if (!over) { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "taste", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "something", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "subtle", context)); } else { context.Elegance = -5; message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "taste", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "something", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "offensive", context)); } break; case MessagingType.Visible: context.Plural = true; if (!over) { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "see", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "shadows", context)); } else { message = new Lexica(LexicalType.Verb, GrammaticalType.Verb, "see", observer, observer) .TryModify(new Lexica(LexicalType.Noun, GrammaticalType.Subject, "lights", context)) .TryModify(new Lexica(LexicalType.Adjective, GrammaticalType.Descriptive, "blinding", context)); } break; } return(message); }
/// <summary> /// Sends a message to a recipient via Facebook Messenger. /// </summary> /// <param name="recipient">The message recipient. Must be a valid <see cref="Recipient"/> subclass.</param> /// <param name="message">The completed message.</param> /// <param name="messageType">The message type. Defaults to <see cref="MessageType.Standard"/>.</param> /// <param name="messagingType">The messaging type. Defaults to <see cref="MessagingType.Response"/>.</param> /// <param name="notificationType">The notification type. Defaults to <see cref="NotificationType.Regular"/>.</param> /// <param name="tag">An optional message reference tag.</param> /// <returns>The id of the sent message.</returns> public async Task <string> SendMessage( Recipient recipient, CompletedMessage message, MessageType messageType = MessageType.Standard, MessagingType messagingType = MessagingType.Response, NotificationType notificationType = NotificationType.Regular, string tag = default ) { //todo: split messages every 2000 characters string messagingTypeString; switch (messagingType) { case MessagingType.Response: messagingTypeString = "RESPONSE"; break; case MessagingType.MessageTag: messagingTypeString = "MESSAGE_TAG"; break; case MessagingType.Update: messagingTypeString = "UPDATE"; break; default: throw new MessagingTypeNotSupportedException(messagingType); } string notificationTypeString; switch (notificationType) { case NotificationType.Regular: notificationTypeString = "REGULAR"; break; case NotificationType.SilentPush: notificationTypeString = "SILENT_PUSH"; break; case NotificationType.NoPush: notificationTypeString = "NO_PUSH"; break; default: throw new MessagingTypeNotSupportedException(messagingType); } var requestContainer = new SendRequestContainerEntity { MessagingType = messagingTypeString, Recipient = recipient.ToEntity(), NotificationType = notificationTypeString, Message = message.GetMessageEntity() }; if (tag != default) { requestContainer.Tag = tag; } if (messageType == MessageType.Subscription) { requestContainer.Tag = "NON_PROMOTIONAL_SUBSCRIPTION"; } var result = await _client.Post <SendMessageResponse, MessengerErrorWrapperEntity>(ApiUri.ToString(), requestContainer); if (result.Error != null) { throw new MessengerRequestFailedException("text", ApiUri.GetLeftPart(UriPartial.Path), result.HttpCode, result.Error.MessengerError.Code, result.Error.MessengerError.Message, result.Error.MessengerError.TraceId, result.Error.MessengerError.SubCode); } return(result.Success.MessageId); }
public MessagingTypeNotSupportedException(MessagingType type) : base($"Invalid messaging type: {type.ToString()}") { }
/// <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)); }