Stats display refactor using ini file done.

This commit is contained in:
Hash Borgir 2024-05-02 21:43:43 -06:00
parent f8349e6ba1
commit 7fd617abd7
176 changed files with 1731 additions and 1866 deletions

Binary file not shown.

View File

@ -1,3 +1,11 @@
 loot_filter.cpp
loot_filter_settings_toggle_menu.cpp
 autosort_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(197,15): warning C4018: '<': signed/unsigned mismatch
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(197,66): warning C4018: '<=': signed/unsigned mismatch
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(252,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(255,43): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(258,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(261,43): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(264,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(282,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(288,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
D2tweaks.vcxproj -> D:\Diablo II\MODS\ironman-dev\D2tweaks.dll

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,7 +42,7 @@
// If MFC is linked, we will use CStringArray for great convenience
#ifdef __AFXWIN_H__
#include <afxtempl.h>
#include <afxtempl.h>
#endif
// Number bases
@ -59,7 +59,7 @@
// string, the 2nd parameter is a 32-bit user defined data, this parameter can
// be NULL. The parsing will terminate if this function returns zero. To use
// the callback, function pointer needs to be passed to "CIni::ParseDNTString".
typedef BOOL (CALLBACK *SUBSTRPROC)(LPCTSTR, LPVOID);
typedef BOOL(CALLBACK* SUBSTRPROC)(LPCTSTR, LPVOID);
class CIni
{

View File

@ -13,25 +13,16 @@
struct StatEntry {
std::wstring stat_display_string;
diablo2::ui_color_t colorStat, colorStatValue;
int x1, y1, x2, y2, is_item_stat, item_type_id, stat = 0; // x1,y1 stat_display_string | x2,y2 statValue
int x1, y1, x2, y2, is_item_stat, item_type_id, stat, op, param = 0; // x1,y1 stat_display_string | x2,y2 statValue
};
extern std::vector<StatEntry> globalStatsVector; // Declaration of the global variable
extern diablo2::structures::gfxdata g_gfxdata; // global gfxdata
extern int randStat;
extern int randStatRangeLow;
extern int randStatRangeHigh;
extern int randStatBool;
extern bool m_stats_enabled;
extern bool m_help_enabled;
extern bool m_cube_enabled;
extern bool m_stash_enabled;
namespace diablo2 {

View File

@ -61,7 +61,6 @@ namespace d2_tweaks {
//handle hovering over item and actual click
static void __fastcall handle_dropped_items(diablo2::structures::unit* unit, void* edx);
};
}
}
}

View File

@ -20,6 +20,7 @@ namespace d2_tweaks {
ui::controls::button* m_btn_toggle_help;
ui::controls::button* m_btn_toggle_cube;
ui::controls::button* m_btn_toggle_stash;
menu* m_filter_settings_menu;
bool m_show;
public:

View File

@ -226,7 +226,6 @@ namespace d2_tweaks {
packet_header() : d2_packet_type(0xBB), message_type(0) {}
};
struct d2_entity_action_cs : packet_header {
uint32_t action;
uint32_t entity_id;
@ -274,7 +273,6 @@ namespace d2_tweaks {
}
};
struct inventory_sort_sc : packet_header {
uint8_t page;
uint8_t tx;
@ -300,7 +298,6 @@ namespace d2_tweaks {
damage_type_t damage_type;
uint32_t damage;
uint32_t currentHp; // New field for current hit points
uint32_t maxHp; // New field for maximum hit points

View File

@ -115,7 +115,6 @@ namespace d2_tweaks {
virtual void middle_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
virtual void mouse_wheel(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
virtual void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) = 0;
};
}

View File

@ -9,7 +9,6 @@
namespace d2_tweaks {
namespace ui {
namespace controls {
class label : public control {
std::wstring m_text;
bool m_text_owned;
@ -31,7 +30,6 @@ namespace d2_tweaks {
return m_text;
}
diablo2::ui_color_t get_color() const {
return m_color;
}

View File

@ -35,7 +35,6 @@ namespace d2_tweaks {
bool process_middle_mouse(bool up);
bool process_mouse_wheel(bool up);
bool process_key_event(uint32_t key, bool up);
};
}

View File

@ -59,7 +59,6 @@ namespace diablo2 {
static bool get_ui_window_state(ui_window_t window);
static void* get_buysellbtn();
static void play_sound(uint32_t soundId, structures::unit* u, uint32_t ticks, BOOL prePick, uint32_t cache);
static structures::unit* get_unit_by_guid(int32_t type, int32_t guid);
@ -90,6 +89,5 @@ namespace diablo2 {
static int32_t send_to_server_9(BYTE type, DWORD num, DWORD unk1);
static void set_ui_toggle(int nToggle, int nUIState, BOOL bToggle);
};
}

View File

@ -92,6 +92,67 @@ namespace diablo2 {
struct items_line;
struct item_types_line;
struct D2OpStatDataStrc
{
uint16_t nOpBase; //0x00
uint16_t nStat; //0x02
uint8_t nOp; //0x04
uint8_t nOpParam; //0x05
};
struct D2ItemStatCostTxt
{
uint16_t wStatId; //0x00
uint16_t pad0x02; //0x02
uint32_t dwItemStatFlags; //0x04
uint8_t nSendBits; //0x08
uint8_t nSendParamBits; //0x09
uint8_t nCsvBits; //0x0A
uint8_t nCsvParam; //0x0B
uint32_t dwDivide; //0x0C
uint32_t dwMultiply; //0x10
uint32_t dwAdd; //0x14
uint8_t nValShift; //0x18
uint8_t nSaveBits; //0x19
uint8_t n09SaveBits; //0x1A
uint8_t pad0x1B; //0x1B
uint32_t dwSaveAdd; //0x1C
uint32_t dw09SaveAdd; //0x20
uint32_t dwSaveParamBits; //0x24
uint32_t dw09SaveParamBits; //0x28
int32_t dwMinAccr; //0x2C
uint8_t nEncode; //0x30
uint8_t pad0x31; //0x31
uint16_t wMaxStat; //0x32
int16_t nDescPriority; //0x34
uint8_t nDescFunc; //0x36
uint8_t nDescVal; //0x37
uint16_t wDescStrPos; //0x38
uint16_t wDescStrNeg; //0x3A
uint16_t wDescStr2; //0x3C
uint16_t wDescGrp; //0x3E
uint8_t nDescGrpFunc; //0x40
uint8_t nDescGrpVal; //0x41
uint16_t wDescGrpStrPos; //0x42
uint16_t wDescGrpStrNeg; //0x44
uint16_t wDescGrpStr2; //0x46
int16_t wItemEvent[2]; //0x48
uint16_t wItemEventFunc[2]; //0x4C
uint8_t nKeepZero; //0x50
uint8_t bIsBaseOfOtherStatOp; //0x51
uint8_t bHasOpStatData; //0x52
uint8_t bHasOpApplyingToItem; //0x53
uint8_t nOp; //0x54
uint8_t nOpParam; //0x55
uint16_t wOpBase; //0x56
uint16_t wOpStat[3]; //0x58
uint16_t unk0x5E[64]; //0x5E - also related to op stats (see DATATBLS_LoadItemStatCostTxt)
D2OpStatDataStrc pOpStatData[16]; //0xDE
uint16_t pad0x13E; //0x13E
uint32_t dwStuff; //0x140
};
}
enum unit_stats_t {
@ -397,7 +458,6 @@ namespace diablo2 {
UNIT_STAT_ITEM_TOHIT_UNDEAD_BYTIME = 0x12B,
UNIT_STAT_ITEM_CRUSHINGBLOW_BYTIME = 0x12C,
// unit_stats_t from Ironman mod
UNIT_STAT_strength = 0,
@ -911,12 +971,8 @@ namespace diablo2 {
UNIT_STAT_runebag_RunesC = 508,
UNIT_STAT_UNUSED_83 = 509,
UNIT_STAT_item_aura_display = 510,
};
class d2_common {
public:
static char* get_base();
@ -983,5 +1039,10 @@ namespace diablo2 {
static void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* pProperty, int nUnused);
static void diablo2::d2_common::ITEMS_SetItemFlag(structures::unit* item, uint32_t dwFlag, BOOL bSet);
//D2Common.0x6FDA42B0
// D2ItemStatCostTxt* __fastcall ITEMS_GetItemStatCostTxtRecord(int nStatId)
// Write a function signature for this function
static structures::D2ItemStatCostTxt* get_item_stat_cost_record(int nStatId);
};
}

View File

@ -47,6 +47,5 @@ namespace diablo2 {
static void update_inventory_items(structures::game* game, structures::unit* player);
static uint32_t __fastcall diablo2::d2_game::transmogrify(diablo2::structures::game* game, diablo2::structures::unit* player);
};
}

View File

@ -18,6 +18,5 @@ namespace diablo2 {
static int32_t get_resolution_mode();
static void draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma, int32_t drawType, void* palette);
static void draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl);
};
}

View File

@ -23,8 +23,6 @@ namespace diablo2 {
struct quest_record;
struct npc_record;
enum class unit_type_t : int32_t {
UNIT_TYPE_PLAYER = 0,
UNIT_TYPE_MONSTER = 1,
@ -76,8 +74,6 @@ namespace diablo2 {
ITEMFLAG_ITEM = 0x08000000
};
struct unit {
unit_type_t type;

View File

@ -23,8 +23,6 @@ namespace diablo2 {
mpq_streambuf m_streambuf;
public:
explicit mpq_ifstream(const std::string& path);
};
}
}

View File

@ -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;
}
@ -207,7 +207,7 @@ 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
{
@ -215,12 +215,12 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
}
}
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;
}
}
@ -425,7 +425,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
{
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;
}
@ -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
@ -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;
}
@ -695,7 +695,7 @@ BOOL CIni::CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIf
//memset(psz, 0, sizeof(TCHAR) * (SRC_LEN + 2));
GetKeyLines(lpSrcSection, psz, SRC_LEN);
const BOOL RES = ::WritePrivateProfileSection(lpDestSection, psz, m_pszPathName);
delete [] psz;
delete[] psz;
return RES;
}
@ -717,7 +717,7 @@ BOOL CIni::CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection
LPTSTR psz = __GetStringDynamic(lpSrcSection, lpSrcKey);
const BOOL RES = WriteString(lpDestSection, lpDestKey, psz);
delete [] psz;
delete[] psz;
return RES;
}
@ -770,7 +770,7 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa
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);
}
@ -828,7 +828,7 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP
lpTarget[COPY_LEN] = _T('\0');
lpTarget = &lpTarget[SEG_LEN + 1];
}
delete [] pszSeg;
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;
}
@ -890,10 +890,10 @@ 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('='));
@ -926,7 +926,7 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
dwCopyLen = dwNameLen;
}
delete [] psz;
delete[] psz;
psl->dwTotalCopied += dwCopyLen + 1;
return TRUE;
}
@ -1068,7 +1068,7 @@ BOOL CIni::__TrimString(LPTSTR lpString)
{
LPTSTR psz = _tcsdup(p);
_tcscpy(lpString, psz);
delete [] psz;
delete[] psz;
}
return bTrimmed;

