Register for your free account! | Forgot your password?

You last visited: Today at 05:34

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

Advertisement



[Release/Guide] Bot

Discussion on [Release/Guide] Bot within the Kal Hacks, Bots, Cheats & Exploits forum part of the Kal Online category.

Reply
 
Old   #1
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
[Release/Guide] Bot

Well, since working bots are released everything why not help the people to get atleast a little bit knowledge. You need atleast some basic coding knowledge to use this. Mostly old code copied together

There are some kinds of bots:
1. Spawnbot
2. ug/og Movebot
3. Playerlike bot
4. splash/healbot

The spawn bot is probably the fastest when it comes to killing but very limited in spots and classes. Very easy to write. Letting the bot move, makes it harder but still easy. Playerlike is hard

Well, first you need a working Send and Recv. Being able to sniff Send packets makes it easier in some points, but isn't needed.

Send:
Code:
__declspec(naked) int __cdecl SendPacket (BYTE Header , LPCSTR Format , ... ){
	__asm{
		push ebp
			mov ebp, esp
			sub esp, 18h
	}
	__asm{JMP SendBack};
}
Recv(Requires detours 1.5):

Code:
int (__stdcall *PacketRecv)(SOCKET Socket, char *Buffer, int Length, int Flags);

void MyPacketRecv(SOCKET Socket, char *Buffer, int Length, int Flags) 
{
           switch(Buffer[2])
           {
           }
           return PacketRecv(Socket, Buffer, Length, Flags); 
}


void InitDetours() 
{
		
	PacketRecv = (int (__stdcall *)(SOCKET, char *, int, int))DetourFunction((PBYTE)recv, (PBYTE)MyPacketRecv);
}
Check this for more:


There are 2 ways how to write the bot-part of your source. Either in a thread or directly into your recv detour. Putting everything into a thread would probably be the better solution. You can't use Sleeps when writing a recv based bot(well, you can but I wouldn't recommend it )

Spawnbot

Let's start with the spawn bot first. There are basicly 2 recv packets you need to pay attention to when doing this 0x3E and 0x3F. 0x3E packet is sent from the server, when something attacks something. Doesn't matter if it's a player or a monster. 0x3F is for skills. For all skills, not only attacks.

Code:
	case 0x3e:
		DWORD target = *(DWORD*)&Buffer[7];
		DWORD attacker = *(DWORD*)&Buffer[3];
For 0x3F it's Buffer[8] and Buffer[4].

Now you compare the target with your player ID. Obtained with the Playerappear packet 0x32. The first one you get is normaly yours.

Code:
       case 0x32:
            PlayerID = *(DWORD*)&Buffer[3];
Don't forget to add a check if you allready saved a playerid

Code:
if(PlayerID == 0)

Whenever a 0x3E/3F packet with your ID appears, you send a LA-Skillpacket. Don't forget, that this kind of bot only works as IC.

Code:
SendPacket(0x0D,"bbd",18,1,attacker);
Well, at this points there are 2 tactics. Some people logged mobs at their appear and calculated their new HP after each LA, sending a finisher when its 1. I personally was too lazy for that. I just checked how many LAs I need to get the mob to 1HP for sure, sending that amount and reacting to misses. Both ways work, mine is faster I guess

Checking for misses:
Code:
case 0x3f:
   	BYTE hitornot = *(BYTE*)&Buffer[18]; // 0 = miss
	WORD damage = *(WORD*)&Buffer[14];
	BYTE skill = *(BYTE*)&Buffer[3]; // skillid

Since LA can't kill, you need another skill/normal attack to finish the mob. Sending them too fast -> 0 damage. This is the function I used to check if I can use a skill or not.


