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  autosort_client.cpp
loot_filter_settings_toggle_menu.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 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

@ -4,7 +4,7 @@
// "CIni" is a simple API wrap class used for ini file access. // "CIni" is a simple API wrap class used for ini file access.
// The purpose of this class is to make ini file access more // The purpose of this class is to make ini file access more
// convenient than direct API calls. // convenient than direct API calls.
// //
// This file is distributed "as is" and without any expressed or implied // This file is distributed "as is" and without any expressed or implied
// warranties. The author holds no responsibilities for any possible damages // 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 // or loss of data that are caused by use of this file. The user must assume
@ -42,7 +42,7 @@
// If MFC is linked, we will use CStringArray for great convenience // If MFC is linked, we will use CStringArray for great convenience
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
#include <afxtempl.h> #include <afxtempl.h>
#endif #endif
// Number bases // Number bases
@ -59,11 +59,11 @@
// string, the 2nd parameter is a 32-bit user defined data, this parameter can // 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 // be NULL. The parsing will terminate if this function returns zero. To use
// the callback, function pointer needs to be passed to "CIni::ParseDNTString". // 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 class CIni
{ {
public: public:
//----------------------------------------------------------- //-----------------------------------------------------------
// Constructors & Destructor // Constructors & Destructor
@ -80,10 +80,10 @@ public:
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
CString GetPathName() const; CString GetPathName() const;
#endif #endif
//------------------------------------------------------------ //------------------------------------------------------------
// String Access // String Access
//------------------------------------------------------------ //------------------------------------------------------------
DWORD GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDefault = NULL) const; DWORD GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDefault = NULL) const;
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
CString GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault = NULL) const; CString GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault = NULL) const;
@ -93,32 +93,32 @@ public:
// Read a string from the ini file, append it with another string then write it // Read a string from the ini file, append it with another string then write it
// back to the ini file. // back to the ini file.
BOOL AppendString(LPCTSTR Section, LPCTSTR lpKey, LPCTSTR lpString) const; BOOL AppendString(LPCTSTR Section, LPCTSTR lpKey, LPCTSTR lpString) const;
//------------------------------------------------------------ //------------------------------------------------------------
// Ini File String Array Access // Ini File String Array Access
//------------------------------------------------------------ //------------------------------------------------------------
// Parse the string retrieved from the ini file and split it into a set of sub strings. // Parse the string retrieved from the ini file and split it into a set of sub strings.
DWORD GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const; DWORD GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const;
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
void GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const; void GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const;
BOOL WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount = -1, LPCTSTR lpDelimiter = NULL) const; BOOL WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount = -1, LPCTSTR lpDelimiter = NULL) const;
#endif #endif
//------------------------------------------------------------ //------------------------------------------------------------
// Primitive Data Type Access // Primitive Data Type Access
//------------------------------------------------------------ //------------------------------------------------------------
int GetInt(LPCTSTR lpSection, LPCTSTR lpKey, int nDefault, int nBase = BASE_DECIMAL) const; int GetInt(LPCTSTR lpSection, LPCTSTR lpKey, int nDefault, int nBase = BASE_DECIMAL) const;
BOOL WriteInt(LPCTSTR lpSection, LPCTSTR lpKey, int nValue, int nBase = BASE_DECIMAL) const; BOOL WriteInt(LPCTSTR lpSection, LPCTSTR lpKey, int nValue, int nBase = BASE_DECIMAL) const;
BOOL IncreaseInt(LPCTSTR lpSection, LPCTSTR lpKey, int nIncrease = 1, int nBase = BASE_DECIMAL) const; BOOL IncreaseInt(LPCTSTR lpSection, LPCTSTR lpKey, int nIncrease = 1, int nBase = BASE_DECIMAL) const;
UINT GetUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nDefault, int nBase = BASE_DECIMAL) const; UINT GetUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nDefault, int nBase = BASE_DECIMAL) const;
BOOL WriteUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nValue, int nBase = BASE_DECIMAL) const; BOOL WriteUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nValue, int nBase = BASE_DECIMAL) const;
BOOL IncreaseUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nIncrease = 1, int nBase = BASE_DECIMAL) const; BOOL IncreaseUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nIncrease = 1, int nBase = BASE_DECIMAL) const;
BOOL GetBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bDefault) const; BOOL GetBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bDefault) const;
BOOL WriteBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bValue) const; BOOL WriteBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bValue) const;
BOOL InvertBool(LPCTSTR lpSection, LPCTSTR lpKey) const; BOOL InvertBool(LPCTSTR lpSection, LPCTSTR lpKey) const;
double GetDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fDefault) const; double GetDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fDefault) const;
BOOL WriteDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fValue, int nPrecision = -1) const; BOOL WriteDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fValue, int nPrecision = -1) const;
BOOL IncreaseDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fIncrease, int nPrecision = -1) const; BOOL IncreaseDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fIncrease, int nPrecision = -1) const;
@ -131,14 +131,14 @@ public:
//------------------------------------------------------------ //------------------------------------------------------------
POINT GetPoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT ptDefault) const; POINT GetPoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT ptDefault) const;
BOOL WritePoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT pt) const; BOOL WritePoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT pt) const;
RECT GetRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rcDefault) const; RECT GetRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rcDefault) const;
BOOL WriteRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rc) const; BOOL WriteRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rc) const;
DWORD GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWORD dwBufSize, DWORD dwOffset = 0) const; DWORD GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWORD dwBufSize, DWORD dwOffset = 0) const;
BOOL WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const; BOOL WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const;
BOOL AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const; BOOL AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const;
//------------------------------------------------------------ //------------------------------------------------------------
// Section Operations // Section Operations
//------------------------------------------------------------ //------------------------------------------------------------
@ -150,17 +150,17 @@ public:
BOOL CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist) const; BOOL CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist) const;
BOOL MoveSection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist = TRUE) const; BOOL MoveSection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist = TRUE) const;
BOOL DeleteSection(LPCTSTR lpSection) const; BOOL DeleteSection(LPCTSTR lpSection) const;
//------------------------------------------------------------ //------------------------------------------------------------
// Key Operations // Key Operations
//------------------------------------------------------------ //------------------------------------------------------------
BOOL IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const; BOOL IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const;
DWORD GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const; DWORD GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const;
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
void GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const; void GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const;
#endif #endif
DWORD GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const; DWORD GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const;
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
void GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const; void GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const;
#endif #endif
BOOL CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection, LPCTSTR lpDestKey, BOOL bFailIfExist) const; BOOL CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection, LPCTSTR lpDestKey, BOOL bFailIfExist) const;
@ -176,8 +176,8 @@ public:
// Check for Whether a String Representing TRUE or FALSE // Check for Whether a String Representing TRUE or FALSE
//------------------------------------------------------------ //------------------------------------------------------------
static BOOL StringToBool(LPCTSTR lpString, BOOL bDefault = FALSE); static BOOL StringToBool(LPCTSTR lpString, BOOL bDefault = FALSE);
protected: protected:
//------------------------------------------------------------ //------------------------------------------------------------
// Helper Functions // Helper Functions
@ -191,7 +191,7 @@ protected:
static void __IntToString(int nNumber, LPTSTR lpBuffer, int nBase); static void __IntToString(int nNumber, LPTSTR lpBuffer, int nBase);
static void __UIntToString(UINT nNumber, LPTSTR lpBuffer, int nBase); static void __UIntToString(UINT nNumber, LPTSTR lpBuffer, int nBase);
static BOOL CALLBACK __SubStrCompare(LPCTSTR lpString1, LPVOID lpParam); static BOOL CALLBACK __SubStrCompare(LPCTSTR lpString1, LPVOID lpParam);
static BOOL CALLBACK __KeyPairProc(LPCTSTR lpString, LPVOID lpParam); static BOOL CALLBACK __KeyPairProc(LPCTSTR lpString, LPVOID lpParam);
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
static BOOL CALLBACK __SubStrAdd(LPCTSTR lpString, LPVOID lpParam); static BOOL CALLBACK __SubStrAdd(LPCTSTR lpString, LPVOID lpParam);
#endif #endif

