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

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

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

View File

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

View File

@ -47,6 +47,5 @@ namespace diablo2 {
static void update_inventory_items(structures::game* game, structures::unit* player); static 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

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

@ -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);
}
} }
} }
} }
@ -223,7 +222,6 @@ __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;
@ -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,7 +282,6 @@ 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
@ -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) {
@ -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;
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; break;
} case 2: // Formula: (statvalue * basevalue) / (2 ^ param)
statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
default: { break;
// By default, get player stats 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); statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
break; break;
} }
} }
else {
/*
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) { for (auto item : items) {
const auto record = diablo2::d2_common::get_item_record(item->data_record_index); const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
int RandStatValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(randStat), NULL); if (record->type == stat.item_type_id) {
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
}
}
}
if (record->type == stat.item_type_id && RandStatValue != 0) { // write code to get player name and display it using MessageBox
// set randStat value to random number 1 and 2^(32) = 4294967296 const auto player = diablo2::d2_client::get_local_player();
diablo2::d2_common::set_stat(item, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0); auto name = player->player_data->name;
diablo2::d2_common::set_stat(item, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0);
}
}
}
else {
// set randStat value to random number 1 and 2^(32) = 4294967296
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0);
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0);
int statValue1 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStat), NULL);
int statValue2 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), NULL);
if (statValue1 > 0 ) {
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), 0, 0);
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), 0, 0);
}
}
*/
auto statValueStr = std::to_wstring(statValue); 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() {
} }

View File

