예제 #1
0
        public static Message DeserializeEQG(IValue value)
        {
            var om    = (Types.Map)value;
            var array = (AnArray)om["Info"];
            var m     = (Types.Map)array[0];
            var msg   = new TeleportFinish
            {
                AgentID        = m["AgentID"].AsUUID,
                LocationID     = m["LocationID"].AsUInt,
                SeedCapability = m["SeedCapability"].ToString(),
                SimAccess      = (RegionAccess)m["SimAccess"].AsUInt,
                SimIP          = new IPAddress((BinaryData)m["SimIP"]),
                SimPort        = (ushort)m["SimPort"].AsUInt
            };

            byte[] tpflags = (BinaryData)m["TeleportFlags"];
            byte[] rx      = (BinaryData)m["RegionSizeX"];
            byte[] ry      = (BinaryData)m["RegionSizeY"];
            if (BitConverter.IsLittleEndian)
            {
                Array.Reverse(tpflags);
                Array.Reverse(rx);
                Array.Reverse(ry);
            }
            msg.TeleportFlags = (TeleportFlags)BitConverter.ToUInt64(tpflags, 0);
            msg.RegionSize    = new GridVector(BitConverter.ToUInt32(rx, 0), BitConverter.ToUInt32(ry, 0));
            return(msg);
        }
예제 #2
0
        public static Message Decode(UDPPacket p)
        {
            var m = new TeleportFinish
            {
                AgentID    = p.ReadUUID(),
                LocationID = p.ReadUInt32(),
                SimIP      = new IPAddress(p.ReadBytes(4)),
                SimPort    = p.ReadUInt16()
            };

            m.GridPosition.RegionHandle = p.ReadUInt32();
            m.SeedCapability            = p.ReadStringLen16();
            m.SimAccess     = (RegionAccess)p.ReadUInt8();
            m.TeleportFlags = (TeleportFlags)p.ReadUInt32();
            return(m);
        }