Log in

View Full Version : Byte converting, isolating? [HaLP]



Zmulan
06-21-2010, 19:12
So we got some nice ppl here with nice knowledge in programming ;)
atm, im making an auto looter.
When I'm trying to open a body I need to convert the position into bytes, im not really sure how i split for example the x coordinate of a waypoint (lets say 33200)

The packet looks like this, (opening body)



packetBuffer[0] = 0x01;
packetBuffer[1] = 0x00;
packetBuffer(2) = 0x82;
packetBuffer[3] = LongToByte(x, 1) //<- is from VB, how to do something similar in C#?
packetBuffer[4] = LongToByte(x, 2)
packetBuffer[5] = LongToByte(y, 1)
packetBuffer[6] = LongToByte(y, 2)
packetBuffer[7] = z
packetBuffer[8] = LongToByte(CorpseID, 1)
packetBuffer[9] = LongToByte(CorpseID, 2)
packetBuffer[10] = LongToByte(StackPos, 1) //stack pos
packetBuffer[11] = LongToByte(BackPacks, 1) //bp pos



I tried something like this, but since im not sure exactly how it work, it didnt turn out very well ;<


buffer[3] = Convert.ToByte(x & 0xFF);
buffer[4] = Convert.ToByte(x >> 8 & 0xFF);
buffer[5] = Convert.ToByte(y >> 16 & 0xFF);
buffer[6] = Convert.ToByte(y >> 24 & 0xFF);



any kind of help appreciated

edit: found out by myself,
but how do i determine the stackpos of the corpse? ;<

the program is sending the right packet (i recorded it with wpe), but still the body doesnt open! If i resend it manually with wpe its opening.
What could be wrong?
do i need to update the containers or something?

klusbert
06-22-2010, 02:17
Use bitconverter I cant remember how right now, if you don't solve it I can help later.

Farsa
06-22-2010, 13:35
BitConverter.GetBytes(x)[1] and [2]

raoul
06-22-2010, 15:42
seems nice, going to desing your own bot/marco?:)

Zmulan
06-22-2010, 17:30
@up,
i was working on my own bot for classictibia, 7.4 ot.

it could:
follow waypoints,
attack creatures,
i never got the looting to work tho.

anyway, now the server shut down after 1 year uptime ;/ so i guess ill close this project.
might release the sources if anyone is interested

edit:
before i started making this bot i could only program simple calculators and such ;o
i've learned a lot from tpforums and on this forum aswell.
this is not a complete bot but it kinda worked xD

Malmis
06-22-2010, 17:35
Could be interesting to see the source. But 7.4 didn't have encryption, or did it?

PlzNoKil
06-22-2010, 17:40
hahahahahhaha, sad to hear that classic is dead Emil, after all time of pg, training and such, even on this bot!

pater
06-22-2010, 18:06
Could be interesting to see the source. But 7.4 didn't have encryption, or did it?

didn't have encryption

Zmulan
06-22-2010, 18:22
I started out by using karelazi's expcounter for classictibia,
since it already had mc compitability and memory writing/reading functions ready.
Then i just read a lot on tpforums and thats how it all started.

anyway, dont blame me for sucky code plx, i just tried all different kind of things until it finally worked somehow ;o

please dont say "zomg virus". it's the packet.dll that i found somewhere on tpforums, im pretty sure the sources are there aswell

note: it's far from complete, but ive ended the project now anyway.

this is how it looks like:
http://yfrog.com/iybotxqj

Uploaded with ImageShack.us (http://imageshack.us)

klusbert
06-25-2010, 14:52
have cipsoft taking any action against classic tibia or what?

If yes are all realmap based ots going to dissapear?

Xavious
06-26-2010, 14:54
i personally doubt cip filed a lawsuit about his map or even server, if they would there are sooooo many other servers that would be worth suing.. classic had pretty much 100-130 players average online and some servers has 800 even

IF their lawsuit was the reason for remere to shut down his server id say it was because of his npc logs, as they were "stolen" or something about 5 years ago and im guessing those are the npc logs he is using for his server. but sine remere doesnt seem to eager to respond to ANY questions conserning his shut down we will probably never know

Crille
06-26-2010, 20:35
are you using packet.dll in C#? I thought using unmanaged DLLs with C# was VERY tedious

Farsa
06-26-2010, 22:05
not at all. a simple DllImport declaration with the correct data types is all u need