예제 #1
0
        /// <summary>
        /// Submits the given string to a filtered list of users (determined by scope)
        /// and after parsing any variables contained within the string.
        /// </summary>
        public void Report(Globals.MessageScopeTypes scope, string message, IEntity oActor,
                           IEntity oVictim    = null, object oDirectObject = null, object oIndirectObject = null,
                           IGameEntity oSpace = null, object oExtra        = null)
        {
            Validation.IsNotNullOrEmpty(message, "message");
            Validation.IsNotNull(oActor, "oActor");

            Report(scope, message,
                   CommandParser.ToReportData(oActor, oVictim, oDirectObject, oIndirectObject, oSpace, oExtra));
        }
예제 #2
0
        /// <summary>
        /// Submits the given string to a filtered list of users (determined by scope)
        /// and after parsing any variables contained within the string.
        /// </summary>
        public void Report(Globals.MessageScopeTypes scope, string message, ReportData data)
        {
            Validation.IsNotNullOrEmpty(message, "message");
            Validation.IsNotNull(data, "data");

            try
            {
                var sb = new StringBuilder();
                sb.Append(CommandManager.GetParser("Command").CastAs <CommandParser>().ParseRegex(message,
                                                                                                  data.Actor.CastAs
                                                                                                  <IGameEntity>()));
                sb = sb.ParseString(CommandManager.VariableHelper,
                                    CommandManager.GetParser("Command").CastAs <CommandParser>(), data);
                if (sb.Length == 0)
                {
                    return;
                }

                sb.Insert(0, Environment.NewLine);

                SendMessageScope value;
                if (_messageScopeTable.TryGetValue(scope, out value))
                {
                    value.DynamicInvoke(sb, data);
                }
                else
                {
                    EntityManager.GetEntities().OfType <ICharacter>().ToList()
                    .ForEach(x => x.CastAs <ICharacter>().User.SendText(sb.ToString()));
                }
            }
            catch (Exception ex)
            {
                ex.Handle(ExceptionHandlingOptions.RecordAndThrow);
            }
        }
예제 #3
0
 public void Report(Globals.MessageScopeTypes scope, string message, ReportData data)
 {
     CommandExecutor.Report(scope, message, data);
 }
예제 #4
0
 public void Report(Globals.MessageScopeTypes scope, string message, IEntity oActor,
                    IEntity oVictim    = null, object oDirectObject = null, object oIndirectObject = null,
                    IGameEntity oSpace = null, object oExtra        = null)
 {
     CommandExecutor.Report(scope, message, oActor, oVictim, oDirectObject, oIndirectObject, oSpace, oExtra);
 }