how to know the packet

04/03/2011 20:47 ighor10#1
Hi guys.


i'm trying to develop now the autopotion to my bot, and to who dosnt know, its packet based.


I already have the character maximum HP and MP. currrently HP and MP.

Problem is:
i dont know why, but the analyser dosnt show the client to server packet of using HP or MP potion.


how can i know the packet to send the use of any potion or the use of Fx bar, y slot?


i think i prefer if the bot works with bars and slot, but i can do it any way.


thx all

Thx
04/03/2011 21:43 kevin_owner#2
Oke so to put things on a little list:

1. You are creating your own bot
2. Autopotion doesn't work and you don't know why
3. You would like to know if the packet is send.

Well according to point 1 you should probably have some pretty good knowledge about the whole packet thing.

To know if the packet is send you could create a little packet logger by yourself (read the thread of mage200 which I already told the same story:))
and if you have read those threads you might noticed the post of lesderid to create some kind of pipe which sends all the packets to another program which dumps them which would probably be the most fastest way.

If you're using the way which lesderid told in that other thread you can log all the packets which your bot sends. So you can check if the correct packets are there.

Another fast way but not recommended by me is using wireshark or some other netwerk logger. Why it just displays too much packets which you don't have to care about.


Well uuhm you also would like to have your bot working with bars and slots. Please correct me if i'm wrong but if you're casting an pot in your inventory shouldn't the countdown also be displayed at the bar?

My guess would be just use the inventory cause it's safer. the bar could get empty and it's just a little tool if you are actually playing. You don't use them if you're casting a skill cause you just directly send the cast this skill packet. You could do the same thing with the potions.

So you just have to sniff 1 packet well you might sniff a few times according to what you know of the content but you just have to sniff 1 type of packet which is just the casting of the packet inside the inventory.

I don't know what the content is cause i've never seen that packet before but my guess would be that it has an inventory number, item number at least those two things and I guess that the server will recognize it as an potion and send the correct stuff back but that's just my guess.

I hope this helps a little bit.
04/04/2011 06:49 Murgen#3
I think you should focus on everything inside the bot in this order...
1. Auto Target
2. Auto Attack
3. Auto Buff
4. Auto Run
5. Loop
6. Auto Pot
Or something like that, the game at least has an auto pot, if its empty you could just get a packet of low amount of potions ya?
04/04/2011 08:49 kevin_owner#4
Agreed with murgen. But I still wonder how your bot looks like cause the packet shouldn't be the biggest problem. edxSilkroadLoader can parse them for you all you have to do is guess the content which shouldn't be that hard.

The main problem will be the logic which you use in your bot cause you have to parse all the packets and at the same time you still have to attack or do some other action. So a lot of fun stuff:)
04/04/2011 12:56 lesderid#5
Quote:
Originally Posted by kevin_owner View Post
edxSilkroadLoader can parse them for you all you have to do is guess the content which shouldn't be that hard.
It only parses post-GateWayServer packets.
But this shouldn't be a problem since he won't make a clientless.
04/04/2011 13:21 kevin_owner#6
Yeah indeed and if he wants to create a clientless he can also take a look at your wonderfull login server documentation:)

The only real challange is guessing what the number mean and sometimes you have a packet which isn't parsed correctly but edxsilkroadloader makes stuff a lot easier:)
04/04/2011 13:35 lesderid#7
Quote:
Originally Posted by kevin_owner View Post
Yeah indeed and if he wants to create a clientless he can also take a look at your wonderfull login server documentation:)
Hehe, thanks.
04/04/2011 18:52 ighor10#8
I dont wanna do it clientless from now.
I have read a lot of stuff about to parse packets, but i dont need it, i will not recreate the wheel xD
im using SrProxy and it do all good to me ATM.



Quote:
Originally Posted by kevin_owner View Post
Agreed with murgen. But I still wonder how your bot looks like cause the packet shouldn't be the biggest problem. edxSilkroadLoader can parse them for you all you have to do is guess the content which shouldn't be that hard.

The main problem will be the logic which you use in your bot cause you have to parse all the packets and at the same time you still have to attack or do some other action. So a lot of fun stuff:)
Thats my point xD
im super newb on silkroad bot's, but the logic is what i love to do.
i dont know how Sbot, sroking, db-bot and others bot did it, but i saw a lot of people trying to make bots, and they just find any way to do it, not the best way or at least a good way..
04/04/2011 20:56 kevin_owner#9
Aha oke well next time please tell how much experienced you are with your bot cause I tought you already had a bot working but that you wanted to add auto potion to it:P