@ -77,7 +77,6 @@ public:
} }
}; };
void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(uint8_t* packet, size_t size) { void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(uint8_t* packet, size_t size) {
if (packet == 0 || size == 0) if (packet == 0 || size == 0)
return; return;
@ -94,7 +93,6 @@ void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(
return; return;
} }
__declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedInterceptASM() { __declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedInterceptASM() {
__asm __asm
{ {
@ -111,12 +109,9 @@ __declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacke
} }
} }
void d2_tweaks::client::modules::item_drop_message::init_early() { void d2_tweaks::client::modules::item_drop_message::init_early() {
} }
void d2_tweaks::client::modules::item_drop_message::init() { void d2_tweaks::client::modules::item_drop_message::init() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
const char* pcIniFile = "\\d2tweaks.ini"; const char* pcIniFile = "\\d2tweaks.ini";
@ -156,7 +151,6 @@ void d2_tweaks::client::modules::item_drop_message::init() {
} }
} }
void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet_header* packet) { void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet_header* packet) {
const auto info = static_cast<common::item_pickup_info_sc*>(packet); const auto info = static_cast<common::item_pickup_info_sc*>(packet);
const auto item_dropped_packet = static_cast<common::item_dropped_info_sc*>(packet); const auto item_dropped_packet = static_cast<common::item_dropped_info_sc*>(packet);

View File

@ -121,10 +121,8 @@ int32_t __fastcall item_click(diablo2::structures::unit* owner, diablo2::structu
} }
void d2_tweaks::client::modules::item_move::init_early() { void d2_tweaks::client::modules::item_move::init_early() {
} }
void d2_tweaks::client::modules::item_move::init() { void d2_tweaks::client::modules::item_move::init() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
const char* pcIniFile = "\\d2tweaks.ini"; const char* pcIniFile = "\\d2tweaks.ini";
@ -138,7 +136,6 @@ void d2_tweaks::client::modules::item_move::init() {
} }
} }
// handle packet coming from the server // handle packet coming from the server
void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* packet) { void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* packet) {
static auto& instance = singleton<client>::instance(); static auto& instance = singleton<client>::instance();

View File

@ -28,7 +28,6 @@ static HANDLE __fastcall delete_save_file(char* name, char* a2) {
return g_delete_save_file_original(name, a2); return g_delete_save_file_original(name, a2);
} }
void d2_tweaks::client::modules::loot_filter::init_early() { void d2_tweaks::client::modules::loot_filter::init_early() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
const char* pcIniFile = "\\d2tweaks.ini"; const char* pcIniFile = "\\d2tweaks.ini";
@ -42,7 +41,6 @@ void d2_tweaks::client::modules::loot_filter::init_early() {
} }
} }
void d2_tweaks::client::modules::loot_filter::init() { void d2_tweaks::client::modules::loot_filter::init() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
const char* pcIniFile = "\\d2tweaks.ini"; const char* pcIniFile = "\\d2tweaks.ini";

View File

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

View File

@ -9,7 +9,6 @@
#include <DllNotify.h> #include <DllNotify.h>
#include <D2Template.h> #include <D2Template.h>
#include <diablo2/d2gfx.h> #include <diablo2/d2gfx.h>
#include <string> #include <string>
@ -98,10 +97,10 @@
#pragma pack(push, 1) #pragma pack(push, 1)
using namespace d2_tweaks::client::modules; using namespace d2_tweaks::client::modules;
bool m_stats_enabled = false; bool m_stats_enabled = true;
bool m_help_enabled = false; bool m_help_enabled = false;
bool m_cube_enabled = false; bool m_cube_enabled = false;
bool m_stash_enabled = false; bool m_stash_enabled = true;
d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settings_toggle_menu(token) { d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settings_toggle_menu(token) {
m_show = false; m_show = false;
@ -124,13 +123,11 @@ d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settin
m_filter_settings_menu = singleton<ui::ui_manager>::instance().get_menu("loot_filter_settings_menu"); m_filter_settings_menu = singleton<ui::ui_manager>::instance().get_menu("loot_filter_settings_menu");
m_btn_toggle_stats = static_cast<ui::controls::button*>(get_control("m_toggle_stats")); m_btn_toggle_stats = static_cast<ui::controls::button*>(get_control("m_toggle_stats"));
m_btn_toggle_stats->set_enabled(true); m_btn_toggle_stats->set_enabled(true);
m_btn_toggle_stats->set_visible(true); m_btn_toggle_stats->set_visible(true);
m_btn_toggle_stats->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stats_settings_click, this)); m_btn_toggle_stats->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stats_settings_click, this));
m_btn_toggle_help = static_cast<ui::controls::button*>(get_control("m_toggle_help")); m_btn_toggle_help = static_cast<ui::controls::button*>(get_control("m_toggle_help"));
m_btn_toggle_help->set_enabled(true); m_btn_toggle_help->set_enabled(true);
m_btn_toggle_help->set_visible(true); m_btn_toggle_help->set_visible(true);
@ -142,21 +139,25 @@ d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settin
m_btn_toggle_cube->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_cube_click, this)); m_btn_toggle_cube->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_cube_click, this));
m_btn_toggle_stash = static_cast<ui::controls::button*>(get_control("m_toggle_stash")); m_btn_toggle_stash = static_cast<ui::controls::button*>(get_control("m_toggle_stash"));
m_btn_toggle_stash->set_enabled(false);
m_btn_toggle_stash->set_visible(false);
auto player = diablo2::d2_client::get_local_player();
//iterate over all items in player inventory
for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
char* normCode1 = record->string_code;
if (strncmp(normCode1, "st0", 3) == 0) {
m_btn_toggle_stash->set_enabled(true); m_btn_toggle_stash->set_enabled(true);
m_btn_toggle_stash->set_visible(true); m_btn_toggle_stash->set_visible(true);
break; //auto player = diablo2::d2_client::get_local_player();
} ////iterate over all items in player inventory
} //for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
// const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
// char* normCode1 = record->string_code;
// if (strncmp(normCode1, "st0", 3) == 0) {
// m_btn_toggle_stash->set_enabled(true);
// m_btn_toggle_stash->set_visible(true);
// break;
// }
// else {
// m_btn_toggle_stash->set_enabled(false);
// m_btn_toggle_stash->set_visible(false);
// }
//}
m_btn_toggle_stash->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stash_click, this)); m_btn_toggle_stash->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stash_click, this));
} }
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_filter_settings_click() { void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_filter_settings_click() {
@ -173,7 +174,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stats_
m_stats_enabled = !m_stats_enabled; m_stats_enabled = !m_stats_enabled;
} }
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_click() { void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_click() {
m_cube_enabled = !m_cube_enabled; m_cube_enabled = !m_cube_enabled;
if (m_cube_enabled) { if (m_cube_enabled) {
@ -211,11 +211,8 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_c
// send to server7 to close cube packet 0x4F // send to server7 to close cube packet 0x4F
diablo2::d2_client::send_to_server_7(0x4F, 0x17, 0, 0); diablo2::d2_client::send_to_server_7(0x4F, 0x17, 0, 0);
} }
} }
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_click() { void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_click() {
m_stash_enabled = !m_stash_enabled; m_stash_enabled = !m_stash_enabled;
if (m_stash_enabled) { if (m_stash_enabled) {
const auto player = diablo2::d2_client::get_local_player(); const auto player = diablo2::d2_client::get_local_player();
@ -247,7 +244,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_
diablo2::d2_client::send_to_server(&packet, sizeof packet); diablo2::d2_client::send_to_server(&packet, sizeof packet);
} }
else { else {
//run a for loop and send th set_ui_toggle packet 255 times from 1 to 255 //run a for loop and send th set_ui_toggle packet 255 times from 1 to 255
diablo2::d2_client::set_ui_toggle(0x19, 1, FALSE); diablo2::d2_client::set_ui_toggle(0x19, 1, FALSE);
@ -256,7 +252,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_
} }
} }
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_help_click() { void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_help_click() {
//m_help_enabled = !m_help_enabled; //m_help_enabled = !m_help_enabled;
// Open the default OS browser to the URL // Open the default OS browser to the URL
@ -271,7 +266,6 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_help_c
// Unsupported platform // Unsupported platform
// You can add handling for other platforms here // You can add handling for other platforms here
#endif #endif
} }
void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::draw() { void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::draw() {

View File

@ -61,7 +61,6 @@ private:
static test_menu* g_test_menu; static test_menu* g_test_menu;
void d2_tweaks::client::modules::test::init_early() { void d2_tweaks::client::modules::test::init_early() {
} }
void d2_tweaks::client::modules::test::init() { void d2_tweaks::client::modules::test::init() {

View File

@ -48,7 +48,6 @@ enum trader_command {
COMMAND_ABORT COMMAND_ABORT
}; };
class trader_update_menu : public d2_tweaks::ui::menu { class trader_update_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_trader_update_btn; d2_tweaks::ui::controls::button* m_trader_update_btn;
@ -116,12 +115,9 @@ private:
} }
}; };
void d2_tweaks::client::modules::trader_update::init_early() { void d2_tweaks::client::modules::trader_update::init_early() {
} }
void d2_tweaks::client::modules::trader_update::init() { void d2_tweaks::client::modules::trader_update::init() {
char szDir[MAX_PATH]; char szDir[MAX_PATH];
char szPath[MAX_PATH]; char szPath[MAX_PATH];
@ -139,12 +135,10 @@ void d2_tweaks::client::modules::trader_update::init() {
} }
} }
void d2_tweaks::client::modules::trader_update::tick() { void d2_tweaks::client::modules::trader_update::tick() {
// const auto unit = diablo2::d2_client::get_local_player(); // const auto unit = diablo2::d2_client::get_local_player();
} }
void d2_tweaks::client::modules::trader_update::handle_cs_packet(common::packet_header* packet) { void d2_tweaks::client::modules::trader_update::handle_cs_packet(common::packet_header* packet) {
static auto& instance = singleton<client>::instance(); static auto& instance = singleton<client>::instance();
const auto income_packet_cs = static_cast<common::d2_entity_action_cs*>(packet); const auto income_packet_cs = static_cast<common::d2_entity_action_cs*>(packet);
@ -156,7 +150,6 @@ void d2_tweaks::client::modules::trader_update::handle_cs_packet(common::packet_
m_nNpcId = (income_packet_cs->action >> 24); m_nNpcId = (income_packet_cs->action >> 24);
} }
void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_header* packet) { void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_header* packet) {
static auto& instance = singleton<client>::instance(); static auto& instance = singleton<client>::instance();
const auto income_packet_sc = static_cast<common::trader_update_sc*>(packet); const auto income_packet_sc = static_cast<common::trader_update_sc*>(packet);
@ -201,4 +194,3 @@ void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_hea
} }
} }
} }

