public SocialDef GetSocial(IBiota biote, string verb) { var socials = _staticDataManager.GetStaticData(Globals.SystemTypes.Social); return(socials.Select(def => def.CastAs <SocialDef>()) .FirstOrDefault(socialDef => socialDef.DisplayName.Equals(verb, StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Populates the command argument dictionary with the given data /// </summary> public IDictionary <string, object> PopulateCommandArgs(IBiota oActor, IEntity obj1, IEntity obj2, string aKeyword, bool aMessage = false) { return(new Dictionary <string, object> { { "actor", oActor }, { "object1", obj1 }, { "object2", obj2 }, { "keyword", aKeyword }, { "message", aMessage } }); }
public void ParseSocial(IBiota biote, SocialDef social, string phrase) { var executor = CommandManager.CommandExecutor; if (string.IsNullOrEmpty(phrase)) { if (biote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Character, social.CharNoArg, biote); } executor.Report(Globals.MessageScopeTypes.SpaceLimited, social.OthersNoArg, biote); return; } IGameEntity ent = null; // TODO: Get the entity from the phrase somehow if (ent == null) { if (biote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Character, Resources.MSG_NOTHING_HERE, biote); } return; } if (ent is ICharacter || ent is IMobile) { if (biote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Character, Resources.MSG_NO_OBJECT, biote); } return; } var oTargetBiote = ent as IBiota; if (oTargetBiote == null) { return; } if (oTargetBiote == biote) { if (biote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Character, social.CharAuto, biote); } executor.Report(Globals.MessageScopeTypes.SpaceLimited, social.OthersAuto, biote); return; } if (oTargetBiote.Location != biote.Location) { if (biote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Character, Resources.MSG_NOT_IN_SPACE, biote, null, oTargetBiote); } return; } if (biote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Character, social.CharFound, biote, oTargetBiote); } if (oTargetBiote is ICharacter) { executor.Report(Globals.MessageScopeTypes.Victim, social.VictFound, biote, oTargetBiote); } executor.Report(Globals.MessageScopeTypes.SpaceLimited, social.OthersFound, biote, oTargetBiote); }