View File

@ -9,7 +9,7 @@ class config : public singleton<config> {
bool m_unlock_fps; bool m_unlock_fps;
bool m_prevent_minimize; bool m_prevent_minimize;
uint32_t m_gold_pickup_range; uint32_t m_gold_pickup_range;
public: public:
explicit config(token); explicit config(token);
}; };

View File

@ -62,7 +62,7 @@ namespace hooking {
template<size_t TOrdinal, typename TOrig> template<size_t TOrdinal, typename TOrig>
mh_status_t hook(void* base, void* detour, TOrig** original) { mh_status_t hook(void* base, void* detour, TOrig** original) {
auto fn = GetProcAddress(reinterpret_cast<HMODULE>(base), auto fn = GetProcAddress(reinterpret_cast<HMODULE>(base),
reinterpret_cast<LPCSTR>(TOrdinal)); reinterpret_cast<LPCSTR>(TOrdinal));
return hook(fn, detour, original); return hook(fn, detour, original);
} }

View File

@ -45,7 +45,7 @@ namespace details {
TRet operator()(Args... args) { TRet operator()(Args... args) {
if (!m_function_ptr) { if (!m_function_ptr) {
m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base), m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base),
reinterpret_cast<LPCSTR>(m_ordinal))); reinterpret_cast<LPCSTR>(m_ordinal)));
} }
return reinterpret_cast<TRet(__cdecl*)(Args...)>(m_function_ptr)(args...); return reinterpret_cast<TRet(__cdecl*)(Args...)>(m_function_ptr)(args...);
@ -67,7 +67,7 @@ namespace details {
TRet operator()(Args... args) { TRet operator()(Args... args) {
if (!m_function_ptr) { if (!m_function_ptr) {
m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base), m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base),
reinterpret_cast<LPCSTR>(m_ordinal))); reinterpret_cast<LPCSTR>(m_ordinal)));
} }
return reinterpret_cast<TRet(__stdcall*)(Args...)>(m_function_ptr)(args...); return reinterpret_cast<TRet(__stdcall*)(Args...)>(m_function_ptr)(args...);
@ -89,7 +89,7 @@ namespace details {
TRet operator()(Args... args) { TRet operator()(Args... args) {
if (!m_function_ptr) { if (!m_function_ptr) {
m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base), m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base),
reinterpret_cast<LPCSTR>(m_ordinal))); reinterpret_cast<LPCSTR>(m_ordinal)));
} }
return reinterpret_cast<TRet(__fastcall*)(Args...)>(m_function_ptr)(args...); return reinterpret_cast<TRet(__fastcall*)(Args...)>(m_function_ptr)(args...);

