Code:
This is the source code for Season 3 Mixes.
Well...
This is Protocol in DLL
Code:
bool ProtocolCore(DWORD aIndex, LPBYTE pBuffer, DWORD pSize) {
BYTE Packet[100] = {0};
switch(pBuffer[2])
{
//----------------------------------------------
// ChaosBox Machine combination packets
case PROTO_CHAOSCOMBINATION:
if(pBuffer[1] == 0x04 && pBuffer[3] == 0x26)
{
ChaosBoxCombineNewFeather(aIndex);
return true;
}
if(pBuffer[1] == 0x04 && pBuffer[3] == 0x27)
{
ChaosBoxCombineNewWings(aIndex);
return true;
}
break;
}
return false;
}
This function return TRUE if know packet. When this function return TRUE, hook in GameServer ProtocolCore jump to end (STACK Footer/POP's). pBuffer[3] is mixID.
This is an example of ProtocolCore hook in GameServer 1.00.16.
Code:
PUSH DWORD PTR SS:[EBP+10] ; Push Packet size
PUSH DWORD PTR SS:[EBP+C] ; Push pointer to first byte of packet
PUSH DWORD PTR SS:[EBP+14] ; Push aIndex/Player Id/gObjId
CALL DWORD PTR DS:[0xB5F0010] ; Call ProtocolCore from DLL
CMP EAX, 1 ; check what return our function and compare it
JE GameServ.0042EEC8 ; jump to function Epilog if return TRUE(1)
JMP GameServ.0042DF13 ; or jump to previous code if FALSE(0)
Now you must add new items to ChaosBox allowed items list. When you do this, you can put items needs to new mixes (Bless package, soul package, etc). 1.03H++ Mains have implemented season 3 Chaos Combinations.
To add new items to ChaosBox we use ASM and our DLL. We make function with naked parameter (more about it on http://msdn2.microsoft.com/en-us/lib...xs(VS.80).aspx).
Code:
void __declspec(naked) ChaosBoxCheckNewItems() {
__asm {
// Original
cmp eax, 0x180F;
je ItemAllowed;
// Flame Of Condor
cmp eax, 0x1A34;
je ItemAllowed;
// Feather of Condor
cmp eax, 0x1A35;
je ItemAllowed;
// Package of 10 Blesses
cmp eax, 0x181E;
je ItemAllowed;
// Package of 10 Souls
cmp eax, 0x181F;
je ItemAllowed;
mov edi, 0x004E3DD4;
jmp edi;
ItemAllowed:
mov edi, 0x004E3E0F;
jmp edi;
}
}
Code is very simply. ItemId = ItemSection * 512 + ItemIdInSection.
Now we must make hook in GameServer 1.00.16.
At 0x004E3DCD offset you have smth like this:
Code:
MOV EDX, DWORD PTR SS:[EBP-78] ; copy item pointer to EDX
MOVSX EAX, WORD PTR DS:[EDX+6] ; copy 6th byte (itemId) from item pointer to EAX
CMP EAX, 180F ; compare itemId with 0x180F const
JE SHORT GameServ.004E3E0F ; if itemId is equal jump to Send PutPacket
Change that code to :
Code:
MOV EDX, DWORD PTR SS:[EBP-78]
MOVSX EAX, WORD PTR DS:[EDX+6]
JMP DWORD PTR DS:[0xB5F0030] ; jump (because is naked) to our function from DLL
NOP
And Mixes Code :
Code:
void ChaosBoxCombineNewFeather(DWORD aIndex) {
DWORD lpObj = (aIndex * gObj_SIZE + gObj_OFFSET);
srand(static_cast<int>(time(NULL)));
if((rand() % 100) <= 60)
{
ItemSerialCreateSend(aIndex, 0xFF, gObj_GetInt(aIndex, gObj_POSX), gObj_GetInt(aIndex, gObj_POSY), 0x1A35, 0, 255, 0, 0, 0, -1, 0, 0);
gObj_Write(aIndex, gObj_MONEY, (gObj_GetInt(aIndex, gObj_MONEY) - 20000));
GCMoneySend(aIndex, gObj_GetInt(aIndex, gObj_MONEY));
Log(mInfo, "[%s][%s] ChaosBoxCombineNewFeather() - Combination success.", gObj_GetChar(aIndex, gObj_LOGIN), gObj_GetChar(aIndex, gObj_NICK));
}
else
{
ChaosBoxInit(lpObj);
GCUserChaosBoxSend(lpObj, 0);
BYTE Packet[10] = {0xC1, 0x0A, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DataSend(aIndex, Packet, 10);
Log(mInfo, "[%s][%s] ChaosBoxCombineNewFeather() - Combination fail.", gObj_GetChar(aIndex, gObj_LOGIN), gObj_GetChar(aIndex, gObj_NICK));
}
}
void ChaosBoxCombineNewWings(DWORD aIndex) {
DWORD lpObj = (aIndex * gObj_SIZE + gObj_OFFSET);
srand(static_cast<int>(time(NULL)));
if((rand() % 100) <= 60)
{
srand(static_cast<int>(time(NULL)));
WORD WingsId = 0x1824 + (rand() % 5);
ItemSerialCreateSend(aIndex, 0xFF, gObj_GetInt(aIndex, gObj_POSX), gObj_GetInt(aIndex, gObj_POSY), WingsId, 0, 255, 0, 0, 0, -1, 0, 0);
gObj_Write(aIndex, gObj_MONEY, (gObj_GetInt(aIndex, gObj_MONEY) - 20000));
GCMoneySend(aIndex, gObj_GetInt(aIndex, gObj_MONEY));
Log(mInfo, "[%s][%s] ChaosBoxCombineNewWings() - Combination success with ItemId [0x%02X].", gObj_GetChar(aIndex, gObj_LOGIN), gObj_GetChar(aIndex, gObj_NICK), WingsId);
}
else
{
ChaosBoxInit(lpObj);
GCUserChaosBoxSend(lpObj, 0);
BYTE Packet[10] = {0xC1, 0x0A, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DataSend(aIndex, Packet, 10);
Log(mInfo, "[%s][%s] ChaosBoxCombineNewWings() - Combination fail.", gObj_GetChar(aIndex, gObj_LOGIN), gObj_GetChar(aIndex, gObj_NICK));
}
}
If needed use that code too :
Code:
/* ProtocolCore.h - Created 2007-07-14 at 11:12
* File is part of MUDLL Project.
*
* Coded by f1x
*/
#ifndef MUDLL_PROTOCOLCORE_H
#define MUDLL_PROTOCOLCORE_H
#define PROTO_NPCCLICK 0x30
#define PROTO_ENTERGAME 0x03
#define PROTO_CHAOSCOMBINATION 0x86
#define PROTO_PRIESTDEVIN 0xA2
bool ProtocolCore(DWORD aIndex, LPBYTE pBuffer, DWORD pSize);
#endif //~MUDLL_PROTOCOLCORE_H
who can make it simple in a .dll or the code to compile it in a .dll file?and a dll hooking guide pls :34::34::34: