View Full Version : [food Eater From Backpack]
wiesniak18
03-25-2007, 03:54 AM
Hello How to make a food eater from backpack i found this but this onyl eat food from arrow's slot
Made by Hyp
procedure SendPacket(ProcessID: DWORD; Packet: Pointer; Encrypt: Boolean; SafeArray: Boolean); stdcall; external 'packet.dll';
{ Procedure: FoodEater }
procedure FoodEater;
var
foodtype: integer;
Packetham, Packetmeat, Packetfish: Array [0..11] of Byte;
const
ARROW_SLOT = $60E304;
MEAT_ID = 3577;
FISH_ID = 3578;
HAM_ID = 3582;
begin
// Packet for eating ham in arrow slot
Packetham[0]:= $0A; Packetham[1]:=$00; Packetham[2]:= $82; Packetham[3]:=$FF;
Packetham[4]:= $FF; Packetham[5]:=$0A; Packetham[6]:= $00; Packetham[7]:=$00;
Packetham[8]:= $FE; Packetham[9]:=$0D; Packetham[10]:= $00; Packetham[11]:=$01;
// Packet for eating meat in arrow slot
Packetmeat[0]:= $0A; Packetmeat[1]:=$00; Packetmeat[2]:= $82; Packetmeat[3]:=$FF;
Packetmeat[4]:= $FF; Packetmeat[5]:=$0A; Packetmeat[6]:= $00; Packetmeat[7]:=$00;
Packetmeat[8]:= $F9; Packetmeat[9]:=$0D; Packetmeat[10]:= $00; Packetmeat[11]:=$01;
// Packet for eating fish in arrow slot
Packetfish[0]:= $0A; Packetfish[1]:=$00; Packetfish[2]:= $82; Packetfish[3]:=$FF;
Packetfish[4]:= $FF; Packetfish[5]:=$0A; Packetfish[6]:= $00; Packetfish[7]:=$00;
Packetfish[8]:= $FA; Packetfish[9]:=$0D; Packetfish[10]:= $00; Packetfish[11]:=$01;
// Get the type of food you have in your arrow slot (ham, meat or fish)
foodtype := ReadMemInteger(ARROW_SLOT); // returns 3577(meat), 3578(fish), 3582(ham)
// you can add more food types if u want...
GetWindowThreadProcessId(FindWindow('TibiaClient', nil), @ProcessID);
if (foodtype = FISH_ID) then
SendPacket(ProcessID,@Packetfish,True,False)
else if (foodtype = MEAT_ID) then
SendPacket(ProcessID,@Packetmeat,True,False)
else if (foodtype = HAM_ID) then
SendPacket(ProcessID,@Packetham,True,False);
end;
I trying change
ARROW_SLOT = $60E304; adress to "Cointainer_start 60E310 adress"
but dont work;/
Anyone can help me with it ??
Any know adress Last_item used?
ExpertMace
03-25-2007, 10:29 AM
It's a bit more complicated to eat from the backpack. You need to find the item with a function and then send a use packet for it. I wish that my delphi functions post was transferred over lol. Heres my function for finding items and useing items:
Find Item:
Function FindItem(ID_Item:integer):TItemBp;
var
BP, slot:byte;
Begin
Result.found :=False;
For Bp:=0 to 15 do
Begin
If MemReadByte(Adr_bp_Open+(Dist_bp*bp)) = 1 then
Begin
For slot:=0 to MemReadByte(Adr_bp+(Dist_bp*bp)-4) do
Begin
if ID_Item = MemReadSmallInt(adr_Bp+(Dist_bp*bp)+(12*slot)) then
Begin
Result.BP:= bp;
Result.slot:= slot;
Result.found :=True;
Exit;
End;
End;
End;
End;
End;
Put a record in the type section with
TItemBp = record
bp:byte;
slot:byte;
found:boolean;
end;
Then put this in the global var section:
Item:TItemBp;
Then use this to use the food in backpack:
procedure packetsend_usecontitem(item_id:smallint);
var
Pid:Cardinal;
begin
GetWindowThreadProcessId(FindWindow('TibiaClient', nil), @Pid);
item:= FindItem(item_ID);
packetbuffer[0]:=$0A;
packetbuffer[1]:=$00;
packetbuffer[2]:=$82;
packetbuffer[3]:=$FF;
packetbuffer[4]:=$FF;
packetbuffer[5]:=$40+item.bp;
packetbuffer[6]:=$00;
packetbuffer[7]:=item.slot;
packetbuffer[8]:=smallinttobyte(item_id,1);
packetbuffer[9]:=smallinttobyte(item_id,2);
packetbuffer[10]:=item.slot;
packetbuffer[11]:=item.bp;
SendPacket(Pid, @PacketBuffer, TRUE, FALSE);
end;
The constants are:
AdrContainerStart=$60E310;
Adr_bp_Open = $60E310;
Adr_Bp = $60E34C;
Dist_Bp = $1EC;
Dist_Item = 12;
smallinttobyte function is:
function smallinttobyte(number:smallint;NByte:smallint):byt e;
var
bytearray:array[0..2] of byte;
begin
CopyMemory(@bytearray[0],@number,length(inttostr(number)));
result:=bytearray[NByte-1];
end;
All the other functions you should be able to find out, if not post up. I hope this helps.
Mace.
wiesniak18
03-25-2007, 08:40 PM
Its Awesome but can u take "MemReadSmallInt function"
when i try compile it got Error on this line
if ID_Item = MemReadSmallInt(adr_Bp+(Dist_bp*bp)+(12*slot)) then
Ty alot for Help's me
Btw.. Got maybe a source to learn??
ExpertMace
03-26-2007, 02:19 PM
Oh yes sorry, the memreadsmallint function is:
function MemReadSmallInt(address:integer): SmallInt;
var
value : SmallInt;
Begin
ReadProcessMemory(IDProcess, Ptr(adress), @Value, 2, NBR);
Result:=Value;
End;
That should be all thats needed. Sorry I haven't any sources released to do with this at the present time, but I may do in the future ;)
Mace.
wiesniak18
03-27-2007, 12:07 AM
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
procedure SendPacket(ProcessID: DWORD; Packet: Pointer; Encrypt: Boolean; SafeArray: Boolean); stdcall; external 'packet.dll';
type
TItemBp = record
bp:byte;
slot:byte;
found:boolean;
end;
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
const
AdrContainerStart=$60E310;
Adr_bp_Open = $60E310;
Adr_Bp = $60E34C;
Dist_Bp = $1EC;
Dist_Item = 12;
var
Item:TItemBp;
Form1: TForm1;
implementation
{$R *.dfm}
function smallinttobyte(number:smallint;NByte:smallint):byt e;
var
bytearray:array[0..2] of byte;
begin
CopyMemory(@bytearray[0],@number,length(inttostr(number)));
result:=bytearray[NByte-1];
end;
function MemReadSmallInt(address:integer): SmallInt;
var
value : SmallInt;
IDProcess : Cardinal;
adress : cardinal;
nbr :cardinal;
Begin
ReadProcessMemory(IDProcess, Ptr(adress), @Value, 2, NBR);
Result:=Value;
End;
function MemReadByte(Address: Cardinal): Cardinal; //Read adress:value
var
ProcId: Cardinal;
tProc: THandle;
NBR: Cardinal;
value:byte;
begin
GetWindowThreadProcessId(FindWindow('TibiaClient', Nil), @ProcId);
tProc:= OpenProcess(PROCESS_ALL_ACCESS, False, ProcId);
ReadProcessMemory(tProc, Ptr(Address), @value, 1, NBR);
CloseHandle(tProc);
Result:=value;
end;
Function FindItem(ID_Item:integer):TItemBp;
var
BP, slot:byte;
Begin
Result.found :=False;
For Bp:=0 to 15 do
Begin
If MemReadByte(Adr_bp_Open+(Dist_bp*bp)) = 1 then
Begin
For slot:=0 to MemReadByte(Adr_bp+(Dist_bp*bp)-4) do
Begin
if ID_Item = MemReadSmallInt(adr_Bp+(Dist_bp*bp)+(12*slot)) then
Begin
Result.BP:= bp;
Result.slot:= slot;
Result.found :=True;
Exit;
End;
End;
End;
End;
End;
procedure packetsend_usecontitem(item_id:smallint);
var
Pid:Cardinal;
ProcessID: Cardinal;
PacketBuffer: array [0..200] of byte;
begin
GetWindowThreadProcessId(FindWindow('TibiaClient', nil), @Pid);
item:= FindItem(item_ID); //<< think its id of meat
packetbuffer[0]:=$0A;
packetbuffer[1]:=$00;
packetbuffer[2]:=$82;
packetbuffer[3]:=$FF;
packetbuffer[4]:=$FF;
packetbuffer[5]:=$40+item.bp;
packetbuffer[6]:=$00;
packetbuffer[7]:=item.slot;
packetbuffer[8]:=smallinttobyte(item_id,1);
packetbuffer[9]:=smallinttobyte(item_id,2);
packetbuffer[10]:=item.slot;
packetbuffer[11]:=item.bp;
SendPacket(Pid, @PacketBuffer, TRUE, FALSE);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
packetsend_usecontitem(3577); //<< this is id of meat
end.
Still dont eat can u tell me where i make MISSTAKE? or can u correct it to state working
You need to encrypt the packet you want to send.
I don't think that anyone would give u full, working source code. Use your brain.
orc there's file named packet.dll for encrypting and sending packets. And it is open source (coded with asm though). :>
OsQu
ExpertMace
03-28-2007, 02:17 PM
@wiesniak18:
If you have msn add me @ expert.mace@hotmail.co.uk and ill remote assist to sort the source code out.
Mace.
Pieter6
06-09-2007, 11:27 AM
can any1 make it work please :>? i need it ;)
EDIT:
i maked it my self ;]
procedure packetsend_usecontitem(item_id:smallint);
var
Pid:Cardinal;
i:integer;
PacketBuffer: array [0..255] of byte;
begin
GetWindowThreadProcessId(FindWindow('TibiaClient', nil), @Pid);
item:= FindItem(item_ID);
Randomize;
for i := 0 to 255 do
Begin
packetbuffer[i]:= Random(255);
End;
packetbuffer[0]:=$0A;
packetbuffer[1]:=$00;
packetbuffer[2]:=$82;
packetbuffer[3]:=$FF;
packetbuffer[4]:=$FF;
packetbuffer[5]:=$40+item.bp;
packetbuffer[6]:=$00;
packetbuffer[7]:=item.slot;
packetbuffer[8]:=smallinttobyte(item_id,1);
packetbuffer[9]:=smallinttobyte(item_id,2);
packetbuffer[10]:=item.slot;
packetbuffer[11]:=item.bp;
SendPacket(Pid, @PacketBuffer, TRUE, FALSE);
end;
thats the good code ;]
Praetox
06-09-2007, 02:10 PM
I don't understand this:
PacketBuffer: array [0..255] of byte;
...
Randomize;
for i := 0 to 255 do
Begin
packetbuffer[i]:= Random(255);
End;
Wouldn't this be better?
PacketBuffer: array [0..11] of byte;
Just my two cents.
Pieter6
06-09-2007, 03:00 PM
nope.. it didnt work :P
sinlessman
03-23-2008, 10:03 AM
Could somebody convert those addresses to Tibia 7.6, please. Or just tell me how to find them.
AdrContainerStart=$60E310;
Adr_bp_Open = $60E310;
Adr_Bp = $60E34C;
Dist_Bp = $1EC;
It'd be really nice.
Regards,
Sinless Man.
Dark Pallys
03-23-2008, 11:21 AM
Could somebody convert those addresses to Tibia 7.6, please. Or just tell me how to find them.
AdrContainerStart=$60E310;
Adr_bp_Open = $60E310;
Adr_Bp = $60E34C;
Dist_Bp = $1EC;
It'd be really nice.
Regards,
Sinless Man.
The Dist_BP stays the same,
AdrContainerStart and Adr_bp_Open are the same as you can see..
That address shows 1 if the first BP is opened, or 0 if its closed..
so to find it..
1. first of all, close all the opened containers..
2. then open one container/backpack.. then on TSearch or w/e search for exact value ( 1 )..
3. then after it finishes, close the backpack.. and push Find Next or w/e.. and search for exact value ( 0 )..
4. repeat 2 and 3 untill you have one address left which shows works like explained above..
and to get Adr_Bp, just add 3C hex ( 60 decimal) to the address of Adr_bp_Open that you've found..
thats it ;)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.