View File

@ -13,25 +13,16 @@
struct StatEntry { struct StatEntry {
std::wstring stat_display_string; std::wstring stat_display_string;
diablo2::ui_color_t colorStat, colorStatValue; 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 std::vector<StatEntry> globalStatsVector; // Declaration of the global variable
extern diablo2::structures::gfxdata g_gfxdata; // global gfxdata 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_stats_enabled;
extern bool m_help_enabled; extern bool m_help_enabled;
extern bool m_cube_enabled; extern bool m_cube_enabled;
extern bool m_stash_enabled; extern bool m_stash_enabled;
namespace diablo2 { namespace diablo2 {

View File

@ -24,7 +24,7 @@ namespace d2_tweaks {
static void save(const char* name); static void save(const char* name);
static void load(const char* name); static void load(const char* name);
static void remove(const char* name); static void remove(const char* name);
private: private:
loot_filter_settings() : size(sizeof(loot_filter_settings)), loot_filter_settings() : size(sizeof(loot_filter_settings)),
alt_only(false), show_gold(true), show_runes(true), show_gems(true), reserved{} alt_only(false), show_gold(true), show_runes(true), show_gems(true), reserved{}

View File

@ -61,7 +61,6 @@ namespace d2_tweaks {
//handle hovering over item and actual click //handle hovering over item and actual click
static void __fastcall handle_dropped_items(diablo2::structures::unit* unit, void* edx); 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_help;
ui::controls::button* m_btn_toggle_cube; ui::controls::button* m_btn_toggle_cube;
ui::controls::button* m_btn_toggle_stash; ui::controls::button* m_btn_toggle_stash;
menu* m_filter_settings_menu; menu* m_filter_settings_menu;
bool m_show; bool m_show;
public: public:

View File

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

View File

@ -24,11 +24,11 @@ namespace d2_tweaks {
void init() override; void init() override;
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
common::packet_header* packet) override; common::packet_header* packet) override;
private: private:
bool sort(diablo2::structures::game* game, diablo2::structures::unit* player, uint8_t page); bool sort(diablo2::structures::game* game, diablo2::structures::unit* player, uint8_t page);
bool find_free_space(diablo2::structures::inventory* inv, bool find_free_space(diablo2::structures::inventory* inv,
diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y, bool isCharmZone); diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y, bool isCharmZone);
}; };
} }
} }

