mirror of
https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
synced 2025-05-02 00:55:33 +00:00
Stats display refactor using ini file done.
This commit is contained in:
parent
f8349e6ba1
commit
7fd617abd7
Binary file not shown.
@ -1,3 +1,11 @@
|
||||
loot_filter.cpp
|
||||
loot_filter_settings_toggle_menu.cpp
|
||||
autosort_client.cpp
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(197,15): warning C4018: '<': signed/unsigned mismatch
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(197,66): warning C4018: '<=': signed/unsigned mismatch
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(252,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(255,43): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(258,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(261,43): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(264,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(282,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(288,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data
|
||||
D2tweaks.vcxproj -> D:\Diablo II\MODS\ironman-dev\D2tweaks.dll
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
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.
BIN
build/Debug/vendor/D2Template/D2Template.obj
vendored
BIN
build/Debug/vendor/D2Template/D2Template.obj
vendored
Binary file not shown.
BIN
build/Debug/vendor/DllNotify/DllNotify.obj
vendored
BIN
build/Debug/vendor/DllNotify/DllNotify.obj
vendored
Binary file not shown.
BIN
build/Debug/vendor/minhook/src/buffer.obj
vendored
BIN
build/Debug/vendor/minhook/src/buffer.obj
vendored
Binary file not shown.
BIN
build/Debug/vendor/minhook/src/hde/hde32.obj
vendored
BIN
build/Debug/vendor/minhook/src/hde/hde32.obj
vendored
Binary file not shown.
BIN
build/Debug/vendor/minhook/src/hde/hde64.obj
vendored
BIN
build/Debug/vendor/minhook/src/hde/hde64.obj
vendored
Binary file not shown.
BIN
build/Debug/vendor/minhook/src/hook.obj
vendored
BIN
build/Debug/vendor/minhook/src/hook.obj
vendored
Binary file not shown.
BIN
build/Debug/vendor/minhook/src/trampoline.obj
vendored
BIN
build/Debug/vendor/minhook/src/trampoline.obj
vendored
Binary file not shown.
@ -42,7 +42,7 @@
|
||||
|
||||
// If MFC is linked, we will use CStringArray for great convenience
|
||||
#ifdef __AFXWIN_H__
|
||||
#include <afxtempl.h>
|
||||
#include <afxtempl.h>
|
||||
#endif
|
||||
|
||||
// Number bases
|
||||
@ -59,7 +59,7 @@
|
||||
// string, the 2nd parameter is a 32-bit user defined data, this parameter can
|
||||
// be NULL. The parsing will terminate if this function returns zero. To use
|
||||
// the callback, function pointer needs to be passed to "CIni::ParseDNTString".
|
||||
typedef BOOL (CALLBACK *SUBSTRPROC)(LPCTSTR, LPVOID);
|
||||
typedef BOOL(CALLBACK* SUBSTRPROC)(LPCTSTR, LPVOID);
|
||||
|
||||
class CIni
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace hooking {
|
||||
template<size_t TOrdinal, typename TOrig>
|
||||
mh_status_t hook(void* base, void* detour, TOrig** original) {
|
||||
auto fn = GetProcAddress(reinterpret_cast<HMODULE>(base),
|
||||
reinterpret_cast<LPCSTR>(TOrdinal));
|
||||
reinterpret_cast<LPCSTR>(TOrdinal));
|
||||
|
||||
return hook(fn, detour, original);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace details {
|
||||
TRet operator()(Args... args) {
|
||||
if (!m_function_ptr) {
|
||||
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...);
|
||||
@ -67,7 +67,7 @@ namespace details {
|
||||
TRet operator()(Args... args) {
|
||||
if (!m_function_ptr) {
|
||||
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...);
|
||||
@ -89,7 +89,7 @@ namespace details {
|
||||
TRet operator()(Args... args) {
|
||||
if (!m_function_ptr) {
|
||||
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...);
|
||||
|
@ -13,25 +13,16 @@
|
||||
struct StatEntry {
|
||||
std::wstring stat_display_string;
|
||||
diablo2::ui_color_t colorStat, colorStatValue;
|
||||
int x1, y1, x2, y2, is_item_stat, item_type_id, stat = 0; // x1,y1 stat_display_string | x2,y2 statValue
|
||||
int x1, y1, x2, y2, is_item_stat, item_type_id, stat, op, param = 0; // x1,y1 stat_display_string | x2,y2 statValue
|
||||
};
|
||||
|
||||
extern std::vector<StatEntry> globalStatsVector; // Declaration of the global variable
|
||||
|
||||
extern diablo2::structures::gfxdata g_gfxdata; // global gfxdata
|
||||
|
||||
extern int randStat;
|
||||
extern int randStatRangeLow;
|
||||
extern int randStatRangeHigh;
|
||||
extern int randStatBool;
|
||||
|
||||
|
||||
extern bool m_stats_enabled;
|
||||
|
||||
extern bool m_help_enabled;
|
||||
|
||||
extern bool m_cube_enabled;
|
||||
|
||||
extern bool m_stash_enabled;
|
||||
|
||||
namespace diablo2 {
|
||||
|
@ -61,7 +61,6 @@ namespace d2_tweaks {
|
||||
//handle hovering over item and actual click
|
||||
static void __fastcall handle_dropped_items(diablo2::structures::unit* unit, void* edx);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace d2_tweaks {
|
||||
ui::controls::button* m_btn_toggle_help;
|
||||
ui::controls::button* m_btn_toggle_cube;
|
||||
ui::controls::button* m_btn_toggle_stash;
|
||||
|
||||
menu* m_filter_settings_menu;
|
||||
bool m_show;
|
||||
public:
|
||||
|
@ -226,7 +226,6 @@ namespace d2_tweaks {
|
||||
packet_header() : d2_packet_type(0xBB), message_type(0) {}
|
||||
};
|
||||
|
||||
|
||||
struct d2_entity_action_cs : packet_header {
|
||||
uint32_t action;
|
||||
uint32_t entity_id;
|
||||
@ -274,7 +273,6 @@ namespace d2_tweaks {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct inventory_sort_sc : packet_header {
|
||||
uint8_t page;
|
||||
uint8_t tx;
|
||||
@ -300,7 +298,6 @@ namespace d2_tweaks {
|
||||
damage_type_t damage_type;
|
||||
uint32_t damage;
|
||||
|
||||
|
||||
uint32_t currentHp; // New field for current hit points
|
||||
uint32_t maxHp; // New field for maximum hit points
|
||||
|
||||
|
@ -24,11 +24,11 @@ namespace d2_tweaks {
|
||||
void init() override;
|
||||
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
|
||||
common::packet_header* packet) override;
|
||||
common::packet_header* packet) override;
|
||||
private:
|
||||
bool sort(diablo2::structures::game* game, diablo2::structures::unit* player, uint8_t page);
|
||||
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);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace d2_tweaks {
|
||||
void init() override;
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ namespace d2_tweaks {
|
||||
void init() override;
|
||||
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
|
||||
common::packet_header* packet) override;
|
||||
common::packet_header* packet) override;
|
||||
private:
|
||||
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);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ namespace d2_tweaks {
|
||||
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;
|
||||
|
||||
//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 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);
|
||||
//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 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);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
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:
|
||||
static int32_t __fastcall net_tick(diablo2::structures::game* game, diablo2::structures::unit* unit, int32_t a3, int32_t a4);
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ namespace d2_tweaks {
|
||||
std::vector<respos> m_respos;
|
||||
public:
|
||||
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);
|
||||
virtual ~button();
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace d2_tweaks {
|
||||
std::function<void(bool)> m_on_click;
|
||||
public:
|
||||
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);
|
||||
|
||||
void set_x(int32_t value) override;
|
||||
|
@ -115,7 +115,6 @@ namespace d2_tweaks {
|
||||
virtual void middle_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
|
||||
virtual void mouse_wheel(int32_t offsetX, int32_t offsetY, bool up, bool& block) {}
|
||||
|
||||
|
||||
virtual void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) = 0;
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
|
||||
class label : public control {
|
||||
std::wstring m_text;
|
||||
bool m_text_owned;
|
||||
@ -19,8 +18,8 @@ namespace d2_tweaks {
|
||||
std::vector<respos> m_respos;
|
||||
public:
|
||||
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_font_t font = diablo2::UI_FONT_16);
|
||||
diablo2::ui_color_t color = diablo2::UI_COLOR_WHITE,
|
||||
diablo2::ui_font_t font = diablo2::UI_FONT_16);
|
||||
explicit label(menu* menu, const pugi::xml_node& node);
|
||||
|
||||
void set_text(const std::wstring& text) {
|
||||
@ -31,7 +30,6 @@ namespace d2_tweaks {
|
||||
return m_text;
|
||||
}
|
||||
|
||||
|
||||
diablo2::ui_color_t get_color() const {
|
||||
return m_color;
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ namespace d2_tweaks {
|
||||
bool process_middle_mouse(bool up);
|
||||
bool process_mouse_wheel(bool up);
|
||||
|
||||
|
||||
bool process_key_event(uint32_t key, bool up);
|
||||
};
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ namespace diablo2 {
|
||||
static bool get_ui_window_state(ui_window_t window);
|
||||
static void* get_buysellbtn();
|
||||
|
||||
|
||||
static void play_sound(uint32_t soundId, structures::unit* u, uint32_t ticks, BOOL prePick, uint32_t cache);
|
||||
|
||||
static structures::unit* get_unit_by_guid(int32_t type, int32_t guid);
|
||||
@ -68,13 +67,13 @@ namespace diablo2 {
|
||||
static void print_chat(wchar_t* string, uint32_t color);
|
||||
|
||||
static bool cache_gfx_data(structures::gfxdata* gfxData,
|
||||
structures::unit* unit,
|
||||
structures::cellfile* cellfFile,
|
||||
int32_t direction,
|
||||
int32_t frame,
|
||||
int32_t* outIndex,
|
||||
int8_t flags,
|
||||
int32_t colorTint);
|
||||
structures::unit* unit,
|
||||
structures::cellfile* cellfFile,
|
||||
int32_t direction,
|
||||
int32_t frame,
|
||||
int32_t* outIndex,
|
||||
int8_t flags,
|
||||
int32_t colorTint);
|
||||
|
||||
static structures::cellfile* load_gfx_resource(char* path);
|
||||
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 void set_ui_toggle(int nToggle, int nUIState, BOOL bToggle);
|
||||
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -43,10 +43,9 @@ namespace diablo2 {
|
||||
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 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 uint32_t __fastcall diablo2::d2_game::transmogrify(diablo2::structures::game* game, diablo2::structures::unit* player);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -18,6 +18,5 @@ namespace diablo2 {
|
||||
static int32_t get_resolution_mode();
|
||||
static void draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma, int32_t drawType, void* palette);
|
||||
static void draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl);
|
||||
|
||||
};
|
||||
}
|
@ -4,52 +4,52 @@
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
struct inventory;
|
||||
|
||||
struct npc_gamble //sizeof 0xC
|
||||
{
|
||||
inventory* pInventory; //+00
|
||||
uint32_t dwGUID; //+04 npc_gamble* pNext; //+08
|
||||
};
|
||||
struct npc_gamble //sizeof 0xC
|
||||
{
|
||||
inventory* pInventory; //+00
|
||||
uint32_t dwGUID; //+04 npc_gamble* pNext; //+08
|
||||
};
|
||||
|
||||
struct npc_record //sizeof 0x44
|
||||
{
|
||||
int nNPC; //+00
|
||||
inventory* pInventory; //+04
|
||||
npc_gamble* pGamble; //+08
|
||||
bool bGambleInit; //+0C
|
||||
uint32_t* pMercData; //+10 //D2MercDataStrc*
|
||||
uint32_t* pEvent; //+14 //D2NPCEventStrc*
|
||||
uint32_t* pVendorChain; //+18 //D2VendorChainStrc*
|
||||
bool bTrading; //+1C
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
bool bFlags[8]; //+20
|
||||
struct
|
||||
{
|
||||
bool bVendorInit; //+20
|
||||
bool bHireInit; //+21
|
||||
uint8_t nAct; //+22
|
||||
bool bTrader; //+23
|
||||
bool bLevelRefresh; //+24
|
||||
bool bInited; //+25
|
||||
bool bForceVendor; //+26
|
||||
bool bRefreshInventory; //+27
|
||||
};
|
||||
};
|
||||
struct npc_record //sizeof 0x44
|
||||
{
|
||||
int nNPC; //+00
|
||||
inventory* pInventory; //+04
|
||||
npc_gamble* pGamble; //+08
|
||||
bool bGambleInit; //+0C
|
||||
uint32_t* pMercData; //+10 //D2MercDataStrc*
|
||||
uint32_t* pEvent; //+14 //D2NPCEventStrc*
|
||||
uint32_t* pVendorChain; //+18 //D2VendorChainStrc*
|
||||
bool bTrading; //+1C
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
bool bFlags[8]; //+20
|
||||
struct
|
||||
{
|
||||
bool bVendorInit; //+20
|
||||
bool bHireInit; //+21
|
||||
uint8_t nAct; //+22
|
||||
bool bTrader; //+23
|
||||
bool bLevelRefresh; //+24
|
||||
bool bInited; //+25
|
||||
bool bForceVendor; //+26
|
||||
bool bRefreshInventory; //+27
|
||||
};
|
||||
};
|
||||
|
||||
uint32_t dwTicks; //+28
|
||||
uint32_t pProxy[4]; //+2C //D2UnitProxyStrc
|
||||
uint32_t dwUnk; //+3C
|
||||
uint32_t dwNPCGUID; //+40
|
||||
};
|
||||
uint32_t dwTicks; //+28
|
||||
uint32_t pProxy[4]; //+2C //D2UnitProxyStrc
|
||||
uint32_t dwUnk; //+3C
|
||||
uint32_t dwNPCGUID; //+40
|
||||
};
|
||||
|
||||
uint32_t pTrade; //+20 //D2NPCTradeStrc
|
||||
};
|
||||
};
|
||||
}
|
||||
uint32_t pTrade; //+20 //D2NPCTradeStrc
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
@ -23,8 +23,6 @@ namespace diablo2 {
|
||||
struct quest_record;
|
||||
struct npc_record;
|
||||
|
||||
|
||||
|
||||
enum class unit_type_t : int32_t {
|
||||
UNIT_TYPE_PLAYER = 0,
|
||||
UNIT_TYPE_MONSTER = 1,
|
||||
@ -76,8 +74,6 @@ namespace diablo2 {
|
||||
ITEMFLAG_ITEM = 0x08000000
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct unit {
|
||||
unit_type_t type;
|
||||
|
||||
|
@ -23,8 +23,6 @@ namespace diablo2 {
|
||||
mpq_streambuf m_streambuf;
|
||||
public:
|
||||
explicit mpq_ifstream(const std::string& path);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ static void* allocate_function_stub(void* origin, void* ptr, size_t size) {
|
||||
if (!current_stub) {
|
||||
current_stub =
|
||||
VirtualAlloc(nullptr, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE,
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
}
|
||||
|
||||
if (!current_stub)
|
||||
|
@ -74,7 +74,7 @@ CIni::CIni(LPCTSTR lpPathName)
|
||||
CIni::~CIni()
|
||||
{
|
||||
if (m_pszPathName != NULL)
|
||||
delete [] m_pszPathName;
|
||||
delete[] m_pszPathName;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -92,7 +92,7 @@ void CIni::SetPathName(LPCTSTR lpPathName)
|
||||
else
|
||||
{
|
||||
if (m_pszPathName != NULL)
|
||||
delete [] m_pszPathName;
|
||||
delete[] m_pszPathName;
|
||||
|
||||
m_pszPathName = _tcsdup(lpPathName);
|
||||
}
|
||||
@ -143,7 +143,7 @@ DWORD CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD d
|
||||
dwLen = min(dwLen, dwBufSize);
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwLen;
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ CString CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault) con
|
||||
{
|
||||
LPTSTR psz = __GetStringDynamic(lpSection, lpKey, lpDefault);
|
||||
CString str(psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
@ -177,8 +177,8 @@ BOOL CIni::AppendString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpString) cons
|
||||
TCHAR* pNewString = new TCHAR[_tcslen(psz) + _tcslen(lpString) + 1];
|
||||
_stprintf(pNewString, _T("%s%s"), psz, lpString);
|
||||
const BOOL RES = WriteString(lpSection, lpKey, pNewString);
|
||||
delete [] pNewString;
|
||||
delete [] psz;
|
||||
delete[] pNewString;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
|
||||
const DWORD MAX_LEN = _tcslen(psz) + 2;
|
||||
LPTSTR p = new TCHAR[MAX_LEN + 1];
|
||||
dwCopied = __StringSplit(psz, p, MAX_LEN, lpDelimiter, bTrimString);
|
||||
delete [] p;
|
||||
delete[] p;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -215,12 +215,12 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw
|
||||
}
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwCopied;
|
||||
}
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCTSTR lpDelimiter, BOOL bTrimString) const
|
||||
void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter, BOOL bTrimString) const
|
||||
{
|
||||
if (pArray != NULL)
|
||||
pArray->RemoveAll();
|
||||
@ -232,12 +232,12 @@ void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCT
|
||||
LPTSTR psz = new TCHAR[LEN + 3];
|
||||
GetArray(lpSection, lpKey, psz, LEN + 2, lpDelimiter);
|
||||
ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
BOOL CIni::WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray *pArray, int nWriteCount, LPCTSTR lpDelimiter) const
|
||||
BOOL CIni::WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount, LPCTSTR lpDelimiter) const
|
||||
{
|
||||
if (pArray == NULL)
|
||||
return FALSE;
|
||||
@ -385,7 +385,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
|
||||
DWORD dwLen = _tcslen(psz) / 2;
|
||||
if (dwLen <= dwOffset)
|
||||
{
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
|
||||
}
|
||||
else
|
||||
{
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -425,7 +425,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR
|
||||
{
|
||||
dwProcLen = dwLen - dwOffset;
|
||||
}
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwProcLen;
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ BOOL CIni::WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWOR
|
||||
for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2)
|
||||
_stprintf(&psz[j], _T("%02X"), lpb[i]);
|
||||
const BOOL RES = WriteString(lpSection, lpKey, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ BOOL CIni::AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWO
|
||||
for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2)
|
||||
_stprintf(&psz[j], _T("%02X"), lpb[i]);
|
||||
const BOOL RES = AppendString(lpSection, lpKey, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@ -514,12 +514,12 @@ DWORD CIni::GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
|
||||
while (dwCopied + 2 >= dwLen)
|
||||
{
|
||||
dwLen += DEF_PROFILE_THRESHOLD;
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
dwCopied = ::GetPrivateProfileSection(lpSection, psz, dwLen, m_pszPathName);
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwCopied + 2;
|
||||
}
|
||||
else
|
||||
@ -549,7 +549,7 @@ DWORD CIni::GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetKeyLines(lpSection, psz, LEN);
|
||||
ParseDNTString(psz, __KeyPairProc, (LPVOID)(&sl));
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
if (lpBuffer != NULL)
|
||||
lpBuffer[sl.dwTotalCopied] = _T('\0');
|
||||
return sl.dwTotalCopied;
|
||||
@ -567,12 +567,12 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const
|
||||
while (dwCopied + 2 >= dwLen)
|
||||
{
|
||||
dwLen += DEF_PROFILE_THRESHOLD;
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
dwCopied = ::GetPrivateProfileSectionNames(psz, dwLen, m_pszPathName);
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return dwCopied + 2;
|
||||
}
|
||||
else
|
||||
@ -582,7 +582,7 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const
|
||||
}
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
void CIni::GetSectionNames(CStringArray *pArray) const
|
||||
void CIni::GetSectionNames(CStringArray* pArray) const
|
||||
{
|
||||
if (pArray != NULL)
|
||||
pArray->RemoveAll();
|
||||
@ -594,13 +594,13 @@ void CIni::GetSectionNames(CStringArray *pArray) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetSectionNames(psz, LEN);
|
||||
ParseDNTString(psz, __SubStrAdd, pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
// Retrieve a list of key-lines(key-pairs) of the specified section
|
||||
void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const
|
||||
{
|
||||
if (pArray != NULL)
|
||||
pArray->RemoveAll();
|
||||
@ -612,13 +612,13 @@ void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetKeyLines(lpSection, psz, LEN);
|
||||
ParseDNTString(psz, __SubStrAdd, pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __AFXWIN_H__
|
||||
// Retrieve a list of key names of the specified section
|
||||
void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const
|
||||
{
|
||||
if (pArray == NULL)
|
||||
return;
|
||||
@ -628,7 +628,7 @@ void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetKeyNames(lpSection, psz, LEN);
|
||||
ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -658,7 +658,7 @@ BOOL CIni::IsSectionExist(LPCTSTR lpSection) const
|
||||
LPTSTR psz = new TCHAR[LEN + 1];
|
||||
GetSectionNames(psz, LEN);
|
||||
BOOL RES = !ParseDNTString(psz, __SubStrCompare, (LPVOID)lpSection);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ BOOL CIni::IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const
|
||||
// Test it with the default unique string
|
||||
LPTSTR psz = __GetStringDynamic(lpSection, lpKey, DEF_PROFILE_TESTSTRING);
|
||||
const BOOL RES = (_tcscmp(psz, DEF_PROFILE_TESTSTRING) != 0);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@ -695,7 +695,7 @@ BOOL CIni::CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIf
|
||||
//memset(psz, 0, sizeof(TCHAR) * (SRC_LEN + 2));
|
||||
GetKeyLines(lpSrcSection, psz, SRC_LEN);
|
||||
const BOOL RES = ::WritePrivateProfileSection(lpDestSection, psz, m_pszPathName);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
|
||||
return RES;
|
||||
}
|
||||
@ -717,7 +717,7 @@ BOOL CIni::CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection
|
||||
|
||||
LPTSTR psz = __GetStringDynamic(lpSrcSection, lpSrcKey);
|
||||
const BOOL RES = WriteString(lpDestSection, lpDestKey, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
return RES;
|
||||
}
|
||||
|
||||
@ -770,7 +770,7 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa
|
||||
while (dwCopied + 1 >= dwLen)
|
||||
{
|
||||
dwLen += DEF_PROFILE_THRESHOLD;
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psz = new TCHAR[dwLen + 1];
|
||||
dwCopied = ::GetPrivateProfileString(lpSection, lpKey, lpDefault == NULL ? _T("") : lpDefault, psz, dwLen, m_pszPathName);
|
||||
}
|
||||
@ -828,7 +828,7 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP
|
||||
lpTarget[COPY_LEN] = _T('\0');
|
||||
lpTarget = &lpTarget[SEG_LEN + 1];
|
||||
}
|
||||
delete [] pszSeg;
|
||||
delete[] pszSeg;
|
||||
lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search
|
||||
lpEnd = _tcsstr(lpPos, pszDel);
|
||||
}
|
||||
@ -849,9 +849,9 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP
|
||||
lpTarget[COPY_LEN] = _T('\0');
|
||||
}
|
||||
|
||||
delete [] pszSeg;
|
||||
delete[] pszSeg;
|
||||
lpBuffer[dwCopied] = _T('\0');
|
||||
delete [] pszDel;
|
||||
delete[] pszDel;
|
||||
return dwCopied;
|
||||
}
|
||||
|
||||
@ -890,10 +890,10 @@ BOOL CALLBACK CIni::__SubStrCompare(LPCTSTR lpString1, LPVOID lpParam)
|
||||
|
||||
// Callback function used to process a key-pair, it extracts the
|
||||
// key name from the key-pair string
|
||||
BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
BOOL CALLBACK CIni::__KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
{
|
||||
STR_LIMIT* psl = (STR_LIMIT*)lpParam;
|
||||
if (lpString == NULL || psl== NULL)
|
||||
if (lpString == NULL || psl == NULL)
|
||||
return FALSE;
|
||||
|
||||
LPCTSTR p = _tcschr(lpString, _T('='));
|
||||
@ -926,7 +926,7 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam)
|
||||
dwCopyLen = dwNameLen;
|
||||
}
|
||||
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
psl->dwTotalCopied += dwCopyLen + 1;
|
||||
return TRUE;
|
||||
}
|
||||
@ -1056,9 +1056,9 @@ BOOL CIni::__TrimString(LPTSTR lpString)
|
||||
// Trim left side
|
||||
LPCTSTR p = lpString;
|
||||
while (*p == _T(' ')
|
||||
|| *p == _T('\t')
|
||||
|| *p == _T('\r')
|
||||
|| *p == _T('\n'))
|
||||
|| *p == _T('\t')
|
||||
|| *p == _T('\r')
|
||||
|| *p == _T('\n'))
|
||||
{
|
||||
p = &p[1];
|
||||
bTrimmed = TRUE;
|
||||
@ -1068,7 +1068,7 @@ BOOL CIni::__TrimString(LPTSTR lpString)
|
||||
{
|
||||
LPTSTR psz = _tcsdup(p);
|
||||
_tcscpy(lpString, psz);
|
||||
delete [] psz;
|
||||
delete[] psz;
|
||||
}
|
||||
|
||||
return bTrimmed;
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
#include <d2tweaks/ui/ui_manager.h>
|
||||
|
||||
|
||||
#include <diablo2/structures/unit.h>
|
||||
#include <diablo2/structures/client_unit_list.h>
|
||||
#include <WinBase.h>
|
||||
@ -45,12 +44,6 @@
|
||||
std::vector<StatEntry> globalStatsVector;
|
||||
diablo2::structures::gfxdata g_gfxdata; // global gfxdata
|
||||
|
||||
int randStat;
|
||||
int randStatRangeLow;
|
||||
int randStatRangeHigh;
|
||||
int randStatBool;
|
||||
|
||||
|
||||
std::wstring ConvertCharToWString(const std::string& charString) {
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
return converter.from_bytes(charString);
|
||||
@ -99,8 +92,6 @@ diablo2::ui_color_t mapColorToEnum(const std::string& colorName) {
|
||||
return diablo2::ui_color_t::UI_COLOR_WHITE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Define a struct to hold key-value pairs within a section
|
||||
struct Section {
|
||||
std::map<std::string, std::string> assignments;
|
||||
@ -166,6 +157,14 @@ void ParseIniFile(const std::string& iniFilePath) {
|
||||
else if (key == "item_type_id") {
|
||||
entry.item_type_id = std::stoi(value);
|
||||
}
|
||||
// add op and param
|
||||
else if (key == "op") {
|
||||
entry.op = std::stoi(value);
|
||||
}
|
||||
// add op and param
|
||||
else if (key == "param") {
|
||||
entry.param = std::stoi(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,8 +213,8 @@ __declspec (naked) void handle_cs_packet_wrapper() {
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call [d2_tweaks::client::client::handle_cs_packet]
|
||||
popfd;
|
||||
call[d2_tweaks::client::client::handle_cs_packet]
|
||||
popfd;
|
||||
popad;
|
||||
// îðèãèíàëüíûå èíñòðóêöèè
|
||||
sub esp, 0x200;
|
||||
@ -223,13 +222,12 @@ __declspec (naked) void handle_cs_packet_wrapper() {
|
||||
RET_TO_RVA(DLLBASE_D2CLIENT, 0xD856);
|
||||
}
|
||||
|
||||
|
||||
__declspec (naked) void handle_sc_standart_packet_wrapper() {
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call[d2_tweaks::client::client::handle_standart_packet]
|
||||
popfd;
|
||||
popfd;
|
||||
popad;
|
||||
// îðèãèíàëüíûå èíñòðóêöèè
|
||||
sub esp, 0x54;
|
||||
@ -239,7 +237,6 @@ __declspec (naked) void handle_sc_standart_packet_wrapper() {
|
||||
RET_TO_RVA(DLLBASE_D2CLIENT, 0x150B5);
|
||||
}
|
||||
|
||||
|
||||
static const DLLPatchStrc gpt_handle_cs_packet[] =
|
||||
{
|
||||
{D2DLL_D2CLIENT, 0xD850 + 0, PATCH_JMP, FALSE, 0x1},
|
||||
@ -248,7 +245,6 @@ static const DLLPatchStrc gpt_handle_cs_packet[] =
|
||||
{D2DLL_INVALID}
|
||||
};
|
||||
|
||||
|
||||
static const DLLPatchStrc gpt_handle_sc_standart_packet[] =
|
||||
{
|
||||
{D2DLL_D2CLIENT, 0x150B0 + 0, PATCH_JMP, FALSE, 0x1},
|
||||
@ -256,7 +252,6 @@ static const DLLPatchStrc gpt_handle_sc_standart_packet[] =
|
||||
{D2DLL_INVALID}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::client::init() {
|
||||
// handle packet îáðàáàòûâàåò ïàêåò ïåðåä GamePacketReceivedIntercept
|
||||
hooking::hook(diablo2::d2_client::get_base() + 0x11CB0, handle_packet, reinterpret_cast<void**>(&g_handle_packet));
|
||||
@ -272,23 +267,10 @@ void d2_tweaks::client::client::init() {
|
||||
if (m_module == nullptr)
|
||||
break;
|
||||
|
||||
//randStat = GetPrivateProfileIntA("RandStat", "stat", 0, lpIniFilePath);
|
||||
//randStatRangeLow = GetPrivateProfileIntA("RandStat", "statRangeLow", 0, lpIniFilePath);
|
||||
//randStatRangeHigh = GetPrivateProfileIntA("RandStat", "statRangeHigh", 0, lpIniFilePath);
|
||||
//randStatBool = GetPrivateProfileIntA("RandStat", "statBool", 0, lpIniFilePath);
|
||||
|
||||
//spdlog::info("randStat = {0}", randStat);
|
||||
//spdlog::info("randStatRangeLow = {0}", randStatRangeLow);
|
||||
//spdlog::info("randStatRangeHigh = {0}", randStatRangeHigh);
|
||||
|
||||
|
||||
|
||||
// Load and parse the INI file
|
||||
ParseIniFile(iniFilePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
D2TEMPLATE_ApplyPatch(gpt_handle_cs_packet);
|
||||
//D2TEMPLATE_ApplyPatch(gpt_handle_sc_standart_packet);
|
||||
|
||||
@ -300,13 +282,12 @@ void d2_tweaks::client::client::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int32_t g_ebp_send_to_client;
|
||||
void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet, size_t size) {
|
||||
#ifndef NDEBUG
|
||||
__asm {
|
||||
push [ebp + 0x2C];
|
||||
pop [g_ebp_send_to_client];
|
||||
push[ebp + 0x2C];
|
||||
pop[g_ebp_send_to_client];
|
||||
}
|
||||
spdlog::warn("[d2client SEND] Packet {} Message {} Size {} CallFrom {}", (void*)packet->d2_packet_type, (void*)packet->message_type, size, (void*)g_ebp_send_to_client);
|
||||
#endif
|
||||
@ -325,7 +306,6 @@ void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet,
|
||||
handler->handle_cs_packet(packet);
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::client::handle_standart_packet(common::packet_header* packet, size_t size) {
|
||||
if (size == -1)
|
||||
return;
|
||||
@ -337,7 +317,6 @@ void d2_tweaks::client::client::handle_standart_packet(common::packet_header* pa
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::client::handle_packet(common::packet_header* packet, size_t size) {
|
||||
static common::packet_header dummy;
|
||||
static auto& instance = singleton<client>::instance();
|
||||
@ -362,10 +341,8 @@ void d2_tweaks::client::client::handle_packet(common::packet_header* packet, siz
|
||||
handler->handle_packet(packet);
|
||||
}
|
||||
|
||||
|
||||
static bool g_is_init = false;
|
||||
void d2_tweaks::client::client::game_tick() {
|
||||
|
||||
static auto& instance = singleton<client>::instance(); /// êîíôëèêò ñ òåêñòîì íà d2 gl
|
||||
|
||||
if (g_is_init == false) {
|
||||
@ -380,7 +357,7 @@ void d2_tweaks::client::client::game_tick() {
|
||||
g_is_init = true;
|
||||
}
|
||||
|
||||
for (auto & tick_handler : instance.m_tick_handlers) {
|
||||
for (auto& tick_handler : instance.m_tick_handlers) {
|
||||
if (tick_handler == nullptr)
|
||||
break;
|
||||
|
||||
@ -390,7 +367,6 @@ void d2_tweaks::client::client::game_tick() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int32_t d2_tweaks::client::client::draw_game_ui() {
|
||||
static auto& ui = singleton<ui::ui_manager>::instance();
|
||||
|
||||
@ -401,8 +377,6 @@ int32_t d2_tweaks::client::client::draw_game_ui() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void d2_tweaks::client::client::register_module(modules::client_module* module) {
|
||||
m_modules[m_module_id_counter++] = module;
|
||||
}
|
||||
|
@ -67,12 +67,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::init_early() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::init() {
|
||||
char acPathToIni[MAX_PATH] = { 0 };
|
||||
const char* pcIniFile = "\\d2tweaks.ini";
|
||||
@ -89,7 +86,6 @@ void d2_tweaks::client::modules::auto_gold_pickup::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::tick() {
|
||||
const auto unit = diablo2::d2_client::get_local_player();
|
||||
|
||||
@ -133,7 +129,6 @@ void d2_tweaks::client::modules::auto_gold_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_gold_pickup::handle_packet(common::packet_header* packet) {
|
||||
const auto info = static_cast<common::gold_pickup_info_sc*>(packet);
|
||||
m_nLastUpdate = GetTickCount();
|
||||
|
@ -67,7 +67,6 @@ static char m_acPathToIni[MAX_PATH] = { 0 };
|
||||
static const char* m_pcIniFile = "\\d2tweaks.ini";
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::init_early() {
|
||||
|
||||
}
|
||||
|
||||
void ReloadFilters(char* szPathToIni) {
|
||||
@ -120,7 +119,6 @@ void ReloadFilters(char* szPathToIni) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Parse ItemCode
|
||||
dwLenght = lstrlen(m_pcItemListAll);
|
||||
memcpy(m_pcItemListAllTemp, m_pcItemListAll, dwLenght + 1);
|
||||
@ -196,7 +194,6 @@ void ReloadFilters(char* szPathToIni) {
|
||||
token_string_itemcode = strtok(NULL, " ,|");
|
||||
}
|
||||
|
||||
|
||||
/// Parse ItemType Code
|
||||
dwLenght = lstrlen(m_pcItemTypesAll);
|
||||
memcpy(m_pcItemTypesAllTemp, m_pcItemTypesAll, dwLenght + 1);
|
||||
@ -272,7 +269,6 @@ void ReloadFilters(char* szPathToIni) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class auto_item_pickup_menu : public d2_tweaks::ui::menu {
|
||||
d2_tweaks::common::asset* m_buttons_img;
|
||||
d2_tweaks::ui::controls::button* m_auto_pickup_btn;
|
||||
@ -359,7 +355,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::init() {
|
||||
GetCurrentDirectory(MAX_PATH, m_acPathToIni);
|
||||
lstrcat(m_acPathToIni, m_pcIniFile);
|
||||
@ -375,7 +370,6 @@ void d2_tweaks::client::modules::auto_item_pickup::init() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) {
|
||||
char data[0x18];
|
||||
|
||||
@ -396,7 +390,6 @@ bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::u
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
static common::item_pickup_info_sc packet;
|
||||
const auto unit = diablo2::d2_client::get_local_player();
|
||||
@ -476,7 +469,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (itemtype_record_equiv2) {
|
||||
if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) {
|
||||
// ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1
|
||||
@ -527,7 +519,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < m_nCountItemListAll; i++)
|
||||
{
|
||||
if (record->string_code[0] == m_stItemList[i].code0 &&
|
||||
@ -560,7 +551,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void d2_tweaks::client::modules::auto_item_pickup::handle_packet(common::packet_header* packet) {
|
||||
const auto info = static_cast<common::item_pickup_info_sc*>(packet);
|
||||
|
||||
|
@ -140,7 +140,6 @@ public:
|
||||
|
||||
ULONGLONG lastSendTime = GetTickCount64();
|
||||
|
||||
|
||||
// Function to split a string into words
|
||||
std::vector<std::string> split(const std::string& s, char delim) {
|
||||
std::stringstream ss(s);
|
||||
@ -210,9 +209,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void draw() override {
|
||||
auto stats = globalStatsVector;
|
||||
int textOffset = 40; // Initial offset for the first line
|
||||
@ -232,119 +228,72 @@ public:
|
||||
// Initialize statValue
|
||||
int32_t statValue = 0;
|
||||
|
||||
if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) {
|
||||
diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50);
|
||||
}
|
||||
//if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) {
|
||||
// diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50);
|
||||
//}
|
||||
|
||||
if (m_stats_enabled) {
|
||||
for (const auto& stat : stats) {
|
||||
double param = 6;
|
||||
int param = stat.param;
|
||||
int op = stat.op;
|
||||
|
||||
int32_t spirits = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(185), NULL);
|
||||
int32_t soulscaptured = statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(184), NULL);
|
||||
|
||||
switch (stat.stat) {
|
||||
// 2. (statValue <- this is probably op stat1 ? * baseValue <- this is probably op base ) / 2 ^ param
|
||||
auto statline = diablo2::d2_common::get_item_stat_cost_record(stat.stat);
|
||||
|
||||
// (op stat1 value * base stat value) / (2 ^ param)
|
||||
// let's try this fucking thing
|
||||
auto opBase = statline->wOpBase;
|
||||
auto opStat = statline->wOpStat[0];
|
||||
|
||||
case 190: {
|
||||
// str/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 191: {
|
||||
// dex/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 192: {
|
||||
// vit/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 193: {
|
||||
// enr/spirits
|
||||
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
case 200: {
|
||||
// skills/souls
|
||||
param = 8;
|
||||
statValue = static_cast<int32_t>((1 * soulscaptured) / pow(2, param)); // what is the value of opStat_str
|
||||
break;
|
||||
}
|
||||
auto opBaseValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(opBase), NULL);
|
||||
auto opStatValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(opStat), NULL);
|
||||
|
||||
case 301: {
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
if (record->type == 104) {
|
||||
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 304: {
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
if (record->type == 104) {
|
||||
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// By default, get player stats
|
||||
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
int32_t diablo2::d2_common::set_stat(structures::unit* unit, unit_stats_t stat, uint32_t value, int16_t param) {
|
||||
static wrap_func_std_import<int32_t(structures::unit*, int32_t, int32_t, int32_t)> set_stat(10517, get_base());
|
||||
return set_stat(unit, stat, value, param);
|
||||
}
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::uniform_int_distribution<> dis(randStatRangeLow, randStatRangeHigh);
|
||||
unsigned int randomNumber = dis(gen);
|
||||
|
||||
std::random_device rdb;
|
||||
std::mt19937 genb(rdb());
|
||||
std::uniform_int_distribution<> randBool(1, 2);
|
||||
unsigned int randomBool = randBool(genb) - 1;
|
||||
|
||||
if (stat.is_item_stat == 1) {
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
int RandStatValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(randStat), NULL);
|
||||
|
||||
if (record->type == stat.item_type_id && RandStatValue != 0) {
|
||||
// set randStat value to random number 1 and 2^(32) = 4294967296
|
||||
diablo2::d2_common::set_stat(item, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0);
|
||||
diablo2::d2_common::set_stat(item, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0);
|
||||
}
|
||||
if (stat.is_item_stat == 0) {
|
||||
int32_t statvalue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
int basevalue = 1;
|
||||
switch (op) {
|
||||
case 0:
|
||||
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
break;
|
||||
case 1: // Formula: opstatbasevalue * statvalue / 100
|
||||
statValue = static_cast<int32_t>(opBaseValue) / 100;
|
||||
break;
|
||||
case 2: // Formula: (statvalue * basevalue) / (2 ^ param)
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
|
||||
break;
|
||||
case 3: // Percentage-based version of op #2
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
case 4: // Item-based stat increase
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
|
||||
break;
|
||||
case 5: // Percentage-based item increase
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
case 11: // Similar to op #1 and #13
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
case 13:
|
||||
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
|
||||
break;
|
||||
default:
|
||||
statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// set randStat value to random number 1 and 2^(32) = 4294967296
|
||||
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0);
|
||||
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0);
|
||||
|
||||
int statValue1 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStat), NULL);
|
||||
int statValue2 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), NULL);
|
||||
|
||||
if (statValue1 > 0 ) {
|
||||
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), 0, 0);
|
||||
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), 0, 0);
|
||||
for (auto item : items) {
|
||||
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
|
||||
if (record->type == stat.item_type_id) {
|
||||
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// write code to get player name and display it using MessageBox
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
auto name = player->player_data->name;
|
||||
|
||||
auto statValueStr = std::to_wstring(statValue);
|
||||
std::wstring statText = std::wstring(stat.stat_display_string);// .append(L" " + statValueStr);
|
||||
|
||||
@ -389,13 +338,9 @@ public:
|
||||
|
||||
// instead try to load direct jpg with gdi and insetad ofloading jpg file, specify it bb64 encoded and decode it.
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (m_help_enabled) {
|
||||
|
||||
const int windowWidth = 1280;
|
||||
const int windowHeight = 768;
|
||||
|
||||
@ -410,14 +355,10 @@ public:
|
||||
// Draw filled background box
|
||||
diablo2::d2_gfx::draw_filled_rect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0, 255);
|
||||
|
||||
|
||||
// Draw justified text inside the box with padding
|
||||
drawJustifiedTextInBox(helpText, boxX, boxY, boxWidth, boxHeight, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
diablo2::ui_color_t::UI_COLOR_WHITE;
|
||||
|
||||
// print player health, mana, and stamina bars, lastexp, nextexp, and level
|
||||
@ -540,15 +481,6 @@ public:
|
||||
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!should_draw()) {
|
||||
m_sort_inventory_btn->set_enabled(false);
|
||||
m_sort_inventory_btn->set_visible(false);
|
||||
|
@ -48,7 +48,6 @@ struct damage_label {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static growing_object_pool<damage_label> g_label_pool([]() {
|
||||
return new damage_label();
|
||||
});
|
||||
@ -99,12 +98,10 @@ static unsigned int g_font_player = 1;
|
||||
static unsigned int g_player_label_posx = 70;
|
||||
static unsigned int g_player_label_posy = 500;
|
||||
|
||||
|
||||
HWND findDiabloIIWindow() {
|
||||
return FindWindow(nullptr, TEXT("Diablo II")); // Change "Diablo II" to the exact title of the game window
|
||||
}
|
||||
|
||||
|
||||
// Function to draw the health bar using Windows GDI
|
||||
void drawHealthBar(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) {
|
||||
HDC hdc = GetDC(hWnd);
|
||||
@ -139,15 +136,12 @@ void OnLoad() {
|
||||
}
|
||||
|
||||
static void onDraw(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) {
|
||||
|
||||
if (GetTickCount64() >= nEndTime) {
|
||||
nEndTime = GetTickCount64() + DURATION;
|
||||
}
|
||||
drawHealthBar(hWnd, x, y, maxWidth, height, healthPercentage, fillColor, outlineColor);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void draw_damage_labels() {
|
||||
const auto player = diablo2::d2_client::get_local_player();
|
||||
|
||||
@ -272,18 +266,12 @@ static void draw_damage_labels() {
|
||||
const auto offset = static_cast<int32_t>(lerp(static_cast<float>(label->unit_height) + 5.f, static_cast<float>(label->unit_height) + 30.f, static_cast<float>(delta) / static_cast<float>(DISPLAY_TIME)));
|
||||
my -= offset;
|
||||
|
||||
|
||||
|
||||
|
||||
// Draw damage label
|
||||
std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" ";
|
||||
const wchar_t* dmgTextPtr = dmgText.c_str();
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_6);
|
||||
diablo2::d2_win::draw_text(const_cast<wchar_t*>(dmgTextPtr), textX + diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(combinedTextPtr)) / 2, my + label->unit_height / 2, textColor, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,7 +297,6 @@ static diablo2::ui_color_t damage_type_to_color(d2_tweaks::common::damage_type_t
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::damage_display::init_early() {
|
||||
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::damage_display::init() {
|
||||
@ -410,5 +397,4 @@ void d2_tweaks::client::modules::damage_display::handle_packet(common::packet_he
|
||||
}
|
||||
|
||||
void d2_tweaks::client::modules::damage_display::tick() {
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user