View File

@ -189,7 +189,6 @@ __declspec (naked) void hook_game_end_asm() {
} }
void d2_tweaks::client::modules::transmute::init_early() { void d2_tweaks::client::modules::transmute::init_early() {
} }
void d2_tweaks::client::modules::transmute::init() { void d2_tweaks::client::modules::transmute::init() {
@ -316,7 +315,6 @@ void d2_tweaks::client::modules::transmute::init() {
token_string_itemcode = strtok(NULL, " ,|"); token_string_itemcode = strtok(NULL, " ,|");
} }
/////// Parse ItemType /////// Parse ItemType
dwLenght = lstrlen(m_acItemTypesAll); dwLenght = lstrlen(m_acItemTypesAll);
memcpy(m_acItemTypesAllTemp, m_acItemTypesAll, dwLenght + 1); memcpy(m_acItemTypesAllTemp, m_acItemTypesAll, dwLenght + 1);
@ -403,7 +401,6 @@ void d2_tweaks::client::modules::transmute::init() {
} }
} }
void d2_tweaks::client::modules::transmute::tick() { void d2_tweaks::client::modules::transmute::tick() {
const auto unit = diablo2::d2_client::get_local_player(); const auto unit = diablo2::d2_client::get_local_player();
@ -529,7 +526,6 @@ L1:;
m_nCountFrames++; m_nCountFrames++;
} }
void d2_tweaks::client::modules::transmute::handle_packet(common::packet_header* packet) { void d2_tweaks::client::modules::transmute::handle_packet(common::packet_header* packet) {
static auto& instance = singleton<client>::instance(); static auto& instance = singleton<client>::instance();
const auto income_packet_sc = static_cast<common::transmute_info_sc*>(packet); const auto income_packet_sc = static_cast<common::transmute_info_sc*>(packet);

View File

@ -25,7 +25,6 @@ void d2_tweaks::server::modules::auto_gold_pickup::init() {
} }
} }
bool d2_tweaks::server::modules::auto_gold_pickup::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) { bool d2_tweaks::server::modules::auto_gold_pickup::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
const auto income_packet_cs = static_cast<common::gold_pickup_info_cs*>(packet); const auto income_packet_cs = static_cast<common::gold_pickup_info_cs*>(packet);
static auto& instance = singleton<server>::instance(); static auto& instance = singleton<server>::instance();
@ -39,7 +38,6 @@ bool d2_tweaks::server::modules::auto_gold_pickup::handle_packet(diablo2::struct
return true; return true;
} }
bool d2_tweaks::server::modules::auto_gold_pickup::au_pickup_gold(diablo2::structures::game* game, diablo2::structures::unit* unit, diablo2::structures::unit* item) bool d2_tweaks::server::modules::auto_gold_pickup::au_pickup_gold(diablo2::structures::game* game, diablo2::structures::unit* unit, diablo2::structures::unit* item)
{ {
static common::gold_pickup_info_sc packet; static common::gold_pickup_info_sc packet;
@ -58,7 +56,6 @@ bool d2_tweaks::server::modules::auto_gold_pickup::au_pickup_gold(diablo2::struc
return TRUE; return TRUE;
} }
void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::game* game, void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::game* game,
diablo2::structures::unit* unit) { diablo2::structures::unit* unit) {
//static common::gold_pickup_info_sc packet; //static common::gold_pickup_info_sc packet;
@ -102,4 +99,3 @@ void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::gam
// continue; // continue;
//} //}
} }

