[Help] Weather Packet (My First Packet)

05/08/2010 19:07 Sion~#16
Quote:
Originally Posted by CptSky View Post
Sorry, wrong conversion :) The packet type is 0x3f8 in hexadecimal, but it's 1016 in decimal, not 1017. And you need the TQServer at the end for new client.
.
05/08/2010 19:36 -Spirits-#17
delete this thread.
05/08/2010 19:44 -impulse-#18
Quote:
Originally Posted by -Spirits- View Post
I get it now! Thanks =]
Well, at least it doesn't crash.
So what now?

I have the correct weather packet...
Code:
public static COPacket Weather(byte Type, uint Intensity, uint Direction, uint Appearance)
        {
            byte[] Packet = new byte[28];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            [B]P.WriteInt16(1017);[/B]
            P.WriteInt16(Type);
            P.WriteInt32(Intensity);
            P.WriteInt32(Direction);
            P.WriteInt32(Appearance);

            return P;
        }
and then this command:
Code:
if (Cmd[0] == "/weather")
                        {
                            byte Weather = 0x1;
                            if (Cmd[1] == "nothing")
                                Weather = 0x1;
                            if (Cmd[1] == "rain")
                                Weather = 0x2;
                            if (Cmd[1] == "snow")
                                Weather = 0x3;
                            if (Cmd[1] == "rainwind")
                                Weather = 0x4;
                            if (Cmd[1] == "autumnleaves")
                                Weather = 0x5;
                            if (Cmd[1] == "cherryblossompetals")
                                Weather = 0x7;
                            if (Cmd[1] == "cherryblossompetalsWind")
                                Weather = 0x8;
                            if (Cmd[1] == "blowingcotten")
                                Weather = 0x9;
                            if (Cmd[1] == "atoms")
                                Weather = 0xa;
                            GC.AddSend(Packets.Weather(Weather, uint.Parse(Cmd[2]), uint.Parse(Cmd[3]), uint.Parse(Cmd[4])));
                        }
Do I need to send it somehow of does it already do that with the return P?
Check the packet it must be 1017 not 1016
05/08/2010 21:25 MonstersAbroad#19
It still will not work.

Check the packet again.
05/08/2010 23:55 Basser#20
Code:
public static COPacket Weather(byte Type, uint Intensity, uint Direction, uint Appearance)
        {
            byte[] Packet = new byte[17 + 8];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16(1016);
            P.WriteByte(Type);
            P.WriteInt32(Intensity);
            P.WriteInt32(Direction);
            P.WriteInt32(Appearance);

            return P;
        }
05/09/2010 00:39 MonstersAbroad#21
Still will not work.
05/09/2010 01:23 Korvacs#22
You have to give all 3 values a number, otherwise your not going to see any change, try fiddling with the values, the packet layout is correct.
05/09/2010 01:40 MonstersAbroad#23
So it is just the command that is wrong ?
05/09/2010 02:05 -Spirits-#24
delete this thread.
05/09/2010 05:23 CptSky#25
My structure works whit my correction... But as Korvacs said, you need to put a value to all. If you use a 5018+ client, you need to add the TQServer to the end, but the length in the packet should be 20.

Code:
Length -> 20
Type -> 1016
Look -> 1
Intensity -> 150
Direction -> 75
Color -> 0
Code:
Data = new byte[Length];
PacketWriter Writer = new PacketWriter(Data);

Writer.WriteUInt16(Length, 0);
Writer.WriteUInt16(Type, 2);
Writer.WriteUInt32(Look, 4);
Writer.WriteUInt32(Intensity, 8);
Writer.WriteUInt32(Direction, 12);
Writer.WriteUInt32(Color, 16);

return Writer.Flush();
05/09/2010 05:42 -Spirits-#26
delete this thread.
05/09/2010 05:46 CptSky#27
Quote:
Originally Posted by -Spirits- View Post
and still no snow =\
so what am I doing wrong?
The color of the snow should be 0.
05/09/2010 07:46 -Spirits-#28
delete this thread.
05/09/2010 12:37 Korvacs#29
try /weather snow 1 1 1

Also:

Code:
        public static COPacket Weather(Features.WeatherType Type, uint Intensity, uint Direction, uint Appearance)
        {
            byte[] Packet = new byte[8 + 17];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16((ushort)0x3f8);
            P.WriteByte((byte)Type);
            P.WriteInt32(Intensity);
            P.WriteInt32(Direction);
            P.WriteInt32(Appearance);
            return P;
        }
This packet is already in 5165 so why are you trying to remake it?
05/09/2010 13:07 MonstersAbroad#30
Still will not work.

I have played around but nothing :( is there a chance that the command is all wrong ?