View File

@ -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,7 +213,7 @@ __declspec (naked) void handle_cs_packet_wrapper() {
__asm {
pushad;
pushfd;
call [d2_tweaks::client::client::handle_cs_packet]
call[d2_tweaks::client::client::handle_cs_packet]
popfd;
popad;
// îðèãèíàëüíûå èíñòðóêöèè
@ -223,7 +222,6 @@ __declspec (naked) void handle_cs_packet_wrapper() {
RET_TO_RVA(DLLBASE_D2CLIENT, 0xD856);
}
__declspec (naked) void handle_sc_standart_packet_wrapper() {
__asm {
pushad;
@ -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 îáðàáàòûâàåò ïàêåò ïåðåä 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(); /// êîíôëèêò ñ òåêñòîì íà 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;
}

View File

@ -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,7 +129,6 @@ 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();

View File

@ -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;
@ -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) {
// ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé 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);

View File

@ -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);
}
}
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 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);
}
}
case 1: // Formula: opstatbasevalue * statvalue / 100
statValue = static_cast<int32_t>(opBaseValue) / 100;
break;
}
default: {
// By default, get player stats
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;
}
}
/*
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) {
else {
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) {
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), 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);
}
}
}
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);
// 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;
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);
}
}
*/
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);

View File

@ -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() {
}

