Exemplo n.º 1
0
    public static PacketWriter UpdatePlayer(IFieldActor <Player> player)
    {
        FieldObjectUpdate flag    = FieldObjectUpdate.Move | FieldObjectUpdate.Animate;
        PacketWriter      pWriter = PacketWriter.Of(SendOp.FIELD_OBJECT);

        pWriter.Write(FieldObjectMode.UpdateEntity);
        pWriter.WriteInt(player.ObjectId);
        pWriter.WriteByte((byte)flag);

        if (flag.HasFlag(FieldObjectUpdate.Type1))
        {
            pWriter.WriteByte();
        }

        if (flag.HasFlag(FieldObjectUpdate.Move))
        {
            pWriter.Write(player.Coord);
        }

        if (flag.HasFlag(FieldObjectUpdate.Level))
        {
            pWriter.WriteShort(player.Value.Levels.Level);
        }

        if (flag.HasFlag(FieldObjectUpdate.Type4))
        {
            pWriter.WriteShort();
            pWriter.WriteInt();
        }

        if (flag.HasFlag(FieldObjectUpdate.Type5))
        {
            pWriter.WriteUnicodeString("Unknown");
        }

        if (flag.HasFlag(FieldObjectUpdate.Type6))
        {
            pWriter.WriteInt();
        }

        if (flag.HasFlag(FieldObjectUpdate.Animate))
        {
            pWriter.WriteShort(player.Animation);
        }

        return(pWriter);
    }
Exemplo n.º 2
0
        public static Packet UpdatePlayer(IFieldObject <Player> player)
        {
            FieldObjectUpdate flag    = FieldObjectUpdate.Move | FieldObjectUpdate.Animate;
            PacketWriter      pWriter = PacketWriter.Of(SendOp.PROXY_GAME_OBJ);

            pWriter.WriteEnum(ProxyGameObjMode.UpdateEntity);
            pWriter.WriteInt(player.ObjectId);
            pWriter.WriteByte((byte)flag);

            if (flag.HasFlag(FieldObjectUpdate.Type1))
            {
                pWriter.WriteByte();
            }
            if (flag.HasFlag(FieldObjectUpdate.Move))
            {
                pWriter.Write(player.Coord);
            }
            if (flag.HasFlag(FieldObjectUpdate.Type3))
            {
                pWriter.WriteShort();
            }
            if (flag.HasFlag(FieldObjectUpdate.Type4))
            {
                pWriter.WriteShort();
                pWriter.WriteInt();
            }
            if (flag.HasFlag(FieldObjectUpdate.Type5))
            {
                pWriter.WriteUnicodeString("Unknown");
            }
            if (flag.HasFlag(FieldObjectUpdate.Type6))
            {
                pWriter.WriteInt();
            }
            if (flag.HasFlag(FieldObjectUpdate.Animate))
            {
                pWriter.WriteShort(player.Value.Animation);
            }

            return(pWriter);
        }