Oke well you said that you don't want to recreate the wheel so you're using srproxy well that's fine but it isn't wrong to take a look how that wheel works:)
cause you might have an idea of how it works but it might be the wrong idea. But that would be something for later:)

Uuhm back to your actual question.

You didn't mention the programming language which you're using cause there are a few differences between the language on how to implement your logic it doesn't matter right now but you might mention it the next time.

Oke so i'll tell you a little bit about my experience and how I started to create things. I guess that the most logical piece of software i've written is an simple emulator for silkroad so I'll tell you a bit how I builded that one (It's the same purpose as a bot you just respond to packets)

Well i just started with an packet parser to read the packets and I created some functions which sends an response to that specific packet. But when you're ingame you have a lot of stuff where you have to think about and create async functions which you also have to abort some times. The first attempt to create such things were really bad it worked but really bad the code was really really messy but I got something which worked.

Then I started to look at the code cause now I know what I exactly needed to manage a few ingame functions. So I wrote down what data I needed and with what kind of things I had to deal with. this way I got a better view of my program and how it actually worked. Then I started to split some things which could be separte parts so I devided the code a bit to make it more like modules instead of one big messy piece.

This way the code visiblity was much better and it was also easier to track down errors.
Also a nice advantage of those "separte modules" was that I could simply replace a piece of code with something which works a lot better without searching trough the whole messy thing. Of course the code still isn't good but it works and it's a lot better than it was before.

I really like this way cause you can apply all the experience which you gained to make the code better and more stable. The first attempt was really bad cause I did some error checking but it was more like "print "Error couldn't find item" well god knows in which function it was or what item. Right now if i print something i write something like "Foo() plus value out of range of item: item name of character: character name"
That makes things a lot easier to find problems.

So now you know a way of how I did it. But I would also like to think a little bit about your problem. I have never wrote a bot to don't rely on my solution:)

If I would create a bot the first thing I would do to log everything which happens ingame so reading the packets. Like what is the current hp/mp what player/mobs/npc's are arround me or did any of the npc's which I see right now despawn. Just all the stuff which you can also see ingame. This way you only have to respond on an incoming packet so you don't need a real bot logic yet but I guess once you have those things correct that the goal of creating a bot is a lot closer:)

After that I would start with things like select an object like an npc and open up the buy panel and buy something. just really simple things to make them work like walk to an monster, select monster, use skill. and at the same time you need to keep in mind that you still get packets of attack stuff which contains the damage you did and the amount of hp you've got left. so you can put a little trigger on that packet like:

if(CurrentHP < 500)
UseHpPotion();

So this way it checks if the hp is low and it sends a packet to the server that you used an potion and the server will give you the correct respond back and you update the bot with the message that the hp is updated and the client will also see that it's updated.

It sounds really easy the way I just said it but it's a lot more difficult than this and you have to keep a lot of things in mind but I hope this helps a little bit:)

btw sorry for some spelling mistakes ect.
04/05/2011 05:26 Keyeight#10
guys i need edxSilkroadLoader can anyone give me link for it !?
04/05/2011 09:00 kevin_owner#11
It's in the forgein sro section it's called edxSilrkoadLoader 5 beta. I believe it was stickied
04/06/2011 05:02 Keyeight#12
will thx alot Kevin ^^
04/10/2011 17:10 ighor10#13
Quote:
Originally Posted by kevin_owner View Post
Aha oke well next time please tell how much experienced you are with your bot cause I tought you already had a bot working but that you wanted to add auto potion to it:P

Oke well you said that you don't want to recreate the wheel so you're using srproxy well that's fine but it isn't wrong to take a look how that wheel works:)
cause you might have an idea of how it works but it might be the wrong idea. But that would be something for later:)

Uuhm back to your actual question.

You didn't mention the programming language which you're using cause there are a few differences between the language on how to implement your logic it doesn't matter right now but you might mention it the next time.

Oke so i'll tell you a little bit about my experience and how I started to create things. I guess that the most logical piece of software i've written is an simple emulator for silkroad so I'll tell you a bit how I builded that one (It's the same purpose as a bot you just respond to packets)

Well i just started with an packet parser to read the packets and I created some functions which sends an response to that specific packet. But when you're ingame you have a lot of stuff where you have to think about and create async functions which you also have to abort some times. The first attempt to create such things were really bad it worked but really bad the code was really really messy but I got something which worked.

