Ejemplo n.º 1
0
        public void Read(PacketIn p)
        {
            GUID = p.ReadPackedGUID();

            Flags  = (MovementFlags)p.ReadUInt32();
            Flags2 = (MovementFlags2)p.ReadUInt16();
            Time   = p.ReadUInt32();

            PositionX = p.ReadSingle();
            PositionY = p.ReadSingle();
            PositionZ = p.ReadSingle();
            PositionO = p.ReadSingle();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT))
            {
                if (MovementDataTransport == null)
                {
                    MovementDataTransport = new MovementDataTransport();
                }

                MovementDataTransport.TransportGuid = p.ReadPackedGUID();
                MovementDataTransport.TransportX    = p.ReadSingle();
                MovementDataTransport.TransportY    = p.ReadSingle();
                MovementDataTransport.TransportZ    = p.ReadSingle();
                MovementDataTransport.TransportO    = p.ReadSingle();
                MovementDataTransport.TransportTime = p.ReadUInt32();
                MovementDataTransport.TransportSeat = p.ReadByte();

                if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
                {
                    MovementDataTransport.TransportTime2 = p.ReadUInt32();
                }
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING | MovementFlags.MOVEMENTFLAG_FLYING) ||
                Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
            {
                Pitch = p.ReadSingle();
            }

            FallTime = p.ReadUInt32();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING))
            {
                FallVerticalSpeed = p.ReadSingle();
                FallSine          = p.ReadSingle();
                FallCosine        = p.ReadSingle();
                FallLateralSpeed  = p.ReadSingle();
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION))
            {
                SplineElevation = p.ReadSingle();
            }
        }
Ejemplo n.º 2
0
        public async Task HandleNameQuery(CMSG_NAME_QUERY pkt)
        {
            var player = GrainFactory.GetGrain<IPlayer>(pkt.guid.ToInt64());
            var valid = await player.IsValid();

            var guid_packed = new PackedGUID(pkt.guid);

            PacketOut p = new PacketOut(RealmOp.SMSG_NAME_QUERY_RESPONSE);
            p.Write(guid_packed);

            if (!valid)
            {
                p.Write((byte)1); //unknown
                await SendPacket(p);
                return;
            }

            p.Write((byte)0); //known
            p.WriteCString(await player.GetName());

            var realmid = await player.GetRealmID();

            if (realmid != await GetRealmID()) //player is on a different realm to this session, append their realm name
            {
                var realm_manager = GrainFactory.GetGrain<IRealmManager>(0);
                p.WriteCString(await realm_manager.GetRealmName((int)realmid));
            }
            else
                p.Write((byte)0); //null string aka same realm aka dont show anything extra

            p.Write(await player.GetRace());
            p.Write(await player.GetGender());
            p.Write(await player.GetClass());
            p.Write((byte)0); //isNameDeclined

            await SendPacket(p);
        }
Ejemplo n.º 3
0
 public void Write(PackedGUID guid)
 {
     Write(guid.mask);
     Write(guid.guidbytes);
 }
Ejemplo n.º 4
0
        public void Read(PacketIn p)
        {
            GUID = p.ReadPackedGUID();

            Flags = (MovementFlags)p.ReadUInt32();
            Flags2 = (MovementFlags2)p.ReadUInt16();
            Time = p.ReadUInt32();

            PositionX = p.ReadSingle();
            PositionY = p.ReadSingle();
            PositionZ = p.ReadSingle();
            PositionO = p.ReadSingle();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT))
            {
                if (MovementDataTransport == null)
                    MovementDataTransport = new MovementDataTransport();

                MovementDataTransport.TransportGuid = p.ReadPackedGUID();
                MovementDataTransport.TransportX = p.ReadSingle();
                MovementDataTransport.TransportY = p.ReadSingle();
                MovementDataTransport.TransportZ = p.ReadSingle();
                MovementDataTransport.TransportO = p.ReadSingle();
                MovementDataTransport.TransportTime = p.ReadUInt32();
                MovementDataTransport.TransportSeat = p.ReadByte();

                if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
                    MovementDataTransport.TransportTime2 = p.ReadUInt32();
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING | MovementFlags.MOVEMENTFLAG_FLYING) ||
                Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
                Pitch = p.ReadSingle();

            FallTime = p.ReadUInt32();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING))
            {
                FallVerticalSpeed = p.ReadSingle();
                FallSine = p.ReadSingle();
                FallCosine = p.ReadSingle();
                FallLateralSpeed = p.ReadSingle();
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION))
                SplineElevation = p.ReadSingle();
        }
Ejemplo n.º 5
0
 public static object Deserializer(System.Type expected, global::Orleans.Serialization.BinaryTokenStreamReader stream)
 {
     Shared.PackedGUID result = new Shared.PackedGUID();
     result.guidbytes = ((byte[])(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(byte[]), stream)));
     result.mask = ((byte)(Orleans.Serialization.SerializationManager.DeserializeInner(typeof(byte), stream)));
     return result;
 }
Ejemplo n.º 6
0
 public static object DeepCopier(object original)
 {
     Shared.PackedGUID input = ((Shared.PackedGUID)(original));
     Shared.PackedGUID result = new Shared.PackedGUID();
     Orleans.Serialization.SerializationContext.Current.RecordObject(original, result);
     result.guidbytes = ((byte[])(Orleans.Serialization.SerializationManager.DeepCopyInner(input.guidbytes)));
     result.mask = input.mask;
     return result;
 }
Ejemplo n.º 7
0
 public void Write(PackedGUID guid)
 {
     Write(guid.mask);
     Write(guid.guidbytes);
 }