public ChatEventArgs(
     string message, SLChatType type, LLVector3 sourcePos, SLSourceType sourceType,
     LLUUID sourceId, LLUUID ownerId, string fromName,
     bool audible, byte command, LLUUID commandId)
 {
     _message = message;
     _type = type;
     _sourcePos = sourcePos;
     _sourceType = sourceType;
     _sourceId = sourceId;
     _ownerId = ownerId;
     _fromName = fromName;
     _audible = audible;
     _command = command;
     _commandId = commandId;
 }
예제 #2
0
 public ChatEventArgs(
     string message, SLChatType type, LLVector3 sourcePos, SLSourceType sourceType,
     LLUUID sourceId, LLUUID ownerId, string fromName,
     bool audible, byte command, LLUUID commandId)
 {
     _message    = message;
     _type       = type;
     _sourcePos  = sourcePos;
     _sourceType = sourceType;
     _sourceId   = sourceId;
     _ownerId    = ownerId;
     _fromName   = fromName;
     _audible    = audible;
     _command    = command;
     _commandId  = commandId;
 }
예제 #3
0
        private void ChatIncoming(Packet packet, Simulator simulator)
        {
            if (packet.Layout.Name != "ChatFromSimulator")
            {
                return;
            }

            string       fromname   = string.Empty; //Name of source.
            LLUUID       sourceid   = new LLUUID(); //UUID of source, object/avatar
            LLUUID       ownerid    = new LLUUID(); //UUID of owner, if object UUID = owner of object, if avatar UUID = same as source
            SLSourceType sourcetype = SLSourceType.None;
            SLChatType   chattype   = SLChatType.Whisper;
            bool         audible    = false;           //Audible: 1 if audible, 0 if beyond 20m (message is null)
            LLVector3    position   = new LLVector3(); //Region local position of source.
            string       message    = string.Empty;    //Message from source
            byte         command    = 0;               //Unused?
            LLUUID       commandID  = new LLUUID();    //Unused?

            ArrayList blocks = packet.Blocks();

            foreach (Block block in blocks)
            {
                foreach (Field field in block.Fields)
                {
                    switch (field.Layout.Name)
                    {
                    case "SourceID":
                        sourceid = (LLUUID)field.Data;
                        break;

                    case "OwnerID":
                        ownerid = (LLUUID)field.Data;
                        break;

                    case "FromName":
                        fromname = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty);
                        break;

                    case "SourceType":
                        sourcetype = (SLSourceType)(byte)field.Data;
                        break;

                    case "ChatType":
                        chattype = (SLChatType)(byte)field.Data;
                        break;

                    case "Audible":
                        audible = ((byte)field.Data == 1 ? true : false);
                        break;

                    case "Message":
                        message = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty);
                        break;

                    case "Position":
                        position = (LLVector3)field.Data;
                        break;

                    case "Command":
                        command = (byte)field.Data;
                        break;

                    case "CommandID":
                        commandID = (LLUUID)field.Data;
                        break;
                    }
                }

                ChatEventArgs eventArgs = new ChatEventArgs(
                    message, chattype,
                    position, sourcetype, sourceid, ownerid,
                    fromname, audible, command, commandID);

                if (netcomSync != null)
                {
                    object[] ea = new object[1];
                    ea[0] = eventArgs;
                    netcomSync.Invoke(new OnChatRaise(OnChatReceived), ea);
                }
                else
                {
                    OnChatReceived(eventArgs);
                }
            }
        }