View File

@ -24,7 +24,7 @@ namespace d2_tweaks {
void init() override; void init() override;
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
common::packet_header* packet) override; common::packet_header* packet) override;
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override; void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
}; };
} }

View File

@ -24,10 +24,10 @@ namespace d2_tweaks {
void init() override; void init() override;
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
common::packet_header* packet) override; common::packet_header* packet) override;
private: private:
bool find_free_space(diablo2::structures::inventory* inv, bool 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);
}; };
} }
} }

View File

@ -22,10 +22,10 @@ namespace d2_tweaks {
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override; void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override; bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override;
//private: //private:
// bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y); // bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y);
// bool send_to_cube(diablo2::structures::game* game, diablo2::structures::unit* player, diablo2::structures::unit* item); // bool send_to_cube(diablo2::structures::game* game, diablo2::structures::unit* player, diablo2::structures::unit* item);
// bool move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet); // bool move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet);
}; };
} }
} }

View File

@ -47,7 +47,7 @@ namespace d2_tweaks {
diablo2::structures::unit* get_server_unit(diablo2::structures::game* game, uint32_t guid, diablo2::structures::unit_type_t type); diablo2::structures::unit* get_server_unit(diablo2::structures::game* game, uint32_t guid, diablo2::structures::unit_type_t type);
void iterate_server_units(diablo2::structures::game* game, diablo2::structures::unit_type_t type, void 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);
private: private:
static int32_t __fastcall net_tick(diablo2::structures::game* game, diablo2::structures::unit* unit, int32_t a3, int32_t a4); static int32_t __fastcall net_tick(diablo2::structures::game* game, diablo2::structures::unit* unit, int32_t a3, int32_t a4);
}; };

View File

