Hey, is originally source from gayak, i will first try to make a dll that will run ..... then i try to make my own codes .. thx
//////////////////////////////////////////////////////////////////////
// Dupeswap.cpp
// -------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////
#include "..\ClientCore.cpp" // Include the backend of the module
BOOL PRIVATE OnGameCommandStart(char** argv, int argc);
BOOL PRIVATE OnGameCommandDupe(char** argv, int argc);
BOOL PRIVATE OnGameCommandSwap(char** argv, int argc);
//////////////////////////////////////////////////////////////////////
THISGAMESTRUCT* thisgame;
char npc[]={0,0,0,0};
char buffer[]={0,0,0,0};
char itm[]={0,0,0,0};
char itm2[]={0,0,0,0};
bool GOTN=false;
int state=0;
BYTE storeback[17]={0x18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//////////////////////////////////////////////////////////////////////
CLIENTINFO
(
0,2, // Module version (Major, Minor)
"Gayak", // Author
"gayak.gods-network.com", // url (
http:// is appended)
"Dupeswap mehod. PATCHED.", // Short module description
"170@guyau.qc.ca" // Author eMail
)
//////////////////////////////////////////////////////////////////////
MODULECOMMANDSTRUCT ModuleCommands[]=
{
{"help",OnGameCommandHelp,
"helpÿc0 List commands available in this module.\n"
"<command> helpÿc0 Shows detailed help for <command> in this module."
},
{"start",OnGameCommandStart,"start ÿc0Starts the dupe."},
{"swap",OnGameCommandSwap,"swap ÿc0Continues the process."},
{"dupe",OnGameCommandDupe,"dupe ÿc0Dupes."},
{NULL} // No more commands
};
BOOL PRIVATE OnGameCommandStart(char** argv, int argc)
{
server->GamePrintInfo("ÿc1Equip the item you want to dupe (unequip and equip if needed). We'll get its ID.");
state=1;
return true;
}
BOOL PRIVATE OnGameCommandSwap(char** argv, int argc)
{
if (state!=5 || !GOTN) {state=0; return false;}
server->GamePrintInfo("ÿc1To dupe, type \"ÿc0.dupeswap dupe [number]ÿc1\".");
BYTE q[9]={0x1d,0,0,0,0,buffer[0],buffer[1],buffer[2],buffer[3]};
for (int y=0; y<5; y++) {
memcpy(q+1, itm2, 4);
server->GameSendPacketToServer(q, 9);
memcpy(q+1, itm, 4);
server->GameSendPacketToServer(q, 9);
}
server->GameSendPacketToServer(storeback, 17);
state=6;
return true;
}
BOOL PRIVATE OnGameCommandDupe(char** argv, int argc)
{
if (state!=6 || !GOTN) {state=0; return false;}
server->GamePrintInfo("ÿc1Now you can buy it back. Dupe is done.");
server->GamePrintInfo("ÿc1Module made by Gayak (gayak.gods-network.com).");
BYTE p[]={0x33,0,0,0,0,0,0,0,0,0x01,0,0,0,0x01,0x01,0,0};
memcpy(p+5,itm,4); // Item ID
memcpy(p+1, npc, 4); // NPC ID
for (int x=0; x<=atoi(argv[2]); x++) {
server->GameSendPacketToServer(p, 17);
}
return true;
}
//////////////////////////////////////////////////////////////////////
VOID EXPORT OnGameJoin(THISGAMESTRUCT* thisgame)
{
server->GamePrintInfo("ÿc1To dupe, enter trade then type \"ÿc0.dupeswap start\"ÿc1.");
state=0;
return;
}
VOID EXPORT OnGameLeave(THISGAMESTRUCT* thisgame)
{
return;
}
DWORD EXPORT OnGamePacketBeforeSent(BYTE* aPacket, DWORD aLen)
{
// Item
if (aPacket[0] == 0x1a && state==1){
server->GamePrintInfo("ÿc1We've got item's ID. Now, you need to pick up your dummy item. It has to be the same kind.");
memcpy(itm,aPacket+1,4);
memcpy(buffer,aPacket+5,4);
state=2;
}
if (aPacket[0] == 0x19 && state==2){
server->GamePrintInfo("ÿc1We've got dummy's ID. For the module, you need to replace it and take it another time.");
memcpy(itm2,aPacket+1,4);
state=3;
}
if (aPacket[0] == 0x18 && state==3){
memcpy(storeback,aPacket,17);
state=4;
}
if (aPacket[0] == 0x19 && state==4){
server->GamePrintInfo("ÿc1Thanks. Type \"ÿc0.dupeswap swapÿc1\" to continue.");
state=5;
}
// NPC
if (aPacket[0] == 0x2f)
{
GOTN=true;
server->GamePrintInfo("ÿc1We've got NPC's ID.");
memcpy(npc,aPacket+5,4);
}
return aLen;
}