diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 9a617027a8..a895ee197a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -44,6 +44,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC { public bool SenseAsAgent { get; set; } + public delegate void ChatToNPC( + string message, byte type, Vector3 fromPos, string fromName, + UUID fromAgentID, UUID ownerID, byte source, byte audible); + + /// + /// Fired when the NPC receives a chat message. + /// + public event ChatToNPC OnChatToNPC; + + /// + /// Fired when the NPC receives an instant message. + /// + public event Action OnInstantMessageToNPC; + private readonly string m_firstname; private readonly string m_lastname; private readonly Vector3 m_startPos; @@ -614,17 +628,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, byte audible) { - } + ChatToNPC ctn = OnChatToNPC; - public virtual void SendChatMessage( - byte[] message, byte type, Vector3 fromPos, string fromName, - UUID fromAgentID, UUID ownerID, byte source, byte audible) - { + if (ctn != null) + ctn(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible); } public void SendInstantMessage(GridInstantMessage im) { - + Action oimtn = OnInstantMessageToNPC; + + if (oimtn != null) + oimtn(im); } public void SendGenericMessage(string method, UUID invoice, List message)