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

@ -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,7 +59,7 @@
// 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
{ {

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

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

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

@ -59,7 +59,6 @@ namespace diablo2 {
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,13 +67,13 @@ 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);
@ -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

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

@ -23,8 +23,6 @@ namespace diablo2 {
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,
UNIT_TYPE_MONSTER = 1, UNIT_TYPE_MONSTER = 1,
@ -76,8 +74,6 @@ namespace diablo2 {
ITEMFLAG_ITEM = 0x08000000 ITEMFLAG_ITEM = 0x08000000
}; };
struct unit { struct unit {
unit_type_t type; unit_type_t type;

View File

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

View File

@ -13,7 +13,7 @@ static void* allocate_function_stub(void* origin, void* ptr, size_t size) {
if (!current_stub) { if (!current_stub) {
current_stub = current_stub =
VirtualAlloc(nullptr, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, VirtualAlloc(nullptr, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE); PAGE_EXECUTE_READWRITE);
} }
if (!current_stub) if (!current_stub)

View File

@ -74,7 +74,7 @@ CIni::CIni(LPCTSTR lpPathName)
CIni::~CIni() CIni::~CIni()
{ {
if (m_pszPathName != NULL) if (m_pszPathName != NULL)
delete [] m_pszPathName; delete[] m_pszPathName;
} }
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -92,7 +92,7 @@ void CIni::SetPathName(LPCTSTR lpPathName)
else else
{ {
if (m_pszPathName != NULL) if (m_pszPathName != NULL)
delete [] m_pszPathName; delete[] m_pszPathName;
m_pszPathName = _tcsdup(lpPathName); m_pszPathName = _tcsdup(lpPathName);
} }
@ -143,7 +143,7 @@ DWORD CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD d
dwLen = min(dwLen, dwBufSize); dwLen = min(dwLen, dwBufSize);
} }
delete [] psz; delete[] psz;
return dwLen; return dwLen;
} }
@ -152,7 +152,7 @@ CString CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault) con
{ {
LPTSTR psz = __GetStringDynamic(lpSection, lpKey, lpDefault); LPTSTR psz = __GetStringDynamic(lpSection, lpKey, lpDefault);
CString str(psz); CString str(psz);
delete [] psz; delete[] psz;
return str; return str;
} }
#endif #endif
@ -177,8 +177,8 @@ BOOL CIni::AppendString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpString) cons
TCHAR* pNewString = new TCHAR[_tcslen(psz) + _tcslen(lpString) + 1]; TCHAR* pNewString = new TCHAR[_tcslen(psz) + _tcslen(lpString) + 1];
_stprintf(pNewString, _T("%s%s"), psz, lpString); _stprintf(pNewString, _T("%s%s"), psz, lpString);
const BOOL RES = WriteString(lpSection, lpKey, pNewString); const BOOL RES = WriteString(lpSection, lpKey, pNewString);
delete [] pNewString; delete[] pNewString;
delete [] psz; delete[] psz;
return RES; return RES;
} }
@ -207,7 +207,7 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
const DWORD MAX_LEN = _tcslen(psz) + 2; const DWORD MAX_LEN = _tcslen(psz) + 2;
LPTSTR p = new TCHAR[MAX_LEN + 1]; LPTSTR p = new TCHAR[MAX_LEN + 1];
dwCopied = __StringSplit(psz, p, MAX_LEN, lpDelimiter, bTrimString); dwCopied = __StringSplit(psz, p, MAX_LEN, lpDelimiter, bTrimString);
delete [] p; delete[] p;
} }
else else
{ {
@ -215,12 +215,12 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
} }
} }
delete [] psz; delete[] psz;
return dwCopied; return dwCopied;
} }
#ifdef __AFXWIN_H__ #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) if (pArray != NULL)
pArray->RemoveAll(); pArray->RemoveAll();
@ -232,12 +232,12 @@ void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCT
LPTSTR psz = new TCHAR[LEN + 3]; LPTSTR psz = new TCHAR[LEN + 3];
GetArray(lpSection, lpKey, psz, LEN + 2, lpDelimiter); GetArray(lpSection, lpKey, psz, LEN + 2, lpDelimiter);
ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray); ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray);
delete [] psz; delete[] psz;
} }
#endif #endif
#ifdef __AFXWIN_H__ #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) if (pArray == NULL)
return FALSE; return FALSE;
@ -385,7 +385,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
DWORD dwLen = _tcslen(psz) / 2; DWORD dwLen = _tcslen(psz) / 2;
if (dwLen <= dwOffset) if (dwLen <= dwOffset)
{ {
delete [] psz; delete[] psz;
return 0; return 0;
} }
@ -401,7 +401,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
} }
else else
{ {
delete [] psz; delete[] psz;
return 0; return 0;
} }
} }
@ -425,7 +425,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
{ {
dwProcLen = dwLen - dwOffset; dwProcLen = dwLen - dwOffset;
} }
delete [] psz; delete[] psz;
return dwProcLen; 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) for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2)
_stprintf(&psz[j], _T("%02X"), lpb[i]); _stprintf(&psz[j], _T("%02X"), lpb[i]);
const BOOL RES = WriteString(lpSection, lpKey, psz); const BOOL RES = WriteString(lpSection, lpKey, psz);
delete [] psz; delete[] psz;
return RES; 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) for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2)
_stprintf(&psz[j], _T("%02X"), lpb[i]); _stprintf(&psz[j], _T("%02X"), lpb[i]);
const BOOL RES = AppendString(lpSection, lpKey, psz); const BOOL RES = AppendString(lpSection, lpKey, psz);
delete [] psz; delete[] psz;
return RES; return RES;
} }
@ -514,12 +514,12 @@ DWORD CIni::GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
while (dwCopied + 2 >= dwLen) while (dwCopied + 2 >= dwLen)
{ {
dwLen += DEF_PROFILE_THRESHOLD; dwLen += DEF_PROFILE_THRESHOLD;
delete [] psz; delete[] psz;
psz = new TCHAR[dwLen + 1]; psz = new TCHAR[dwLen + 1];
dwCopied = ::GetPrivateProfileSection(lpSection, psz, dwLen, m_pszPathName); dwCopied = ::GetPrivateProfileSection(lpSection, psz, dwLen, m_pszPathName);
} }
delete [] psz; delete[] psz;
return dwCopied + 2; return dwCopied + 2;
} }
else else
@ -549,7 +549,7 @@ DWORD CIni::GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
LPTSTR psz = new TCHAR[LEN + 1]; LPTSTR psz = new TCHAR[LEN + 1];
GetKeyLines(lpSection, psz, LEN); GetKeyLines(lpSection, psz, LEN);
ParseDNTString(psz, __KeyPairProc, (LPVOID)(&sl)); ParseDNTString(psz, __KeyPairProc, (LPVOID)(&sl));
delete [] psz; delete[] psz;
if (lpBuffer != NULL) if (lpBuffer != NULL)
lpBuffer[sl.dwTotalCopied] = _T('\0'); lpBuffer[sl.dwTotalCopied] = _T('\0');
return sl.dwTotalCopied; return sl.dwTotalCopied;
@ -567,12 +567,12 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const
while (dwCopied + 2 >= dwLen) while (dwCopied + 2 >= dwLen)
{ {
dwLen += DEF_PROFILE_THRESHOLD; dwLen += DEF_PROFILE_THRESHOLD;
delete [] psz; delete[] psz;
psz = new TCHAR[dwLen + 1]; psz = new TCHAR[dwLen + 1];
dwCopied = ::GetPrivateProfileSectionNames(psz, dwLen, m_pszPathName); dwCopied = ::GetPrivateProfileSectionNames(psz, dwLen, m_pszPathName);
} }
delete [] psz; delete[] psz;
return dwCopied + 2; return dwCopied + 2;
} }
else else
@ -582,7 +582,7 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const
} }
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
void CIni::GetSectionNames(CStringArray *pArray) const void CIni::GetSectionNames(CStringArray* pArray) const
{ {
if (pArray != NULL) if (pArray != NULL)
pArray->RemoveAll(); pArray->RemoveAll();
@ -594,13 +594,13 @@ void CIni::GetSectionNames(CStringArray *pArray) const
LPTSTR psz = new TCHAR[LEN + 1]; LPTSTR psz = new TCHAR[LEN + 1];
GetSectionNames(psz, LEN); GetSectionNames(psz, LEN);
ParseDNTString(psz, __SubStrAdd, pArray); ParseDNTString(psz, __SubStrAdd, pArray);
delete [] psz; delete[] psz;
} }
#endif #endif
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
// Retrieve a list of key-lines(key-pairs) of the specified section // 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) if (pArray != NULL)
pArray->RemoveAll(); pArray->RemoveAll();
@ -612,13 +612,13 @@ void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const
LPTSTR psz = new TCHAR[LEN + 1]; LPTSTR psz = new TCHAR[LEN + 1];
GetKeyLines(lpSection, psz, LEN); GetKeyLines(lpSection, psz, LEN);
ParseDNTString(psz, __SubStrAdd, pArray); ParseDNTString(psz, __SubStrAdd, pArray);
delete [] psz; delete[] psz;
} }
#endif #endif
#ifdef __AFXWIN_H__ #ifdef __AFXWIN_H__
// Retrieve a list of key names of the specified section // 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) if (pArray == NULL)
return; return;
@ -628,7 +628,7 @@ void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const
LPTSTR psz = new TCHAR[LEN + 1]; LPTSTR psz = new TCHAR[LEN + 1];
GetKeyNames(lpSection, psz, LEN); GetKeyNames(lpSection, psz, LEN);
ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray); ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray);
delete [] psz; delete[] psz;
} }
#endif #endif
@ -658,7 +658,7 @@ BOOL CIni::IsSectionExist(LPCTSTR lpSection) const
LPTSTR psz = new TCHAR[LEN + 1]; LPTSTR psz = new TCHAR[LEN + 1];
GetSectionNames(psz, LEN); GetSectionNames(psz, LEN);
BOOL RES = !ParseDNTString(psz, __SubStrCompare, (LPVOID)lpSection); BOOL RES = !ParseDNTString(psz, __SubStrCompare, (LPVOID)lpSection);
delete [] psz; delete[] psz;
return RES; return RES;
} }
@ -670,7 +670,7 @@ BOOL CIni::IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const
// Test it with the default unique string // Test it with the default unique string
LPTSTR psz = __GetStringDynamic(lpSection, lpKey, DEF_PROFILE_TESTSTRING); LPTSTR psz = __GetStringDynamic(lpSection, lpKey, DEF_PROFILE_TESTSTRING);
const BOOL RES = (_tcscmp(psz, DEF_PROFILE_TESTSTRING) != 0); const BOOL RES = (_tcscmp(psz, DEF_PROFILE_TESTSTRING) != 0);
delete [] psz; delete[] psz;
return RES; return RES;
} }
@ -695,7 +695,7 @@ BOOL CIni::CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIf
//memset(psz, 0, sizeof(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); const BOOL RES = ::WritePrivateProfileSection(lpDestSection, psz, m_pszPathName);
delete [] psz; delete[] psz;
return RES; return RES;
} }
@ -717,7 +717,7 @@ BOOL CIni::CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection
LPTSTR psz = __GetStringDynamic(lpSrcSection, lpSrcKey); LPTSTR psz = __GetStringDynamic(lpSrcSection, lpSrcKey);
const BOOL RES = WriteString(lpDestSection, lpDestKey, psz); const BOOL RES = WriteString(lpDestSection, lpDestKey, psz);
delete [] psz; delete[] psz;
return RES; return RES;
} }
@ -770,7 +770,7 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa
while (dwCopied + 1 >= dwLen) while (dwCopied + 1 >= dwLen)
{ {
dwLen += DEF_PROFILE_THRESHOLD; dwLen += DEF_PROFILE_THRESHOLD;
delete [] psz; delete[] psz;
psz = new TCHAR[dwLen + 1]; psz = new TCHAR[dwLen + 1];
dwCopied = ::GetPrivateProfileString(lpSection, lpKey, lpDefault == NULL ? _T("") : lpDefault, psz, dwLen, m_pszPathName); 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[COPY_LEN] = _T('\0');
lpTarget = &lpTarget[SEG_LEN + 1]; lpTarget = &lpTarget[SEG_LEN + 1];
} }
delete [] pszSeg; delete[] pszSeg;
lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search
lpEnd = _tcsstr(lpPos, pszDel); lpEnd = _tcsstr(lpPos, pszDel);
} }
@ -849,9 +849,9 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP
lpTarget[COPY_LEN] = _T('\0'); lpTarget[COPY_LEN] = _T('\0');
} }
delete [] pszSeg; delete[] pszSeg;
lpBuffer[dwCopied] = _T('\0'); lpBuffer[dwCopied] = _T('\0');
delete [] pszDel; delete[] pszDel;
return dwCopied; 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 // Callback function used to process a key-pair, it extracts the
// key name from the key-pair string // 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; STR_LIMIT* psl = (STR_LIMIT*)lpParam;
if (lpString == NULL || psl== NULL) if (lpString == NULL || psl == NULL)
return FALSE; return FALSE;
LPCTSTR p = _tcschr(lpString, _T('=')); LPCTSTR p = _tcschr(lpString, _T('='));
@ -926,7 +926,7 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
dwCopyLen = dwNameLen; dwCopyLen = dwNameLen;
} }
delete [] psz; delete[] psz;
psl->dwTotalCopied += dwCopyLen + 1; psl->dwTotalCopied += dwCopyLen + 1;
return TRUE; return TRUE;
} }
@ -1056,9 +1056,9 @@ BOOL CIni::__TrimString(LPTSTR lpString)
// Trim left side // Trim left side
LPCTSTR p = lpString; LPCTSTR p = lpString;
while (*p == _T(' ') while (*p == _T(' ')
|| *p == _T('\t') || *p == _T('\t')
|| *p == _T('\r') || *p == _T('\r')
|| *p == _T('\n')) || *p == _T('\n'))
{ {
p = &p[1]; p = &p[1];
bTrimmed = TRUE; bTrimmed = TRUE;
@ -1068,7 +1068,7 @@ BOOL CIni::__TrimString(LPTSTR lpString)
{ {
LPTSTR psz = _tcsdup(p); LPTSTR psz = _tcsdup(p);
_tcscpy(lpString, psz); _tcscpy(lpString, psz);
delete [] psz; delete[] psz;
} }
return bTrimmed; return bTrimmed;

View File

@ -8,7 +8,6 @@
#include <d2tweaks/client/modules/client_module.h> #include <d2tweaks/client/modules/client_module.h>
#include <d2tweaks/ui/ui_manager.h> #include <d2tweaks/ui/ui_manager.h>
#include <diablo2/structures/unit.h> #include <diablo2/structures/unit.h>
#include <diablo2/structures/client_unit_list.h> #include <diablo2/structures/client_unit_list.h>
#include <WinBase.h> #include <WinBase.h>
@ -45,12 +44,6 @@
std::vector<StatEntry> globalStatsVector; std::vector<StatEntry> globalStatsVector;
diablo2::structures::gfxdata g_gfxdata; // global gfxdata diablo2::structures::gfxdata g_gfxdata; // global gfxdata
int randStat;
int randStatRangeLow;
int randStatRangeHigh;
int randStatBool;
std::wstring ConvertCharToWString(const std::string& charString) { std::wstring ConvertCharToWString(const std::string& charString) {
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter; std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
return converter.from_bytes(charString); 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; return diablo2::ui_color_t::UI_COLOR_WHITE;
} }
// Define a struct to hold key-value pairs within a section // Define a struct to hold key-value pairs within a section
struct Section { struct Section {
std::map<std::string, std::string> assignments; std::map<std::string, std::string> assignments;
@ -166,6 +157,14 @@ void ParseIniFile(const std::string& iniFilePath) {
else if (key == "item_type_id") { else if (key == "item_type_id") {
entry.item_type_id = std::stoi(value); 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 { __asm {
pushad; pushad;
pushfd; pushfd;
call [d2_tweaks::client::client::handle_cs_packet] call[d2_tweaks::client::client::handle_cs_packet]
popfd; popfd;
popad; popad;
// îðèãèíàëüíûå èíñòðóêöèè // îðèãèíàëüíûå èíñòðóêöèè
sub esp, 0x200; sub esp, 0x200;
@ -223,13 +222,12 @@ __declspec (naked) void handle_cs_packet_wrapper() {
RET_TO_RVA(DLLBASE_D2CLIENT, 0xD856); RET_TO_RVA(DLLBASE_D2CLIENT, 0xD856);
} }
__declspec (naked) void handle_sc_standart_packet_wrapper() { __declspec (naked) void handle_sc_standart_packet_wrapper() {
__asm { __asm {
pushad; pushad;
pushfd; pushfd;
call[d2_tweaks::client::client::handle_standart_packet] call[d2_tweaks::client::client::handle_standart_packet]
popfd; popfd;
popad; popad;
// îðèãèíàëüíûå èíñòðóêöèè // îðèãèíàëüíûå èíñòðóêöèè
sub esp, 0x54; sub esp, 0x54;
@ -239,7 +237,6 @@ __declspec (naked) void handle_sc_standart_packet_wrapper() {
RET_TO_RVA(DLLBASE_D2CLIENT, 0x150B5); RET_TO_RVA(DLLBASE_D2CLIENT, 0x150B5);
} }
static const DLLPatchStrc gpt_handle_cs_packet[] = static const DLLPatchStrc gpt_handle_cs_packet[] =
{ {
{D2DLL_D2CLIENT, 0xD850 + 0, PATCH_JMP, FALSE, 0x1}, {D2DLL_D2CLIENT, 0xD850 + 0, PATCH_JMP, FALSE, 0x1},
@ -248,7 +245,6 @@ static const DLLPatchStrc gpt_handle_cs_packet[] =
{D2DLL_INVALID} {D2DLL_INVALID}
}; };
static const DLLPatchStrc gpt_handle_sc_standart_packet[] = static const DLLPatchStrc gpt_handle_sc_standart_packet[] =
{ {
{D2DLL_D2CLIENT, 0x150B0 + 0, PATCH_JMP, FALSE, 0x1}, {D2DLL_D2CLIENT, 0x150B0 + 0, PATCH_JMP, FALSE, 0x1},
@ -256,7 +252,6 @@ static const DLLPatchStrc gpt_handle_sc_standart_packet[] =
{D2DLL_INVALID} {D2DLL_INVALID}
}; };
void d2_tweaks::client::client::init() { void d2_tweaks::client::client::init() {
// handle packet îáðàáàòûâàåò ïàêåò ïåðåä GamePacketReceivedIntercept // handle packet îáðàáàòûâàåò ïàêåò ïåðåä GamePacketReceivedIntercept
hooking::hook(diablo2::d2_client::get_base() + 0x11CB0, handle_packet, reinterpret_cast<void**>(&g_handle_packet)); 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) if (m_module == nullptr)
break; 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 // Load and parse the INI file
ParseIniFile(iniFilePath); ParseIniFile(iniFilePath);
} }
D2TEMPLATE_ApplyPatch(gpt_handle_cs_packet); D2TEMPLATE_ApplyPatch(gpt_handle_cs_packet);
//D2TEMPLATE_ApplyPatch(gpt_handle_sc_standart_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; static int32_t g_ebp_send_to_client;
void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet, size_t size) { void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet, size_t size) {
#ifndef NDEBUG #ifndef NDEBUG
__asm { __asm {
push [ebp + 0x2C]; push[ebp + 0x2C];
pop [g_ebp_send_to_client]; 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); 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 #endif
@ -325,7 +306,6 @@ void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet,
handler->handle_cs_packet(packet); handler->handle_cs_packet(packet);
} }
void d2_tweaks::client::client::handle_standart_packet(common::packet_header* packet, size_t size) { void d2_tweaks::client::client::handle_standart_packet(common::packet_header* packet, size_t size) {
if (size == -1) if (size == -1)
return; return;
@ -337,7 +317,6 @@ void d2_tweaks::client::client::handle_standart_packet(common::packet_header* pa
return; return;
} }
void d2_tweaks::client::client::handle_packet(common::packet_header* packet, size_t size) { void d2_tweaks::client::client::handle_packet(common::packet_header* packet, size_t size) {
static common::packet_header dummy; static common::packet_header dummy;
static auto& instance = singleton<client>::instance(); 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); handler->handle_packet(packet);
} }
static bool g_is_init = false; static bool g_is_init = false;
void d2_tweaks::client::client::game_tick() { void d2_tweaks::client::client::game_tick() {
static auto& instance = singleton<client>::instance(); /// êîíôëèêò ñ òåêñòîì íà d2 gl static auto& instance = singleton<client>::instance(); /// êîíôëèêò ñ òåêñòîì íà d2 gl
if (g_is_init == false) { if (g_is_init == false) {
@ -380,7 +357,7 @@ void d2_tweaks::client::client::game_tick() {
g_is_init = true; g_is_init = true;
} }
for (auto & tick_handler : instance.m_tick_handlers) { for (auto& tick_handler : instance.m_tick_handlers) {
if (tick_handler == nullptr) if (tick_handler == nullptr)
break; break;
@ -390,7 +367,6 @@ void d2_tweaks::client::client::game_tick() {
return; return;
} }
int32_t d2_tweaks::client::client::draw_game_ui() { int32_t d2_tweaks::client::client::draw_game_ui() {
static auto& ui = singleton<ui::ui_manager>::instance(); static auto& ui = singleton<ui::ui_manager>::instance();
@ -401,8 +377,6 @@ int32_t d2_tweaks::client::client::draw_game_ui() {
return result; return result;
} }
void d2_tweaks::client::client::register_module(modules::client_module* module) { void d2_tweaks::client::client::register_module(modules::client_module* module) {
m_modules[m_module_id_counter++] = 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_early() {
} }
void d2_tweaks::client::modules::auto_gold_pickup::init() { void d2_tweaks::client::modules::auto_gold_pickup::init() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
const char* pcIniFile = "\\d2tweaks.ini"; 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() { void d2_tweaks::client::modules::auto_gold_pickup::tick() {
const auto unit = diablo2::d2_client::get_local_player(); 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) { 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); const auto info = static_cast<common::gold_pickup_info_sc*>(packet);
m_nLastUpdate = GetTickCount(); m_nLastUpdate = GetTickCount();

View File

@ -67,7 +67,6 @@ static char m_acPathToIni[MAX_PATH] = { 0 };
static const char* m_pcIniFile = "\\d2tweaks.ini"; static const char* m_pcIniFile = "\\d2tweaks.ini";
void d2_tweaks::client::modules::auto_item_pickup::init_early() { void d2_tweaks::client::modules::auto_item_pickup::init_early() {
} }
void ReloadFilters(char* szPathToIni) { void ReloadFilters(char* szPathToIni) {
@ -120,7 +119,6 @@ void ReloadFilters(char* szPathToIni) {
} }
} }
/// Parse ItemCode /// Parse ItemCode
dwLenght = lstrlen(m_pcItemListAll); dwLenght = lstrlen(m_pcItemListAll);
memcpy(m_pcItemListAllTemp, m_pcItemListAll, dwLenght + 1); memcpy(m_pcItemListAllTemp, m_pcItemListAll, dwLenght + 1);
@ -196,7 +194,6 @@ void ReloadFilters(char* szPathToIni) {
token_string_itemcode = strtok(NULL, " ,|"); token_string_itemcode = strtok(NULL, " ,|");
} }
/// Parse ItemType Code /// Parse ItemType Code
dwLenght = lstrlen(m_pcItemTypesAll); dwLenght = lstrlen(m_pcItemTypesAll);
memcpy(m_pcItemTypesAllTemp, m_pcItemTypesAll, dwLenght + 1); 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 { class auto_item_pickup_menu : public d2_tweaks::ui::menu {
d2_tweaks::common::asset* m_buttons_img; d2_tweaks::common::asset* m_buttons_img;
d2_tweaks::ui::controls::button* m_auto_pickup_btn; d2_tweaks::ui::controls::button* m_auto_pickup_btn;
@ -359,7 +355,6 @@ private:
} }
}; };
void d2_tweaks::client::modules::auto_item_pickup::init() { void d2_tweaks::client::modules::auto_item_pickup::init() {
GetCurrentDirectory(MAX_PATH, m_acPathToIni); GetCurrentDirectory(MAX_PATH, m_acPathToIni);
lstrcat(m_acPathToIni, m_pcIniFile); 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) { 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]; char data[0x18];
@ -396,7 +390,6 @@ bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::u
return false; return false;
} }
void d2_tweaks::client::modules::auto_item_pickup::tick() { void d2_tweaks::client::modules::auto_item_pickup::tick() {
static common::item_pickup_info_sc packet; static common::item_pickup_info_sc packet;
const auto unit = diablo2::d2_client::get_local_player(); 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 (itemtype_record_equiv2) {
if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) { if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) {
// ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1 // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1
@ -527,7 +519,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
} }
} }
for (uint32_t i = 0; i < m_nCountItemListAll; i++) for (uint32_t i = 0; i < m_nCountItemListAll; i++)
{ {
if (record->string_code[0] == m_stItemList[i].code0 && 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) { 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); const auto info = static_cast<common::item_pickup_info_sc*>(packet);

View File

@ -140,7 +140,6 @@ public:
ULONGLONG lastSendTime = GetTickCount64(); ULONGLONG lastSendTime = GetTickCount64();
// Function to split a string into words // Function to split a string into words
std::vector<std::string> split(const std::string& s, char delim) { std::vector<std::string> split(const std::string& s, char delim) {
std::stringstream ss(s); std::stringstream ss(s);
@ -210,9 +209,6 @@ public:
} }
} }
void draw() override { void draw() override {
auto stats = globalStatsVector; auto stats = globalStatsVector;
int textOffset = 40; // Initial offset for the first line int textOffset = 40; // Initial offset for the first line
@ -232,119 +228,72 @@ public:
// Initialize statValue // Initialize statValue
int32_t statValue = 0; int32_t statValue = 0;
if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) { //if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) {
diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50); // diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50);
} //}
if (m_stats_enabled) { if (m_stats_enabled) {
for (const auto& stat : stats) { 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 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); int32_t soulscaptured = statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(184), NULL);
switch (stat.stat) { auto statline = diablo2::d2_common::get_item_stat_cost_record(stat.stat);
// 2. (statValue <- this is probably op stat1 ? * baseValue <- this is probably op base ) / 2 ^ param
// (op stat1 value * base stat value) / (2 ^ param) auto opBase = statline->wOpBase;
// let's try this fucking thing auto opStat = statline->wOpStat[0];
case 190: { auto opBaseValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(opBase), NULL);
// str/spirits auto opStatValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(opStat), NULL);
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;
}
case 301: { if (stat.is_item_stat == 0) {
for (auto item : items) { int32_t statvalue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
const auto record = diablo2::d2_common::get_item_record(item->data_record_index); int basevalue = 1;
if (record->type == 104) { switch (op) {
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL); case 0:
} statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
} break;
break; case 1: // Formula: opstatbasevalue * statvalue / 100
} statValue = static_cast<int32_t>(opBaseValue) / 100;
break;
case 304: { case 2: // Formula: (statvalue * basevalue) / (2 ^ param)
for (auto item : items) { statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
const auto record = diablo2::d2_common::get_item_record(item->data_record_index); break;
if (record->type == 104) { case 3: // Percentage-based version of op #2
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL); statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
} break;
} case 4: // Item-based stat increase
break; statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
} break;
case 5: // Percentage-based item increase
default: { statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
// By default, get player stats break;
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL); case 11: // Similar to op #1 and #13
break; statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
} break;
} case 13:
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
/* break;
int32_t diablo2::d2_common::set_stat(structures::unit* unit, unit_stats_t stat, uint32_t value, int16_t param) { default:
static wrap_func_std_import<int32_t(structures::unit*, int32_t, int32_t, int32_t)> set_stat(10517, get_base()); statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
return set_stat(unit, stat, value, param); break;
}
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);
}
} }
} }
else { else {
// set randStat value to random number 1 and 2^(32) = 4294967296 for (auto item : items) {
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0); const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0); if (record->type == stat.item_type_id) {
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
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);
} }
} }
*/
// 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); auto statValueStr = std::to_wstring(statValue);
std::wstring statText = std::wstring(stat.stat_display_string);// .append(L" " + statValueStr); 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. // instead try to load direct jpg with gdi and insetad ofloading jpg file, specify it bb64 encoded and decode it.
} }
} }
if (m_help_enabled) { if (m_help_enabled) {
const int windowWidth = 1280; const int windowWidth = 1280;
const int windowHeight = 768; const int windowHeight = 768;
@ -410,14 +355,10 @@ public:
// Draw filled background box // Draw filled background box
diablo2::d2_gfx::draw_filled_rect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0, 255); diablo2::d2_gfx::draw_filled_rect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0, 255);
// Draw justified text inside the box with padding // Draw justified text inside the box with padding
drawJustifiedTextInBox(helpText, boxX, boxY, boxWidth, boxHeight, 0); drawJustifiedTextInBox(helpText, boxX, boxY, boxWidth, boxHeight, 0);
} }
diablo2::ui_color_t::UI_COLOR_WHITE; diablo2::ui_color_t::UI_COLOR_WHITE;
// print player health, mana, and stamina bars, lastexp, nextexp, and level // 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 diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
if (!should_draw()) { if (!should_draw()) {
m_sort_inventory_btn->set_enabled(false); m_sort_inventory_btn->set_enabled(false);
m_sort_inventory_btn->set_visible(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([]() { static growing_object_pool<damage_label> g_label_pool([]() {
return new damage_label(); 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_posx = 70;
static unsigned int g_player_label_posy = 500; static unsigned int g_player_label_posy = 500;
HWND findDiabloIIWindow() { HWND findDiabloIIWindow() {
return FindWindow(nullptr, TEXT("Diablo II")); // Change "Diablo II" to the exact title of the game window 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 // 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) { void drawHealthBar(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) {
HDC hdc = GetDC(hWnd); 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) { static void onDraw(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) {
if (GetTickCount64() >= nEndTime) { if (GetTickCount64() >= nEndTime) {
nEndTime = GetTickCount64() + DURATION; nEndTime = GetTickCount64() + DURATION;
} }
drawHealthBar(hWnd, x, y, maxWidth, height, healthPercentage, fillColor, outlineColor); drawHealthBar(hWnd, x, y, maxWidth, height, healthPercentage, fillColor, outlineColor);
} }
static void draw_damage_labels() { static void draw_damage_labels() {
const auto player = diablo2::d2_client::get_local_player(); 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))); 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; my -= offset;
// Draw damage label // Draw damage label
std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" "; std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" ";
const wchar_t* dmgTextPtr = dmgText.c_str(); const wchar_t* dmgTextPtr = dmgText.c_str();
diablo2::d2_win::set_current_font(diablo2::UI_FONT_6); 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); 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_early() {
} }
void d2_tweaks::client::modules::damage_display::init() { 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() { void d2_tweaks::client::modules::damage_display::tick() {
} }

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