Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 02:10

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



little help with packet structure and inspiration

Discussion on little help with packet structure and inspiration within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
little help with packet structure and inspiration

edit : okay now forget what i've said been hrs looking for this stuff but still at some point so **** confused

now i got a working proxy , i got packet structure for entity spawn and for attacking packet and i can simply do something like ummm here
while(hunting)
get monsters x,y from packet 10014
send 1022 packet to the server with action kill the monster , right ? and incase i want to update the client i send the server reply to the client , right ?

is that right ? i don't think so , cuz i get the 10014 packet way faster than ill reply for it
for example : servers send me 50 monsters and i reply that i've killed 1 , so server won't send more till i move , right ?
should i save them in a list then with foreach loop ?

i duno im completely lost , will keep trying but still need little help to save time , thanks and any help is appreciated
go for it is offline  
Old 09/10/2012, 18:51   #2
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by go for it View Post
edit : okay now forget what i've said been hrs looking for this stuff but still at some point so **** confused

now i got a working proxy , i got packet structure for entity spawn and for attacking packet and i can simply do something like ummm here
while(hunting)
get monsters x,y from packet 10014
send 1022 packet to the server with action kill the monster , right ? and incase i want to update the client i send the server reply to the client , right ?

is that right ? i don't think so , cuz i get the 10014 packet way faster than ill reply for it
for example : servers send me 50 monsters and i reply that i've killed 1 , so server won't send more till i move , right ?
should i save them in a list then with foreach loop ?

i duno im completely lost , will keep trying but still need little help to save time , thanks and any help is appreciated
That's where dictionary's/Lists come in handy...

You need to store the spawned monsters in a dictionary/list based on monster type/level which is totally up to you and create a thread to loop through that list content... find the closest monster and attack it

