If you would put the LongToByte ASM code in packet.dll and recompile it you could use the following function in C++ to call the LongToByte as well as the SendPacket function. Alternatively you can just include the LongToByte for C++ (which is easier) and remove everything else related to the packet.dll.
The code is just dusting on my computer, I'd rather just post it somewhere so it's on the web for someone to find if they would need it.
Code:
/****************************/
/* Created by Froboo, 2006. */
/****************************/
#include <windows.h> // Required for finding our tibiaclient (window handling)
#include <stdio.h>
// Declaring how the SENDPACKET and the LONGTOBYTE functions should be used
typedef int (WINAPI *SENDPACKET)(DWORD, char*, BOOL, BOOL);
typedef int (WINAPI *LONGTOBYTE)(long, int);
// Create an instance of the functions
SENDPACKET SendPacket = NULL;
LONGTOBYTE LongToByte = NULL;
// Creating an instance called hLib where we will store the info
// about packet.dll
HINSTANCE hLib;
void UseItemOnFloor( int itemID, int x, int y, int z )
{
// Get the address of the function so the program will jump to the right
// location when we make the call to it
LongToByte = (LONGTOBYTE)GetProcAddress(hLib, "LongToByte");
// The packet consists of 12 bytes where 5 is always the same
char cPacket[12];
cPacket[0] = 0x0A;
cPacket[1] = 0x00;
cPacket[2] = 0x82;
cPacket[3] = LongToByte( x, 1 ); // retrieve the first byte of x (a 5 digit number equals only 2 bytes)
cPacket[4] = LongToByte( x, 2 ); // retrieve the second byte of x
cPacket[5] = LongToByte( y, 1 );
cPacket[6] = LongToByte( y, 2 );
cPacket[7] = z;
cPacket[8] = LongToByte( itemID, 1 );
cPacket[9] = LongToByte( itemID, 2 );
cPacket[10] = 0x01;
cPacket[11] = 0x03;
DWORD PID;
HWND hwnd = FindWindow( "tibiaclient", NULL ); // Fetch a handle to the tibia client
GetWindowThreadProcessId( hwnd, &PID ); // Get the process id
SendPacket = (SENDPACKET)GetProcAddress(hLib, "SendPacket");
SendPacket( PID, cPacket, 1, 0 ); // Send the packet using packet.dll
}
int main()
{
hLib = LoadLibrary("mod_packet.dll"); // Load mod_packet.dll into hLib
// If I remember correctly these are the coordinates + the id of the first ladder in rookgaard rats
UseItemOnFloor( 1948, 32097, 32205, 8 );
FreeLibrary(hLib);
return 0;
}