Esempio n. 1
0
        public MH_UserProp(ClientMessage cmsg, byte[] backing)
            : base(cmsg, backing)
        {
            UserID = cmsg.refNum; //The refnum field contains the UserID of the user whose props are changing

            var numProps = Reader.ReadInt32();
            Debug.WriteLine("{0} changed props (new count: {1})", UserID, numProps);

            PropIDs = new List<int>();

            var pSpecList = new List<AssetSpec>(9);
            while (numProps-- > 0)
            {
                var spec = Reader.ReadStruct<AssetSpec>();
                pSpecList.Add(spec);

                Debug.WriteLine("{0}th Prop spec: ID {1} CRC {2}", numProps, spec.id, spec.crc);

                Debug.WriteLine("Issuing prop request to palace server");
                var MHx = new MH_AssetQuery();
                MHx.Write(UserID, spec.id, spec.crc);

                //GetWebPropAsync(spec.id);
                PropIDs.Add(spec.id);
            }

            //user.PropRecords = pSpecList;
        }
Esempio n. 2
0
        public MH_UserExit(ClientMessage cmsg)
            : base(cmsg)
        {
            ExitingUserID = cmsg.refNum; //The refnum field contains the UserID of the user who left the room.

            Debug.WriteLine("User left current room: " + ExitingUserID);
        }
Esempio n. 3
0
 public MH_XTalk(ClientMessage cmsg, byte[] payload)
     : base(cmsg, payload)
 {
     short len = Reader.ReadInt16();
     byte[] xmsg = Reader.ReadBytes(len - 3);
     Reader.ReadByte();
     Text = PalaceEncryption.Decrypt(xmsg);
 }
Esempio n. 4
0
        public MH_UserLog(ClientMessage cmsg, byte[] backing)
            : base(cmsg, backing)
        {
            NewUserID = cmsg.refNum;
            NewUserCount = Reader.ReadInt32();

            Debug.WriteLine("{0} users, {1} joined", NewUserCount, NewUserID);
        }
Esempio n. 5
0
 public MH_XWhisper(ClientMessage cmsg, byte[] backing)
     : base(cmsg, backing)
 {
     short len = Reader.ReadInt16();
     byte[] xmsg = Reader.ReadBytes(len - 3);
     Reader.ReadByte();
     Text = PalaceEncryption.Decrypt(xmsg);
     TargetID = cmsg.refNum;
 }
Esempio n. 6
0
        public MH_ServerVersion(ClientMessage cmsg, byte[] backing)
            : base(cmsg, backing)
        {
            short
                refVerLo = (short)(cmsg.refNum),
                refVerHi = (short)(cmsg.refNum >> 16);

            Version = new Version(refVerHi, refVerLo);
            Debug.WriteLine("v{0}", Version);
        }
Esempio n. 7
0
        public override byte[] Write()
        {
            var head = new ClientMessage
            {
                eventType = MessageTypes.VERSION,
                length = 0,
                refNum = Version.Minor + Version.Major << 16
            };
            Writer.WriteStruct(head);

            return base.Write();
        }
Esempio n. 8
0
 public MH_SMsg(ClientMessage header, byte[] backing)
     : base(header, backing)
 {
 }
Esempio n. 9
0
 public MH_Logon(ClientMessage header, byte[] backing)
     : base(header, backing)
 {
     Record = Reader.ReadStruct<AuxRegistrationRec>();
 }
Esempio n. 10
0
 public MH_Whisper(ClientMessage cmsg, byte[] backing)
     : base(cmsg, backing)
 {
     Text = Reader.ReadCString();
     TargetID = cmsg.refNum;
 }
Esempio n. 11
0
 public MH_Blowthru(ClientMessage cmsg, byte[] backing)
     : base(cmsg, backing)
 {
     Payload = Reader.ReadBytes(cmsg.length);
     Debug.WriteLine("Blowthru (size {0}, refnum {1}): {2}", cmsg.length, cmsg.refNum, Payload.ToArrayString());
 }
