My Packet Build

01/14/2012 02:30 shadowman123#1
Well i Was Learning about Constrcuting packets So here my example of nameChange packet Building

Heres My Code

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Conquer_Online_Server.Network.GamePackets
{
    class NameChange : Writer, Interfaces.IPacket
    {
        byte[] Buffer;
        public NameChange(bool Create)
        {
            if (Create)
            {
                Buffer = new byte[26 + 8];
                WriteUInt16(26, 0, Buffer);
                WriteUInt16(2080, 2, Buffer);
            }
        }
        public byte[] ToArray()
        {
            return Buffer;
        }
        public void Deserialize(byte[] buffer)
        {
            Buffer = buffer;
        }
        public void Send(Client.GameState client)
        {
            client.Send(Buffer);
        }
    }
}
So my question now is it built Right or smthing should be added ?
01/14/2012 03:30 Arco.#2
Considering there are 26 bytes in the packet, I'm sure there must be something else to the packet.
01/14/2012 14:55 shadowman123#3
Quote:
Originally Posted by Arco. View Post
Considering there are 26 bytes in the packet, I'm sure there must be something else to the packet.
what do u mean by that i dont understand u really ..Could u explain ?
01/14/2012 15:18 Kiyono#4
It could be me but it looks like you're not sending any data.
01/14/2012 15:25 Korvacs#5
Your only sending the packet's header.

Ie. Length and Type.

The packet should then have a body which contains fields...
01/14/2012 18:39 shadowman123#6
Quote:
Originally Posted by Korvacs View Post
Your only sending the packet's header.

Ie. Length and Type.

The packet should then have a body which contains fields...
u mean using smthing like that ?? if so how to know the right offsets and how to know the number of public uint which should be made ?

Code:
public uint Attacker
        {
            get { return BitConverter.ToUInt32(Buffer, 8); }
            set { Writer.WriteUInt32(value, 8, Buffer); }
        }

        public uint Attacked
        {
            get { return BitConverter.ToUInt32(Buffer, 12); }
            set { Writer.WriteUInt32(value, 12, Buffer); }
        }
        public Conquer_Online_Server.Network.GamePackets.SpellUse.EffectValue FirstEffect
        {
            get { return (Conquer_Online_Server.Network.GamePackets.SpellUse.EffectValue)Buffer[32]; }
            set { Writer.WriteByte((byte)value, 32, Buffer); }
        }
01/14/2012 19:25 Kiyono#7
Quote:
Originally Posted by shadowman123 View Post
u mean using smthing like that ?? if so how to know the right offsets and how to know the number of public uint which should be made ?

Code:
public uint Attacker
        {
            get { return BitConverter.ToUInt32(Buffer, 8); }
            set { Writer.WriteUInt32(value, 8, Buffer); }
        }

        public uint Attacked
        {
            get { return BitConverter.ToUInt32(Buffer, 12); }
            set { Writer.WriteUInt32(value, 12, Buffer); }
        }
        public Conquer_Online_Server.Network.GamePackets.SpellUse.EffectValue FirstEffect
        {
            get { return (Conquer_Online_Server.Network.GamePackets.SpellUse.EffectValue)Buffer[32]; }
            set { Writer.WriteByte((byte)value, 32, Buffer); }
        }
How do you know for sure that only ints are used? You have 26 bytes so it's very well possible for the packet to have other things such as:
byte = 1 byte
short = 2 bytes
int = 4 bytes
long = 8 bytes
And you can get offsets from trial and error/take them from other sources/packetlogging.
01/14/2012 19:27 Korvacs#8
Sure thats one way of doing it. You need to research the correct offsets which each packet contains, my packet wiki is one source of info, other server sources also contain packet structures, and you can find them out yourself by packet sniffing.
01/14/2012 20:06 shadowman123#9
Quote:
Originally Posted by Kiyono View Post
How do you know for sure that only ints are used? You have 26 bytes so it's very well possible for the packet to have other things such as:
byte = 1 byte
short = 2 bytes
int = 4 bytes
long = 8 bytes
And you can get offsets from trial and error/take them from other sources/packetlogging.
How to Packet logging beside the total bytes is 15 so there is missing bites or what ?? and how to know that my offsets r right when i use trial and error