View File

@ -44,7 +44,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
//if (!room) //if (!room)
// return; // return;
//for (auto item = room->unit; item; item = item->prev_unit_in_room) { //for (auto item = room->unit; item; item = item->prev_unit_in_room) {
// if (!item) // if (!item)
// continue; // continue;
@ -92,7 +91,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
// } // }
// } // }
// if (itemtype_record_equiv2) { // if (itemtype_record_equiv2) {
// if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) { // if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) {
// // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1 // // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1
@ -110,7 +108,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
// } // }
// } // }
// for (uint32_t i = 0; i < g_pickup_count_itemtype_code; i++) // for (uint32_t i = 0; i < g_pickup_count_itemtype_code; i++)
// { // {
// for (uint32_t count = 0; count < index_arr_itemtype; count++) // for (uint32_t count = 0; count < index_arr_itemtype; count++)
@ -126,7 +123,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
// } // }
// } // }
// for (uint32_t i = 0; i < g_pickup_count_all_items; i++) // for (uint32_t i = 0; i < g_pickup_count_all_items; i++)
// { // {
// if (record->string_code[0] == g_pickup_itemcode_st[i].code0 && // if (record->string_code[0] == g_pickup_itemcode_st[i].code0 &&
@ -148,7 +144,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam
////spdlog::info("current {0}", g_tick_between_item_pickup); ////spdlog::info("current {0}", g_tick_between_item_pickup);
} }
bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::structures::game* game, diablo2::structures::unit* unit, uint32_t guid) bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::structures::game* game, diablo2::structures::unit* unit, uint32_t guid)
{ {
static common::item_pickup_info_sc packet; static common::item_pickup_info_sc packet;
@ -166,7 +161,6 @@ bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::struc
return true; return true;
} }
bool d2_tweaks::server::modules::auto_item_pickup::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) { bool d2_tweaks::server::modules::auto_item_pickup::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) {
const auto income_packet_cs = static_cast<common::item_pickup_info_cs*>(packet); const auto income_packet_cs = static_cast<common::item_pickup_info_cs*>(packet);
static auto& instance = singleton<server>::instance(); static auto& instance = singleton<server>::instance();

View File

@ -36,17 +36,17 @@ struct packed_area {
uint8_t h; uint8_t h;
}; };
// Define the inventory zone // Define variables to store the inventory zone values
int iminValidX = 0; int iminValidX = GetPrivateProfileInt("InventoryZone", "iminValidX", 0, "./D2Tweaks.ini");
int imaxValidX = 15; int imaxValidX = GetPrivateProfileInt("InventoryZone", "imaxValidX", 0, "./D2Tweaks.ini");
int iminValidY = 0; int iminValidY = GetPrivateProfileInt("InventoryZone", "iminValidY", 0, "./D2Tweaks.ini");
int imaxValidY = 12; int imaxValidY = GetPrivateProfileInt("InventoryZone", "imaxValidY", 0, "./D2Tweaks.ini");
// Define the charm zone // Define variables to store the charm zone values
int cminValidX = 0; int cminValidX = GetPrivateProfileInt("CharmZone", "cminValidX", 0, "./D2Tweaks.ini");
int cmaxValidX = 15; int cmaxValidX = GetPrivateProfileInt("CharmZone", "cmaxValidX", 0, "./D2Tweaks.ini");
int cminValidY = 12; int cminValidY = GetPrivateProfileInt("CharmZone", "cminValidY", 0, "./D2Tweaks.ini");
int cmaxValidY = 15; int cmaxValidY = GetPrivateProfileInt("CharmZone", "cmaxValidY", 0, "./D2Tweaks.ini");
void d2_tweaks::server::modules::autosort::init() { void d2_tweaks::server::modules::autosort::init() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
@ -62,7 +62,6 @@ void d2_tweaks::server::modules::autosort::init() {
bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::game* game, bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::game* game,
diablo2::structures::unit* player, common::packet_header* packet) { diablo2::structures::unit* player, common::packet_header* packet) {
if (static_cast<common::inventory_sort_cs*>(packet)->remItem == 1) { if (static_cast<common::inventory_sort_cs*>(packet)->remItem == 1) {
diablo2::d2_common::inv_remove_item(player->inventory, static_cast<common::inventory_sort_cs*>(packet)->item_to_remove); diablo2::d2_common::inv_remove_item(player->inventory, static_cast<common::inventory_sort_cs*>(packet)->item_to_remove);
diablo2::d2_game::update_inventory_items(game, player); diablo2::d2_game::update_inventory_items(game, player);
@ -71,12 +70,9 @@ bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::ga
for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) { for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
if (item == static_cast<common::inventory_sort_cs*>(packet)->item_to_remove) { if (item == static_cast<common::inventory_sort_cs*>(packet)->item_to_remove) {
diablo2::d2_common::inv_remove_item(player->inventory, item); diablo2::d2_common::inv_remove_item(player->inventory, item);
diablo2::d2_game::update_inventory_items(game, player); diablo2::d2_game::update_inventory_items(game, player);
} }
} }
MessageBoxA(NULL, "Item removed", "Item removed", MB_OK); MessageBoxA(NULL, "Item removed", "Item removed", MB_OK);
@ -163,11 +159,9 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game,
const auto itemsCount = items.size(); const auto itemsCount = items.size();
const auto charmsCount = charms.size(); const auto charmsCount = charms.size();
if (itemsCount == 0) if (itemsCount == 0)
return true; //there's nothing to sort return true; //there's nothing to sort
auto success = NULL; auto success = NULL;
if (itemsCount > 0) { if (itemsCount > 0) {
@ -219,7 +213,6 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game,
items_typed.erase(sorted_item->data_record_index); items_typed.erase(sorted_item->data_record_index);
} }
} }
if (charmsCount > 0) { if (charmsCount > 0) {
@ -365,7 +358,8 @@ bool d2_tweaks::server::modules::autosort::find_free_space(diablo2::structures::
} }
} }
return false; return false;
} else { }
else {
for (x = minValidX; x <= maxValidX - record->inv_width + 1; x++) { for (x = minValidX; x <= maxValidX - record->inv_width + 1; x++) {
for (y = minValidY; y <= inventoryMaxValidY - record->inv_height + 1; y++) { for (y = minValidY; y <= inventoryMaxValidY - record->inv_height + 1; y++) {
diablo2::structures::unit* blockingUnit = nullptr; diablo2::structures::unit* blockingUnit = nullptr;

View File

@ -14,7 +14,6 @@
#include <diablo2/structures/data/monstats_line.h> #include <diablo2/structures/data/monstats_line.h>
MODULE_INIT(damage_display) MODULE_INIT(damage_display)
static char(__fastcall* g_apply_attack_results_origin)(diablo2::structures::game* game, static char(__fastcall* g_apply_attack_results_origin)(diablo2::structures::game* game,
@ -76,7 +75,6 @@ static void send_damage_data(diablo2::structures::unit* defender,
spdlog::info("maxHp: {0}", packet.maxHp); spdlog::info("maxHp: {0}", packet.maxHp);
spdlog::info("damage: {0}", packet.damage); spdlog::info("damage: {0}", packet.damage);
if (packet.damage_type == d2_tweaks::common::DAMAGE_TYPE_UNKNOWN) if (packet.damage_type == d2_tweaks::common::DAMAGE_TYPE_UNKNOWN)
return; return;
@ -186,7 +184,8 @@ static void process_hireling_damage(diablo2::structures::game* game,
if (attacker->is_hireling()) { if (attacker->is_hireling()) {
owner = get_hireling_owner(game, attacker); owner = get_hireling_owner(game, attacker);
} else if (defender->is_hireling()) { }
else if (defender->is_hireling()) {
owner = get_hireling_owner(game, defender); owner = get_hireling_owner(game, defender);
} }
@ -204,7 +203,8 @@ static void process_pet_damage(diablo2::structures::game* game,
if (attacker->is_pet()) { if (attacker->is_pet()) {
owner = get_pet_owner(game, attacker); owner = get_pet_owner(game, attacker);
} else if (defender->is_pet()) { }
else if (defender->is_pet()) {
owner = get_pet_owner(game, defender); owner = get_pet_owner(game, defender);
} }

View File

@ -133,4 +133,3 @@ void d2_tweaks::server::modules::identify_on_pickup::init() {
g_item_Tempered = GetPrivateProfileInt("IdentifyOnPickup", "Tempered", 1, acPathToIni); g_item_Tempered = GetPrivateProfileInt("IdentifyOnPickup", "Tempered", 1, acPathToIni);
} }
} }

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