Esempio n. 12
0
 private void HandleMessage(ClientMessage msg)
 {
     switch (msg.eventType)
     {
         case MessageTypes.ALTLOGONREPLY:
             var altreset = new MH_Logon(this);
             var altrec = altreset.Record;
     #if OFFLINE
             break;
     #endif
             var rec = reset.Record;
             Debug.WriteLine("AltLogonReply.");
             if (altrec.puidCRC != rec.puidCRC && altrec.puidCtr != rec.puidCtr)
             {
                 Debug.WriteLine("Server changed our puid data. Reconnecting.");
                 Signoff();
             }
             break;
         case MessageTypes.PING:
             Debug.WriteLine("Ping.");
             var msg_pingpong = new MH_PingPong(this, msg);
             msg_pingpong.Write();
             Debug.WriteLine("Pong.");
             break;
         case MessageTypes.USERSTATUS:
             var msg_ustatus = new MH_UserStatus(this, msg);
             break;
         case MessageTypes.USERMOVE:
             var msg_umove = new MH_UserMove(this, msg);
             break;
         case MessageTypes.USERPROP:
             var msg_uprop = new MH_UserProp(this, msg);
             break;
         case MessageTypes.USERLOG:
             var msg_ulog = new MH_UserLog(this, msg);
             break;
         case MessageTypes.USERLIST:
             var msg_ulist = new MH_UserList(this, msg);
             break;
         case MessageTypes.USEREXIT:
             var msg_uexit = new MH_UserExit(this, msg);
             break;
         case MessageTypes.USERNEW:
             var msg_unew = new MH_UserNew(this, msg);
             break;
         case MessageTypes.LOGOFF:
             var msg_logoff = new MH_Logoff(this, msg);
             break;
         case MessageTypes.TALK:
             var msg_talk = new MH_Talk(this);
             Debug.WriteLine("(fromuser {1}) msg: `{0}`", msg_talk.Text, msg.refNum);
             break;
         case MessageTypes.XTALK:
             var msg_xtalk = new MH_XTalk(this, msg);
             Debug.WriteLine("(fromuser {1}) msg: `{0}`", msg_xtalk.Text, msg.refNum);
     #if CLEVER
             if (Identity.ID != msg.refNum)
             {
                 var newxtalk = new MH_XTalk(this, clever.Think(msg_xtalk.Text));
                 newxtalk.Write();
             }
     #endif
             break;
         case MessageTypes.WHISPER:
             var msg_whisp = new MH_Whisper(this, msg);
             Debug.WriteLine("(fromuser {1}) msg: `{0}`", msg_whisp.Text, msg_whisp.Target.ID);
             //if (msg_whisp.Target.ID != Identity.ID)
             //{
             //    var msg_whisp_out = new MH_Whisper(this, msg_whisp.Target, new string(msg_whisp.Text.Reverse().ToArray()));
             //    msg_whisp_out.Write();
             //}
             break;
         case MessageTypes.XWHISPER:
             var msg_xwhisp = new MH_XWhisper(this, msg);
             Debug.WriteLine("(fromuser {1}) msg: `{0}`", msg_xwhisp.Text, msg_xwhisp.Target.ID);
     #if CLEVER
             if (msg_xwhisp.Target.ID != Identity.ID)
             {
                 //var msg_xwhisp_out = new MH_XWhisper(this, msg_xwhisp.Target, clever.Think(msg_xwhisp.Text));
                 var msg_xwhisp_out = new MH_XWhisper(this, msg_xwhisp.Target, new string(msg_xwhisp.Text.Reverse().ToArray()));
                 msg_xwhisp_out.Write();
             }
     #endif
             break;
         case MessageTypes.ROOMDESC:
             var msg_roomdesc = new MH_RoomDesc(this, msg);
             break;
         case MessageTypes.ROOMDESCEND:
             break;
         case MessageTypes.ASSETSEND:
             var msg_assetsend = new MH_AssetSend(this, msg);
             break;
         case MessageTypes.VERSION:
             var mh_sv = new MH_ServerVersion(this, msg);
             break;
         case MessageTypes.SERVERINFO:
             var msg_svinfo = new MH_ServerInfo(this, msg);
             break;
         case MessageTypes.HTTPSERVER:
             var msg_httpsv = new MH_HTTPServer(this);
             break;
         case MessageTypes.BLOWTHRU:
             var msg_blowthru = new MH_Blowthru(this, msg);
     #if OFFLINE
             blowthrus.Add(msg_blowthru.Payload);
     #endif
             break;
         default:
             //for (int i = 0; i < 500; i++)
             //    new MH_XWhisper(this, Palace.GetUserByID(msg.refNum), "hi").Write();
             Debug.WriteLine("Unknown EvT: {0} (0x{1:X8})", msg.eventType, (uint)msg.eventType);
             Reader.ReadBytes(msg.length);
             break;
     }
 }
Esempio n. 13
0
 protected MessageReader(ClientMessage header, byte[] backing = null)
     : this(backing)
 {
     this.Header = header;
 }