mirror of
https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
synced 2025-10-14 00:44:22 -05:00
Stats display refactor using ini file done.
This commit is contained in:
@@ -10,4 +10,4 @@ void asm_code::build() {
|
||||
for (auto addr : m_addresses) {
|
||||
addr->build(m_code);
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,4 +15,4 @@ config::config(token) {
|
||||
|
||||
m_json->parse(ss.str());
|
||||
}
|
||||
}
|
||||
}
|
@@ -13,7 +13,7 @@ static void* allocate_function_stub(void* origin, void* ptr, size_t size) {
|
||||
if (!current_stub) {
|
||||
current_stub =
|
||||
VirtualAlloc(nullptr, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE,
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
}
|
||||
|
||||
if (!current_stub)
|
||||
@@ -85,4 +85,4 @@ void* hooking::get_call(void* address) {
|
||||
target += reinterpret_cast<intptr_t>(address) + 5;
|
||||
|
||||
return reinterpret_cast<void*>(target);
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
// "CIni" is a simple API wrap class used for ini file access.
|
||||
// The purpose of this class is to make ini file access more
|
||||
// convenient than direct API calls.
|
||||
//
|
||||
//
|
||||
// This file is distributed "as is" and without any expressed or implied
|
||||
// warranties. The author holds no responsibilities for any possible damages
|
||||
// or loss of data that are caused by use of this file. The user must assume
|
||||
@@ -74,7 +74,7 @@ CIni::CIni(LPCTSTR lpPathName)
|
||||
CIni::~CIni()
|
||||
{
|
||||
if (m_pszPathName != NULL)
|
||||
delete [] m_pszPathName;
|
||||
delete[] m_pszPathName;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -92,7 +92,7 @@ void CIni::SetPathName(LPCTSTR lpPathName)
|
||||
else
|
||||
{
|
||||
if (m_pszPathName != NULL)
|
||||
delete [] m_pszPathName;
|
||||
delete[] m_pszPathName;
|
||||
|
||||
m_pszPathName = _tcsdup(lpPathName);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ DWORD CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD d
|
||||
dwLen = min(dwLen, dwBufSize);
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwLen;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ CString CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault) con
|
||||
{
|
||||
LPTSTR psz = __GetStringDynamic(lpSection, lpKey, lpDefault);
|
||||
CString str(psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
@@ -177,8 +177,8 @@ BOOL CIni::AppendString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpString) cons
|
||||
TCHAR* pNewString = new TCHAR[_tcslen(psz) + _tcslen(lpString) + 1];
|
||||
_stprintf(pNewString, _T("%s%s"), psz, lpString);
|
||||
const BOOL RES = WriteString(lpSection, lpKey, pNewString);
|
||||
delete [] pNewString;
|
||||
delete [] psz;
|
||||
delete[] pNewString;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@@ -193,10 +193,10 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
|
||||
*lpBuffer = _T('\0');
|
||||
|
||||
if (lpSection == NULL || lpKey == NULL)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
LPTSTR psz = __GetStringDynamic(lpSection, lpKey);
|
||||
|
||||
|
||||
DWORD dwCopied = 0;
|
||||
|
||||
if (*psz != _T('\0'))
|
||||
@@ -207,20 +207,20 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
|
||||
const DWORD MAX_LEN = _tcslen(psz) + 2;
|
||||
LPTSTR p = new TCHAR[MAX_LEN + 1];
|
||||
dwCopied = __StringSplit(psz, p, MAX_LEN, lpDelimiter, bTrimString);
|
||||
delete [] p;
|
||||
delete[] p;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwCopied = __StringSplit(psz, lpBuffer, dwBufSize, lpDelimiter, bTrimString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwCopied;
|
||||
}
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCTSTR lpDelimiter, BOOL bTrimString) const
|
||||
void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter, BOOL bTrimString) const
|
||||
{
|
||||
if (pArray != NULL)
|
||||
pArray->RemoveAll();
|
||||
@@ -232,12 +232,12 @@ void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCT
|
||||
LPTSTR psz = new TCHAR[LEN + 3];
|
||||
GetArray(lpSection, lpKey, psz, LEN + 2, lpDelimiter);
|
||||
ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
BOOL CIni::WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray *pArray, int nWriteCount, LPCTSTR lpDelimiter) const
|
||||
BOOL CIni::WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount, LPCTSTR lpDelimiter) const
|
||||
{
|
||||
if (pArray == NULL)
|
||||
return FALSE;
|
||||
@@ -385,7 +385,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
|
||||
DWORD dwLen = _tcslen(psz) / 2;
|
||||
if (dwLen <= dwOffset)
|
||||
{
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
|
||||
}
|
||||
else
|
||||
{
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -414,18 +414,18 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
|
||||
dwProcLen = min(dwLen - dwOffset, dwBufSize);
|
||||
LPCTSTR p = &psz[dwOffset * 2];
|
||||
for (DWORD i = 0; i < dwProcLen; i++)
|
||||
{
|
||||
{
|
||||
TCHAR sz[3] = _T("");
|
||||
_tcsncpy(sz, p, 2);
|
||||
_tcsncpy(sz, p, 2);
|
||||
lpb[i] = BYTE(_tcstoul(sz, NULL, 16));
|
||||
p = &p[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dwProcLen = dwLen - dwOffset;
|
||||
}
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwProcLen;
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ BOOL CIni::WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWOR
|
||||
for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2)
|
||||
_stprintf(&psz[j], _T("%02X"), lpb[i]);
|
||||
const BOOL RES = WriteString(lpSection, lpKey, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ BOOL CIni::AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWO
|
||||
for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2)
|
||||
_stprintf(&psz[j], _T("%02X"), lpb[i]);
|
||||
const BOOL RES = AppendString(lpSection, lpKey, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ DWORD CIni::GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
|
||||
*lpBuffer = _T('\0');
|
||||
|
||||
if (lpSection == NULL)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if (lpBuffer == NULL)
|
||||
{
|
||||
@@ -514,12 +514,12 @@ DWORD CIni::GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
|
||||
while (dwCopied + 2 >= dwLen)
|
||||
{
|
||||
dwLen += DEF_PROFILE_THRESHOLD;
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
dwCopied = ::GetPrivateProfileSection(lpSection, psz, dwLen, m_pszPathName);
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwCopied + 2;
|
||||
}
|
||||
else
|
||||
@@ -535,9 +535,9 @@ DWORD CIni::GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
|
||||
*lpBuffer = _T('\0');
|
||||
|
||||
if (lpSection == NULL)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
STR_LIMIT sl;
|
||||
STR_LIMIT sl;
|
||||
sl.lpTarget = lpBuffer;
|
||||
sl.dwRemain = dwBufSize;
|
||||
sl.dwTotalCopied = 0;
|
||||
@@ -549,7 +549,7 @@ DWORD CIni::GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetKeyLines(lpSection, psz, LEN);
|
||||
ParseDNTString(psz, __KeyPairProc, (LPVOID)(&sl));
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
if (lpBuffer != NULL)
|
||||
lpBuffer[sl.dwTotalCopied] = _T('\0');
|
||||
return sl.dwTotalCopied;
|
||||
@@ -567,12 +567,12 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const
|
||||
while (dwCopied + 2 >= dwLen)
|
||||
{
|
||||
dwLen += DEF_PROFILE_THRESHOLD;
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
dwCopied = ::GetPrivateProfileSectionNames(psz, dwLen, m_pszPathName);
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
|
||||
delete[] psz;
|
||||
return dwCopied + 2;
|
||||
}
|
||||
else
|
||||
@@ -582,7 +582,7 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const
|
||||
}
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
void CIni::GetSectionNames(CStringArray *pArray) const
|
||||
void CIni::GetSectionNames(CStringArray* pArray) const
|
||||
{
|
||||
if (pArray != NULL)
|
||||
pArray->RemoveAll();
|
||||
@@ -594,13 +594,13 @@ void CIni::GetSectionNames(CStringArray *pArray) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetSectionNames(psz, LEN);
|
||||
ParseDNTString(psz, __SubStrAdd, pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
// Retrieve a list of key-lines(key-pairs) of the specified section
|
||||
void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const
|
||||
{
|
||||
if (pArray != NULL)
|
||||
pArray->RemoveAll();
|
||||
@@ -612,13 +612,13 @@ void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetKeyLines(lpSection, psz, LEN);
|
||||
ParseDNTString(psz, __SubStrAdd, pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
// Retrieve a list of key names of the specified section
|
||||
void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const
|
||||
{
|
||||
if (pArray == NULL)
|
||||
return;
|
||||
@@ -628,7 +628,7 @@ void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetKeyNames(lpSection, psz, LEN);
|
||||
ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -658,7 +658,7 @@ BOOL CIni::IsSectionExist(LPCTSTR lpSection) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetSectionNames(psz, LEN);
|
||||
BOOL RES = !ParseDNTString(psz, __SubStrCompare, (LPVOID)lpSection);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ BOOL CIni::IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const
|
||||
// Test it with the default unique string
|
||||
LPTSTR psz = __GetStringDynamic(lpSection, lpKey, DEF_PROFILE_TESTSTRING);
|
||||
const BOOL RES = (_tcscmp(psz, DEF_PROFILE_TESTSTRING) != 0);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@@ -693,9 +693,9 @@ BOOL CIni::CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIf
|
||||
const DWORD SRC_LEN = GetKeyLines(lpSrcSection, NULL, 0);
|
||||
LPTSTR psz = new TCHAR[SRC_LEN + 2];
|
||||
//memset(psz, 0, sizeof(TCHAR) * (SRC_LEN + 2));
|
||||
GetKeyLines(lpSrcSection, psz, SRC_LEN);
|
||||
GetKeyLines(lpSrcSection, psz, SRC_LEN);
|
||||
const BOOL RES = ::WritePrivateProfileSection(lpDestSection, psz, m_pszPathName);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
|
||||
return RES;
|
||||
}
|
||||
@@ -714,10 +714,10 @@ BOOL CIni::CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection
|
||||
|
||||
if (bFailIfExist && IsKeyExist(lpDestSection, lpDestKey))
|
||||
return FALSE;
|
||||
|
||||
|
||||
LPTSTR psz = __GetStringDynamic(lpSrcSection, lpSrcKey);
|
||||
const BOOL RES = WriteString(lpDestSection, lpDestKey, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@@ -758,23 +758,23 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa
|
||||
psz = new TCHAR[_tcslen(lpDefault) + 1];
|
||||
_tcscpy(psz, lpDefault);
|
||||
}
|
||||
|
||||
|
||||
return psz;
|
||||
}
|
||||
|
||||
|
||||
// Keep enlarging the buffer size until being certain on that the string we
|
||||
// retrieved was original(not truncated).
|
||||
DWORD dwLen = DEF_PROFILE_THRESHOLD;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
DWORD dwCopied = ::GetPrivateProfileString(lpSection, lpKey, lpDefault == NULL ? _T("") : lpDefault, psz, dwLen, m_pszPathName);
|
||||
while (dwCopied + 1 >= dwLen)
|
||||
{
|
||||
{
|
||||
dwLen += DEF_PROFILE_THRESHOLD;
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
dwCopied = ::GetPrivateProfileString(lpSection, lpKey, lpDefault == NULL ? _T("") : lpDefault, psz, dwLen, m_pszPathName);
|
||||
}
|
||||
|
||||
|
||||
return psz; // !!! Requires the caller to free this memory !!!
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa
|
||||
DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter, BOOL bTrimString)
|
||||
{
|
||||
if (lpString == NULL || lpBuffer == NULL || dwBufSize == 0)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
DWORD dwCopied = 0;
|
||||
*lpBuffer = _T('\0');
|
||||
@@ -828,8 +828,8 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP
|
||||
lpTarget[COPY_LEN] = _T('\0');
|
||||
lpTarget = &lpTarget[SEG_LEN + 1];
|
||||
}
|
||||
delete [] pszSeg;
|
||||
lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search
|
||||
delete[] pszSeg;
|
||||
lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search
|
||||
lpEnd = _tcsstr(lpPos, pszDel);
|
||||
}
|
||||
|
||||
@@ -849,9 +849,9 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP
|
||||
lpTarget[COPY_LEN] = _T('\0');
|
||||
}
|
||||
|
||||
delete [] pszSeg;
|
||||
delete[] pszSeg;
|
||||
lpBuffer[dwCopied] = _T('\0');
|
||||
delete [] pszDel;
|
||||
delete[] pszDel;
|
||||
return dwCopied;
|
||||
}
|
||||
|
||||
@@ -876,7 +876,7 @@ BOOL CIni::ParseDNTString(LPCTSTR lpString, SUBSTRPROC lpFnStrProc, LPVOID lpPar
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Callback function used to compare elements inside of a
|
||||
// Callback function used to compare elements inside of a
|
||||
// "double null terminated string" with a given string. Useful for
|
||||
// searching in the section names list.
|
||||
BOOL CALLBACK CIni::__SubStrCompare(LPCTSTR lpString1, LPVOID lpParam)
|
||||
@@ -890,16 +890,16 @@ BOOL CALLBACK CIni::__SubStrCompare(LPCTSTR lpString1, LPVOID lpParam)
|
||||
|
||||
// Callback function used to process a key-pair, it extracts the
|
||||
// key name from the key-pair string
|
||||
BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
BOOL CALLBACK CIni::__KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
{
|
||||
STR_LIMIT* psl = (STR_LIMIT*)lpParam;
|
||||
if (lpString == NULL || psl== NULL)
|
||||
if (lpString == NULL || psl == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
||||
LPCTSTR p = _tcschr(lpString, _T('='));
|
||||
if (p == NULL || p == lpString)
|
||||
return TRUE;
|
||||
|
||||
|
||||
// extract the sub-string on left side of the '='
|
||||
LPTSTR psz = new TCHAR[_tcslen(lpString) + 1];
|
||||
int i = 0;
|
||||
@@ -911,14 +911,14 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
__TrimString(psz);
|
||||
DWORD dwNameLen = _tcslen(psz);
|
||||
DWORD dwCopyLen = 0;
|
||||
|
||||
|
||||
//copy to the buffer
|
||||
if (psl->lpTarget != NULL)
|
||||
{
|
||||
dwCopyLen = (psl->dwRemain > 1) ? min(dwNameLen, psl->dwRemain - 1) : 0;
|
||||
_tcsncpy(psl->lpTarget, psz, dwCopyLen);
|
||||
psl->lpTarget[dwCopyLen] = _T('\0');
|
||||
psl->lpTarget = &(psl->lpTarget[dwCopyLen + 1]);
|
||||
psl->lpTarget = &(psl->lpTarget[dwCopyLen + 1]);
|
||||
psl->dwRemain -= dwCopyLen + 1;
|
||||
}
|
||||
else
|
||||
@@ -926,13 +926,13 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
dwCopyLen = dwNameLen;
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psl->dwTotalCopied += dwCopyLen + 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
// Callback function used to add elements that are extracted from a
|
||||
// Callback function used to add elements that are extracted from a
|
||||
// "double null terminated string" to an MFC CStringArray.
|
||||
BOOL CALLBACK CIni::__SubStrAdd(LPCTSTR lpString, LPVOID lpParam)
|
||||
{
|
||||
@@ -950,8 +950,8 @@ void CIni::__ToBinaryString(UINT nNumber, LPTSTR lpBuffer, DWORD dwBufSize)
|
||||
{
|
||||
if (dwBufSize == 0)
|
||||
return;
|
||||
|
||||
DWORD dwIndex = 0;
|
||||
|
||||
DWORD dwIndex = 0;
|
||||
do
|
||||
{
|
||||
lpBuffer[dwIndex++] = (nNumber % 2) ? _T('1') : _T('0');
|
||||
@@ -993,7 +993,7 @@ void CIni::__IntToString(int nNumber, LPTSTR lpBuffer, int nBase)
|
||||
default:
|
||||
_stprintf(lpBuffer, _T("%d"), nNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert an unsigned integer into string representation, based on its base
|
||||
@@ -1016,7 +1016,7 @@ void CIni::__UIntToString(UINT nNumber, LPTSTR lpBuffer, int nBase)
|
||||
default:
|
||||
_stprintf(lpBuffer, _T("%u"), nNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CIni::StringToBool(LPCTSTR lpString, BOOL bDefault)
|
||||
@@ -1041,7 +1041,7 @@ BOOL CIni::__TrimString(LPTSTR lpString)
|
||||
int nLen = _tcslen(lpString);
|
||||
|
||||
// '\n' and '\r' are actually not possible in this case, but anyway...
|
||||
|
||||
|
||||
// Trim right side
|
||||
while (nLen > 0
|
||||
&& (lpString[nLen - 1] == _T(' ')
|
||||
@@ -1050,15 +1050,15 @@ BOOL CIni::__TrimString(LPTSTR lpString)
|
||||
|| lpString[nLen - 1] == _T('\n')))
|
||||
{
|
||||
lpString[--nLen] = _T('\0');
|
||||
bTrimmed = TRUE;
|
||||
bTrimmed = TRUE;
|
||||
}
|
||||
|
||||
// Trim left side
|
||||
LPCTSTR p = lpString;
|
||||
LPCTSTR p = lpString;
|
||||
while (*p == _T(' ')
|
||||
|| *p == _T('\t')
|
||||
|| *p == _T('\r')
|
||||
|| *p == _T('\n'))
|
||||
|| *p == _T('\t')
|
||||
|| *p == _T('\r')
|
||||
|| *p == _T('\n'))
|
||||
{
|
||||
p = &p[1];
|
||||
bTrimmed = TRUE;
|
||||
@@ -1068,7 +1068,7 @@ BOOL CIni::__TrimString(LPTSTR lpString)
|
||||
{
|
||||
LPTSTR psz = _tcsdup(p);
|
||||
_tcscpy(lpString, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
|
||||
return bTrimmed;
|
||||
|
@@ -11,4 +11,4 @@ std::wstring string_utils::string_to_wstring(const std::string& str) {
|
||||
MultiByteToWideChar(CP_ACP, 0, &str[0], static_cast<int>(str.size()), &wstrTo[0], sizeNeeded);
|
||||
|
||||
return wstrTo;
|
||||
}
|
||||
}
|
@@ -8,7 +8,6 @@
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
#include <d2tweaks/ui/ui_manager.h>
|
||||
|
||||
|
||||
#include <diablo2/structures/unit.h>
|
||||
#include <diablo2/structures/client_unit_list.h>
|
||||
#include <WinBase.h>
|
||||
@@ -45,12 +44,6 @@
|
||||
std::vector<StatEntry> globalStatsVector;
|
||||
diablo2::structures::gfxdata g_gfxdata; // global gfxdata
|
||||
|
||||
int randStat;
|
||||
int randStatRangeLow;
|
||||
int randStatRangeHigh;
|
||||
int randStatBool;
|
||||
|
||||
|
||||
std::wstring ConvertCharToWString(const std::string& charString) {
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
return converter.from_bytes(charString);
|
||||
@@ -99,8 +92,6 @@ diablo2::ui_color_t mapColorToEnum(const std::string& colorName) {
|
||||
return diablo2::ui_color_t::UI_COLOR_WHITE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Define a struct to hold key-value pairs within a section
|
||||
struct Section {
|
||||
std::map<std::string, std::string> assignments;
|
||||
@@ -166,6 +157,14 @@ void ParseIniFile(const std::string& iniFilePath) {
|
||||
else if (key == "item_type_id") {
|
||||
entry.item_type_id = std::stoi(value);
|
||||
}
|
||||
// add op and param
|
||||
else if (key == "op") {
|
||||
entry.op = std::stoi(value);
|
||||
}
|
||||
// add op and param
|
||||
else if (key == "param") {
|
||||
entry.param = std::stoi(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,8 +213,8 @@ __declspec (naked) void handle_cs_packet_wrapper() {
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call [d2_tweaks::client::client::handle_cs_packet]
|
||||
popfd;
|
||||
call[d2_tweaks::client::client::handle_cs_packet]
|
||||
popfd;
|
||||
popad;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
sub esp, 0x200;
|
||||
@@ -223,13 +222,12 @@ __declspec (naked) void handle_cs_packet_wrapper() {
|
||||
RET_TO_RVA(DLLBASE_D2CLIENT, 0xD856);
|
||||
}
|
||||
|
||||
|
||||
__declspec (naked) void handle_sc_standart_packet_wrapper() {
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call[d2_tweaks::client::client::handle_standart_packet]
|
||||
popfd;
|
||||
popfd;
|
||||
popad;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
sub esp, 0x54;
|
||||
@@ -239,7 +237,6 @@ __declspec (naked) void handle_sc_standart_packet_wrapper() {
|
||||
RET_TO_RVA(DLLBASE_D2CLIENT, 0x150B5);
|
||||
}
|
||||
|
||||
|
||||
static const DLLPatchStrc gpt_handle_cs_packet[] =
|
||||
{
|
||||
{D2DLL_D2CLIENT, 0xD850 + 0, PATCH_JMP, FALSE, 0x1},
|
||||
@@ -248,7 +245,6 @@ static const DLLPatchStrc gpt_handle_cs_packet[] =
|
||||
{D2DLL_INVALID}
|
||||
};
|
||||
|
||||
|
||||
static const DLLPatchStrc gpt_handle_sc_standart_packet[] =
|
||||
{
|
||||
{D2DLL_D2CLIENT, 0x150B0 + 0, PATCH_JMP, FALSE, 0x1},
|
||||
@@ -256,7 +252,6 @@ static const DLLPatchStrc gpt_handle_sc_standart_packet[] =
|
||||
{D2DLL_INVALID}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::client::init() {
|
||||
// handle packet <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> GamePacketReceivedIntercept
|
||||
hooking::hook(diablo2::d2_client::get_base() + 0x11CB0, handle_packet, reinterpret_cast<void**>(&g_handle_packet));
|
||||
@@ -272,23 +267,10 @@ void d2_tweaks::client::client::init() {
|
||||
if (m_module == nullptr)
|
||||
break;
|
||||
|
||||
//randStat = GetPrivateProfileIntA("RandStat", "stat", 0, lpIniFilePath);
|
||||
//randStatRangeLow = GetPrivateProfileIntA("RandStat", "statRangeLow", 0, lpIniFilePath);
|
||||
//randStatRangeHigh = GetPrivateProfileIntA("RandStat", "statRangeHigh", 0, lpIniFilePath);
|
||||
//randStatBool = GetPrivateProfileIntA("RandStat", "statBool", 0, lpIniFilePath);
|
||||
|
||||
//spdlog::info("randStat = {0}", randStat);
|
||||
//spdlog::info("randStatRangeLow = {0}", randStatRangeLow);
|
||||
//spdlog::info("randStatRangeHigh = {0}", randStatRangeHigh);
|
||||
|
||||
|
||||
|
||||
// Load and parse the INI file
|
||||
ParseIniFile(iniFilePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
D2TEMPLATE_ApplyPatch(gpt_handle_cs_packet);
|
||||
//D2TEMPLATE_ApplyPatch(gpt_handle_sc_standart_packet);
|
||||
|
||||
@@ -300,13 +282,12 @@ void d2_tweaks::client::client::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int32_t g_ebp_send_to_client;
|
||||
void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet, size_t size) {
|
||||
#ifndef NDEBUG
|
||||
__asm {
|
||||
push [ebp + 0x2C];
|
||||
pop [g_ebp_send_to_client];
|
||||
push[ebp + 0x2C];
|
||||
pop[g_ebp_send_to_client];
|
||||
}
|
||||
spdlog::warn("[d2client SEND] Packet {} Message {} Size {} CallFrom {}", (void*)packet->d2_packet_type, (void*)packet->message_type, size, (void*)g_ebp_send_to_client);
|
||||
#endif
|
||||
@@ -325,7 +306,6 @@ void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet,
|
||||
handler->handle_cs_packet(packet);
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::client::handle_standart_packet(common::packet_header* packet, size_t size) {
|
||||
if (size == -1)
|
||||
return;
|
||||
@@ -337,7 +317,6 @@ void d2_tweaks::client::client::handle_standart_packet(common::packet_header* pa
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::client::handle_packet(common::packet_header* packet, size_t size) {
|
||||
static common::packet_header dummy;
|
||||
static auto& instance = singleton<client>::instance();
|
||||
@@ -362,10 +341,8 @@ void d2_tweaks::client::client::handle_packet(common::packet_header* packet, siz
|
||||
handler->handle_packet(packet);
|
||||
}
|
||||
|
||||
|
||||
static bool g_is_init = false;
|
||||
void d2_tweaks::client::client::game_tick() {
|
||||
|
||||
static auto& instance = singleton<client>::instance(); /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> d2 gl
|
||||
|
||||
if (g_is_init == false) {
|
||||
@@ -380,7 +357,7 @@ void d2_tweaks::client::client::game_tick() {
|
||||
g_is_init = true;
|
||||
}
|
||||
|
||||
for (auto & tick_handler : instance.m_tick_handlers) {
|
||||
for (auto& tick_handler : instance.m_tick_handlers) {
|
||||
if (tick_handler == nullptr)
|
||||
break;
|
||||
|
||||
@@ -390,7 +367,6 @@ void d2_tweaks::client::client::game_tick() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int32_t d2_tweaks::client::client::draw_game_ui() {
|
||||
static auto& ui = singleton<ui::ui_manager>::instance();
|
||||
|
||||
@@ -401,8 +377,6 @@ int32_t d2_tweaks::client::client::draw_game_ui() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void d2_tweaks::client::client::register_module(modules::client_module* module) {
|
||||
m_modules[m_module_id_counter++] = module;
|
||||
}
|
||||
@@ -439,4 +413,4 @@ diablo2::structures::unit* d2_tweaks::client::client::get_client_unit(uint32_t t
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -67,12 +67,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::init_early() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::init() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
const char* pcIniFile = "\\d2tweaks.ini";
|
||||
@@ -89,7 +86,6 @@ void d2_tweaks::client::modules::auto_gold_pickup::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::tick() {
|
||||
const auto unit = diablo2::d2_client::get_local_player();
|
||||
|
||||
@@ -133,9 +129,8 @@ void d2_tweaks::client::modules::auto_gold_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::handle_packet(common::packet_header* packet) {
|
||||
const auto info = static_cast<common::gold_pickup_info_sc*>(packet);
|
||||
m_nLastUpdate = GetTickCount();
|
||||
m_nGoldValue += info->gold;
|
||||
}
|
||||
}
|
@@ -67,7 +67,6 @@ static char m_acPathToIni[MAX_PATH] = { 0 };
|
||||
static const char* m_pcIniFile = "\\d2tweaks.ini";
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::init_early() {
|
||||
|
||||
}
|
||||
|
||||
void ReloadFilters(char* szPathToIni) {
|
||||
@@ -120,7 +119,6 @@ void ReloadFilters(char* szPathToIni) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Parse ItemCode
|
||||
dwLenght = lstrlen(m_pcItemListAll);
|
||||
memcpy(m_pcItemListAllTemp, m_pcItemListAll, dwLenght + 1);
|
||||
@@ -196,7 +194,6 @@ void ReloadFilters(char* szPathToIni) {
|
||||
token_string_itemcode = strtok(NULL, " ,|");
|
||||
}
|
||||
|
||||
|
||||
/// Parse ItemType Code
|
||||
dwLenght = lstrlen(m_pcItemTypesAll);
|
||||
memcpy(m_pcItemTypesAllTemp, m_pcItemTypesAll, dwLenght + 1);
|
||||
@@ -272,7 +269,6 @@ void ReloadFilters(char* szPathToIni) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class auto_item_pickup_menu : public d2_tweaks::ui::menu {
|
||||
d2_tweaks::common::asset* m_buttons_img;
|
||||
d2_tweaks::ui::controls::button* m_auto_pickup_btn;
|
||||
@@ -304,7 +300,7 @@ public:
|
||||
//diablo2::d2_client::print_chat(L"AUTO TRANSMUTE OFF", 2);
|
||||
m_auto_pickup_btn->set_current_frame(6);
|
||||
}
|
||||
|
||||
|
||||
if (m_bToggleAutoItemPickup && m_bInventoryFull) {
|
||||
m_auto_pickup_btn->set_current_frame(7);
|
||||
}
|
||||
@@ -359,7 +355,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::init() {
|
||||
GetCurrentDirectory(MAX_PATH, m_acPathToIni);
|
||||
lstrcat(m_acPathToIni, m_pcIniFile);
|
||||
@@ -375,7 +370,6 @@ void d2_tweaks::client::modules::auto_item_pickup::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) {
|
||||
char data[0x18];
|
||||
|
||||
@@ -396,7 +390,6 @@ bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::u
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
static common::item_pickup_info_sc packet;
|
||||
const auto unit = diablo2::d2_client::get_local_player();
|
||||
@@ -476,7 +469,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (itemtype_record_equiv2) {
|
||||
if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
@@ -527,7 +519,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < m_nCountItemListAll; i++)
|
||||
{
|
||||
if (record->string_code[0] == m_stItemList[i].code0 &&
|
||||
@@ -560,7 +551,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::handle_packet(common::packet_header* packet) {
|
||||
const auto info = static_cast<common::item_pickup_info_sc*>(packet);
|
||||
|
||||
@@ -571,4 +561,4 @@ void d2_tweaks::client::modules::auto_item_pickup::handle_packet(common::packet_
|
||||
// g_tick_between_item_pickup = g_delay_between_item_pickup;
|
||||
//}
|
||||
//g_value += info->gold;
|
||||
}
|
||||
}
|
@@ -140,7 +140,6 @@ public:
|
||||
|
||||
ULONGLONG lastSendTime = GetTickCount64();
|
||||
|
||||
|
||||
// Function to split a string into words
|
||||
std::vector<std::string> split(const std::string& s, char delim) {
|
||||
std::stringstream ss(s);
|
||||
@@ -210,9 +209,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void draw() override {
|
||||
auto stats = globalStatsVector;
|
||||
int textOffset = 40; // Initial offset for the first line
|
||||
@@ -232,119 +228,72 @@ public:
|
||||
// Initialize statValue
|
||||
int32_t statValue = 0;
|
||||
|
||||
if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) {
|
||||
diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50);
|
||||
}
|
||||
//if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) {
|
||||
// diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50);
|
||||
//}
|
||||
|
||||
if (m_stats_enabled) {
|
||||
for (const auto& stat : stats) {
|
||||
double param = 6;
|
||||
int param = stat.param;
|
||||
int op = stat.op;
|
||||
|
||||
int32_t spirits = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(185), NULL);
|
||||
int32_t soulscaptured = statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(184), NULL);
|
||||
|
||||
switch (stat.stat) {
|
||||
// 2. (statValue <- this is probably op stat1 ? * baseValue <- this is probably op base ) / 2 ^ param
|
||||
auto statline = diablo2::d2_common::get_item_stat_cost_record(stat.stat);
|
||||
|
||||
// (op stat1 value * base stat value) / (2 ^ param)
|
||||
// let's try this fucking thing
|
||||
auto opBase = statline->wOpBase;
|
||||
auto opStat = statline->wOpStat[0];
|
||||
|
||||
case 190: {
|
||||
// str/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 191: {
|
||||
// dex/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 192: {
|
||||
// vit/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 193: {
|
||||
// enr/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 200: {
|
||||
// skills/souls
|
||||
param = 8;
|
||||
statValue = static_cast<int32_t>((1 * soulscaptured) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
auto opBaseValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(opBase), NULL);
|
||||
auto opStatValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(opStat), NULL);
|
||||
|
||||
case 301: {
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
if (record->type == 104) {
|
||||
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 304: {
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
if (record->type == 104) {
|
||||
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// By default, get player stats
|
||||
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
int32_t diablo2::d2_common::set_stat(structures::unit* unit, unit_stats_t stat, uint32_t value, int16_t param) {
|
||||
static wrap_func_std_import<int32_t(structures::unit*, int32_t, int32_t, int32_t)> set_stat(10517, get_base());
|
||||
return set_stat(unit, stat, value, param);
|
||||
}
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::uniform_int_distribution<> dis(randStatRangeLow, randStatRangeHigh);
|
||||
unsigned int randomNumber = dis(gen);
|
||||
|
||||
std::random_device rdb;
|
||||
std::mt19937 genb(rdb());
|
||||
std::uniform_int_distribution<> randBool(1, 2);
|
||||
unsigned int randomBool = randBool(genb) - 1;
|
||||
|
||||
if (stat.is_item_stat == 1) {
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
int RandStatValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(randStat), NULL);
|
||||
|
||||
if (record->type == stat.item_type_id && RandStatValue != 0) {
|
||||
// set randStat value to random number 1 and 2^(32) = 4294967296
|
||||
diablo2::d2_common::set_stat(item, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0);
|
||||
diablo2::d2_common::set_stat(item, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0);
|
||||
}
|
||||
if (stat.is_item_stat == 0) {
|
||||
int32_t statvalue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
int basevalue = 1;
|
||||
switch (op) {
|
||||
case 0:
|
||||
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
break;
|
||||
case 1: // Formula: opstatbasevalue * statvalue / 100
|
||||
statValue = static_cast<int32_t>(opBaseValue) / 100;
|
||||
break;
|
||||
case 2: // Formula: (statvalue * basevalue) / (2 ^ param)
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
|
||||
break;
|
||||
case 3: // Percentage-based version of op #2
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
case 4: // Item-based stat increase
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
|
||||
break;
|
||||
case 5: // Percentage-based item increase
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
case 11: // Similar to op #1 and #13
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
case 13:
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
default:
|
||||
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// set randStat value to random number 1 and 2^(32) = 4294967296
|
||||
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0);
|
||||
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0);
|
||||
|
||||
int statValue1 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStat), NULL);
|
||||
int statValue2 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), NULL);
|
||||
|
||||
if (statValue1 > 0 ) {
|
||||
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), 0, 0);
|
||||
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), 0, 0);
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
if (record->type == stat.item_type_id) {
|
||||
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// write code to get player name and display it using MessageBox
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
auto name = player->player_data->name;
|
||||
|
||||
auto statValueStr = std::to_wstring(statValue);
|
||||
std::wstring statText = std::wstring(stat.stat_display_string);// .append(L" " + statValueStr);
|
||||
|
||||
@@ -389,13 +338,9 @@ public:
|
||||
|
||||
// instead try to load direct jpg with gdi and insetad ofloading jpg file, specify it bb64 encoded and decode it.
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (m_help_enabled) {
|
||||
|
||||
const int windowWidth = 1280;
|
||||
const int windowHeight = 768;
|
||||
|
||||
@@ -410,14 +355,10 @@ public:
|
||||
// Draw filled background box
|
||||
diablo2::d2_gfx::draw_filled_rect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0, 255);
|
||||
|
||||
|
||||
// Draw justified text inside the box with padding
|
||||
drawJustifiedTextInBox(helpText, boxX, boxY, boxWidth, boxHeight, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
diablo2::ui_color_t::UI_COLOR_WHITE;
|
||||
|
||||
// print player health, mana, and stamina bars, lastexp, nextexp, and level
|
||||
@@ -540,15 +481,6 @@ public:
|
||||
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!should_draw()) {
|
||||
m_sort_inventory_btn->set_enabled(false);
|
||||
m_sort_inventory_btn->set_visible(false);
|
||||
|
@@ -12,4 +12,4 @@ void d2_tweaks::client::modules::client_module::tick() {}
|
||||
|
||||
void d2_tweaks::client::modules::client_module::handle_packet(common::packet_header* packet) {}
|
||||
|
||||
void d2_tweaks::client::modules::client_module::handle_cs_packet(common::packet_header* packet) {}
|
||||
void d2_tweaks::client::modules::client_module::handle_cs_packet(common::packet_header* packet) {}
|
@@ -48,7 +48,6 @@ struct damage_label {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static growing_object_pool<damage_label> g_label_pool([]() {
|
||||
return new damage_label();
|
||||
});
|
||||
@@ -99,12 +98,10 @@ static unsigned int g_font_player = 1;
|
||||
static unsigned int g_player_label_posx = 70;
|
||||
static unsigned int g_player_label_posy = 500;
|
||||
|
||||
|
||||
HWND findDiabloIIWindow() {
|
||||
return FindWindow(nullptr, TEXT("Diablo II")); // Change "Diablo II" to the exact title of the game window
|
||||
}
|
||||
|
||||
|
||||
// Function to draw the health bar using Windows GDI
|
||||
void drawHealthBar(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) {
|
||||
HDC hdc = GetDC(hWnd);
|
||||
@@ -139,15 +136,12 @@ void OnLoad() {
|
||||
}
|
||||
|
||||
static void onDraw(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) {
|
||||
|
||||
if (GetTickCount64() >= nEndTime) {
|
||||
nEndTime = GetTickCount64() + DURATION;
|
||||
}
|
||||
drawHealthBar(hWnd, x, y, maxWidth, height, healthPercentage, fillColor, outlineColor);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void draw_damage_labels() {
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
|
||||
@@ -272,18 +266,12 @@ static void draw_damage_labels() {
|
||||
const auto offset = static_cast<int32_t>(lerp(static_cast<float>(label->unit_height) + 5.f, static_cast<float>(label->unit_height) + 30.f, static_cast<float>(delta) / static_cast<float>(DISPLAY_TIME)));
|
||||
my -= offset;
|
||||
|
||||
|
||||
|
||||
|
||||
// Draw damage label
|
||||
std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" ";
|
||||
const wchar_t* dmgTextPtr = dmgText.c_str();
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_6);
|
||||
diablo2::d2_win::draw_text(const_cast<wchar_t*>(dmgTextPtr), textX + diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(combinedTextPtr)) / 2, my + label->unit_height / 2, textColor, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +297,6 @@ static diablo2::ui_color_t damage_type_to_color(d2_tweaks::common::damage_type_t
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::damage_display::init_early() {
|
||||
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::damage_display::init() {
|
||||
@@ -410,5 +397,4 @@ void d2_tweaks::client::modules::damage_display::handle_packet(common::packet_he
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::damage_display::tick() {
|
||||
|
||||
}
|
||||
}
|
@@ -28,7 +28,7 @@ struct message {
|
||||
char arr_itemtype_codestr_equivstr[20][5];
|
||||
|
||||
message(bool active, uint32_t hires_posx, uint32_t hires_posy, uint32_t lowres_posx, uint32_t lowres_posy, uint32_t quality)
|
||||
: active(active),
|
||||
: active(active),
|
||||
text_width(0), quality(quality) {
|
||||
start = 0;//GetTickCount();
|
||||
memset(item_text, 0x00, sizeof item_text);
|
||||
@@ -47,9 +47,9 @@ struct message {
|
||||
static uint32_t m_nMsgCount = 0;
|
||||
static message m_stMsg[32];
|
||||
|
||||
static wchar_t* m_apwcColorStr[17] = {L"ÿc0", L"ÿc1", L"ÿc2", L"ÿc3", L"ÿc4", L"ÿc5", L"ÿc6", L"ÿc7", L"ÿc8", L"ÿc9", L"ÿc:", L"ÿc;", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0" };
|
||||
static wchar_t* m_apwcQualityStr[10] = {L"", L"(Cracked)", L"(Normal)", L"(Superior)", L"(Magic)", L"(Set)", L"(Rare)", L"(Unique)", L"(Crafted)", L"(Tempered)"};
|
||||
static char* m_apcQualityStr[10] = {"", "(Cracked)", "(Normal)", "(Superior)", "(Magic)", "(Set)", "(Rare)", "(Unique)", "(Crafted)", "(Tempered)"};
|
||||
static wchar_t* m_apwcColorStr[17] = { L"ÿc0", L"ÿc1", L"ÿc2", L"ÿc3", L"ÿc4", L"ÿc5", L"ÿc6", L"ÿc7", L"ÿc8", L"ÿc9", L"ÿc:", L"ÿc;", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0" };
|
||||
static wchar_t* m_apwcQualityStr[10] = { L"", L"(Cracked)", L"(Normal)", L"(Superior)", L"(Magic)", L"(Set)", L"(Rare)", L"(Unique)", L"(Crafted)", L"(Tempered)" };
|
||||
static char* m_apcQualityStr[10] = { "", "(Cracked)", "(Normal)", "(Superior)", "(Magic)", "(Set)", "(Rare)", "(Unique)", "(Crafted)", "(Tempered)" };
|
||||
|
||||
static uint32_t m_nHookMethod = 1;
|
||||
static uint32_t m_anQualityColor[10] = { 0 };
|
||||
@@ -77,7 +77,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(uint8_t* packet, size_t size) {
|
||||
if (packet == 0 || size == 0)
|
||||
return;
|
||||
@@ -94,9 +93,8 @@ void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
__declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedInterceptASM() {
|
||||
__asm
|
||||
__asm
|
||||
{
|
||||
// call our function (__fastcall)
|
||||
pushad;
|
||||
@@ -107,16 +105,13 @@ __declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacke
|
||||
popfd;
|
||||
popad;
|
||||
|
||||
jmp [fn_GamePacketReceivedIntercept]
|
||||
jmp[fn_GamePacketReceivedIntercept]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::item_drop_message::init_early() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::item_drop_message::init() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
const char* pcIniFile = "\\d2tweaks.ini";
|
||||
@@ -156,7 +151,6 @@ void d2_tweaks::client::modules::item_drop_message::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet_header* packet) {
|
||||
const auto info = static_cast<common::item_pickup_info_sc*>(packet);
|
||||
const auto item_dropped_packet = static_cast<common::item_dropped_info_sc*>(packet);
|
||||
@@ -209,21 +203,21 @@ void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet
|
||||
mbstowcs(m_aawcItemtypeEquiv[8], m_stMsg[i].arr_itemtype_codestr_equivstr[9], 4);
|
||||
mbstowcs(m_aawcItemtypeEquiv[9], m_stMsg[i].arr_itemtype_codestr_equivstr[10], 4);
|
||||
|
||||
swprintf_s(buffer, L"%s ÿc0Code: %s Quality: %i %s Type: %s Equiv: %s %s %s %s %s %s %s %s %s %s",
|
||||
m_stMsg[i].item_text,
|
||||
m_awcCode,
|
||||
m_stMsg[i].quality,
|
||||
m_apwcQualityStr[m_stMsg[i].quality],
|
||||
swprintf_s(buffer, L"%s ÿc0Code: %s Quality: %i %s Type: %s Equiv: %s %s %s %s %s %s %s %s %s %s",
|
||||
m_stMsg[i].item_text,
|
||||
m_awcCode,
|
||||
m_stMsg[i].quality,
|
||||
m_apwcQualityStr[m_stMsg[i].quality],
|
||||
m_awcItemtypeCode,
|
||||
m_aawcItemtypeEquiv[0],
|
||||
m_aawcItemtypeEquiv[0],
|
||||
m_aawcItemtypeEquiv[1],
|
||||
m_aawcItemtypeEquiv[2],
|
||||
m_aawcItemtypeEquiv[2],
|
||||
m_aawcItemtypeEquiv[3],
|
||||
m_aawcItemtypeEquiv[4],
|
||||
m_aawcItemtypeEquiv[4],
|
||||
m_aawcItemtypeEquiv[5],
|
||||
m_aawcItemtypeEquiv[6],
|
||||
m_aawcItemtypeEquiv[6],
|
||||
m_aawcItemtypeEquiv[7],
|
||||
m_aawcItemtypeEquiv[8],
|
||||
m_aawcItemtypeEquiv[8],
|
||||
m_aawcItemtypeEquiv[9]);
|
||||
}
|
||||
|
||||
@@ -264,4 +258,4 @@ void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -121,10 +121,8 @@ int32_t __fastcall item_click(diablo2::structures::unit* owner, diablo2::structu
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::item_move::init_early() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::item_move::init() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
const char* pcIniFile = "\\d2tweaks.ini";
|
||||
@@ -138,7 +136,6 @@ void d2_tweaks::client::modules::item_move::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// handle packet coming from the server
|
||||
void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* packet) {
|
||||
static auto& instance = singleton<client>::instance();
|
||||
@@ -165,4 +162,4 @@ void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header*
|
||||
diablo2::d2_client::play_sound(itemRecord->drop_sound, nullptr, 0, 0, 0);
|
||||
else
|
||||
diablo2::d2_client::play_sound(4, nullptr, 0, 0, 0);
|
||||
}
|
||||
}
|
@@ -28,7 +28,6 @@ static HANDLE __fastcall delete_save_file(char* name, char* a2) {
|
||||
return g_delete_save_file_original(name, a2);
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter::init_early() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
const char* pcIniFile = "\\d2tweaks.ini";
|
||||
@@ -42,7 +41,6 @@ void d2_tweaks::client::modules::loot_filter::init_early() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter::init() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
const char* pcIniFile = "\\d2tweaks.ini";
|
||||
@@ -54,4 +52,4 @@ void d2_tweaks::client::modules::loot_filter::init() {
|
||||
singleton<ui::ui_manager>::instance().add_menu(&singleton<loot_filter_settings_menu>::instance());
|
||||
singleton<ui::ui_manager>::instance().add_menu(&singleton<loot_filter_settings_toggle_menu>::instance());
|
||||
}
|
||||
}
|
||||
}
|
@@ -82,5 +82,4 @@ void loot_filter_settings::remove(const char* name) {
|
||||
|
||||
std::filesystem::remove(buffer);
|
||||
memset(g_buffer, 0x00, sizeof g_buffer);
|
||||
}
|
||||
|
||||
}
|
@@ -56,25 +56,25 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_misc_checkb
|
||||
if (m_altonly) {
|
||||
m_altonly->set_state(loot_filter_settings::get().alt_only);
|
||||
m_altonly->set_on_click(std::bind(&loot_filter_settings_menu::update_alt_only,
|
||||
this, std::placeholders::_1));
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
if (m_show_gold) {
|
||||
m_show_gold->set_state(loot_filter_settings::get().show_gold);
|
||||
m_show_gold->set_on_click(std::bind(&loot_filter_settings_menu::update_show_gold,
|
||||
this, std::placeholders::_1));
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
if (m_show_runes) {
|
||||
m_show_runes->set_state(loot_filter_settings::get().show_runes);
|
||||
m_show_runes->set_on_click(std::bind(&loot_filter_settings_menu::update_show_runes,
|
||||
this, std::placeholders::_1));
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
if (m_show_gems) {
|
||||
m_show_gems->set_state(loot_filter_settings::get().show_gems);
|
||||
m_show_gems->set_on_click(std::bind(&loot_filter_settings_menu::update_show_gems,
|
||||
this, std::placeholders::_1));
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,13 +113,13 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::update_show_gems(boo
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_menu::update_quality_allowance(bool value,
|
||||
diablo2::structures::item_quality_t quality) {
|
||||
diablo2::structures::item_quality_t quality) {
|
||||
loot_filter_settings::get().quality_settings[static_cast<uint32_t>(quality)] = value;
|
||||
loot_filter_settings::get().save(diablo2::d2_client::get_local_player_name());
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_menu::register_quality_checkbox(const std::string& name,
|
||||
diablo2::structures::item_quality_t quality) {
|
||||
diablo2::structures::item_quality_t quality) {
|
||||
auto control = get_control<ui::controls::checkbox>(name);
|
||||
|
||||
if (!control)
|
||||
@@ -127,7 +127,7 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_quality_che
|
||||
|
||||
control->set_state(loot_filter_settings::get().quality_settings[static_cast<size_t>(quality)]);
|
||||
control->set_on_click(std::bind(&loot_filter_settings_menu::update_quality_allowance,
|
||||
this, std::placeholders::_1, quality));
|
||||
this, std::placeholders::_1, quality));
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_menu::setup_hooks() {
|
||||
@@ -148,7 +148,7 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::setup_alt_hook() con
|
||||
asm_code asmCode;
|
||||
asmCode.add({ 0x83, 0x7D, 0x00, 0x04 }); //cmp dword ptr [ebp+0], 4
|
||||
asmCode.add({ 0x0F, 0x85 },
|
||||
new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //jnz D2Client.dll+6A399
|
||||
new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //jnz D2Client.dll+6A399
|
||||
|
||||
asmCode.add({ 0x56 }); //push esi
|
||||
asmCode.add({ 0xB8 }, new asm_address_static(1, check_alt_item)); //mov eax, check_alt_item
|
||||
@@ -158,9 +158,9 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::setup_alt_hook() con
|
||||
|
||||
asmCode.add({ 0x84, 0xC0 }); //test al, al
|
||||
asmCode.add({ 0x0F, 0x84 },
|
||||
new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //je D2Client.dll+6A399
|
||||
new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //je D2Client.dll+6A399
|
||||
asmCode.add({ 0xE9 },
|
||||
new asm_address_relative(1, 5, diablo2::d2_client::get_base() + 0x6A027)); //jmp D2Client.dll+6A027
|
||||
new asm_address_relative(1, 5, diablo2::d2_client::get_base() + 0x6A027)); //jmp D2Client.dll+6A027
|
||||
|
||||
auto addr = diablo2::d2_client::get_base() + 0x6A022;
|
||||
|
||||
@@ -283,7 +283,7 @@ bool d2_tweaks::client::modules::loot_filter_settings_menu::check_alt_item(diabl
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_menu::draw_dropped_items_names(diablo2::structures::unit* unit,
|
||||
void* edx) {
|
||||
void* edx) {
|
||||
static auto& instance = singleton<loot_filter_settings_menu>::instance();
|
||||
|
||||
if (!unit || unit->type != diablo2::structures::unit_type_t::UNIT_TYPE_ITEM) {
|
||||
@@ -315,7 +315,7 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::draw_dropped_items_n
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_menu::handle_dropped_items(diablo2::structures::unit* unit,
|
||||
void* edx) {
|
||||
void* edx) {
|
||||
static auto& instance = singleton<loot_filter_settings_menu>::instance();
|
||||
|
||||
if (!unit || unit->type != diablo2::structures::unit_type_t::UNIT_TYPE_ITEM) {
|
||||
@@ -344,4 +344,4 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::handle_dropped_items
|
||||
return;
|
||||
|
||||
instance.m_handle_dropped_items_original(unit, edx);
|
||||
}
|
||||
}
|
@@ -9,7 +9,6 @@
|
||||
#include <DllNotify.h>
|
||||
#include <D2Template.h>
|
||||
|
||||
|
||||
#include <diablo2/d2gfx.h>
|
||||
|
||||
#include <string>
|
||||
@@ -98,10 +97,10 @@
|
||||
#pragma pack(push, 1)
|
||||
|
||||
using namespace d2_tweaks::client::modules;
|
||||
bool m_stats_enabled = false;
|
||||
bool m_stats_enabled = true;
|
||||
bool m_help_enabled = false;
|
||||
bool m_cube_enabled = false;
|
||||
bool m_stash_enabled = false;
|
||||
bool m_stash_enabled = true;
|
||||
|
||||
d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settings_toggle_menu(token) {
|
||||
m_show = false;
|
||||
@@ -124,13 +123,11 @@ d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settin
|
||||
|
||||
m_filter_settings_menu = singleton<ui::ui_manager>::instance().get_menu("loot_filter_settings_menu");
|
||||
|
||||
|
||||
m_btn_toggle_stats = static_cast<ui::controls::button*>(get_control("m_toggle_stats"));
|
||||
m_btn_toggle_stats->set_enabled(true);
|
||||
m_btn_toggle_stats->set_visible(true);
|
||||
m_btn_toggle_stats->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stats_settings_click, this));
|
||||
|
||||
|
||||
m_btn_toggle_help = static_cast<ui::controls::button*>(get_control("m_toggle_help"));
|
||||
m_btn_toggle_help->set_enabled(true);
|
||||
m_btn_toggle_help->set_visible(true);
|
||||
@@ -142,21 +139,25 @@ d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settin
|
||||
m_btn_toggle_cube->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_cube_click, this));
|
||||
|
||||
m_btn_toggle_stash = static_cast<ui::controls::button*>(get_control("m_toggle_stash"));
|
||||
m_btn_toggle_stash->set_enabled(false);
|
||||
m_btn_toggle_stash->set_visible(false);
|
||||
auto player = diablo2::d2_client::get_local_player();
|
||||
//iterate over all items in player inventory
|
||||
for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
char* normCode1 = record->string_code;
|
||||
if (strncmp(normCode1, "st0", 3) == 0) {
|
||||
m_btn_toggle_stash->set_enabled(true);
|
||||
m_btn_toggle_stash->set_visible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_btn_toggle_stash->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stash_click, this));
|
||||
|
||||
m_btn_toggle_stash->set_enabled(true);
|
||||
m_btn_toggle_stash->set_visible(true);
|
||||
//auto player = diablo2::d2_client::get_local_player();
|
||||
////iterate over all items in player inventory
|
||||
//for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
|
||||
// const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
// char* normCode1 = record->string_code;
|
||||
// if (strncmp(normCode1, "st0", 3) == 0) {
|
||||
// m_btn_toggle_stash->set_enabled(true);
|
||||
// m_btn_toggle_stash->set_visible(true);
|
||||
// break;
|
||||
// }
|
||||
// else {
|
||||
// m_btn_toggle_stash->set_enabled(false);
|
||||
// m_btn_toggle_stash->set_visible(false);
|
||||
// }
|
||||
//}
|
||||
m_btn_toggle_stash->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stash_click, this));
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_filter_settings_click() {
|
||||
@@ -173,7 +174,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stats_
|
||||
m_stats_enabled = !m_stats_enabled;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_click() {
|
||||
m_cube_enabled = !m_cube_enabled;
|
||||
if (m_cube_enabled) {
|
||||
@@ -197,7 +197,7 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_c
|
||||
//uint8_t MsgID; // 0x02
|
||||
uint32_t guid; // 0x06
|
||||
uint32_t tx; // 0x07
|
||||
uint32_t ty; // 0x09
|
||||
uint32_t ty; // 0x09
|
||||
};
|
||||
D2GSPacketClt20 packet;
|
||||
packet.PacketId = 0x20;
|
||||
@@ -211,11 +211,8 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_c
|
||||
// send to server7 to close cube packet 0x4F
|
||||
diablo2::d2_client::send_to_server_7(0x4F, 0x17, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_click() {
|
||||
|
||||
m_stash_enabled = !m_stash_enabled;
|
||||
if (m_stash_enabled) {
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
@@ -237,7 +234,7 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_
|
||||
uint8_t PacketId; // 0x01
|
||||
uint32_t guid; // 0x06
|
||||
uint32_t tx; // 0x07
|
||||
uint32_t ty; // 0x09
|
||||
uint32_t ty; // 0x09
|
||||
};
|
||||
D2GSPacketClt20 packet;
|
||||
packet.PacketId = 0x20;
|
||||
@@ -247,16 +244,14 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_
|
||||
diablo2::d2_client::send_to_server(&packet, sizeof packet);
|
||||
}
|
||||
else {
|
||||
|
||||
//run a for loop and send th set_ui_toggle packet 255 times from 1 to 255
|
||||
diablo2::d2_client::set_ui_toggle(0x19, 1, FALSE);
|
||||
|
||||
|
||||
// send to server7 to close cube packet 0x4F
|
||||
diablo2::d2_client::send_to_server_7(0x4F, 0x17, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_help_click() {
|
||||
//m_help_enabled = !m_help_enabled;
|
||||
// Open the default OS browser to the URL
|
||||
@@ -271,7 +266,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_help_c
|
||||
// Unsupported platform
|
||||
// You can add handling for other platforms here
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::draw() {
|
||||
|
@@ -39,4 +39,4 @@ void d2_tweaks::client::modules::small_patches::init() {
|
||||
// //Window auto-hiding on focus loss
|
||||
// hooking::hook<10026>(diablo2::d2_gfx::get_base(), is_iconic, &g_is_iconic_original);
|
||||
//}
|
||||
}
|
||||
}
|
@@ -61,7 +61,6 @@ private:
|
||||
static test_menu* g_test_menu;
|
||||
|
||||
void d2_tweaks::client::modules::test::init_early() {
|
||||
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::test::init() {
|
||||
|
@@ -48,7 +48,6 @@ enum trader_command {
|
||||
COMMAND_ABORT
|
||||
};
|
||||
|
||||
|
||||
class trader_update_menu : public d2_tweaks::ui::menu {
|
||||
d2_tweaks::common::asset* m_buttons_img;
|
||||
d2_tweaks::ui::controls::button* m_trader_update_btn;
|
||||
@@ -98,7 +97,7 @@ private:
|
||||
|
||||
void trader_update_click() {
|
||||
const auto unit = diablo2::d2_client::get_local_player();
|
||||
|
||||
|
||||
static d2_tweaks::common::trader_update_cs request_packet_cs;
|
||||
request_packet_cs.client_id = unit->guid;
|
||||
request_packet_cs.npc_id = diablo2::d2_client::current_vendor_guid();
|
||||
@@ -116,12 +115,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::trader_update::init_early() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::trader_update::init() {
|
||||
char szDir[MAX_PATH];
|
||||
char szPath[MAX_PATH];
|
||||
@@ -139,28 +135,25 @@ void d2_tweaks::client::modules::trader_update::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::trader_update::tick() {
|
||||
// const auto unit = diablo2::d2_client::get_local_player();
|
||||
// const auto unit = diablo2::d2_client::get_local_player();
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::trader_update::handle_cs_packet(common::packet_header* packet) {
|
||||
static auto& instance = singleton<client>::instance();
|
||||
const auto income_packet_cs = static_cast<common::d2_entity_action_cs*>(packet);
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
spdlog::debug("[D2CLIENT C > S] ENTITY ACTION! message {} action {} entity_id {} complement {}", (uint8_t) income_packet_cs->message_type, (void*)(income_packet_cs->action >> 24), (void*)(income_packet_cs->entity_id >> 24), (void*)income_packet_cs->complement);
|
||||
spdlog::debug("[D2CLIENT C > S] ENTITY ACTION! message {} action {} entity_id {} complement {}", (uint8_t)income_packet_cs->message_type, (void*)(income_packet_cs->action >> 24), (void*)(income_packet_cs->entity_id >> 24), (void*)income_packet_cs->complement);
|
||||
#endif
|
||||
m_nMenuOpen = (uint8_t)income_packet_cs->message_type; // 1 = trade, 2 = gamble
|
||||
m_nNpcId = (income_packet_cs->action >> 24);
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_header* packet) {
|
||||
static auto& instance = singleton<client>::instance();
|
||||
const auto income_packet_sc = static_cast<common::trader_update_sc*>(packet);
|
||||
|
||||
|
||||
if (!diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_NPCSHOP))
|
||||
return;
|
||||
|
||||
@@ -200,5 +193,4 @@ void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_hea
|
||||
diablo2::d2_client::send_to_server(&request_packet_cs, sizeof request_packet_cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -149,7 +149,7 @@ private:
|
||||
//request_packet_cs.transmute_start_flag = m_bToggleTransmute;
|
||||
//request_packet_cs.command = COMMAND_TRANSMUTE_START;
|
||||
//diablo2::d2_client::send_to_server(&request_packet_cs, sizeof request_packet_cs);
|
||||
|
||||
|
||||
if (m_bToggleTransmute) {
|
||||
diablo2::d2_client::print_chat(L"AUTO TRANSMUTE ON", 1);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ void __fastcall hook_play_sound(uint32_t soundId, uint32_t* unit, const uint32_t
|
||||
return;
|
||||
}
|
||||
|
||||
void __stdcall hook_game_end () {
|
||||
void __stdcall hook_game_end() {
|
||||
m_game_init_done = false;
|
||||
m_bToggleTransmute = false;
|
||||
return;
|
||||
@@ -184,12 +184,11 @@ __declspec (naked) void hook_game_end_asm() {
|
||||
popfd;
|
||||
popad;
|
||||
|
||||
jmp [fn_hook_game_end];
|
||||
jmp[fn_hook_game_end];
|
||||
}
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::transmute::init_early() {
|
||||
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::transmute::init() {
|
||||
@@ -229,8 +228,8 @@ void d2_tweaks::client::modules::transmute::init() {
|
||||
sprintf_s(m_acBuffer, sizeof(m_acBuffer), "ItemList%d", i + 1);
|
||||
dwLenght = config.GetString("AutoTransmute", m_acBuffer, m_aacItemList[i], MAX_STRING_LENGHT - 1);
|
||||
if (dwLenght != 0) {
|
||||
lstrcat(m_acItemListAll, m_aacItemList[i]);
|
||||
lstrcat(m_acItemListAll, "|");
|
||||
lstrcat(m_acItemListAll, m_aacItemList[i]);
|
||||
lstrcat(m_acItemListAll, "|");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,12 +237,12 @@ void d2_tweaks::client::modules::transmute::init() {
|
||||
sprintf_s(m_acBuffer, sizeof(m_acBuffer), "ItemTypeList%d", i + 1);
|
||||
dwLenght = config.GetString("AutoTransmute", m_acBuffer, m_aacItemTypes[i], MAX_STRING_LENGHT - 1);
|
||||
if (dwLenght != 0) {
|
||||
lstrcat(m_acItemTypesAll, m_aacItemTypes[i]);
|
||||
lstrcat(m_acItemTypesAll, m_aacItemTypes[i]);
|
||||
lstrcat(m_acItemTypesAll, "|");
|
||||
}
|
||||
}
|
||||
|
||||
/////// Parse ItemCode
|
||||
/////// Parse ItemCode
|
||||
dwLenght = lstrlen(m_acItemListAll);
|
||||
memcpy(m_acItemListAllTemp, m_acItemListAll, dwLenght + 1);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -316,8 +315,7 @@ void d2_tweaks::client::modules::transmute::init() {
|
||||
token_string_itemcode = strtok(NULL, " ,|");
|
||||
}
|
||||
|
||||
|
||||
/////// Parse ItemType
|
||||
/////// Parse ItemType
|
||||
dwLenght = lstrlen(m_acItemTypesAll);
|
||||
memcpy(m_acItemTypesAllTemp, m_acItemTypesAll, dwLenght + 1);
|
||||
char* token_string_itemtype_code = strtok(m_acItemTypesAllTemp, ",|");
|
||||
@@ -394,7 +392,7 @@ void d2_tweaks::client::modules::transmute::init() {
|
||||
if (m_nTransmuteSound == false) {
|
||||
hooking::hook(diablo2::d2_client::get_base() + 0xB5820, hook_play_sound, reinterpret_cast<void**>(&fn_hook_play_sound));
|
||||
}
|
||||
|
||||
|
||||
hooking::hook(diablo2::d2_client::get_base() + 0xB528, hook_game_end_asm, reinterpret_cast<void**>(&fn_hook_game_end));
|
||||
|
||||
singleton<ui::ui_manager>::instance().add_menu(new auto_transmute_menu());
|
||||
@@ -403,7 +401,6 @@ void d2_tweaks::client::modules::transmute::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::transmute::tick() {
|
||||
const auto unit = diablo2::d2_client::get_local_player();
|
||||
|
||||
@@ -412,7 +409,7 @@ void d2_tweaks::client::modules::transmute::tick() {
|
||||
m_bToggleTransmute = false;
|
||||
}
|
||||
|
||||
if (!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if (unit->type != diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER)
|
||||
@@ -421,7 +418,7 @@ void d2_tweaks::client::modules::transmute::tick() {
|
||||
if (!m_bToggleTransmute)
|
||||
return;
|
||||
|
||||
if (m_nCountFrames > m_nDelayFrames)
|
||||
if (m_nCountFrames > m_nDelayFrames)
|
||||
{
|
||||
m_nCountFrames = 0;
|
||||
|
||||
@@ -449,7 +446,7 @@ void d2_tweaks::client::modules::transmute::tick() {
|
||||
// index second code in array
|
||||
uint32_t index_arr_itemtype = 1;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
if (itemtype_record_equiv1) {
|
||||
if (*(DWORD*)itemtype_record_equiv1->code != 0x20202020) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
@@ -529,7 +526,6 @@ L1:;
|
||||
m_nCountFrames++;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::transmute::handle_packet(common::packet_header* packet) {
|
||||
static auto& instance = singleton<client>::instance();
|
||||
const auto income_packet_sc = static_cast<common::transmute_info_sc*>(packet);
|
||||
@@ -554,12 +550,12 @@ void d2_tweaks::client::modules::transmute::handle_packet(common::packet_header*
|
||||
// send 'transmute' command
|
||||
request_packet_cs.command = COMMAND_CALL_TRANSMUTE;
|
||||
diablo2::d2_client::send_to_server(&request_packet_cs, sizeof request_packet_cs);
|
||||
|
||||
|
||||
//diablo2::d2_client::send_to_server_7(0x4F, 0x18, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
if (income_packet_sc->command == COMMAND_ABORT) {
|
||||
m_bToggleTransmute = false;
|
||||
diablo2::d2_client::print_chat(L"WRONG RECIPE, AUTO TRANSMUTE OFF", 2);
|
||||
diablo2::d2_client::print_chat(L"WRONG RECIPE, AUTO TRANSMUTE OFF", 2);
|
||||
}
|
||||
}
|
||||
}
|
@@ -71,9 +71,9 @@ d2_tweaks::common::asset* d2_tweaks::common::asset_manager::get_mpq_file(const s
|
||||
|
||||
void* d2_tweaks::common::asset_manager::load_asset_data(const std::string& path, mpq_file_type_t type) {
|
||||
switch (type) {
|
||||
case MPQ_FILE_TYPE_DC6:
|
||||
return diablo2::d2_client::load_gfx_resource(const_cast<char*>(path.c_str()));
|
||||
default:
|
||||
return nullptr;
|
||||
case MPQ_FILE_TYPE_DC6:
|
||||
return diablo2::d2_client::load_gfx_resource(const_cast<char*>(path.c_str()));
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,8 +18,8 @@ static int32_t g_ebp_send_to_server;
|
||||
static int32_t g_ebp_send_to_client;
|
||||
static int32_t __stdcall net_send_to_server(int32_t queue, d2_tweaks::common::packet_header* packet, size_t size) {
|
||||
__asm {
|
||||
push [ebp + 4]
|
||||
pop [g_ebp_send_to_server]
|
||||
push[ebp + 4]
|
||||
pop[g_ebp_send_to_server]
|
||||
}
|
||||
|
||||
spdlog::debug("[d2net SEND C >>> S] Queue {} Packet {} Size {} CallFrom {}", queue, (void*)packet->d2_packet_type, size, (void*)g_ebp_send_to_server);
|
||||
@@ -29,8 +29,8 @@ static int32_t __stdcall net_send_to_server(int32_t queue, d2_tweaks::common::pa
|
||||
|
||||
static int32_t __stdcall net_send_to_client(int32_t queue, int32_t clientId, d2_tweaks::common::packet_header* packet, size_t size) {
|
||||
__asm {
|
||||
push [ebp+4]
|
||||
pop [g_ebp_send_to_client]
|
||||
push[ebp + 4]
|
||||
pop[g_ebp_send_to_client]
|
||||
}
|
||||
|
||||
spdlog::error("[d2net SEND S >>> C] Queue {} Packet {} Size {} ClientID {} CallFrom {}", queue, (void*)packet->d2_packet_type, size, clientId, (void*)g_ebp_send_to_client);
|
||||
@@ -88,94 +88,94 @@ void d2_tweaks::common::common::init() {
|
||||
|
||||
bool d2_tweaks::common::common::get_packet_size_cs(packet_header* packet, size_t& size) {
|
||||
switch (packet->message_type) {
|
||||
case MESSAGE_TYPE_ITEM_MOVE:
|
||||
{
|
||||
size = sizeof item_move_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_INVENTORY_SORT:
|
||||
{
|
||||
size = sizeof inventory_sort_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_DAMAGE_INFO:
|
||||
{
|
||||
size = sizeof damage_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_GOLD_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof gold_pickup_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof item_pickup_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_DROPPED_INFO:
|
||||
{
|
||||
size = sizeof item_dropped_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRANSMUTE:
|
||||
{
|
||||
size = sizeof transmute_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRADER_UPDATE:
|
||||
{
|
||||
size = sizeof trader_update_cs;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
case MESSAGE_TYPE_ITEM_MOVE:
|
||||
{
|
||||
size = sizeof item_move_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_INVENTORY_SORT:
|
||||
{
|
||||
size = sizeof inventory_sort_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_DAMAGE_INFO:
|
||||
{
|
||||
size = sizeof damage_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_GOLD_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof gold_pickup_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof item_pickup_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_DROPPED_INFO:
|
||||
{
|
||||
size = sizeof item_dropped_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRANSMUTE:
|
||||
{
|
||||
size = sizeof transmute_info_cs;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRADER_UPDATE:
|
||||
{
|
||||
size = sizeof trader_update_cs;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool d2_tweaks::common::common::get_packet_size_sc(packet_header* packet, size_t& size) {
|
||||
switch (packet->message_type) {
|
||||
case MESSAGE_TYPE_ITEM_MOVE:
|
||||
{
|
||||
size = sizeof item_move_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_INVENTORY_SORT:
|
||||
{
|
||||
size = sizeof inventory_sort_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_DAMAGE_INFO:
|
||||
{
|
||||
size = sizeof damage_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_GOLD_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof gold_pickup_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof item_pickup_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_DROPPED_INFO:
|
||||
{
|
||||
size = sizeof item_dropped_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRANSMUTE:
|
||||
{
|
||||
size = sizeof transmute_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRADER_UPDATE:
|
||||
{
|
||||
size = sizeof trader_update_sc;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
case MESSAGE_TYPE_ITEM_MOVE:
|
||||
{
|
||||
size = sizeof item_move_sc;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
case MESSAGE_TYPE_INVENTORY_SORT:
|
||||
{
|
||||
size = sizeof inventory_sort_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_DAMAGE_INFO:
|
||||
{
|
||||
size = sizeof damage_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_GOLD_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof gold_pickup_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_PICKUP_INFO:
|
||||
{
|
||||
size = sizeof item_pickup_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_ITEM_DROPPED_INFO:
|
||||
{
|
||||
size = sizeof item_dropped_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRANSMUTE:
|
||||
{
|
||||
size = sizeof transmute_info_sc;
|
||||
return true;
|
||||
}
|
||||
case MESSAGE_TYPE_TRADER_UPDATE:
|
||||
{
|
||||
size = sizeof trader_update_sc;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -25,7 +25,6 @@ void d2_tweaks::server::modules::auto_gold_pickup::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::auto_gold_pickup::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
const auto income_packet_cs = static_cast<common::gold_pickup_info_cs*>(packet);
|
||||
static auto& instance = singleton<server>::instance();
|
||||
@@ -39,7 +38,6 @@ bool d2_tweaks::server::modules::auto_gold_pickup::handle_packet(diablo2::struct
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::auto_gold_pickup::au_pickup_gold(diablo2::structures::game* game, diablo2::structures::unit* unit, diablo2::structures::unit* item)
|
||||
{
|
||||
static common::gold_pickup_info_sc packet;
|
||||
@@ -58,9 +56,8 @@ bool d2_tweaks::server::modules::auto_gold_pickup::au_pickup_gold(diablo2::struc
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* unit) {
|
||||
diablo2::structures::unit* unit) {
|
||||
//static common::gold_pickup_info_sc packet;
|
||||
//static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
//if (!game || !unit)
|
||||
@@ -101,5 +98,4 @@ void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::gam
|
||||
|
||||
// continue;
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
@@ -30,7 +30,7 @@ void d2_tweaks::server::modules::auto_item_pickup::init() {
|
||||
}
|
||||
|
||||
void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* unit) {
|
||||
diablo2::structures::unit* unit) {
|
||||
//static common::item_pickup_info_sc packet;
|
||||
//static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
//if (!game || !unit)
|
||||
@@ -44,7 +44,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
|
||||
//if (!room)
|
||||
// return;
|
||||
|
||||
|
||||
//for (auto item = room->unit; item; item = item->prev_unit_in_room) {
|
||||
// if (!item)
|
||||
// continue;
|
||||
@@ -92,7 +91,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// if (itemtype_record_equiv2) {
|
||||
// if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) {
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
@@ -110,7 +108,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// for (uint32_t i = 0; i < g_pickup_count_itemtype_code; i++)
|
||||
// {
|
||||
// for (uint32_t count = 0; count < index_arr_itemtype; count++)
|
||||
@@ -126,7 +123,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// for (uint32_t i = 0; i < g_pickup_count_all_items; i++)
|
||||
// {
|
||||
// if (record->string_code[0] == g_pickup_itemcode_st[i].code0 &&
|
||||
@@ -148,7 +144,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
|
||||
////spdlog::info("current {0}", g_tick_between_item_pickup);
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::structures::game* game, diablo2::structures::unit* unit, uint32_t guid)
|
||||
{
|
||||
static common::item_pickup_info_sc packet;
|
||||
@@ -156,17 +151,16 @@ bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::struc
|
||||
uint32_t ptrNull = 0;
|
||||
//if (g_tick_between_item_pickup >= 25) {
|
||||
// true - if item picked up, false - if inventory full
|
||||
if (diablo2::d2_game::pickup_item(game, unit, guid, &ptrNull) != true)
|
||||
{
|
||||
//packet.inventory_full = true;
|
||||
//singleton<server>::instance().send_packet(unit->player_data->net_client, &packet, sizeof packet);
|
||||
}
|
||||
if (diablo2::d2_game::pickup_item(game, unit, guid, &ptrNull) != true)
|
||||
{
|
||||
//packet.inventory_full = true;
|
||||
//singleton<server>::instance().send_packet(unit->player_data->net_client, &packet, sizeof packet);
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::auto_item_pickup::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
const auto income_packet_cs = static_cast<common::item_pickup_info_cs*>(packet);
|
||||
static auto& instance = singleton<server>::instance();
|
||||
|
@@ -36,17 +36,17 @@ struct packed_area {
|
||||
uint8_t h;
|
||||
};
|
||||
|
||||
// Define the inventory zone
|
||||
int iminValidX = 0;
|
||||
int imaxValidX = 15;
|
||||
int iminValidY = 0;
|
||||
int imaxValidY = 12;
|
||||
// Define variables to store the inventory zone values
|
||||
int iminValidX = GetPrivateProfileInt("InventoryZone", "iminValidX", 0, "./D2Tweaks.ini");
|
||||
int imaxValidX = GetPrivateProfileInt("InventoryZone", "imaxValidX", 0, "./D2Tweaks.ini");
|
||||
int iminValidY = GetPrivateProfileInt("InventoryZone", "iminValidY", 0, "./D2Tweaks.ini");
|
||||
int imaxValidY = GetPrivateProfileInt("InventoryZone", "imaxValidY", 0, "./D2Tweaks.ini");
|
||||
|
||||
// Define the charm zone
|
||||
int cminValidX = 0;
|
||||
int cmaxValidX = 15;
|
||||
int cminValidY = 12;
|
||||
int cmaxValidY = 15;
|
||||
// Define variables to store the charm zone values
|
||||
int cminValidX = GetPrivateProfileInt("CharmZone", "cminValidX", 0, "./D2Tweaks.ini");
|
||||
int cmaxValidX = GetPrivateProfileInt("CharmZone", "cmaxValidX", 0, "./D2Tweaks.ini");
|
||||
int cminValidY = GetPrivateProfileInt("CharmZone", "cminValidY", 0, "./D2Tweaks.ini");
|
||||
int cmaxValidY = GetPrivateProfileInt("CharmZone", "cmaxValidY", 0, "./D2Tweaks.ini");
|
||||
|
||||
void d2_tweaks::server::modules::autosort::init() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
@@ -61,8 +61,7 @@ void d2_tweaks::server::modules::autosort::init() {
|
||||
}
|
||||
|
||||
bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
if (static_cast<common::inventory_sort_cs*>(packet)->remItem == 1) {
|
||||
diablo2::d2_common::inv_remove_item(player->inventory, static_cast<common::inventory_sort_cs*>(packet)->item_to_remove);
|
||||
diablo2::d2_game::update_inventory_items(game, player);
|
||||
@@ -71,12 +70,9 @@ bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::ga
|
||||
|
||||
for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
|
||||
if (item == static_cast<common::inventory_sort_cs*>(packet)->item_to_remove) {
|
||||
|
||||
diablo2::d2_common::inv_remove_item(player->inventory, item);
|
||||
diablo2::d2_game::update_inventory_items(game, player);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
MessageBoxA(NULL, "Item removed", "Item removed", MB_OK);
|
||||
@@ -148,7 +144,7 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game,
|
||||
spdlog::info("is_charm: {0}\n\n", is_charm);
|
||||
}
|
||||
|
||||
if (occupied_cells > inventoryHeight* inventoryWidth) {
|
||||
if (occupied_cells > inventoryHeight * inventoryWidth) {
|
||||
//should never be happen in normal cases
|
||||
spdlog::warn("occupied_cells > inventoryHeight* inventoryWidth");
|
||||
return false;
|
||||
@@ -163,11 +159,9 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game,
|
||||
const auto itemsCount = items.size();
|
||||
const auto charmsCount = charms.size();
|
||||
|
||||
|
||||
if (itemsCount == 0)
|
||||
return true; //there's nothing to sort
|
||||
|
||||
|
||||
auto success = NULL;
|
||||
|
||||
if (itemsCount > 0) {
|
||||
@@ -219,7 +213,6 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game,
|
||||
|
||||
items_typed.erase(sorted_item->data_record_index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (charmsCount > 0) {
|
||||
@@ -365,7 +358,8 @@ bool d2_tweaks::server::modules::autosort::find_free_space(diablo2::structures::
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (x = minValidX; x <= maxValidX - record->inv_width + 1; x++) {
|
||||
for (y = minValidY; y <= inventoryMaxValidY - record->inv_height + 1; y++) {
|
||||
diablo2::structures::unit* blockingUnit = nullptr;
|
||||
@@ -378,4 +372,4 @@ bool d2_tweaks::server::modules::autosort::find_free_space(diablo2::structures::
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -14,14 +14,13 @@
|
||||
|
||||
#include <diablo2/structures/data/monstats_line.h>
|
||||
|
||||
|
||||
MODULE_INIT(damage_display)
|
||||
|
||||
static char(__fastcall* g_apply_attack_results_origin)(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
BOOL recalculateDamage,
|
||||
diablo2::structures::damage* dmg);
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
BOOL recalculateDamage,
|
||||
diablo2::structures::damage* dmg);
|
||||
|
||||
#define PRINT_DMG_DELIMITER(name, delimiter) if(dmg->name > 0) spdlog::debug(#name ": {0}", dmg->name / delimiter)
|
||||
#define PRINT_DMG(name) PRINT_DMG_DELIMITER(name, 256)
|
||||
@@ -76,7 +75,6 @@ static void send_damage_data(diablo2::structures::unit* defender,
|
||||
spdlog::info("maxHp: {0}", packet.maxHp);
|
||||
spdlog::info("damage: {0}", packet.damage);
|
||||
|
||||
|
||||
if (packet.damage_type == d2_tweaks::common::DAMAGE_TYPE_UNKNOWN)
|
||||
return;
|
||||
|
||||
@@ -87,23 +85,23 @@ static void send_damage_data(diablo2::structures::unit* defender,
|
||||
}
|
||||
|
||||
static bool has_players(diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender) {
|
||||
diablo2::structures::unit* defender) {
|
||||
return attacker->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER ||
|
||||
defender->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER;
|
||||
}
|
||||
|
||||
static bool has_hirelings(diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender) {
|
||||
diablo2::structures::unit* defender) {
|
||||
return attacker && attacker->is_hireling() || defender && defender->is_hireling();
|
||||
}
|
||||
|
||||
static bool has_pets(diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender) {
|
||||
diablo2::structures::unit* defender) {
|
||||
return attacker && attacker->is_pet() || defender && defender->is_pet();
|
||||
}
|
||||
|
||||
static diablo2::structures::unit* get_hireling_owner(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* unit) {
|
||||
diablo2::structures::unit* unit) {
|
||||
static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
|
||||
if (!unit)
|
||||
@@ -123,7 +121,7 @@ static diablo2::structures::unit* get_hireling_owner(diablo2::structures::game*
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
if (guid == 0)
|
||||
return nullptr;
|
||||
@@ -134,7 +132,7 @@ static diablo2::structures::unit* get_hireling_owner(diablo2::structures::game*
|
||||
}
|
||||
|
||||
static diablo2::structures::unit* get_pet_owner(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* unit) {
|
||||
diablo2::structures::unit* unit) {
|
||||
static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
|
||||
if (!unit)
|
||||
@@ -148,14 +146,14 @@ static diablo2::structures::unit* get_pet_owner(diablo2::structures::game* game,
|
||||
instance.iterate_server_units(game, diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER, [&](diablo2::structures::unit* player) {
|
||||
diablo2::d2_game::iterate_unit_pets(
|
||||
game, player, [&](diablo2::structures::game*, diablo2::structures::unit*, diablo2::structures::unit* u) {
|
||||
if (u != unit)
|
||||
return;
|
||||
if (u != unit)
|
||||
return;
|
||||
|
||||
guid = player->guid;
|
||||
});
|
||||
guid = player->guid;
|
||||
});
|
||||
|
||||
return guid == 0;
|
||||
});
|
||||
});
|
||||
|
||||
if (guid == 0)
|
||||
return nullptr;
|
||||
@@ -166,8 +164,8 @@ static diablo2::structures::unit* get_pet_owner(diablo2::structures::game* game,
|
||||
}
|
||||
|
||||
static void process_players_damage(diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::unit* defender,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::net_client* client = nullptr;
|
||||
|
||||
if (attacker->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER)
|
||||
@@ -179,14 +177,15 @@ static void process_players_damage(diablo2::structures::unit* attacker,
|
||||
}
|
||||
|
||||
static void process_hireling_damage(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::unit* owner = nullptr;
|
||||
|
||||
if (attacker->is_hireling()) {
|
||||
owner = get_hireling_owner(game, attacker);
|
||||
} else if (defender->is_hireling()) {
|
||||
}
|
||||
else if (defender->is_hireling()) {
|
||||
owner = get_hireling_owner(game, defender);
|
||||
}
|
||||
|
||||
@@ -197,14 +196,15 @@ static void process_hireling_damage(diablo2::structures::game* game,
|
||||
}
|
||||
|
||||
static void process_pet_damage(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::unit* owner = nullptr;
|
||||
|
||||
if (attacker->is_pet()) {
|
||||
owner = get_pet_owner(game, attacker);
|
||||
} else if (defender->is_pet()) {
|
||||
}
|
||||
else if (defender->is_pet()) {
|
||||
owner = get_pet_owner(game, defender);
|
||||
}
|
||||
|
||||
@@ -215,10 +215,10 @@ static void process_pet_damage(diablo2::structures::game* game,
|
||||
}
|
||||
|
||||
static char __fastcall apply_attack_results(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
BOOL recalculateDamage,
|
||||
diablo2::structures::damage* dmg) {
|
||||
diablo2::structures::unit* attacker,
|
||||
diablo2::structures::unit* defender,
|
||||
BOOL recalculateDamage,
|
||||
diablo2::structures::damage* dmg) {
|
||||
static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
|
||||
static char result = 0;
|
||||
@@ -257,8 +257,8 @@ void d2_tweaks::server::modules::damage_display::init() {
|
||||
}
|
||||
|
||||
bool d2_tweaks::server::modules::damage_display::handle_packet(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void d2_tweaks::server::modules::damage_display::tick(diablo2::structures::game* game, diablo2::structures::unit* unit) {}
|
||||
void d2_tweaks::server::modules::damage_display::tick(diablo2::structures::game* game, diablo2::structures::unit* unit) {}
|
@@ -19,12 +19,12 @@ static unsigned int g_item_Crafted = 0;
|
||||
static unsigned int g_item_Tempered = 0;
|
||||
|
||||
static uint32_t(__fastcall* g_pickup_item_original)(diablo2::structures::game*,
|
||||
diablo2::structures::unit*,
|
||||
uint32_t, uint32_t);
|
||||
diablo2::structures::unit*,
|
||||
uint32_t, uint32_t);
|
||||
static uint32_t __fastcall pickup_item(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player,
|
||||
uint32_t guid,
|
||||
uint32_t a4) {
|
||||
diablo2::structures::unit* player,
|
||||
uint32_t guid,
|
||||
uint32_t a4) {
|
||||
static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
|
||||
if (!game || !player || player->type != diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER)
|
||||
@@ -66,12 +66,12 @@ static uint32_t __fastcall pickup_item(diablo2::structures::game* game,
|
||||
}
|
||||
|
||||
static uint32_t(__fastcall* g_pickup_item_cursor_original)(diablo2::structures::game*,
|
||||
diablo2::structures::unit*,
|
||||
uint32_t, uint32_t);
|
||||
diablo2::structures::unit*,
|
||||
uint32_t, uint32_t);
|
||||
static uint32_t __fastcall pickup_item_cursor(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player,
|
||||
uint32_t guid,
|
||||
uint32_t a4) {
|
||||
diablo2::structures::unit* player,
|
||||
uint32_t guid,
|
||||
uint32_t a4) {
|
||||
static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
|
||||
if (!game || !player || player->type != diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER)
|
||||
@@ -132,5 +132,4 @@ void d2_tweaks::server::modules::identify_on_pickup::init() {
|
||||
g_item_Crafted = GetPrivateProfileInt("IdentifyOnPickup", "Crafted", 1, acPathToIni);
|
||||
g_item_Tempered = GetPrivateProfileInt("IdentifyOnPickup", "Tempered", 1, acPathToIni);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -34,7 +34,6 @@ static char m_acBuffer[1024] = { 0 };
|
||||
static item_code* m_stItemList;
|
||||
static item_type* m_stItemTypes;
|
||||
|
||||
|
||||
void d2_tweaks::server::modules::item_drop_message::init() {
|
||||
uint32_t dwLenght = 0;
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
@@ -62,7 +61,7 @@ void d2_tweaks::server::modules::item_drop_message::init() {
|
||||
}
|
||||
}
|
||||
|
||||
/////// Parse ItemCode
|
||||
/////// Parse ItemCode
|
||||
dwLenght = lstrlen(m_acItemListAll);
|
||||
memcpy(m_acItemListAllTemp, m_acItemListAll, dwLenght + 1);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -137,8 +136,7 @@ void d2_tweaks::server::modules::item_drop_message::init() {
|
||||
token_string_itemcode = strtok(NULL, " ,|");
|
||||
}
|
||||
|
||||
|
||||
/// Parse ItemType
|
||||
/// Parse ItemType
|
||||
dwLenght = lstrlen(m_acItemTypesAll);
|
||||
memcpy(m_acItemTypesAllTemp, m_acItemTypesAll, dwLenght + 1);
|
||||
char* token_string_itemtype_code = strtok(m_acItemTypesAllTemp, ",|");
|
||||
@@ -218,7 +216,7 @@ void d2_tweaks::server::modules::item_drop_message::init() {
|
||||
}
|
||||
|
||||
void d2_tweaks::server::modules::item_drop_message::tick(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* unit) {
|
||||
diablo2::structures::unit* unit) {
|
||||
static common::item_pickup_info_sc packet;
|
||||
static auto& instance = singleton<d2_tweaks::server::server>::instance();
|
||||
if (!game || !unit)
|
||||
@@ -228,12 +226,11 @@ void d2_tweaks::server::modules::item_drop_message::tick(diablo2::structures::ga
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
const auto income_item_dropped_packet = static_cast<common::item_dropped_info_cs*>(packet);
|
||||
static common::item_dropped_info_sc response_item_dropped_packet;
|
||||
|
||||
switch (income_item_dropped_packet->message_type)
|
||||
|
||||
switch (income_item_dropped_packet->message_type)
|
||||
{
|
||||
case common::message_types_t::MESSAGE_TYPE_ITEM_DROPPED_INFO:
|
||||
auto current_unit = diablo2::d2_game::get_server_unit(game, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM, income_item_dropped_packet->item_id);
|
||||
@@ -248,7 +245,7 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc
|
||||
const auto itemtype_record = diablo2::d2_common::get_item_type_record(record->type);
|
||||
auto itemtype_record_equiv1 = diablo2::d2_common::get_item_type_record(itemtype_record->equiv1);
|
||||
auto itemtype_record_equiv2 = diablo2::d2_common::get_item_type_record(itemtype_record->equiv2);
|
||||
|
||||
|
||||
wcstombs(string_mb, string_wc, 256);
|
||||
|
||||
memset(response_item_dropped_packet.arr_itemtype_codestr_equivstr, 0, sizeof response_item_dropped_packet.arr_itemtype_codestr_equivstr);
|
||||
@@ -258,7 +255,7 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc
|
||||
uint32_t index_arr_itemtype = 1;
|
||||
|
||||
if (itemtype_record_equiv1) {
|
||||
//
|
||||
//
|
||||
if (*(DWORD*)itemtype_record_equiv1->code != 0x20202020) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
*(DWORD*)response_item_dropped_packet.arr_itemtype_codestr_equivstr[index_arr_itemtype] = *(DWORD*)itemtype_record_equiv1->code;
|
||||
@@ -269,13 +266,12 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc
|
||||
itemtype_record_equiv1 = diablo2::d2_common::get_item_type_record(itemtype_record_equiv1->equiv1);
|
||||
if (*(DWORD*)itemtype_record_equiv1->code != 0x20202020) {
|
||||
*(DWORD*)response_item_dropped_packet.arr_itemtype_codestr_equivstr[index_arr_itemtype] = *(DWORD*)itemtype_record_equiv1->code;
|
||||
}
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (itemtype_record_equiv2) {
|
||||
if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1
|
||||
@@ -293,7 +289,6 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GetKeyState(VK_SCROLL) != 0) {
|
||||
response_item_dropped_packet.item = income_item_dropped_packet->item_id;
|
||||
response_item_dropped_packet.code[0] = record->string_code[0];
|
||||
@@ -312,7 +307,6 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < m_nCountItemTypesAll; i++)
|
||||
{
|
||||
for (uint32_t count = 0; count < index_arr_itemtype; count++)
|
||||
@@ -342,7 +336,6 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < m_nCountItemListAll; i++)
|
||||
{
|
||||
if (record->string_code[0] == m_stItemList[i].code0 &&
|
||||
|
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <windows.h> // Include Windows API header for MessageBox
|
||||
|
||||
|
||||
#include <iomanip> // For std::setw
|
||||
|
||||
void serialize_item(const std::string& itemcode, const diablo2::structures::unit& item, std::ofstream& file) {
|
||||
@@ -54,11 +53,9 @@ void d2_tweaks::server::modules::item_move::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// handle packet coming from the client
|
||||
bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
static common::item_move_sc resp;
|
||||
static auto& instance = singleton<server>::instance();
|
||||
|
||||
@@ -71,7 +68,6 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g
|
||||
const auto item = instance.get_server_unit(game, itemMove->item_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item
|
||||
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
|
||||
|
||||
const char* itemcode = itemMove->item_code;
|
||||
const auto bag = instance.get_server_unit(game, itemMove->bag_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item
|
||||
@@ -83,7 +79,6 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g
|
||||
itemProperty.nMax = itemMove->val;
|
||||
diablo2::d2_common::add_property(bag, &itemProperty, 1);
|
||||
|
||||
|
||||
if (item == nullptr)
|
||||
return true; //block further packet processing
|
||||
|
||||
@@ -114,24 +109,17 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g
|
||||
diablo2::d2_net::send_to_client(1, client->client_id, &resp, sizeof resp);
|
||||
|
||||
if (itemMove->removeFromBag == 1) {
|
||||
|
||||
// here we need to add item to inventory
|
||||
|
||||
diablo2::structures::unit* item;
|
||||
|
||||
// or I can do something like this,
|
||||
// when extractor is clicked, send the bag and extractor to cube,
|
||||
// or I can do something like this,
|
||||
// when extractor is clicked, send the bag and extractor to cube,
|
||||
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (itemMove->updateBag == 1) {
|
||||
|
||||
// Serialize item data into binary file
|
||||
std::string playerName = player->player_data->name;
|
||||
std::string fileName = "./Save/" + playerName + ".boh";
|
||||
@@ -146,12 +134,11 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool d2_tweaks::server::modules::item_move::find_free_space(diablo2::structures::inventory* inv,
|
||||
diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) {
|
||||
diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) {
|
||||
char data[0x18];
|
||||
|
||||
diablo2::d2_common::get_inventory_data(inventoryIndex, 0, data);
|
||||
@@ -170,4 +157,4 @@ bool d2_tweaks::server::modules::item_move::find_free_space(diablo2::structures:
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -7,9 +7,9 @@ d2_tweaks::server::modules::server_module::server_module() {
|
||||
}
|
||||
|
||||
bool d2_tweaks::server::modules::server_module::handle_packet(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void d2_tweaks::server::modules::server_module::tick(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* unit) {}
|
||||
diablo2::structures::unit* unit) {}
|
@@ -10,14 +10,13 @@
|
||||
MODULE_INIT(test)
|
||||
|
||||
static int(__stdcall* g_set_stat_original)(diablo2::structures::unit* unit,
|
||||
diablo2::unit_stats_t stat,
|
||||
uint32_t value, int16_t param);
|
||||
diablo2::unit_stats_t stat,
|
||||
uint32_t value, int16_t param);
|
||||
static int __stdcall set_stat(diablo2::structures::unit* unit,
|
||||
diablo2::unit_stats_t stat,
|
||||
uint32_t value, int16_t param) {
|
||||
diablo2::unit_stats_t stat,
|
||||
uint32_t value, int16_t param) {
|
||||
if (unit->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER &&
|
||||
stat == diablo2::UNIT_STAT_GOLD) {
|
||||
|
||||
spdlog::debug("Setting UNIT_STAT_GOLD stat!");
|
||||
}
|
||||
|
||||
@@ -25,7 +24,7 @@ static int __stdcall set_stat(diablo2::structures::unit* unit,
|
||||
}
|
||||
|
||||
static int32_t(__stdcall* g_set_stat_in_list_original)(void*, diablo2::unit_stats_t stat,
|
||||
uint32_t value, uint32_t param);
|
||||
uint32_t value, uint32_t param);
|
||||
static int32_t __stdcall set_stat_in_list(void* a1, diablo2::unit_stats_t stat, uint32_t value, uint32_t param) {
|
||||
if (stat == diablo2::UNIT_STAT_GOLD) {
|
||||
spdlog::debug("Setting UNIT_STAT_GOLD stat!");
|
||||
@@ -46,4 +45,4 @@ void d2_tweaks::server::modules::test::init() {
|
||||
hooking::hook<10517>(diablo2::d2_common::get_base(), set_stat, &g_set_stat_original);
|
||||
|
||||
hooking::hook(diablo2::d2_game::get_base() + 0x50F80, regen_tick, &g_regen_tick_original);
|
||||
}
|
||||
}
|
@@ -78,7 +78,7 @@ static uint32_t m_nParam4 = 1;
|
||||
//__declspec (naked) void click_trade_menu() {
|
||||
// __asm {
|
||||
// pushad; //+0x24 esp
|
||||
// pushfd; //
|
||||
// pushfd; //
|
||||
// //mov eax, [esp + 0x28];//+0x4
|
||||
// //mov [m_nNpcId], eax;
|
||||
// mov eax, [esp + 0x34];//+0x10
|
||||
@@ -99,7 +99,7 @@ static uint32_t m_nParam4 = 1;
|
||||
//__declspec (naked) void click_gamble_menu() {
|
||||
// __asm {
|
||||
// pushad; //+0x24 esp
|
||||
// pushfd; //
|
||||
// pushfd; //
|
||||
// //mov eax, [esp + 0x28];//+0x4
|
||||
// //mov [m_nNpcId], eax;
|
||||
// mov eax, [esp + 0x34];//+0x10
|
||||
@@ -133,7 +133,6 @@ static uint32_t m_nParam4 = 1;
|
||||
// {D2DLL_INVALID}
|
||||
//};
|
||||
|
||||
|
||||
void d2_tweaks::server::modules::trader_update::init() {
|
||||
char szDir[MAX_PATH];
|
||||
char szPath[MAX_PATH];
|
||||
@@ -151,30 +150,27 @@ void d2_tweaks::server::modules::trader_update::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::server::modules::trader_update::tick(diablo2::structures::game* game, diablo2::structures::unit* unit) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
struct ClientFromNumber {
|
||||
uint8_t padding[0x174];
|
||||
diablo2::structures::net_client* net_cleint;
|
||||
};
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
const auto income_packet_cs = static_cast<common::trader_update_cs*>(packet);
|
||||
static common::trader_update_sc response_packet_sc;
|
||||
|
||||
|
||||
diablo2::structures::unit* temp_ptNPC = diablo2::d2_game::get_server_unit(game, diablo2::structures::unit_type_t::UNIT_TYPE_MONSTER, income_packet_cs->npc_id);
|
||||
diablo2::structures::npc_record* npcrecord = diablo2::d2_game::get_npc_record(game, temp_ptNPC, &temp_ptNPC);
|
||||
diablo2::structures::unit* ptNPC = diablo2::d2_game::get_server_unit(game, diablo2::structures::unit_type_t::UNIT_TYPE_MONSTER, income_packet_cs->npc_id);
|
||||
|
||||
|
||||
if (!ptNPC)
|
||||
return true;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (income_packet_cs->command == COMMAND_FREE_NPC_INVENTORY) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// id net client - 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 3, 5, 7, 9, 11, 13, 15
|
||||
@@ -189,7 +185,6 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (income_packet_cs->command == COMMAND_FREE_NPC_GAMBLE) {
|
||||
npcrecord->pGamble->pInventory = 0;
|
||||
npcrecord->pGamble->dwGUID = 0;
|
||||
@@ -200,7 +195,6 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure
|
||||
singleton<server>::instance().send_packet(player->player_data->net_client, &response_packet_sc, sizeof response_packet_sc);
|
||||
}
|
||||
|
||||
|
||||
if (income_packet_cs->command == COMMAND_FILL_NPC_INVENTORY) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
npcrecord->bRefreshInventory = true;
|
||||
@@ -220,7 +214,6 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (income_packet_cs->command == COMMAND_FILL_NPC_GAMBLE) {
|
||||
diablo2::d2_game::create_vendor_cache1(game, player, ptNPC, 1, true);
|
||||
response_packet_sc.command = COMMAND_FILL_NPC_GAMBLE;
|
||||
@@ -230,4 +223,4 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -53,7 +53,6 @@ void d2_tweaks::server::modules::transmute::tick(diablo2::structures::game* game
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
inline uint64_t TimeStart() {
|
||||
_asm {
|
||||
cpuid
|
||||
@@ -61,33 +60,31 @@ inline uint64_t TimeStart() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline uint64_t TimeEnd() {
|
||||
_asm {
|
||||
rdtsc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::transmute::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
const auto income_packet_cs = static_cast<common::transmute_info_cs*>(packet);
|
||||
static common::transmute_info_sc response_packet_sc;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (income_packet_cs->command == COMMAND_CALL_TRANSMUTE) {
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
uint64_t time = TimeStart();
|
||||
#endif
|
||||
#endif
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> item, <20><><EFBFBD> getmaxcuberecipes <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (diablo2::d2_game::transmogrify(game, player) == diablo2::d2_common::get_max_cube_recipes()) {
|
||||
response_packet_sc.command = COMMAND_ABORT;
|
||||
singleton<server>::instance().send_packet(player->player_data->net_client, &response_packet_sc, sizeof response_packet_sc);
|
||||
//diablo2::d2_net::send_to_client(1, client->client_id, &response_packet_sc, sizeof response_packet_sc);
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
time = (TimeEnd() - time);
|
||||
spdlog::debug("Time {}", time);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (income_packet_cs->command == COMMAND_MOVE_ITEM) {
|
||||
@@ -97,8 +94,6 @@ bool d2_tweaks::server::modules::transmute::handle_packet(diablo2::structures::g
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::transmute::move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
static common::transmute_info_sc resp;
|
||||
static auto& instance = singleton<server>::instance();
|
||||
@@ -134,8 +129,6 @@ bool d2_tweaks::server::modules::transmute::move_item_to(diablo2::structures::ga
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool d2_tweaks::server::modules::transmute::find_free_space(diablo2::structures::inventory* inv,
|
||||
diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) {
|
||||
char data[0x18];
|
||||
@@ -156,5 +149,4 @@ bool d2_tweaks::server::modules::transmute::find_free_space(diablo2::structures:
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@@ -17,13 +17,13 @@
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
#include <common/hooking.h>
|
||||
#include <D2Template.h>
|
||||
#include <filesystem>
|
||||
|
||||
static int32_t(__fastcall* g_get_incoming_packet_info_original)(d2_tweaks::common::packet_header* data, unsigned int dataSize, size_t* packetSizeOut, size_t* someOffset, int* packetGroup, int32_t* a6, int a7, int a8);
|
||||
|
||||
static int32_t(__fastcall* g_handle_packet_original)(diablo2::structures::game* game, diablo2::structures::unit* player, d2_tweaks::common::packet_header* data, size_t size);
|
||||
static int32_t(__fastcall* g_net_tick_original)(diablo2::structures::game*, diablo2::structures::unit*, int32_t, int32_t);
|
||||
|
||||
|
||||
//returns some kind of processing type (i.e. resultGroup == 0x04 means drop packet)
|
||||
static int32_t __fastcall get_incoming_packet_info(d2_tweaks::common::packet_header* data, unsigned int dataSize, size_t* packetSizeOut, size_t* someOffset, int* packetGroup, int32_t* a6, int a7, int a8) {
|
||||
static d2_tweaks::common::packet_header dummy;
|
||||
@@ -69,8 +69,8 @@ static int32_t g_ebp_send_to_client;
|
||||
void __fastcall hook_sc_packet_before_sent(uint32_t* client_strc, d2_tweaks::common::packet_header* packet, size_t size) {
|
||||
#ifndef NDEBUG
|
||||
__asm {
|
||||
push [ebp + 0x30];
|
||||
pop [g_ebp_send_to_client];
|
||||
push[ebp + 0x30];
|
||||
pop[g_ebp_send_to_client];
|
||||
}
|
||||
|
||||
if (size == -1)
|
||||
@@ -82,20 +82,19 @@ void __fastcall hook_sc_packet_before_sent(uint32_t* client_strc, d2_tweaks::com
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
__declspec (naked) void hook_sc_packet_before_sent_wrapper() {
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
push [esp+0x28]
|
||||
call [hook_sc_packet_before_sent]
|
||||
popfd;
|
||||
push[esp + 0x28]
|
||||
call[hook_sc_packet_before_sent]
|
||||
popfd;
|
||||
popad;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
push ecx
|
||||
push ebp
|
||||
push esi
|
||||
mov esi, ecx
|
||||
push ebp
|
||||
push esi
|
||||
mov esi, ecx
|
||||
}
|
||||
RET_TO_RVA(DLLBASE_D2GAME, 0xC715);
|
||||
}
|
||||
@@ -108,7 +107,6 @@ static const DLLPatchStrc gpt_hook_sc_packet_before_sent[] =
|
||||
{D2DLL_INVALID}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::server::server::init() {
|
||||
hooking::hook(reinterpret_cast<void*>(diablo2::d2_game::get_base() + 0x59320), ::handle_packet, &g_handle_packet_original);
|
||||
hooking::hook(reinterpret_cast<void*>(diablo2::d2_game::get_base() + 0x50F80), net_tick, &g_net_tick_original);
|
||||
@@ -137,8 +135,8 @@ void d2_tweaks::server::server::send_packet(diablo2::structures::net_client* cli
|
||||
}
|
||||
|
||||
bool d2_tweaks::server::server::handle_packet(diablo2::structures::game* game,
|
||||
diablo2::structures::unit* player,
|
||||
common::packet_header* packet) {
|
||||
diablo2::structures::unit* player,
|
||||
common::packet_header* packet) {
|
||||
auto handler = m_packet_handlers[packet->message_type];
|
||||
|
||||
if (!handler)
|
||||
@@ -187,7 +185,7 @@ diablo2::structures::unit* d2_tweaks::server::server::get_server_unit(diablo2::s
|
||||
}
|
||||
|
||||
void d2_tweaks::server::server::iterate_server_units(diablo2::structures::game* game, diablo2::structures::unit_type_t type,
|
||||
const std::function<bool(diablo2::structures::unit*)>& cb) {
|
||||
const std::function<bool(diablo2::structures::unit*)>& cb) {
|
||||
if (!cb)
|
||||
return;
|
||||
|
||||
@@ -225,4 +223,4 @@ int32_t d2_tweaks::server::server::net_tick(diablo2::structures::game* game, dia
|
||||
}
|
||||
|
||||
return g_net_tick_original(game, unit, a3, a4);
|
||||
}
|
||||
}
|
@@ -10,13 +10,13 @@
|
||||
#include <common/string_utils.h>
|
||||
|
||||
d2_tweaks::ui::controls::button::button(menu* menu,
|
||||
const rect& rect, const std::function<void()>& onClick,
|
||||
common::asset* image,
|
||||
int32_t frameDown, int32_t frameUp, int32_t clickSound) : control(menu,
|
||||
rect.get_x(),
|
||||
rect.get_y(),
|
||||
rect.get_width(),
|
||||
rect.get_height()) {
|
||||
const rect& rect, const std::function<void()>& onClick,
|
||||
common::asset* image,
|
||||
int32_t frameDown, int32_t frameUp, int32_t clickSound) : control(menu,
|
||||
rect.get_x(),
|
||||
rect.get_y(),
|
||||
rect.get_width(),
|
||||
rect.get_height()) {
|
||||
control::set_enabled(true);
|
||||
control::set_visible(true);
|
||||
|
||||
@@ -42,8 +42,6 @@ d2_tweaks::ui::controls::button::button(menu* menu,
|
||||
// uint32_t pos_y;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
d2_tweaks::ui::controls::button::button(menu* menu, const pugi::xml_node& node) : control(menu, 0, 0, 0, 0) {
|
||||
char buf[32] = { 0 };
|
||||
|
||||
@@ -51,7 +49,7 @@ d2_tweaks::ui::controls::button::button(menu* menu, const pugi::xml_node& node)
|
||||
auto cy = node.attribute("default_pos_y").as_int(0);
|
||||
|
||||
m_res_count = node.attribute("resolution_count").as_int(1);
|
||||
|
||||
|
||||
respos temp;
|
||||
for (uint32_t i = 1; i <= m_res_count; i++) {
|
||||
sprintf_s(buf, "res%d_x", i);
|
||||
@@ -143,9 +141,9 @@ void d2_tweaks::ui::controls::button::draw(int32_t offsetX, int32_t offsetY) {
|
||||
!m_popup.empty()) {
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16);
|
||||
diablo2::d2_win::set_popup_properties(const_cast<wchar_t*>(m_popup.c_str()),
|
||||
get_x() + offsetX + m_rect.get_width() / 2,
|
||||
get_y() + offsetY - m_rect.get_height(),
|
||||
diablo2::UI_COLOR_WHITE, TRUE);
|
||||
get_x() + offsetX + m_rect.get_width() / 2,
|
||||
get_y() + offsetY - m_rect.get_height(),
|
||||
diablo2::UI_COLOR_WHITE, TRUE);
|
||||
diablo2::d2_win::draw_popup();
|
||||
}
|
||||
|
||||
@@ -185,4 +183,4 @@ void d2_tweaks::ui::controls::button::left_mouse(int32_t offsetX, int32_t offset
|
||||
|
||||
void d2_tweaks::ui::controls::button::right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
|
||||
|
||||
void d2_tweaks::ui::controls::button::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
||||
void d2_tweaks::ui::controls::button::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
@@ -9,13 +9,13 @@
|
||||
const int32_t PADDING = 3;
|
||||
|
||||
d2_tweaks::ui::controls::checkbox::checkbox(menu* menu, const std::wstring& text, const rect& rect,
|
||||
const std::function<void()>& onClick,
|
||||
common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound)
|
||||
const std::function<void()>& onClick,
|
||||
common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound)
|
||||
: control(menu,
|
||||
rect.get_x(),
|
||||
rect.get_y(),
|
||||
rect.get_width(),
|
||||
rect.get_height()) {
|
||||
rect.get_x(),
|
||||
rect.get_y(),
|
||||
rect.get_width(),
|
||||
rect.get_height()) {
|
||||
control::set_enabled(true);
|
||||
control::set_visible(true);
|
||||
|
||||
@@ -72,7 +72,7 @@ d2_tweaks::ui::controls::checkbox::checkbox(menu* menu, const pugi::xml_node& no
|
||||
|
||||
m_image = new image(menu, cimg, cx, cy, m_frame_unchecked);
|
||||
m_label = new label(menu, string_utils::string_to_wstring(ctext), cx + m_image->get_width() + PADDING, cy,
|
||||
static_cast<diablo2::ui_color_t>(ccolor), static_cast<diablo2::ui_font_t>(cfont));
|
||||
static_cast<diablo2::ui_color_t>(ccolor), static_cast<diablo2::ui_font_t>(cfont));
|
||||
|
||||
checkbox::set_x(cx);
|
||||
checkbox::set_y(cy);
|
||||
@@ -103,9 +103,9 @@ void d2_tweaks::ui::controls::checkbox::draw(int32_t offsetX, int32_t offsetY) {
|
||||
!m_popup.empty()) {
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16);
|
||||
diablo2::d2_win::set_popup_properties(const_cast<wchar_t*>(m_popup.c_str()),
|
||||
get_x() + offsetX + m_rect.get_width() / 2,
|
||||
get_y() + offsetY - m_rect.get_height(),
|
||||
diablo2::UI_COLOR_WHITE, TRUE);
|
||||
get_x() + offsetX + m_rect.get_width() / 2,
|
||||
get_y() + offsetY - m_rect.get_height(),
|
||||
diablo2::UI_COLOR_WHITE, TRUE);
|
||||
diablo2::d2_win::draw_popup();
|
||||
}
|
||||
|
||||
@@ -152,4 +152,4 @@ void d2_tweaks::ui::controls::checkbox::left_mouse(int32_t offsetX, int32_t offs
|
||||
|
||||
void d2_tweaks::ui::controls::checkbox::right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
|
||||
|
||||
void d2_tweaks::ui::controls::checkbox::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
||||
void d2_tweaks::ui::controls::checkbox::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
@@ -88,7 +88,7 @@ void d2_tweaks::ui::controls::group::right_mouse(int32_t offsetX, int32_t offset
|
||||
}
|
||||
|
||||
void d2_tweaks::ui::controls::group::key_event(int32_t offsetX, int32_t offsetY,
|
||||
uint32_t key, bool up, bool& block) {
|
||||
uint32_t key, bool up, bool& block) {
|
||||
for (auto control : m_controls) {
|
||||
if (!control->get_enabled())
|
||||
continue;
|
||||
@@ -105,4 +105,4 @@ void d2_tweaks::ui::controls::group::add_control(control* control) {
|
||||
return;
|
||||
|
||||
get_menu()->add_control(control);
|
||||
}
|
||||
}
|
@@ -92,4 +92,4 @@ void d2_tweaks::ui::controls::image::right_mouse(int32_t offsetX, int32_t offset
|
||||
block = m_rect.contains(diablo2::d2_client::get_mouse_x(), diablo2::d2_client::get_mouse_y(), offsetX, offsetY);
|
||||
}
|
||||
|
||||
void d2_tweaks::ui::controls::image::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
||||
void d2_tweaks::ui::controls::image::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
@@ -3,7 +3,7 @@
|
||||
#include <diablo2/d2client.h>
|
||||
|
||||
d2_tweaks::ui::controls::label::label(menu* menu, const std::wstring& text, int32_t x, int32_t y, diablo2::ui_color_t color,
|
||||
diablo2::ui_font_t font) : control(menu, x, y, 0, 0) {
|
||||
diablo2::ui_font_t font) : control(menu, x, y, 0, 0) {
|
||||
control::set_enabled(true);
|
||||
control::set_visible(true);
|
||||
|
||||
@@ -97,4 +97,4 @@ void d2_tweaks::ui::controls::label::left_mouse(int32_t offsetX, int32_t offsetY
|
||||
|
||||
void d2_tweaks::ui::controls::label::right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
|
||||
|
||||
void d2_tweaks::ui::controls::label::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
||||
void d2_tweaks::ui::controls::label::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {}
|
@@ -70,7 +70,6 @@ bool d2_tweaks::ui::menu::load_xml(const char* path) {
|
||||
m_respos.push_back(temp);
|
||||
}
|
||||
|
||||
|
||||
m_name = menuNode.node().attribute("name").as_string();
|
||||
m_width = menuNode.node().attribute("width").as_int(-1);
|
||||
m_height = menuNode.node().attribute("height").as_int(-1);
|
||||
@@ -220,7 +219,6 @@ bool d2_tweaks::ui::menu::mouse_wheel(bool up) {
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
bool d2_tweaks::ui::menu::key_event(uint32_t key, bool up) {
|
||||
auto block = false;
|
||||
|
||||
@@ -234,4 +232,4 @@ bool d2_tweaks::ui::menu::key_event(uint32_t key, bool up) {
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
}
|
@@ -69,6 +69,8 @@
|
||||
#include <string>
|
||||
#include <CommCtrl.h> // Include for edit control
|
||||
|
||||
#include <d2tweaks/client/client.h>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
using namespace std;
|
||||
@@ -220,7 +222,7 @@ diablo2::structures::unit unserialize_item(const std::string& hexString) {
|
||||
}
|
||||
|
||||
// Create an item object
|
||||
diablo2::structures::unit item;
|
||||
diablo2::structures::unit item{};
|
||||
|
||||
// Convert the hexadecimal string to binary data
|
||||
for (size_t i = 0; i < hexString.size(); i += 2) {
|
||||
@@ -244,6 +246,38 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||
block = true; // block the game from processing this key
|
||||
}
|
||||
|
||||
if (wParam == 'V') {
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
int32_t st0Guid = 0;
|
||||
uint32_t st0X = 0;
|
||||
uint32_t st0Y = 0;
|
||||
diablo2::structures::unit* box{};
|
||||
for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
char* st0Code = record->string_code;
|
||||
if (strncmp(st0Code, "st0", 3) == 0) {
|
||||
box = item;
|
||||
st0Guid = box->guid;
|
||||
st0X = player->path->mapx;
|
||||
st0Y = player->path->mapy;
|
||||
}
|
||||
}
|
||||
struct D2GSPacketClt20 {
|
||||
uint8_t PacketId; // 0x01
|
||||
uint32_t guid; // 0x06
|
||||
uint32_t tx; // 0x07
|
||||
uint32_t ty; // 0x09
|
||||
};
|
||||
D2GSPacketClt20 packet;
|
||||
packet.PacketId = 0x20;
|
||||
packet.guid = st0Guid;
|
||||
packet.tx = st0X;
|
||||
packet.ty = st0Y;
|
||||
diablo2::d2_client::send_to_server(&packet, sizeof packet);
|
||||
m_stash_enabled = false;
|
||||
block = true;
|
||||
}
|
||||
|
||||
// Send item move packet + transmute packet for certain codes only for runes and gems
|
||||
if (wParam == 'G') {
|
||||
// Call the item_click function using the function pointer
|
||||
@@ -1607,7 +1641,6 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||
|| record->type == 53 - 3
|
||||
|
||||
) {
|
||||
|
||||
// open the cube
|
||||
struct D2GSPacketClt20 {
|
||||
uint8_t PacketId; // 0x01
|
||||
@@ -1655,7 +1688,6 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||
}
|
||||
diablo2::d2_client::send_to_server(&packet, sizeof packet);
|
||||
diablo2::d2_client::send_to_server_7(0x4F, 0x18, 0, 0);
|
||||
|
||||
|
||||
// now move the harvester back to the inv
|
||||
//static d2_tweaks::common::item_move_cs h1packet;
|
||||
@@ -1664,7 +1696,6 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||
//diablo2::d2_client::send_to_server(&h1packet, sizeof h1packet);
|
||||
|
||||
(*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4)) = nullptr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ bool diablo2::d2_client::is_lod() {
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_client::get_local_player() {
|
||||
static wrap_func_std<structures::unit * ()> get_local_player(0x883D0, get_base());
|
||||
static wrap_func_std<structures::unit* ()> get_local_player(0x883D0, get_base());
|
||||
return get_local_player();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ uint32_t diablo2::d2_client::get_mouse_y() {
|
||||
return get_mouse_y();
|
||||
}
|
||||
|
||||
|
||||
bool diablo2::d2_client::get_ui_window_state(const ui_window_t window) {
|
||||
static auto ui_states = reinterpret_cast<BOOL*>(get_base() + 0x11A6A8);
|
||||
return ui_states[window];
|
||||
@@ -67,7 +66,6 @@ void* diablo2::d2_client::get_buysellbtn() {
|
||||
return get_buysellbtn();
|
||||
}
|
||||
|
||||
|
||||
void diablo2::d2_client::resync_vendor_inventory(structures::unit* ptNPC) {
|
||||
static wrap_func_fast<void(structures::unit* ptNPC)>resync_vendor_inventory(0x578E0, get_base());
|
||||
resync_vendor_inventory(ptNPC);
|
||||
@@ -79,7 +77,7 @@ void diablo2::d2_client::play_sound(const uint32_t soundId, structures::unit* u,
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_client::get_unit_by_guid(const int32_t guid, const int32_t type) {
|
||||
static wrap_func_fast<structures::unit * (int32_t, int32_t)> get_unit_by_guid(0x869F0, get_base());
|
||||
static wrap_func_fast<structures::unit* (int32_t, int32_t)> get_unit_by_guid(0x869F0, get_base());
|
||||
return get_unit_by_guid(guid, type);
|
||||
}
|
||||
|
||||
@@ -89,17 +87,17 @@ void diablo2::d2_client::send_to_server(void* data, const size_t size) {
|
||||
}
|
||||
|
||||
bool diablo2::d2_client::cache_gfx_data(structures::gfxdata* gfxData, structures::unit* unit,
|
||||
structures::cellfile* cellfFile, int32_t direction, int32_t frame, int32_t* outIndex, int8_t flags,
|
||||
int32_t colorTint) {
|
||||
structures::cellfile* cellfFile, int32_t direction, int32_t frame, int32_t* outIndex, int8_t flags,
|
||||
int32_t colorTint) {
|
||||
static wrap_func_fast<int32_t(structures::gfxdata*,
|
||||
structures::unit*,
|
||||
structures::cellfile*,
|
||||
int32_t, int32_t, int32_t*, int8_t, int32_t)> cache_gfx_data(0xBEC80, get_base());
|
||||
structures::unit*,
|
||||
structures::cellfile*,
|
||||
int32_t, int32_t, int32_t*, int8_t, int32_t)> cache_gfx_data(0xBEC80, get_base());
|
||||
return cache_gfx_data(gfxData, unit, cellfFile, direction, frame, outIndex, flags, colorTint);
|
||||
}
|
||||
|
||||
diablo2::structures::cellfile* diablo2::d2_client::load_gfx_resource(char* path) {
|
||||
static wrap_func_fast<structures::cellfile * (char*, int32_t)> load_gfx_resource(0x1000, get_base());
|
||||
static wrap_func_fast<structures::cellfile* (char*, int32_t)> load_gfx_resource(0x1000, get_base());
|
||||
return load_gfx_resource(path, 0);
|
||||
}
|
||||
|
||||
@@ -108,7 +106,6 @@ int32_t diablo2::d2_client::unload_gfx_resource(structures::cellfile* handle) {
|
||||
return unload_gfx_resource(handle);
|
||||
}
|
||||
|
||||
|
||||
int32_t diablo2::d2_client::send_to_server_7(BYTE type, DWORD num, DWORD unk1, DWORD unk2) {
|
||||
static wrap_func_fast<int32_t(BYTE type, DWORD num, DWORD unk1, DWORD unk2)> send_to_server_7(0xD9E0, get_base());
|
||||
return send_to_server_7(type, num, unk1, unk2);
|
||||
@@ -141,11 +138,9 @@ bool diablo2::d2_client::is_gamble_open() {
|
||||
return *reinterpret_cast<bool*>(get_base() + 0x115D7C);
|
||||
}
|
||||
|
||||
|
||||
// 1 = talk
|
||||
// 3 = trade or gamble
|
||||
// 7 = imbue / add sockets / personalize
|
||||
uint8_t diablo2::d2_client::current_interact_menu() {
|
||||
return *reinterpret_cast<uint8_t*>(get_base() + 0x115C3B);
|
||||
}
|
||||
|
||||
}
|
@@ -12,4 +12,4 @@ char* diablo2::structures::d2_cmp::get_base() {
|
||||
bool diablo2::structures::d2_cmp::init_gfx_data(gfxdata* gfxdata) {
|
||||
static wrap_func_std_import<BOOL(structures::gfxdata*, int32_t, int32_t)> init_gfx_data(10055, get_base());
|
||||
return init_gfx_data(gfxdata, 0, 1) > 0;
|
||||
}
|
||||
}
|
@@ -22,18 +22,16 @@ int32_t diablo2::d2_common::get_item_type_from_unit(structures::unit* item) {
|
||||
return get_item_type_from_unit(item);
|
||||
}
|
||||
|
||||
|
||||
//__stdcall UNITS_GetPreviousInteractGUID(D2UnitStrc* pUnit)
|
||||
int32_t diablo2::d2_common::get_previous_interact_guid(structures::unit* player) {
|
||||
static wrap_func_std_import <int32_t(structures::unit*)>get_previous_interact_guid(10383, get_base());
|
||||
return get_previous_interact_guid(player);
|
||||
}
|
||||
|
||||
|
||||
//__stdcall INV_EmptyInventory(D2InventoryStrc* pInventory)
|
||||
// deletes items one by one
|
||||
void diablo2::d2_common::empty_inventory_1(structures::inventory* inv) {
|
||||
static wrap_func_std_import <void (structures::inventory*)>empty_inventory_1(10279, get_base());
|
||||
static wrap_func_std_import <void(structures::inventory*)>empty_inventory_1(10279, get_base());
|
||||
return empty_inventory_1(inv);
|
||||
}
|
||||
|
||||
@@ -63,7 +61,6 @@ diablo2::structures::unit* diablo2::d2_common::get_next_inventory_item(structure
|
||||
return get_next_inventory_item(prev_item);
|
||||
}
|
||||
|
||||
|
||||
int32_t diablo2::d2_common::get_inventory_index(structures::unit* item, char page, BOOL lod) {
|
||||
static wrap_func_std_import<int32_t(structures::unit*, char, BOOL)> get_inventory_index(10409, get_base());
|
||||
return get_inventory_index(item, page, lod);
|
||||
@@ -75,33 +72,30 @@ void* diablo2::d2_common::get_inventory_data(int32_t index, int32_t zero, char*
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_common::get_item_at_cell(structures::inventory* inv, uint32_t cellx,
|
||||
uint32_t celly, uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page) {
|
||||
static wrap_func_std_import<structures::unit * (structures::inventory*, uint32_t, uint32_t, uint32_t*, uint32_t*,
|
||||
int32_t, uint8_t)> get_item_at_cell(10252, get_base());
|
||||
uint32_t celly, uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page) {
|
||||
static wrap_func_std_import<structures::unit* (structures::inventory*, uint32_t, uint32_t, uint32_t*, uint32_t*,
|
||||
int32_t, uint8_t)> get_item_at_cell(10252, get_base());
|
||||
return get_item_at_cell(inv, cellx, celly, pcellx, pcelly, invIndex, page);
|
||||
}
|
||||
|
||||
uint32_t diablo2::d2_common::can_put_into_slot(structures::inventory* inv, structures::unit* item, uint32_t x,
|
||||
uint32_t y, uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page) {
|
||||
uint32_t y, uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page) {
|
||||
static wrap_func_std_import< uint32_t(structures::inventory*, structures::unit*, uint32_t, uint32_t,
|
||||
uint32_t, structures::unit**, uint32_t*, uint8_t)> can_put_into_slot(
|
||||
10247, get_base());
|
||||
uint32_t, structures::unit**, uint32_t*, uint8_t)> can_put_into_slot(
|
||||
10247, get_base());
|
||||
return can_put_into_slot(inv, item, x, y, invIndex, lastBlockingUnit, lastBlockingUnitIndex, page);
|
||||
}
|
||||
|
||||
|
||||
uint32_t diablo2::d2_common::get_item_type(structures::unit* item) {
|
||||
static wrap_func_std_import< uint32_t(structures::unit*)>get_item_type(10751, get_base());
|
||||
return get_item_type(item);
|
||||
}
|
||||
|
||||
|
||||
uint32_t diablo2::d2_common::get_item_type_class(structures::unit* item) {
|
||||
static wrap_func_std_import< uint32_t(structures::unit*)>get_item_type_class(10739, get_base());
|
||||
return get_item_type_class(item);
|
||||
}
|
||||
|
||||
|
||||
uint32_t diablo2::d2_common::get_item_primary_weapon_class(structures::unit* item) {
|
||||
static wrap_func_std_import< uint32_t(structures::unit*)>get_item_type_class(10744, get_base());
|
||||
return get_item_type_class(item);
|
||||
@@ -112,16 +106,15 @@ uint32_t diablo2::d2_common::set_unit_mode(structures::unit* item, uint32_t mode
|
||||
return set_unit_mode(item, mode);
|
||||
}
|
||||
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_common::inv_remove_item(structures::inventory* inventory, structures::unit* item) {
|
||||
static wrap_func_std_import<structures::unit * (structures::inventory*, structures::unit*)> inv_remove_item(10243, get_base());
|
||||
static wrap_func_std_import<structures::unit* (structures::inventory*, structures::unit*)> inv_remove_item(10243, get_base());
|
||||
return inv_remove_item(inventory, item);
|
||||
}
|
||||
|
||||
BOOL diablo2::d2_common::inv_add_item(structures::inventory* inv, structures::unit* item, uint32_t x, uint32_t y,
|
||||
uint32_t invIndex, BOOL isClient, uint8_t page) {
|
||||
uint32_t invIndex, BOOL isClient, uint8_t page) {
|
||||
static wrap_func_std_import<BOOL(structures::inventory*, structures::unit*, uint32_t, uint32_t,
|
||||
uint32_t, BOOL, uint8_t)> inv_add_item(10249, get_base());
|
||||
uint32_t, BOOL, uint8_t)> inv_add_item(10249, get_base());
|
||||
|
||||
return inv_add_item(inv, item, x, y, invIndex, isClient, page);
|
||||
}
|
||||
@@ -132,17 +125,17 @@ BOOL diablo2::d2_common::inv_update_item(structures::inventory* inv, structures:
|
||||
}
|
||||
|
||||
diablo2::structures::items_line* diablo2::d2_common::get_item_record(uint32_t guid) {
|
||||
static wrap_func_std_import<structures::items_line * (uint32_t)> get_item_record(10600, get_base());
|
||||
static wrap_func_std_import<structures::items_line* (uint32_t)> get_item_record(10600, get_base());
|
||||
return get_item_record(guid);
|
||||
}
|
||||
|
||||
diablo2::structures::item_types_line* diablo2::d2_common::get_item_type_record(uint32_t typeId) {
|
||||
static wrap_func_fast<structures::item_types_line * (uint32_t)>get_item_type_record(0x2B1A0, get_base());
|
||||
static wrap_func_fast<structures::item_types_line* (uint32_t)>get_item_type_record(0x2B1A0, get_base());
|
||||
return get_item_type_record(typeId);
|
||||
}
|
||||
|
||||
uint32_t diablo2::d2_common::check_item_type_equiv(uint32_t itemtype, uint32_t itemtype_equiv) {
|
||||
static wrap_func_std_import<uint32_t (uint32_t, uint32_t)>check_item_type_equiv(10730, get_base());
|
||||
static wrap_func_std_import<uint32_t(uint32_t, uint32_t)>check_item_type_equiv(10730, get_base());
|
||||
return check_item_type_equiv(itemtype, itemtype_equiv);
|
||||
}
|
||||
|
||||
@@ -182,7 +175,7 @@ int32_t diablo2::d2_common::_10116(int32_t x1, int32_t y1, int32_t* x, int32_t*
|
||||
}
|
||||
|
||||
diablo2::structures::room* diablo2::d2_common::get_room_from_unit(structures::unit* unit) {
|
||||
static wrap_func_std_import<structures::room * (structures::unit*)> get_room_from_unit(10342, get_base());
|
||||
static wrap_func_std_import<structures::room* (structures::unit*)> get_room_from_unit(10342, get_base());
|
||||
return get_room_from_unit(unit);
|
||||
}
|
||||
|
||||
@@ -227,12 +220,12 @@ int32_t diablo2::d2_common::get_item_quality(structures::unit* item) {
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_common::get_target_from_path(structures::path* path) {
|
||||
static wrap_func_std_import<structures::unit * (structures::path*)> get_target_from_path(10180, get_base());
|
||||
static wrap_func_std_import<structures::unit* (structures::path*)> get_target_from_path(10180, get_base());
|
||||
return get_target_from_path(path);
|
||||
}
|
||||
|
||||
void diablo2::d2_common::free_inventory(structures::inventory* inventory) {
|
||||
static wrap_func_std_import<void (structures::inventory*)> free_inventory(10241, get_base());
|
||||
static wrap_func_std_import<void(structures::inventory*)> free_inventory(10241, get_base());
|
||||
free_inventory(inventory);
|
||||
}
|
||||
|
||||
@@ -241,7 +234,6 @@ void diablo2::d2_common::refresh_unit_inventory(structures::unit* unit, bool set
|
||||
refresh_unit_inventory(unit, set_update_flags);
|
||||
}
|
||||
|
||||
|
||||
void diablo2::d2_common::update_trade(structures::inventory* inventory, structures::unit* item) {
|
||||
static wrap_func_std_import<void(structures::inventory* inventory, structures::unit* item)> update_trade(10283, get_base());
|
||||
update_trade(inventory, item);
|
||||
@@ -260,4 +252,9 @@ void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* pr
|
||||
void diablo2::d2_common::ITEMS_SetItemFlag(structures::unit* item, uint32_t dwFlag, BOOL bSet) {
|
||||
static wrap_func_std_import<void(structures::unit* item, uint32_t dwFlag, BOOL bSet)> ITEMS_SetItemFlag(10708, get_base());
|
||||
ITEMS_SetItemFlag(item, dwFlag, bSet);
|
||||
}
|
||||
|
||||
diablo2::structures::D2ItemStatCostTxt* diablo2::d2_common::get_item_stat_cost_record(int statId) {
|
||||
static wrap_func_fast<diablo2::structures::D2ItemStatCostTxt* (int)> get_item_stat_cost_record(0x642b0, get_base());
|
||||
return get_item_stat_cost_record(statId);
|
||||
}
|
@@ -3,7 +3,6 @@
|
||||
#include <diablo2/structures/npc_record.h>
|
||||
#include <common/ptr_wrapper.h>
|
||||
|
||||
|
||||
char* diablo2::d2_game::get_base() {
|
||||
static auto base = reinterpret_cast<char*>(GetModuleHandle("d2game.dll"));
|
||||
return base;
|
||||
@@ -14,13 +13,13 @@ void diablo2::d2_game::enqueue_packet(structures::net_client* client, void* pack
|
||||
enqueue_packet(client, packet, size);
|
||||
}
|
||||
|
||||
diablo2::structures::npc_record* diablo2::d2_game::get_npc_record(structures::game* game, structures::unit* npc, structures::unit **ptnpc) {
|
||||
diablo2::structures::npc_record* diablo2::d2_game::get_npc_record(structures::game* game, structures::unit* npc, structures::unit** ptnpc) {
|
||||
static wrap_func_fast<structures::npc_record* (structures::game*, structures::unit*, structures::unit**)>get_npc_record(0x9B910, get_base());
|
||||
return get_npc_record(game, npc, ptnpc);
|
||||
}
|
||||
|
||||
void diablo2::d2_game::free_gamble(structures::game* game, structures::unit* player, structures::unit* npc, structures::npc_record* npcrecord) {
|
||||
static wrap_func_fast<void (structures::game* game, structures::unit* player, structures::unit* npc, structures::npc_record* npcrecord)>free_gamble(0x9D190, get_base());
|
||||
static wrap_func_fast<void(structures::game* game, structures::unit* player, structures::unit* npc, structures::npc_record* npcrecord)>free_gamble(0x9D190, get_base());
|
||||
free_gamble(game, player, npc, npcrecord);
|
||||
}
|
||||
|
||||
@@ -40,18 +39,18 @@ void diablo2::d2_game::create_vendor_cache2(structures::game* game, structures::
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_game::get_server_unit(structures::game* game, structures::unit_type_t type, uint32_t uniqueid) {
|
||||
static wrap_func_fast<structures::unit*(structures::game*, structures::unit_type_t, uint32_t)>get_server_unit(0x8BB00, get_base());
|
||||
static wrap_func_fast<structures::unit* (structures::game*, structures::unit_type_t, uint32_t)>get_server_unit(0x8BB00, get_base());
|
||||
return get_server_unit(game, type, uniqueid);
|
||||
}
|
||||
|
||||
diablo2::structures::game* diablo2::d2_game::get_game_from_client_id(int32_t id) {
|
||||
static wrap_func_fast<structures::game * (int32_t)> get_game_from_client_id(0x94E0, get_base());
|
||||
static wrap_func_fast<structures::game* (int32_t)> get_game_from_client_id(0x94E0, get_base());
|
||||
return get_game_from_client_id(id);
|
||||
}
|
||||
|
||||
// __fastcall D2CLIENTS_GetClientByClientNumber(pGame, int nNumber)
|
||||
diablo2::structures::net_client* diablo2::d2_game::get_net_client_from_id(structures::game* game, int32_t id) {
|
||||
static wrap_func_fast<structures::net_client * (structures::game*, int32_t)>get_net_client_from_id(0x1DE0, get_base());
|
||||
static wrap_func_fast<structures::net_client* (structures::game*, int32_t)>get_net_client_from_id(0x1DE0, get_base());
|
||||
return get_net_client_from_id(game, id);
|
||||
}
|
||||
|
||||
@@ -61,8 +60,8 @@ diablo2::structures::net_client* diablo2::d2_game::get_net_client_from_id_2(stru
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_game::get_player_pet(structures::game* game, structures::unit* unit,
|
||||
uint32_t type, uint32_t index) {
|
||||
static wrap_func_fast<structures::unit * (structures::game*, structures::unit*, uint32_t, uint32_t)>get_player_pet(0x4E8B0, get_base());
|
||||
uint32_t type, uint32_t index) {
|
||||
static wrap_func_fast<structures::unit* (structures::game*, structures::unit*, uint32_t, uint32_t)>get_player_pet(0x4E8B0, get_base());
|
||||
return get_player_pet(game, unit, type, index);
|
||||
}
|
||||
|
||||
@@ -105,37 +104,35 @@ static diablo2::structures::game* (__thiscall* g_get_game)(diablo2::structures::
|
||||
= decltype(g_get_game)(0xB6A0 + diablo2::d2_game::get_base());
|
||||
|
||||
diablo2::structures::game* diablo2::d2_game::get_game(structures::game_server* gs, uint32_t gameId) {
|
||||
static wrap_func_std<structures::game * (uint32_t, void*)> get_game(0xB6A0, get_base());
|
||||
static wrap_func_std<structures::game* (uint32_t, void*)> get_game(0xB6A0, get_base());
|
||||
return g_get_game(gs, gameId, reinterpret_cast<char*>(gs) + 0x44);
|
||||
}
|
||||
|
||||
diablo2::structures::unit* diablo2::d2_game::get_unit_owner(structures::game* game, structures::unit* unit) {
|
||||
static wrap_func_fast<structures::unit * (structures::game*, structures::unit*)> get_unit_owner(0x8BB70, get_base());
|
||||
static wrap_func_fast<structures::unit* (structures::game*, structures::unit*)> get_unit_owner(0x8BB70, get_base());
|
||||
return get_unit_owner(game, unit);
|
||||
}
|
||||
|
||||
static void __fastcall unit_pet_iterator(diablo2::structures::game* game, diablo2::structures::unit* owner,
|
||||
diablo2::structures::unit* unit, void* arg) {
|
||||
diablo2::structures::unit* unit, void* arg) {
|
||||
const std::function<void(diablo2::structures::game*, diablo2::structures::unit*, diablo2::structures::unit*)>* cb =
|
||||
reinterpret_cast<decltype(cb)>(arg);
|
||||
cb->operator()(game, owner, unit);
|
||||
}
|
||||
|
||||
void* diablo2::d2_game::iterate_unit_pets(structures::game* game, structures::unit* unit,
|
||||
const std::function<void(structures::game*, structures::unit*, diablo2::structures::unit*)>& cb) {
|
||||
const std::function<void(structures::game*, structures::unit*, diablo2::structures::unit*)>& cb) {
|
||||
static wrap_func_fast<void* (structures::game*, structures::unit*,
|
||||
void(__fastcall*)(structures::game*, structures::unit*, diablo2::structures::unit*, void*), void*)> iterate_unit_pets(0x4E7C0, get_base());
|
||||
void(__fastcall*)(structures::game*, structures::unit*, diablo2::structures::unit*, void*), void*)> iterate_unit_pets(0x4E7C0, get_base());
|
||||
const auto cbref = &cb;
|
||||
// ReSharper disable once CppCStyleCast
|
||||
return iterate_unit_pets(game, unit, unit_pet_iterator, (void*)cbref);
|
||||
}
|
||||
|
||||
|
||||
uint32_t __fastcall diablo2::d2_game::transmogrify(diablo2::structures::game* game, diablo2::structures::unit* player) {
|
||||
static wrap_func_fast<uint32_t(diablo2::structures::game*, diablo2::structures::unit*)>transmogrify(0x62130, get_base());
|
||||
return transmogrify(game, player);
|
||||
}
|
||||
|
||||
|
||||
// d2game:$0x60010
|
||||
// int __fastcall CRAFT_Transmogrify(D2GameStrc* pGame, D2UnitStrc* pPlayer, D2CubemainTXT* pCubeTxt, void* pUnknown)
|
||||
// int __fastcall CRAFT_Transmogrify(D2GameStrc* pGame, D2UnitStrc* pPlayer, D2CubemainTXT* pCubeTxt, void* pUnknown)
|
@@ -27,14 +27,13 @@ int32_t diablo2::d2_gfx::get_resolution_mode() {
|
||||
}
|
||||
|
||||
void diablo2::d2_gfx::draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma,
|
||||
int32_t drawType, void* palette) {
|
||||
int32_t drawType, void* palette) {
|
||||
static wrap_func_std_import<void(structures::gfxdata*, uint32_t, uint32_t,
|
||||
int32_t, int32_t, void*)> draw_image(10072, get_base());
|
||||
int32_t, int32_t, void*)> draw_image(10072, get_base());
|
||||
draw_image(data, x, y, gamma, drawType, palette);
|
||||
}
|
||||
|
||||
|
||||
void diablo2::d2_gfx::draw_filled_rect(int left , int top, int right, int bottom, DWORD color, int transTbl) {
|
||||
void diablo2::d2_gfx::draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl) {
|
||||
static wrap_func_std_import<void(int, int, int, int, DWORD, int)> draw_boxed_text(10056, get_base());
|
||||
draw_boxed_text(left, top, right, bottom, color, transTbl);
|
||||
}
|
@@ -5,4 +5,4 @@
|
||||
char* diablo2::d2_launch::get_base() {
|
||||
static char* base = reinterpret_cast<char*>(GetModuleHandle("d2launch.dll"));
|
||||
return base;
|
||||
}
|
||||
}
|
@@ -14,5 +14,4 @@ int32_t diablo2::d2_net::send_to_server(int32_t queue, void* data, size_t size)
|
||||
int32_t diablo2::d2_net::send_to_client(int32_t queue, int32_t clientId, void* packet, size_t size) {
|
||||
static wrap_func_std_import<int32_t(int32_t, int32_t, void*, size_t)> send_to_client(10006, get_base());
|
||||
return send_to_client(queue, clientId, packet, size);
|
||||
}
|
||||
|
||||
}
|
@@ -17,7 +17,7 @@ void diablo2::d2_win::draw_text(wchar_t* str, uint32_t x, uint32_t y, ui_color_t
|
||||
}
|
||||
|
||||
void diablo2::d2_win::draw_boxed_text(wchar_t* str, uint32_t x, uint32_t y, int32_t paletteIndex, int32_t transTbl,
|
||||
ui_color_t color) {
|
||||
ui_color_t color) {
|
||||
static wrap_func_fast_import<void(wchar_t*, uint32_t, uint32_t, int32_t, int32_t, int32_t)> draw_boxed_text(10132, get_base());
|
||||
draw_boxed_text(str, x, y, paletteIndex, transTbl, color);
|
||||
}
|
||||
@@ -60,4 +60,4 @@ void* diablo2::d2_win::load_mpq(char* dllName, char* mpqName, char* mpqTitle, in
|
||||
bool diablo2::d2_win::unload_mpq(void* mpq) {
|
||||
static wrap_func_fast<BOOL(void*)> unload_mpq(0x012548, get_base());
|
||||
return unload_mpq(mpq);
|
||||
}
|
||||
}
|
@@ -29,4 +29,4 @@ bool diablo2::fog::mpq_read_file(structures::file_handle* handle, void* buffer,
|
||||
size_t diablo2::fog::mpq_get_file_size(structures::file_handle* handle, size_t* compressedSize) {
|
||||
static wrap_func_fast_import<size_t(structures::file_handle*, size_t*)> mpq_get_file_size(10105, get_base());
|
||||
return mpq_get_file_size(handle, compressedSize);
|
||||
}
|
||||
}
|
@@ -5,4 +5,4 @@
|
||||
char* diablo2::storm::get_base() {
|
||||
static auto base = reinterpret_cast<char*>(GetModuleHandle("storm.dll"));
|
||||
return base;
|
||||
}
|
||||
}
|
@@ -14,7 +14,7 @@ diablo2::utils::mpq_ifstream::mpq_streambuf::~mpq_streambuf() {
|
||||
std::basic_streambuf<char>::int_type diablo2::utils::mpq_ifstream::mpq_streambuf::underflow() {
|
||||
if (!m_handle)
|
||||
return EOF;
|
||||
|
||||
|
||||
if (!fog::mpq_read_file(m_handle, &m_data, 1, nullptr))
|
||||
return EOF;
|
||||
|
||||
@@ -24,5 +24,4 @@ std::basic_streambuf<char>::int_type diablo2::utils::mpq_ifstream::mpq_streambuf
|
||||
}
|
||||
|
||||
diablo2::utils::mpq_ifstream::mpq_ifstream(const std::string& path) : std::istream(&m_streambuf), m_streambuf(path) {
|
||||
|
||||
}
|
||||
}
|
@@ -24,4 +24,4 @@ void diablo2::utils::screen::world_to_screen(int32_t wx, int32_t wy, int32_t& sx
|
||||
|
||||
sx = x - d2_client::get_view_offset_x();
|
||||
sy = y - d2_client::get_view_offset_y();
|
||||
}
|
||||
}
|
52
src/main.cpp
52
src/main.cpp
@@ -17,7 +17,6 @@
|
||||
//#pragma comment(lib, "vcruntime.lib")
|
||||
#pragma comment(lib, "mincore_downlevel.lib")
|
||||
|
||||
|
||||
void init_log() {
|
||||
const auto console_err = std::make_shared<spdlog::sinks::stderr_color_sink_mt>();
|
||||
const auto logPath = "d2tweaks.log";
|
||||
@@ -39,7 +38,6 @@ void init_log() {
|
||||
spdlog::info("Log system initialized");
|
||||
}
|
||||
|
||||
|
||||
void initialize(uint32_t param) {
|
||||
#ifndef NDEBUG
|
||||
AllocConsole();
|
||||
@@ -80,34 +78,34 @@ void initialize(uint32_t param) {
|
||||
HANDLE g_hThread = 0;
|
||||
// ReSharper disable once CppInconsistentNaming
|
||||
BOOL APIENTRY DllMain(HMODULE moduleHandle,
|
||||
DWORD reason,
|
||||
LPVOID reserved) {
|
||||
DWORD reason,
|
||||
LPVOID reserved) {
|
||||
// ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
//dllnotify::DllNotify::Init_Dllnotify();
|
||||
DisableThreadLibraryCalls(moduleHandle);
|
||||
initialize(0);
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
//dllnotify::DllNotify::Init_Dllnotify();
|
||||
DisableThreadLibraryCalls(moduleHandle);
|
||||
initialize(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
if (g_hThread != NULL) {
|
||||
#ifndef NDEBUG
|
||||
FreeConsole();
|
||||
#endif
|
||||
CloseHandle(g_hThread);
|
||||
MH_Uninitialize();
|
||||
//dllnotify::DllNotify::Uninit_Dllnotify();
|
||||
}
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
if (g_hThread != NULL) {
|
||||
#ifndef NDEBUG
|
||||
FreeConsole();
|
||||
#endif
|
||||
CloseHandle(g_hThread);
|
||||
MH_Uninitialize();
|
||||
//dllnotify::DllNotify::Uninit_Dllnotify();
|
||||
}
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user