Attached is a C# Example.. check it out it might be useful to you
Attached Files
File Type: rar Class1.rar (851 Bytes, 25 views)
{ Angelius } is offline  
Thanks
2 Users
Old 09/10/2012, 18:59   #3
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
fine i know about that , list and then attack them , but i was talking about better view , like hit nearest monster (which i think it's kinda useless) or like jump when there is no more monsters
anyway i've done that so far , using collection to sort monsters on sight and haven't made it to attack them yet as i'm not done with 1022 , also so damn confused at 10017 as im trying to make it auto use fs once it come , all i got is 10017 1022 1105 and trying to understand them correctly
so far have done 10010 1004 10014 1101 1009 but still need help or atleast couple of days to fully understand the rest of packets , it's kinda fun but sometimes boring when u can't figure out anything about something or how it works
anyway thanks , if u don't mind i would want to know what packet recived/sent for xp skills , pm or post ^^ thanks bro

EDIT : HAHAHAHAHAHAHHAHAHAHAHAHA I DID IT FUCKKKKKKKKKKKKKK XD
finally after an hr i figured it out

Code:
case 10017:
                            Console.WriteLine("packed of 10017 had came to life with value at offset 16 = " + BitConverter.ToInt16(data, 16));
                            if (BitConverter.ToInt16(data, 16) == 16)
                            {
                                Console.WriteLine("xp skill is there , test code");
                                byte[] data2; // this should send superman to server and server will tell client if it works and activate it
                                data2 = new byte[48];
                                ReadWrite.WriteUInt16(0x0028, 0, data2);
                                ReadWrite.WriteUInt16(0x03FE,2,data2);
                                ReadWrite.WriteUInt32(0x000F50C0, 8, data2);
                                ReadWrite.WriteUInt32(0x9DE0A56B, 12, data2);
                                ReadWrite.WriteUInt16(role.X, 16, data2);
                                ReadWrite.WriteUInt16(role.Y, 18, data2);
                                ReadWrite.WriteUInt32(0x00000018, 20, data2);
                                ReadWrite.WriteUInt32(0xCC2161CA, 24, data2);
                                Console.WriteLine("trying to send this packet to activate fs" + data2.ToString()); //should be convert.tostring(data2) ^^
                                role.SendToServer(data2);
                            }
                            break;
it's damn fun to figure stuff on your own , yes was packet 10017 offset 16 with value 0x10 (16b)
ill struct it now for the rest of xp skills i was doing it on wrong offset

and thank you for the class example , ill check it out now
for any mod , close this thread , i was damn wrong to give up and post this , doing it on my own sounds more fun XD
go for it is offline  
Old 09/10/2012, 22:47   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Here's a VERY basic example of how I have coded it in the past.



Step 1: Learn about your surroundings.

In your packet handler you handle the entity spawn packet. If the UID matches the range for monsters (300k-500k iirc) then add it to a monsters list by storing the X/Y/UID + any other information you feel you want for your purposes.

Step 2: Updating the map

On kill subtype (server>Client interaction packet with subtype kill) then you remove the UID from your map collection.

On moving (jump/walk Client>Server) you check all stored monsters to see if they are off screen and now you remove from your map collection

On Entity remove subtype of general data packet (very rare but may as well handle it) remove from the map collection


Grats! You can now move around the map and have an always up to date list of monsters which are currently on your screen.

Now you need to create a logic thread. This will look something like...


//Only abort the logic loop when you disconnect and should be clearing your resources at this point
while(user.Connected)
{
//use whatever time system you want. Personally I've used Environment.TickCount, SystemTime and DateTime. They all work just fine
if(user.LastAttack + user.AttackSpeed > CurrentTime)
{
Monster mob = GetClosestMonster();//Just cycle through the monsters collection and pull closest to your location!

if(mob == null)
{
//Pick a location to move to and jump/walk there! (pathfinding or random movement checked vs dmaps.

}
else if(Distance(user, mob) < 3)//In melee Range
{
user.SendToServer(new InteractionPacket(AttackType.Melee, user.UID, mob.UID));
user.LastAttack = CurrentTime;
}
else
{
Point moveTo = GetPathPoint(user, mob);//Simple function to find a point to move to closer to monsters
user.SendToServer(new GeneralDataPacket(ActionType.Jump, user UID, moveTo.X, moveTo.Y));
user.SendToClient(new GeneralDataPacket(ActionType.NinjaStep, user.UID, moveTo.X, moveTo.Y));

//This is debatable. Ideally I'd only update my position from the Server>Client Jump responses but this is a simple example so whatever.
user.X = moveTo.X;
user.Y = moveTo.Y;
}
}
}


Done! Very basic hunt bot with simple logic.
pro4never is offline  
Thanks
2 Users
Old 09/11/2012, 00:08   #5
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
Code:
case 10014 :
                            if(GUI.__ishunting)
                            {
                                Dictionary<uint, Point> Monsters = new Dictionary<uint, Point>();
                                ushort X = BitConverter.ToUInt16(data, 86);//get the X value from the packet 
                                ushort Y = BitConverter.ToUInt16(data, 88);//get the Y value from the packet 
                                uint UID = BitConverter.ToUInt32(data, 8);
                                Monsters.Add(UID, new Point (X,Y) , true);
                                if (Monsters.Keys.Count != 0)
                                {
                                    foreach (KeyValuePair<uint, Point> monster in Monsters)
                                    {
                                        if ((role.X - BitConverter.ToInt16(data, 16) < 18) && (role.Y - BitConverter.ToInt16(data, 18) < 18))
                                        {
                                            try
                                            {
                                                Console.WriteLine("hunting started");
                                                byte[] data3; // this should send superman to server and server will tell client if it works and activate it
                                                data3 = new byte[40];
                                                ReadWrite.WriteUInt16(0x0028, 0, data3);
                                                ReadWrite.WriteUInt16(0x03FE, 2, data3);
                                                ReadWrite.WriteUInt32(0x000F50C0, 8, data3);
                                                ReadWrite.WriteUInt32(monster.Key, 12, data3);
                                                ReadWrite.WriteUInt16((Convert.ToUInt16(monster.Value.X)), 16, data3);
                                                ReadWrite.WriteUInt16((Convert.ToUInt16(monster.Value.Y)), 18, data3);
                                                ReadWrite.WriteUInt32(0x00000002, 20, data3);
                                                Console.WriteLine("trying to send this packet to hunt");
                                                role.SendToServer(data3);
                                            }
                                            finally
                                            {
                                                //          Point newpoint = new Point(((Convert.ToUInt16(monster.Value.X)),(Convert.ToUInt16(monster.Value.Y))));
                                                Monsters.Remove(monster.Key);
                                            }
                                        }
                                    }
that's what i was doing , basically trying to kill every monster i get on packet 10014 , if failed or passed it remove it from the directory , it's really shitty and giving me error that the directory had been modified (duno how to solve it) , anyway ill read now what u posted and will rewrite it all over again , duno how to separate the hunting/looting from packets aka can't create events and stuff cuz im asshole in c# and my packet structures ain't good , but ill work on it , thanks and ill rewrite it once more
go for it is offline  
Old 09/11/2012, 00:52   #6
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Quote:
Originally Posted by go for it View Post
Code:
case 10014 :
                            if(GUI.__ishunting)
                            {
                                Dictionary<uint, Point> Monsters = new Dictionary<uint, Point>();
                                ushort X = BitConverter.ToUInt16(data, 86);//get the X value from the packet 
                                ushort Y = BitConverter.ToUInt16(data, 88);//get the Y value from the packet 
                                uint UID = BitConverter.ToUInt32(data, 8);
                                Monsters.Add(UID, new Point (X,Y) , true);
                                if (Monsters.Keys.Count != 0)
                                {
                                    foreach (KeyValuePair<uint, Point> monster in Monsters)
                                    {
                                        if ((role.X - BitConverter.ToInt16(data, 16) < 18) && (role.Y - BitConverter.ToInt16(data, 18) < 18))
                                        {
                                            try
                                            {
                                                Console.WriteLine("hunting started");
                                                byte[] data3; // this should send superman to server and server will tell client if it works and activate it
                                                data3 = new byte[40];
                                                ReadWrite.WriteUInt16(0x0028, 0, data3);
                                                ReadWrite.WriteUInt16(0x03FE, 2, data3);
                                                ReadWrite.WriteUInt32(0x000F50C0, 8, data3);
                                                ReadWrite.WriteUInt32(monster.Key, 12, data3);
                                                ReadWrite.WriteUInt16((Convert.ToUInt16(monster.Value.X)), 16, data3);
                                                ReadWrite.WriteUInt16((Convert.ToUInt16(monster.Value.Y)), 18, data3);
                                                ReadWrite.WriteUInt32(0x00000002, 20, data3);
                                                Console.WriteLine("trying to send this packet to hunt");
                                                role.SendToServer(data3);
                                            }
                                            finally
                                            {
                                                //          Point newpoint = new Point(((Convert.ToUInt16(monster.Value.X)),(Convert.ToUInt16(monster.Value.Y))));
                                                Monsters.Remove(monster.Key);
                                            }
                                        }
                                    }
that's what i was doing , basically trying to kill every monster i get on packet 10014 , if failed or passed it remove it from the directory , it's really shitty and giving me error that the directory had been modified (duno how to solve it) , anyway ill read now what u posted and will rewrite it all over again , duno how to separate the hunting/looting from packets aka can't create events and stuff cuz im asshole in c# and my packet structures ain't good , but ill work on it , thanks and ill rewrite it once more
#1: If you send attack packet with coords > 6 from where you are then you get booted.

#2: if you attack too quickly you can get booted.


You need to be sure to handle things in a timely fashion that makes sense with how the game plays and interacts with the server (EG: Cannot just say "yah, i attacked that monster that's across the map from me cause I can!" the server simply won't allow it and will either ignore, boot or botjail you)
pro4never is offline  
Thanks
2 Users
Old 09/11/2012, 03:43   #7
 
Silent-Death's Avatar
 
elite*gold: 0
Join Date: Jan 2006
Posts: 1,055
Received Thanks: 296
nice thread, i actually hope the lad keeps us posted on his progress..
over at chrome the spawn is analysed as the account is attacking it so you get the best out of the xp skill.

Keep us posted mate, and good luck.
Silent-Death is offline  
Thanks
1 User
Old 09/11/2012, 08:07   #8
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
**** it , ill help myself no matter how long it take, thanks everyone
go for it is offline  
Old 09/11/2012, 12:56   #9
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 991
Received Thanks: 1,107
Quote:
Originally Posted by go for it View Post
**** it , ill help myself no matter how long it took , thanks everyone
I saw your post before you edit it and it sounds like you have problems handling things in the correct order :P

You need only 1 thread to do the job for you and you don't restart the thread every time a new monster is spawned...

Check the attached project...
Attached Files
File Type: rar BotTest.rar (28.2 KB, 23 views)
{ Angelius } is offline  
Thanks
1 User
Old 09/11/2012, 13:40   #10
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
Quote:
Originally Posted by { Angelius } View Post
I saw your post before you edit it and it sounds like you have problems handling things in the correct order :P

You need only 1 thread to do the job for you and you don't restart the thread every time a new monster is spawned...

Check the attached project...
im really thankful , im learning how to handle it from your codes
go for it is offline  
Reply


Similar Threads Similar Threads
Packet Structure from SRO_Client.exe
06/12/2011 - SRO Coding Corner - 2 Replies
Hello Community, im developing a new emulator and use a packet sniffer for finding my packets. Now i want to try to read the packet structure from client with ollydbg. That would simplify my work. I hope someone can explain me how it works
[Request] Packet Structure for CharData Packet
05/16/2011 - Silkroad Online - 4 Replies
can someone tell me which structure the CharData packet has? i would really appreciate this, since im still noob in such things. its just too high for me/ too much information for my head. :handsdown: S->C(3013)...
packet structure
03/09/2008 - Conquer Online 2 - 16 Replies
For what I'd like to do, I think packets are the place to start. After that, probably java then C and VB. This is a question for the people here who are self-taught... what resources would you recommend for... 1. understanding packet structure 2. learning some programming language without enrolling at the local university I'm mainly interested in packet structure and how to capture/decipher/edit/send them, and eventually I'd like to "automate" these functions by writing some programs. ...



All times are GMT +2. The time now is 02:10.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.