@ -40,7 +40,7 @@ namespace d2_tweaks {
std::vector<respos> m_respos; std::vector<respos> m_respos;
public: public:
button(menu* menu, const rect& rect, const std::function<void()>& onClick, button(menu* menu, const rect& rect, const std::function<void()>& onClick,
common::asset* image, int32_t frameDown, int32_t frameUp, int32_t clickSound = -1); common::asset* image, int32_t frameDown, int32_t frameUp, int32_t clickSound = -1);
explicit button(menu* menu, const pugi::xml_node& node); explicit button(menu* menu, const pugi::xml_node& node);
virtual ~button(); virtual ~button();

View File

@ -35,7 +35,7 @@ namespace d2_tweaks {
std::function<void(bool)> m_on_click; std::function<void(bool)> m_on_click;
public: public:
explicit checkbox(menu* menu, const std::wstring& text, const rect& rect, const std::function<void()>& onClick, explicit 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 = -1); common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound = -1);
explicit checkbox(menu* menu, const pugi::xml_node& node); explicit checkbox(menu* menu, const pugi::xml_node& node);
void set_x(int32_t value) override; void set_x(int32_t value) override;

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 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 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; 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 d2_tweaks {
namespace ui { namespace ui {
namespace controls { namespace controls {
class label : public control { class label : public control {
std::wstring m_text; std::wstring m_text;
bool m_text_owned; bool m_text_owned;
@ -19,8 +18,8 @@ namespace d2_tweaks {
std::vector<respos> m_respos; std::vector<respos> m_respos;
public: public:
explicit label(menu* menu, const std::wstring& text, int32_t x = 0, int32_t y = 0, explicit label(menu* menu, const std::wstring& text, int32_t x = 0, int32_t y = 0,
diablo2::ui_color_t color = diablo2::UI_COLOR_WHITE, diablo2::ui_color_t color = diablo2::UI_COLOR_WHITE,
diablo2::ui_font_t font = diablo2::UI_FONT_16); diablo2::ui_font_t font = diablo2::UI_FONT_16);
explicit label(menu* menu, const pugi::xml_node& node); explicit label(menu* menu, const pugi::xml_node& node);
void set_text(const std::wstring& text) { void set_text(const std::wstring& text) {
@ -31,7 +30,6 @@ namespace d2_tweaks {
return m_text; return m_text;
} }
diablo2::ui_color_t get_color() const { diablo2::ui_color_t get_color() const {
return m_color; return m_color;
} }

View File

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

View File

@ -53,13 +53,12 @@ namespace diablo2 {
static int32_t get_view_offset_x(); static int32_t get_view_offset_x();
static int32_t get_view_offset_y(); static int32_t get_view_offset_y();
static uint32_t get_mouse_x(); static uint32_t get_mouse_x();
static uint32_t get_mouse_y(); static uint32_t get_mouse_y();
static bool get_ui_window_state(ui_window_t window); static bool get_ui_window_state(ui_window_t window);
static void* get_buysellbtn(); static void* get_buysellbtn();
static void play_sound(uint32_t soundId, structures::unit* u, uint32_t ticks, BOOL prePick, uint32_t cache); 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); static structures::unit* get_unit_by_guid(int32_t type, int32_t guid);
@ -68,14 +67,14 @@ namespace diablo2 {
static void print_chat(wchar_t* string, uint32_t color); static void print_chat(wchar_t* string, uint32_t color);
static bool cache_gfx_data(structures::gfxdata* gfxData, static bool cache_gfx_data(structures::gfxdata* gfxData,
structures::unit* unit, structures::unit* unit,
structures::cellfile* cellfFile, structures::cellfile* cellfFile,
int32_t direction, int32_t direction,
int32_t frame, int32_t frame,
int32_t* outIndex, int32_t* outIndex,
int8_t flags, int8_t flags,
int32_t colorTint); int32_t colorTint);
static structures::cellfile* load_gfx_resource(char* path); static structures::cellfile* load_gfx_resource(char* path);
static int32_t unload_gfx_resource(structures::cellfile* handle); static int32_t unload_gfx_resource(structures::cellfile* handle);
static int32_t send_to_server_7(BYTE type, DWORD num, DWORD unk1, DWORD unk2); static int32_t send_to_server_7(BYTE type, DWORD num, DWORD unk1, DWORD unk2);
@ -90,6 +89,5 @@ namespace diablo2 {
static int32_t send_to_server_9(BYTE type, DWORD num, DWORD unk1); static int32_t send_to_server_9(BYTE type, DWORD num, DWORD unk1);
static void set_ui_toggle(int nToggle, int nUIState, BOOL bToggle); static void set_ui_toggle(int nToggle, int nUIState, BOOL bToggle);
}; };
} }

File diff suppressed because it is too large Load Diff

View File

@ -43,10 +43,9 @@ namespace diablo2 {
static bool __fastcall pickup_item(structures::game* game, structures::unit* player, uint32_t guid, uint32_t* ptrItemCarried); static bool __fastcall pickup_item(structures::game* game, structures::unit* player, uint32_t guid, uint32_t* ptrItemCarried);
static structures::unit* get_unit_owner(structures::game* game, structures::unit* unit); static structures::unit* get_unit_owner(structures::game* game, structures::unit* unit);
static void* iterate_unit_pets(structures::game* game, structures::unit* unit, static void* iterate_unit_pets(structures::game* game, structures::unit* unit,
const std::function<void(structures::game*, structures::unit*, structures::unit*)>& cb); const std::function<void(structures::game*, structures::unit*, structures::unit*)>& cb);
static void update_inventory_items(structures::game* game, structures::unit* player); 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); 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 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_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); static void draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl);
}; };
} }

View File

@ -26,7 +26,7 @@ namespace diablo2 {
uint32_t dwCostAdd; //0x80 uint32_t dwCostAdd; //0x80
uint16_t wDropSound; //0x84 uint16_t wDropSound; //0x84
uint16_t wUseSound; //0x86 uint16_t wUseSound; //0x86
uint32_t dwDropSfxFrame; //0x88 uint32_t dwDropSfxFrame; //0x88
uint32_t dwProp1; //0x8C uint32_t dwProp1; //0x8C
uint32_t dwPar1; //0x90 uint32_t dwPar1; //0x90
uint32_t dwMin1; //0x94 uint32_t dwMin1; //0x94

View File

@ -106,7 +106,7 @@ namespace diablo2 {
uint32_t* pHirelings; //+000001A0 055D8CD8 hirelings.txt (limit = 256) uint32_t* pHirelings; //+000001A0 055D8CD8 hirelings.txt (limit = 256)
int nHirelings; //+000001A4 00000078 # of hirelings records int nHirelings; //+000001A4 00000078 # of hirelings records
int pMercFirst[256]; //+000001A8 00000000 array of 256 integers (namefirst column from hirelings.txt) int pMercFirst[256]; //+000001A8 00000000 array of 256 integers (namefirst column from hirelings.txt)
int pMercLast[256]; //+000005A8 0000000C array of 256 integers (namelast column from hirelings.txt) int pMercLast[256]; //+000005A8 0000000C array of 256 integers (namelast column from hirelings.txt)
void* pNPCs; //+000009A8 05724F74 npcs.txt void* pNPCs; //+000009A8 05724F74 npcs.txt
int nNPCs; //+000009AC 00000011 # of npcs records int nNPCs; //+000009AC 00000011 # of npcs records
void* pColours; //+000009B0 01417568 colors.txt void* pColours; //+000009B0 01417568 colors.txt

View File

@ -69,9 +69,9 @@ namespace diablo2 {
ITEMFLAG_FROMPLAYER = 0x01000000, ITEMFLAG_FROMPLAYER = 0x01000000,
ITEMFLAG_RUNEuint16_t = 0x04000000 ITEMFLAG_RUNEuint16_t = 0x04000000
*/ */
uint32_t guid1; //+1C Global Unique ID 1 uint32_t guid1; //+1C Global Unique ID 1
uint32_t guid2; //+20 Global Unique ID 2 uint32_t guid2; //+20 Global Unique ID 2
uint32_t guid3; //+24 Global Unique ID 3 uint32_t guid3; //+24 Global Unique ID 3
uint32_t unique_id; //+28 uint32_t unique_id; //+28
uint8_t ilvl; //+2C uint8_t ilvl; //+2C
uint8_t uk1[0x03]; //+2D uint8_t uk1[0x03]; //+2D
@ -108,7 +108,7 @@ namespace diablo2 {
uint8_t item_data3; //+47 //D2Common10854 D2Common10853 uint8_t item_data3; //+47 //D2Common10854 D2Common10853
uint8_t p_ear_level; //+48 uint8_t p_ear_level; //+48
uint8_t var_gfx; //+49 uint8_t var_gfx; //+49
char i_name[0x12]; //+4A //inscribed/ear get_name char i_name[0x12]; //+4A //inscribed/ear get_name
inventory* inventory; //+5C inventory* inventory; //+5C
unit* pt_prev_item; //+60 unit* pt_prev_item; //+60
unit* pt_next_item; //+64 unit* pt_next_item; //+64

View File

@ -5,7 +5,7 @@
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {
struct game; struct game;
struct net_client { struct net_client {
uint32_t client_id; //+00 uint32_t client_id; //+00
uint8_t uk1[0x06]; //+04 uint8_t uk1[0x06]; //+04

View File

@ -4,52 +4,52 @@
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {
struct inventory; struct inventory;
struct npc_gamble //sizeof 0xC struct npc_gamble //sizeof 0xC
{ {
inventory* pInventory; //+00 inventory* pInventory; //+00
uint32_t dwGUID; //+04 npc_gamble* pNext; //+08 uint32_t dwGUID; //+04 npc_gamble* pNext; //+08
}; };
struct npc_record //sizeof 0x44 struct npc_record //sizeof 0x44
{ {
int nNPC; //+00 int nNPC; //+00
inventory* pInventory; //+04 inventory* pInventory; //+04
npc_gamble* pGamble; //+08 npc_gamble* pGamble; //+08
bool bGambleInit; //+0C bool bGambleInit; //+0C
uint32_t* pMercData; //+10 //D2MercDataStrc* uint32_t* pMercData; //+10 //D2MercDataStrc*
uint32_t* pEvent; //+14 //D2NPCEventStrc* uint32_t* pEvent; //+14 //D2NPCEventStrc*
uint32_t* pVendorChain; //+18 //D2VendorChainStrc* uint32_t* pVendorChain; //+18 //D2VendorChainStrc*
bool bTrading; //+1C bool bTrading; //+1C
union union
{ {
struct struct
{ {
union union
{ {
bool bFlags[8]; //+20 bool bFlags[8]; //+20
struct struct
{ {
bool bVendorInit; //+20 bool bVendorInit; //+20
bool bHireInit; //+21 bool bHireInit; //+21
uint8_t nAct; //+22 uint8_t nAct; //+22
bool bTrader; //+23 bool bTrader; //+23
bool bLevelRefresh; //+24 bool bLevelRefresh; //+24
bool bInited; //+25 bool bInited; //+25
bool bForceVendor; //+26 bool bForceVendor; //+26
bool bRefreshInventory; //+27 bool bRefreshInventory; //+27
}; };
}; };
uint32_t dwTicks; //+28 uint32_t dwTicks; //+28
uint32_t pProxy[4]; //+2C //D2UnitProxyStrc uint32_t pProxy[4]; //+2C //D2UnitProxyStrc
uint32_t dwUnk; //+3C uint32_t dwUnk; //+3C
uint32_t dwNPCGUID; //+40 uint32_t dwNPCGUID; //+40
}; };
uint32_t pTrade; //+20 //D2NPCTradeStrc uint32_t pTrade; //+20 //D2NPCTradeStrc
}; };
}; };
} }
} }

View File

@ -5,20 +5,20 @@
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {
struct net_client; struct net_client;
struct player_data { struct player_data {
char name[0x10]; //+00 Player Name char name[0x10]; //+00 Player Name
void* pt_quest[3]; //+10 Quest Pointers for each difficulty void* pt_quest[3]; //+10 Quest Pointers for each difficulty
uint8_t uk1[0x18]; //+1C //before : 0x14 uint8_t uk1[0x18]; //+1C //before : 0x14
void* pt_arena_unit; //+34 ptArena for the Unit void* pt_arena_unit; //+34 ptArena for the Unit
uint8_t uk2[0x4]; //+38 //before : 0x7 uint8_t uk2[0x4]; //+38 //before : 0x7
uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID
uint8_t uk3[0x2]; //+3E uint8_t uk3[0x2]; //+3E
uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID
uint8_t uk4[0x06]; //+42 uint8_t uk4[0x06]; //+42
uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals
uint8_t uk5[0x53]; //+49 uint8_t uk5[0x53]; //+49
net_client* net_client; //+9C ptClient net_client* net_client; //+9C ptClient
}; };
} }
} }

View File

@ -5,7 +5,7 @@
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {
struct unit; struct unit;
struct room//size=0x80 struct room//size=0x80
{ {
//ptRoom +48 0 = spawn new units (monster, objects e.tc), 1 = don't spawn any new units //ptRoom +48 0 = spawn new units (monster, objects e.tc), 1 = don't spawn any new units

View File

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

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