Then I started to look at the code cause now I know what I exactly needed to manage a few ingame functions. So I wrote down what data I needed and with what kind of things I had to deal with. this way I got a better view of my program and how it actually worked. Then I started to split some things which could be separte parts so I devided the code a bit to make it more like modules instead of one big messy piece.

This way the code visiblity was much better and it was also easier to track down errors.
Also a nice advantage of those "separte modules" was that I could simply replace a piece of code with something which works a lot better without searching trough the whole messy thing. Of course the code still isn't good but it works and it's a lot better than it was before.

I really like this way cause you can apply all the experience which you gained to make the code better and more stable. The first attempt was really bad cause I did some error checking but it was more like "print "Error couldn't find item" well god knows in which function it was or what item. Right now if i print something i write something like "Foo() plus value out of range of item: item name of character: character name"
That makes things a lot easier to find problems.

So now you know a way of how I did it. But I would also like to think a little bit about your problem. I have never wrote a bot to don't rely on my solution:)

If I would create a bot the first thing I would do to log everything which happens ingame so reading the packets. Like what is the current hp/mp what player/mobs/npc's are arround me or did any of the npc's which I see right now despawn. Just all the stuff which you can also see ingame. This way you only have to respond on an incoming packet so you don't need a real bot logic yet but I guess once you have those things correct that the goal of creating a bot is a lot closer:)

After that I would start with things like select an object like an npc and open up the buy panel and buy something. just really simple things to make them work like walk to an monster, select monster, use skill. and at the same time you need to keep in mind that you still get packets of attack stuff which contains the damage you did and the amount of hp you've got left. so you can put a little trigger on that packet like:

if(CurrentHP < 500)
UseHpPotion();

So this way it checks if the hp is low and it sends a packet to the server that you used an potion and the server will give you the correct respond back and you update the bot with the message that the hp is updated and the client will also see that it's updated.

It sounds really easy the way I just said it but it's a lot more difficult than this and you have to keep a lot of things in mind but I hope this helps a little bit:)

btw sorry for some spelling mistakes ect.


Thx u so much.

i just write everything before starting programming.
From now i am studing how to do the things, but to the bot, it will be all divided and organized.


I will do it in the order that somebody here told.
now i want to do the auto select and attack.

First thing, how many packets can i get informations about the mobs?
I saw a packet realy big, and i think its a packet with mobs id.

but, if each mob have an different id, so they need to have a static id too, only way to sro client know what monster is this.

so, how can i get the mobs arroud the player?

thx
04/10/2011 18:33 kevin_owner#14
Well the mob packets aren't that big they just have some stuff in it like the mob id, the unique id, position and some other stuff which isn't that important.
then you have an packet which you get if you select a monster idk what this one contains but it has the hp and some other stuff in it.

In the first packet you already got the mob id but let's say it's 1933. I know that that one is an Manyang but you can easly read it from the data in the client. it's in the media.pk2 inside the server_dep/textdata or simething like that there is a lot of important data about the items, skills, npc data and monster data. you can find the id and the names of the monsters/npc's in the chardata_5000.txt till chardata_40000.txt

in this case it's 1933 so it's in the chardata_5000.txt and if you browse trough that file and check the line with that id you can see the information about that id which is an manyang and you can read the hp ect.

there are some other files also needed for an complete bot but that's just a thing which is browsing trough the files and see if there is something usefull.

I guess that you underestimate the whole bot thing cause you can't just think how a bot is going to work cause it's always different when you program cause the language has his limits so I would advice you to start with things before you think about the whole thing.

just create some basic stuff so you can send packets/receive packets and start some handeling. once that is done you can start thinking about some logic like processing all packets with the spawning opcode and safe them and show them on the screen.
and remove them if you get an despawn packet.
04/10/2011 22:57 ighor10#15
Hello

I already did it.

I just wait for spawn, i got the char max hp, max mp, hp, mp, str, int e etc...

to see that its working fine, i sent a packet to sit the character and works fine.

before start writing the bot, i just want to know all about my system..
i cant write a good system without knowing it.
Im not writing the bot right now, i just writing some application like auto select/attack just to know how it works, and then, i will see: "ok, now i know all that i need to project it" xD
and then i will write my project and code it.
:)

I'm dont want it to the next month, I want to do it well.

Thx for ur reply,
i will try to find that packet