Quote:
Originally Posted by Korvacs View Post
Sure thats one way of doing it. You need to research the correct offsets which each packet contains, my packet wiki is one source of info, other server sources also contain packet structures, and you can find them out yourself by packet sniffing.
Sure ill take alook at it ...but is the example of body i mentioned is good way to build like that or there is better ways ??
01/14/2012 20:29 Kiyono#10
Quote:
Originally Posted by shadowman123 View Post
How to Packet logging beside the total bytes is 15 so there is missing bites or what ?? and how to know that my offsets r right when i use trial and error
Uhm yeah? You're obviously missing stuff and what do you mean by 15 bytes? Your post says Buffer = new byte[26 + 8]; so it's obviously 26.
01/14/2012 21:41 -impulse-#11
He cant get the window to spawn (window to change your name..?) because as I know it's 10010 and not 2080. 2080 only handles when you click ok after you filled up the data.
01/14/2012 21:47 pro4never#12
Quote:
Originally Posted by -impulse- View Post
He cant get the window to spawn (window to change your name..?) because as I know it's 10010 and not 2080. 2080 only handles when you click ok after you filled up the data.
And also cause he's not writing any data to the packet even if it was right for what he wanted.

Please this is like your fourth thread on packets and you still haven't learned the basics on how they work! Take some time to read the links and watch the videos we already posted for you...
01/14/2012 23:19 shadowman123#13
Quote:
Originally Posted by -impulse- View Post
He cant get the window to spawn (window to change your name..?) because as I know it's 10010 and not 2080. 2080 only handles when you click ok after you filled up the data.
dude it Openwindow parameter but when i tried to enter my name it gave me unhandled packet 2080 with leght 26 so i started making the packet ..its in Alberto source i've seen it but its way of building packet weird or idk ..

but all i have to become is Strcutring the Packet in right way and knowing how to bring right offsets but surely i cant do that excpet by ur help Guyz

what i need to know now ..is How to packet Log as alot of ppls said to me and idk understand whats that means or how i do that ..and by trial and error i could create a command but how do i know that im using right offset by using this way

third what i need to know is how to Handle the packet and this cant be done even i asked you guyz cuz i have to Try my best to handle them and see examples from source ..really i became much interested and enjoying in coding and testing

Quote:
Originally Posted by pro4never View Post
And also cause he's not writing any data to the packet even if it was right for what he wanted.

Please this is like your fourth thread on packets and you still haven't learned the basics on how they work! Take some time to read the links and watch the videos we already posted for you...
well i checked many of posts u gave to me and i've watched vedios that fang posted here about how the internet works in 5 mins but my point guyz is i wont find any vedios which learn me how to code packets in co or smthing like that ..thats y iam learning from you guyz ..it would be bad if i kept repeting the same question over and over..i've posted ways of buidling packets and i asked what the best way would be so what i mean my question Aims at learning exact smthing not just Spaming ..i wish you get the message and thx for your Help dude you and others that try to help me
01/14/2012 23:26 Kiyono#14
If you want to know the offsets for this packet, just look at albetros.
ushort 0 26+8
ushort 2 2080
ushort 4 namechangeaction
ushort 6 editcount
ushort 8 editallowed
string (16 bytes) 10 name

Used with dialog 489.
01/14/2012 23:51 shadowman123#15
Quote:
Originally Posted by Kiyono View Post
If you want to know the offsets for this packet, just look at albetros.
ushort 0 26+8
ushort 2 2080
ushort 4 namechangeaction
ushort 6 editcount
ushort 8 editallowed
string (16 bytes) 10 name

Used with dialog 489.
thx alot for that but as well its a simple solution not efficient one cuz i wont find every offsets i want in sources so i have to learn creating them..so the question would be how can i get these values ? and i do know what dialog is cuz i created a command which allows me to test open window ids and i found the NameChange window dialog beside Degrade wep :)