View Single Post
Old 20.06.2006, 06:12   #1
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default [share]L2Extend source code

final words from me:
due to personal issue, i am out of this community, so good luck on dev/cracking/hacking guys
i will share certain features that directly rip from my dll.
havent decided if i should put complete project out, or maybe some of you can buy my source * *, but at least you guys will get something.
i dont use asm code for most of my features, and i wont give out any struct code, but its not really hard to get your own, just time consuming

RequestChangePartyLeader
Code:
bool __cdecl isInParty(BYTE * pParty, DWORD dwTargetID)
{
	BYTE *pUser;
	int nPartySize, i;
	DWORD dwObjectID;

	PARTY aParty;
	aParty.pFirst = NULL;
	aParty.pLast = NULL;
	MakeParty(pParty, &aParty);
	nPartySize = ((DWORD)aParty.pLast - (DWORD)aParty.pFirst) / 4;

	i = 0;
	while(i < nPartySize)
	{
		pUser = (unsigned char*)(*(unsigned int*)(aParty.pFirst + i * 4));
		dwObjectID = *(unsigned int*)(pUser + 0x18);
		if (dwObjectID == dwTargetID) return true;
		++i;
	}
	return false;
}

void __cdecl AnnounceNewPartyLeader(BYTE * pParty, wchar_t *ptarget_name)
{
	BYTE *pUser, *pSocket;
	int nPartySize, i;

	PARTY aParty;
	aParty.pFirst = NULL;
	aParty.pLast = NULL;
	MakeParty(pParty, &aParty);
	nPartySize = ((DWORD)aParty.pLast - (DWORD)aParty.pFirst) / 4;

	i = 0;
	while(i < nPartySize)
	{
		pUser = (unsigned char*)(*(unsigned int*)(aParty.pFirst + i * 4));
		pSocket = (unsigned char*)(*(unsigned int*)(pUser + 0x19B8));
		Lin2Send(pSocket, "cdddS", 0x7A, 1384, 1, 0, ptarget_name);
		++i;
	}
}

void __cdecl RequestChangePartyLeader(BYTE * pData, BYTE* pUser, BYTE * pSocket)
{
	BYTE *pBuffer, *pParty, *pTargetUser;
	wchar_t *ptarget_name;
	DWORD dwLeaderID, dwObjectID, dwTargetID;

	pBuffer = pData;

	if (pUser!=NULL)
	{
		ptarget_name = (wchar_t*)pBuffer;
		pParty = GetParty(pUser);
		if (pParty == NULL)
		{
			Lin2Send(pSocket, "cd", 0x7A, 1403);
			return;
		}
		dwLeaderID = *(unsigned int*)(*(unsigned int*)(pParty +0x28) + 0x70);
		dwObjectID = *(unsigned int*)(pUser +0x18);

		if (dwObjectID != dwLeaderID)
		{
			Lin2Send(pSocket, "cd", 0x7A, 1399);
			return;
		}
		pTargetUser = wchar2pUser(pBuffer);
		if (pTargetUser == NULL)	return;
		dwTargetID = *(unsigned int*)(pTargetUser +0x18);

		if (dwTargetID == dwObjectID) 
		{
			Lin2Send(pSocket, "cd", 0x7A, 1401);
			return;
		}
		if (isInParty(pParty, dwTargetID))
		{
			*(unsigned int*)(*(unsigned int*)(pParty +0x28) + 0x70) = dwTargetID;
			AnnounceNewPartyLeader(pParty,ptarget_name);
		}
		else
		{
			Lin2Send(pSocket, "cd", 0x7A, 1402);
		}
	}
}
torune is offline