Code:
int Skillchoose()
{
	if(timerNormalArrow < GetTickCount()-400)
	{
		timerNormalArrow = GetTickCount();
		return 0;
	}
	else if(timerPassive < GetTickCount()-400)
	{
		timerPassive = GetTickCount();
		return 4;
	}
	else if(timerFlamy < GetTickCount()-400)
	{
		timerFlamy = GetTickCount();
		return 6;
	}
	else if(timerBlow < GetTickCount()-400)
	{	
		timerBlow = GetTickCount();
		return 14;
	}
	else if(timerHeart < GetTickCount()-2000)
	{
		timerHeart = GetTickCount();
		return 9;
	}
	else
		return 3;
}
Check if it returns 3(Stagger) twice in a row. If that happens, cancle the attack or you can end in 0-damage stagger spamming

Behead and picking left, both easy.

Behead:

Code:
	case 0x3d:
		DWORD beheadID = *(DWORD*)&Buffer[3];
		SendPacket(0x0D,"bbd",1,1,beheadID);
0x3d is NOT mob died packet. It is mob animation state! But well, since we are ug/og anyway and it's just behead, no need to care!

Pick:
Code:
case 0x36:
		DWORD dwIID = *(DWORD*)&Buffer[5];
		DWORD iX = *(DWORD*)&Buffer[5+4];
		DWORD iY = *(DWORD*)&Buffer[5+4+4];
                SendPacket(0x1D,"ddd",dwIID,iX/32,iY/32);
Kal doesn't really care about correct x/y. Can also be 1/1 and it still picks.

While botting I got kinda pissed off with all that useless noob stuff you find.

