コード例 #1
0
        private void CreateYellEvent(Thing entity)
        {
            var contextMessage = new ContextualString(entity, null)
            {
                ToOriginator = $"You yell: {yellSentence}",
                ToReceiver   = $"You hear {entity.Name} yell: {yellSentence}",
                ToOthers     = $"You hear {entity.Name} yell: {yellSentence}",
            };
            var sm = new SensoryMessage(SensoryType.Hearing, 100, contextMessage);

            yellEvent = new VerbalCommunicationEvent(entity, sm, VerbalCommunicationType.Yell);
        }
コード例 #2
0
ファイル: Yell.cs プロジェクト: wyt3dr4g0n/WheelMUD
        private void CreateYellEvent(Thing entity)
        {
            var contextMessage = new ContextualString(entity, null)
            {
                ToOriginator = "You yell: " + this.yellSentence,
                ToReceiver   = "You hear $ActiveThing.Name yell: " + this.yellSentence,
                ToOthers     = "You hear $ActiveThing.Name yell: " + this.yellSentence,
            };
            var sm = new SensoryMessage(SensoryType.Hearing, 100, contextMessage);

            this.yellEvent = new VerbalCommunicationEvent(entity, sm, VerbalCommunicationType.Yell);
        }
コード例 #3
0
ファイル: Say.cs プロジェクト: jmurdick/WheelMUD
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        public override void Execute(ActionInput actionInput)
        {
            IController sender         = actionInput.Controller;
            var         contextMessage = new ContextualString(sender.Thing, sender.Thing.Parent)
            {
                ToOriginator = $"You say: {this.sayText}",
                ToReceiver   = $"{sender.Thing.Name} says: {this.sayText}",
                ToOthers     = $"{sender.Thing.Name} says: {this.sayText}",
            };
            var sm = new SensoryMessage(SensoryType.Hearing, 100, contextMessage);

            var sayEvent = new VerbalCommunicationEvent(sender.Thing, sm, VerbalCommunicationType.Say);

            sender.Thing.Eventing.OnCommunicationRequest(sayEvent, EventScope.ParentsDown);
            if (!sayEvent.IsCancelled)
            {
                sender.Thing.Eventing.OnCommunicationEvent(sayEvent, EventScope.ParentsDown);
            }
        }
コード例 #4
0
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        public override void Execute(ActionInput actionInput)
        {
            var emoteString = $"<*{actionInput.Actor.Name} {actionInput.Tail}>";

            var contextualString = new ContextualString(actionInput.Actor, actionInput.Actor.Parent)
            {
                ToOriginator = emoteString,
                ToOthers     = emoteString
            };

            var msg        = new SensoryMessage(SensoryType.Sight, 100, contextualString);
            var emoteEvent = new VerbalCommunicationEvent(actionInput.Actor, msg, VerbalCommunicationType.Emote);

            actionInput.Actor.Eventing.OnCommunicationRequest(emoteEvent, EventScope.ParentsDown);
            if (!emoteEvent.IsCancelled)
            {
                actionInput.Actor.Eventing.OnCommunicationEvent(emoteEvent, EventScope.ParentsDown);
            }
        }
コード例 #5
0
ファイル: Emote.cs プロジェクト: CassCoffey/WheelMUD
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        public override void Execute(ActionInput actionInput)
        {
            IController sender      = actionInput.Controller;
            string      emoteString = string.Format("$ActiveThing.Name {0}", emoteText);

            var contextualString = new ContextualString(sender.Thing, sender.Thing.Parent)
            {
                ToOriginator = emoteString,
                ToOthers     = emoteString
            };

            var msg        = new SensoryMessage(SensoryType.Sight, 100, contextualString);
            var emoteEvent = new VerbalCommunicationEvent(sender.Thing, msg, VerbalCommunicationType.Emote);

            sender.Thing.Eventing.OnCommunicationRequest(emoteEvent, EventScope.ParentsDown);
            if (!emoteEvent.IsCancelled)
            {
                sender.Thing.Eventing.OnCommunicationEvent(emoteEvent, EventScope.ParentsDown);
            }
        }
コード例 #6
0
ファイル: Tell.cs プロジェクト: arty1901/WheelMUD
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        /// <remarks>TODO: ability to block via ear muffs, send tell to NPC? Also remote rtell via @</remarks>
        public override void Execute(ActionInput actionInput)
        {
            var fixedSentence  = $"'<%yellow%> {sentence}<%n%>'";
            var contextMessage = new ContextualString(actionInput.Controller.Thing, target)
            {
                ToOriginator = BuildOriginatorMessage(fixedSentence),
                ToReceiver   = $"{actionInput.Controller.Thing.Name} tells you: {fixedSentence}",
                ToOthers     = null,
            };
            var sm = new SensoryMessage(SensoryType.Hearing, 100, contextMessage);

            var tellEvent = new VerbalCommunicationEvent(actionInput.Controller.Thing, sm, VerbalCommunicationType.Tell);

            // Make sure both the user is allowed to do the tell and the target is allowed to receive it.
            target.Eventing.OnCommunicationRequest(tellEvent, EventScope.SelfDown);
            actionInput.Controller.Thing.Eventing.OnCommunicationRequest(tellEvent, EventScope.SelfDown);
            if (!tellEvent.IsCancelled)
            {
                // Printing the sensory message is all that's left to do, which the event itself will take care of.
                target.Eventing.OnCommunicationEvent(tellEvent, EventScope.SelfDown);
                actionInput.Controller.Thing.Eventing.OnCommunicationEvent(tellEvent, EventScope.SelfDown);
            }
        }
コード例 #7
0
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        /// <remarks>TODO: ability to block via ear muffs, send tell to NPC? Also remote rtell via @</remarks>
        public override void Execute(ActionInput actionInput)
        {
            IController sender         = actionInput.Controller;
            string      fixedSentence  = "\"<%yellow%>" + this.sentence + "<%n%>\"";
            var         contextMessage = new ContextualString(sender.Thing, this.target)
            {
                ToOriginator = this.BuildOriginatorMessage(fixedSentence),
                ToReceiver   = string.Format("{0} tells you: {1}", sender.Thing.Name, fixedSentence),
                ToOthers     = null,
            };
            var sm = new SensoryMessage(SensoryType.Hearing, 100, contextMessage);

            var tellEvent = new VerbalCommunicationEvent(sender.Thing, sm, VerbalCommunicationType.Tell);

            // Make sure both the user is allowed to do the tell and the target is allowed to receive it.
            this.target.Eventing.OnCommunicationRequest(tellEvent, EventScope.SelfDown);
            sender.Thing.Eventing.OnCommunicationRequest(tellEvent, EventScope.SelfDown);
            if (!tellEvent.IsCancelled)
            {
                // Printing the sensory message is all that's left to do, which the event itself will take care of.
                this.target.Eventing.OnCommunicationEvent(tellEvent, EventScope.SelfDown);
                sender.Thing.Eventing.OnCommunicationEvent(tellEvent, EventScope.SelfDown);
            }
        }