View File

@ -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,7 +93,6 @@ void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(
return;
}
__declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedInterceptASM() {
__asm
{
@ -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);

View File

@ -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();

View File

@ -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";

View File

@ -83,4 +83,3 @@ void loot_filter_settings::remove(const char* name) {
std::filesystem::remove(buffer);
memset(g_buffer, 0x00, sizeof g_buffer);
}

View File

@ -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;
}
}
//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) {
@ -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();
@ -247,7 +244,6 @@ 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);
@ -256,7 +252,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_
}
}
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() {

View File

@ -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() {

View File

@ -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;
@ -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,24 +135,21 @@ 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);
@ -201,4 +194,3 @@ void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_hea
}
}
}

View File

@ -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() {
@ -243,7 +242,7 @@ void d2_tweaks::client::modules::transmute::init() {
}
}
/////// Parse ItemCode
/////// Parse ItemCode
dwLenght = lstrlen(m_acItemListAll);
memcpy(m_acItemListAllTemp, m_acItemListAll, dwLenght + 1);
// ñ÷èòàåì êîëè÷åñòâî âñåõ ïðåäìåòîâ
@ -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, ",|");
@ -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();
@ -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);

View File

@ -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);

View File

@ -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,7 +56,6 @@ 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) {
//static common::gold_pickup_info_sc packet;
@ -102,4 +99,3 @@ void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::gam
// continue;
//}
}

View File

@ -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) {
// // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé 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;
@ -166,7 +161,6 @@ bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::struc
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();

Some files were not shown because too many files have changed in this diff Show More