Code:
int blacklist[] = {331,330,318,327,328,329,316,282,290,298,306,314,276,284,292,300,308,1495/*monsterarm*/};
	case 0x36://Item Drop
		{
			bool abbruch = false;
			WORD Index = *(WORD*)&Buffer[3];
			for(int i = 0;i<sizeof(blacklist)/sizeof(blacklist[0]);i++)
			{
				if(Index == blacklist[i])
				{	
					abbruch = true;
					break;
				}
			}
			if(abbruch == false)
			{
                              //pick it
You should also add stuff like g1 waepons to the blacklist, to avoid ppl spamming your inventory. I know that it is possible to let items appear with a wrong item id, but well, the amount of people being able to do this is small, so don't worry about it

Another thing I would suggest you, is destroying nearly every item that gives revision stones. Things you should keep are g53+ dagger and g59+ waepons, g55+ armor and stuff you need for further bots. Destroying stuff is less money than selling it to npc/player but it takes about 2hours to get a full inventory in d2. Ofcoz you could autosell it to npc(you need to be near the npc to make it work),send it to other accounts etc but destroying is the easiest thing
The packetheader you need to take a look at is 0x07, it appears every time you get something into ur inventory, no matter where it comes from. Maybe it also does something else, no idea
You can either instant destroy them or store them to destroy after some time. If you kill mobs at spawn and move to drops, you should store them otherwise just destroy.

Code:
WORD itemtype = *(WORD*)&Buffer[3];
DWORD itemid = *(DWORD*)&Buffer[5];
SendPacket(0x51,"bd",0,itemid);
Thats all you need, just do the same thing we did with the blacklist for items.

It is a huge speed increase to kill mobs when they spawn. The mob appear packet is 0x33.

Code:
DWORD mobID = *(DWORD*)&Buffer[5];
WORD mobIndex = *(WORD*)&Buffer[3];
Don't forget, that you have to move to items when using this. Basicly you just have to calculate the direction and the distance. There are quite a few ways to archive that. Easy math, vectors...
After writing(and testing) your move function, you need to do a few additions. At 0x36(itemdrop) you have to check, whether the item is in pick range or not when dropping. A range of 65 or lower is fine, otherwise save the item into an array. I used to pick all items, once I reached a specified limit. Move to first item in array -> pick it -> check if any other item is in range, if yes pick it -> move to next not picked item. Here are my functions, will help you to understand it

Code:
void Pick()
{
	for(int i = 0; i<itemcount;i++)
	{
		//printf("Searching item...\n");
		if(Items[i].dwIID != 0)
		{
			Move(Items[i].iX,Items[i].iY);
			SendPacket(0x1D,"ddd",Items[i].dwIID,Items[i].iX/32,Items[i].iY/32);
			Items[i].dwIID = 0;
			PickIt();
		}
	}
	Move(startx,starty);
}

void PickIt()
{
	//printf("Pick all...\n");
	for(int i = 0;i<itemcount;i++)
	{
		if(Items[i].dwIID != 0)
		{
			int xrange = ownx - Items[i].iX;
			int yrange = owny - Items[i].iY;
			if(sqrt((float)((xrange*xrange)+(yrange*yrange)))<=65)
			{
				//printf("Found item to pick \n");
				SendPacket(0x1D,"ddd",Items[i].dwIID,Items[i].iX/32,Items[i].iY/32);
				Items[i].dwIID = 0;
			}
		}
	}

}

There are some improvements that can be done. This is just a very basic version.
Here is a little list(I will add some of those things from time to time):
-Kill mobs at appear(you need to move to drops for this, do not do this nonstop, move like once every 30sec, depends on serverlag, gear, mobs and your computer )(added 25.07.2011)
-Do not pick everything, noone needs crap talis(added 24.07.2011)
-Destroy rings,belts, low grade waepons/armor for revision stones(added 24.07.2011)
-Auto party leave when forced
-Protection against reporters

Splash/Healbot

Nothing is more annoying than spawnsplash partys. So why shouldn't we write a bot for that?

Source:
Code:
void SplashBot(void*)
{
	while(true)
	{
		if(heal == 1)
		{
			//SkillAni 28
			SendPacket(0x28,"b",28);
			Sleep(1200);
			//SkillExecute 28
			SendPacket(0x0D,"b",28);
		}
		else if(splash == 1)
		{
			//SkillAni 24
			SendPacket(0x28,"b",24);
			Sleep(900);
			//SkillExecute 24
			SendPacket(0x0D,"b",24);
		}
		Sleep(600);
		Sleep(200); // realistic reason

	}
}
Those 200ms sleep at the end is required to make it look more realistic.

Just run the thread, add an autobehead. There are a few things you have to care about:
-just behead when you really need mana
-take care mob is in range!
-don't move while splashing or ppl will notice, best is to stand in other ppl

Either you do range check to the dead mob or you just behead mobs which were attacked by you or attacked you. Most of the time they should be in range. Best would be to combine the ways.
To check your mana, use the State-change packet(0x45). Buffer[3] is the thing which needs to be checked, if it's 0x08 your mana changed.
Code:
WORD curmp = *(WORD*)&Buffer[4];
Some information/source for move/playerlike bot will follow later.






Credits: The usual people
MoepMeep is offline  
Thanks
28 Users
Old 07/23/2011, 23:30   #2
 
meak1's Avatar
 
elite*gold: 220
Join Date: Jun 2007
Posts: 3,768
Received Thanks: 1,126
Und wo ist jetzt der fertige bot zum download ?

kaum wer hier will was lernen, nur fertige downloads =\

€: naja trozdem nett das du dir die mühe machst, viell. gucken sich das doch welche an^^
aber inix wirds deswegen nicht schneller fixxen =P
meak1 is offline  
Old 07/23/2011, 23:54   #3
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Da müsste ich ja meine commands so ändern, dass es irgendwer versteht!
MoepMeep is offline  
Old 07/24/2011, 01:08   #4
 
elite*gold: 0
Join Date: Jun 2011
Posts: 149
Received Thanks: 241
Dann trag ich auch mal was bei:


Send List (incomplete):
Code:
//Account
Type: 0x00 Format: Ud - Restore Char
Type: 0x01 Format: ? - HS
Type: 0x02 Format: Uss - Login
Type: 0x03 Format: ? - HS
Type: 0x04 Format: Usbwwwwwbb - CharGen
Type: 0x05 Format: Ud - Ping
Type: 0x07 Format: Ud - Delete Char
Type: 0x08 Format: dddddbb - Connect
Type: 0x09 Format: Ubd - Check Version
Type: 0x0a Format: Uddd - LoadPlayer
Type: 0x75 Format: Ubs - 2nd Pass

//Char
Type: 0x0a Format: Uddd - GameStart
Type: 0x0c Format: Ubdd - Attack
Type: 0x0d Format: Ubbd - Attack with Skill
Type: 0x0e Format: Us - Chat

Type: 0x10 Format: Ub - Relog
Type: 0x11 Format: Ubbb - Move
Type: 0x12 Format: Ubbb - MoveStop
Type: 0x13 Format: Ud - Talk To NPC
Type: 0x14 Format: Ud - Merchant Get Tax
Type: 0x15 Format: Um - Merchant Buy
Type: 0x16 Format: Um - Merchant Sell
Type: 0x17 Format: Udd - DropItem
Type: 0x18 Format: U - Quit Game
Type: 0x19 Format: Um - Trade insert item

Type: 0x1b Format: Ub - Stat Up
Type: 0x1c Format: Ub - Rest
Type: 0x1d Format: Uddd - Pick Item
Type: 0x1e Format: Ud - Use Item
Type: 0x1f Format: Ud - Request Trade

Type: 0x20 Format: Ubd - OnAskTrade
Type: 0x21 Format: U - Cancel Trade
Type: 0x22 Format: U - Revive

Type: 0x27 Format: Ub - SkillUp
Type: 0x28 Format: Ubd - Skill (Prep Ani)
Type: 0x29 Format: Ud - Request Party
Type: 0x2a Format: Ubd - Party Onask
Type: 0x2b Format: ... - guild {...}
Type: 0x2c Format: U - Party Leave
Type: 0x2d Format: d - Party kick
Type: 0x2e Format: Um - StorageKeeper CheckIn
Type: 0x2f Format: Um - StorageKeeper CheckOut

Type: 0x30 Format: Ud - NPC-Reply
Type: 0x31 Format: U - Storage Keeper Show Invent

Type: 0x33 Format: Ubd - Statue Save
Type: 0x34 Format: Udd - Pimp
Type: 0x35 Format: bddd - Player Shop AddItem

Type: 0x38 Format: Udb - Ani (Dance)
Type: 0x39 Format: U - Trade confirm

Type: 0x3a Format: Ud - Destroy Item
Type: 0x3b Format: Ub - Friendlist
Type: 0x3c Format: Ud - PutOn Item
Type: 0x3d Format: Ud - PutOff Item
Type: 0x3e Format: Ub - Cancel PlayerShop
Type: 0x3f Format: U - CancelFishing



Type: 0x40 Format: bd - Check Playershop Shop
Type: 0x41 Format: Um - Buy Playershop

Type: 0x47 Format: U - Request AssaList
Type: 0x48 Format: Ud - Request Duel
Type: 0x49 Format: Ubd - Duel OnAsk

Type: 0x4d Format: Ub - Student (open Window)

Type: 0x4f Format: Ub - ? beim login

Type: 0x51 Format: Ubd - Blacksmith
Type: 0x52 Format: Um - FL Parcel

Type: 0x54 Format: Ud - Treasure Box

Type: 0x57 Format: Udbb - Teleport (fisher?)

Type: 0x9d Format: Ub - Triangular Battle
NoTtT is offline  
Thanks
4 Users
Old 07/24/2011, 02:11   #5




 
bloodx's Avatar
 
elite*gold: 55
Join Date: Mar 2006
Posts: 4,582
Received Thanks: 1,537
mach doch lieber

Code:
enum Header {Pick=0x36,MobAnimation=0x3d}; usw...
finde ich schöner als überall nur die dummen Hexwerte.

naja man könnte noch mehr Sachen verändern aber nicht so wichtig.
bloodx is offline  
Old 07/24/2011, 13:04   #6
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by bloodx View Post
mach doch lieber

Code:
enum Header {Pick=0x36,MobAnimation=0x3d}; usw...
finde ich schöner als überall nur die dummen Hexwerte.

naja man könnte noch mehr Sachen verändern aber nicht so wichtig.
Bei einer vollen Source eine möglichkeit, bei den kleinen teilen eher hinderlich.
MoepMeep is offline  
Old 07/24/2011, 13:53   #7
 
kwisi's Avatar
 
elite*gold: 0
Join Date: Mar 2007
Posts: 528
Received Thanks: 106
was ist den mit moebmoep los?
kwisi is offline  
Thanks
1 User
Old 07/24/2011, 14:32   #8
 
omgz0rg's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 124
Received Thanks: 34
does this mean you're working on a bot yourself Moep? anyway, thanx for the tut
omgz0rg is offline  
Old 07/24/2011, 14:47   #9
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by omgz0rg View Post
does this mean you're working on a bot yourself Moep? anyway, thanx for the tut
Got all kinds of bots running, well okay, was too lazy to finish the playerlike one
MoepMeep is offline  
Old 07/25/2011, 18:24   #10
 
strik3r2k5's Avatar
 
elite*gold: 0
Join Date: Jun 2006
Posts: 1,203
Received Thanks: 366
hat wer ne (fast) komplette recv liste?
strik3r2k5 is offline  
Old 07/25/2011, 19:27   #11
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,254
Received Thanks: 199
wow ich glaub ich werd doch wieder mein c++ buch raushohlen und ma schauen ob ich damit was hin kriege ( dürft ja nich so schwer sein is ja alles da) xD


müste bei dem send la packet nicht noch ne wiederhohlungsschleife rein?
KillerExtreme is offline  
Old 07/25/2011, 19:43   #12
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by KillerExtreme View Post
wow ich glaub ich werd doch wieder mein c++ buch raushohlen und ma schauen ob ich damit was hin kriege ( dürft ja nich so schwer sein is ja alles da) xD


müste bei dem send la packet nicht noch ne wiederhohlungsschleife rein?
Schau mal, was direkt dadrunter steht
MoepMeep is offline  
Old 07/25/2011, 19:55   #13
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,254
Received Thanks: 199
ahh versteh ich das richtig, 0x0D is das attaking packet 18 der skill und die 1 anzahl der LAs ist? (sy ich stell mich wieder dämlich an)
KillerExtreme is offline  
Old 07/25/2011, 20:01   #14
 
strik3r2k5's Avatar
 
elite*gold: 0
Join Date: Jun 2006
Posts: 1,203
Received Thanks: 366
Ne, die 1 ist der kind? ...auf jedenfall ist 1 = monster & wenn man spieler angreift, ist es 0
strik3r2k5 is offline  
Old 07/25/2011, 20:05   #15
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by KillerExtreme View Post
ahh versteh ich das richtig, 0x0D is das attaking packet 18 der skill und die 1 anzahl der LAs ist? (sy ich stell mich wieder dämlich an)
0x0D ist skillpacket, attack ist 0x0C.
MoepMeep is offline  
Reply


Similar Threads Similar Threads
[RELEASE] Crazy Tao Guide and Release with working server programs and database
07/08/2020 - Private Server - 143 Replies
TOO MUCH SPAM AND TOO MUCH MESSAGES. PLEASE LOCK TOPIC. THANKS GUYS AND HAVE A NICE DAY :D Check Links Below For Information on Current Status Of Crazy Tao Server
[Release]Best Guide ever!
01/13/2009 - CO2 PServer Guides & Releases - 9 Replies
Greatest Guide Ever What you need: A Brain A Finger Steps:
[GUIDE] Item Filter Guide | Cabal Crafting & Dungeon Guide by Dewa Gempak.
06/15/2008 - Cabal Guides & Templates - 5 Replies
Since its his work, just SHARING it here, i just gonna link his URL from his work. because i dont like copy and pasting other ppl's guides: http://119.110.98.150:90/ipb/index.php?showtopic= 1145 Q#1: Does it work with CabalRider (PH)? A#1: Yes, it works, i tried it personally myself. Q#2: I'm too dumb to understand it, how to make it work. A#2: Try reading it again and again, if u still don't know how, don't use it then sleep.gif



All times are GMT +2. The time now is 05:34.


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.