36 Commits

Author SHA1 Message Date
Hash Borgir
df8d43422e middle clicks gems to store 2024-05-19 20:46:16 -06:00
Hash Borgir
488e2a0c2e close button working.Need to add misc pots 2024-05-19 19:35:35 -06:00
Hash Borgir
4d21c90f5a Latest fixes 2024-05-10 00:19:14 -06:00
Hash Borgir
058db50095 Added 250ms delay to sendPacketAndUpdateProperty 2024-05-09 09:13:42 -06:00
Hash Borgir
43defeb6d8 page 99 problem fixed, need to clean code 2024-05-08 18:55:59 -06:00
Hash Borgir
dc76f5627b r01 not extracting. 2024-05-08 17:56:23 -06:00
Hash Borgir
d75e045bc7 custom panel stat display 2024-05-07 17:44:20 -06:00
Hash Borgir
e431b3f7d4 extract item stat fix 2024-05-07 13:58:58 -06:00
Hash Borgir
551f3e44f2 HP/Mana storage working 2024-05-07 08:31:54 -06:00
Hash Borgir
41a4c4d181 Code optimization, reduce repetitive code. 2024-05-07 05:31:18 -06:00
Hash Borgir
9719a540df Clean up 2024-05-06 23:45:45 -06:00
Hash Borgir
408aee62c1 Rejuv potiuons added to extractor 2024-05-06 23:00:55 -06:00
Hash Borgir
a61dce8f03 Extractor GUI done. Working... 2024-05-06 19:50:37 -06:00
Hash Borgir
5f220fa23e Working 2024-05-06 03:01:27 -06:00
Hash Borgir
4e02101d5d broken 2024-05-06 00:57:34 -06:00
Hash Borgir
ee810d5f38 Before gem implementation 2024-05-05 23:27:15 -06:00
Hash Borgir
343fa4253b Rune functions done. 2024-05-05 21:34:17 -06:00
Hash Borgir
331d1d75fe Extraction working 2024-05-05 20:39:25 -06:00
Hash Borgir
95f7d9bed3 Bag crashes upon hover. Need to debug. 2024-05-05 18:08:33 -06:00
Hash Borgir
3a7be104d9 Latest stable. 2024-05-05 10:41:26 -06:00
Hash Borgir
6141cc0a7b added transmorify wrapper 2024-05-04 12:06:59 -06:00
Hash Borgir
9e57031fdd cleanup 2024-05-04 12:05:34 -06:00
Hash Borgir
69965f77d1 Cleanup and fix itemtypes checks 2024-05-04 02:10:56 -06:00
Hash Borgir
aec114d05c Refactor/cleanup, had too many if conditions 2024-05-04 01:57:45 -06:00
Hash Borgir
06c28f4d56 Everything ini configurable 2024-05-03 07:34:36 -06:00
Hash Borgir
7fd617abd7 Stats display refactor using ini file done. 2024-05-02 21:43:43 -06:00
Hash Borgir
f8349e6ba1 close remtoe stash works 2024-05-01 13:42:06 -06:00
Hash Borgir
d33c619372 Cube opening works 2024-04-30 23:24:36 -06:00
Hash Borgir
56a49ff1e0 added more item types and codes to right click to send to cube 2024-04-29 12:23:23 -06:00
Hash Borgir
4d8fe9b2e2 Seems to be working 2024-04-29 04:58:24 -06:00
Hash Borgir
8f5c45d1c5 Gems not going back to inv, runes do. May need to revert 2024-04-29 04:53:56 -06:00
Hash Borgir
b5587695e8 Right click moving gems to cube and back is working. 2024-04-29 04:16:36 -06:00
Hash Borgir
27d93fa91e Latest 2024-04-29 02:48:40 -06:00
Hash Borgir
78fcd692b2 saving added gems to .boh file working 2024-04-28 14:15:06 -06:00
Hash Borgir
87d4758efc key local var? 2024-04-28 12:16:04 -06:00
Hash Borgir
74f1d9de01 Working on right click gem extraction 2024-04-28 12:09:32 -06:00
182 changed files with 6499 additions and 2309 deletions

2
ClassDiagram.cd Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram />

BIN
D2tweaks.aps Normal file

Binary file not shown.

View File

@@ -47,12 +47,12 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\..\Diablo II\MODS\ironman-dev</OutDir> <OutDir>..\..\Diablo II\MODS\ironman-dev\</OutDir>
<IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\..\Diablo II\MODS\ironman-dev</OutDir> <OutDir>..\..\Diablo II\MODS\ironman-dev\</OutDir>
<IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)Build\$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -180,6 +180,7 @@
<ClCompile Include="vendor\minhook\src\trampoline.c" /> <ClCompile Include="vendor\minhook\src\trampoline.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ClassDiagram.cd" />
<None Include="vendor\minhook\dll_resources\MinHook.def" /> <None Include="vendor\minhook\dll_resources\MinHook.def" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -279,6 +280,7 @@
<ClInclude Include="include\diablo2\utils\screen.h" /> <ClInclude Include="include\diablo2\utils\screen.h" />
<ClInclude Include="include\fw\pool.h" /> <ClInclude Include="include\fw\pool.h" />
<ClInclude Include="include\fw\singleton.h" /> <ClInclude Include="include\fw\singleton.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="vendor\D2Template\D2Template.h" /> <ClInclude Include="vendor\D2Template\D2Template.h" />
<ClInclude Include="vendor\D2Template\D2TemplateConstants.h" /> <ClInclude Include="vendor\D2Template\D2TemplateConstants.h" />
<ClInclude Include="vendor\D2Template\D2TemplateDataTables.h" /> <ClInclude Include="vendor\D2Template\D2TemplateDataTables.h" />

Binary file not shown.

View File

@@ -1,3 +1,39 @@
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.  client.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
auto_gold_pickup_client.cpp
auto_item_pickup_client.cpp
damage_display_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(135,12): warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(140,31): warning C4244: '=': conversion from 'ULONGLONG' to 'long', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(264,59): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
item_drop_message_client.cpp
item_move_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\item_move\item_move_client.cpp(99,33): warning C4018: '<': signed/unsigned mismatch
loot_filter.cpp
loot_filter_settings.cpp
loot_filter_settings_menu.cpp
loot_filter_settings_toggle_menu.cpp
test.cpp
trader_update_client.cpp
transmute_client.cpp
autosort_server.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\autosort\autosort_server.cpp(363,25): warning C4018: '<=': signed/unsigned mismatch
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\autosort\autosort_server.cpp(364,26): warning C4018: '<=': signed/unsigned mismatch
auto_gold_pickup_server.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\auto_gold_pickup\auto_gold_pickup_server.cpp(49,33): warning C4018: '>': signed/unsigned mismatch
auto_item_pickup_server.cpp
damage_display_server.cpp
identify_on_pickup_server.cpp
item_drop_message_server.cpp
item_move_server.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\item_move\item_move_server.cpp(144,1): warning C4715: 'd2_tweaks::server::modules::item_move::handle_packet': not all control paths return a value
test.cpp
trader_update_server.cpp
transmute_server.cpp
ui_manager.cpp ui_manager.cpp
d2common.cpp
screen.cpp
LINK : ..\..\Diablo II\MODS\ironman-dev\D2tweaks.dll not found or not built by the last incremental link; performing full link
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

@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

View File

@@ -13,20 +13,17 @@
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_cube_enabled;
extern bool m_stash_enabled;
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {

View File

@@ -15,6 +15,99 @@ namespace d2_tweaks {
bool show_runes; bool show_runes;
bool show_gems; bool show_gems;
bool m_show_r01;
bool m_show_r02;
bool m_show_r03;
bool m_show_r04;
bool m_show_r05;
bool m_show_r06;
bool m_show_r07;
bool m_show_r08;
bool m_show_r09;
bool m_show_r10;
bool m_show_r11;
bool m_show_r12;
bool m_show_r13;
bool m_show_r14;
bool m_show_r15;
bool m_show_r16;
bool m_show_r17;
bool m_show_r18;
bool m_show_r19;
bool m_show_r20;
bool m_show_r21;
bool m_show_r22;
bool m_show_r23;
bool m_show_r24;
bool m_show_r25;
bool m_show_r26;
bool m_show_r27;
bool m_show_r28;
bool m_show_r29;
bool m_show_r30;
bool m_show_r31;
bool m_show_r32;
bool m_show_r33;
bool m_show_amethyst;
bool m_show_diamond;
bool m_show_emerald;
bool m_show_ruby;
bool m_show_sapphire;
bool m_show_skull;
bool m_show_topaz;
bool m_show_chipped;
bool m_show_flawed;
bool m_show_normal;
bool m_show_flawless;
bool m_show_perfect;
bool m_show_rough;
bool m_show_faded;
bool m_show_blemished;
bool m_show_cleaned;
bool m_show_triangle;
bool m_show_trangle_cut;
bool m_show_square;
bool m_show_square_cut;
bool m_show_regular;
bool m_show_regular_cut;
bool m_show_star;
bool m_show_star_cut;
bool m_show_imperial;
bool m_show_imperial_cut;
bool m_show_royal;
bool m_show_royal_cut;
bool m_show_spectacular;
bool m_show_legendary;
bool m_show_legendary_cut;
bool m_show_flourite;
bool m_show_jade;
bool m_show_argonite;
bool m_show_azurite;
bool m_show_sulpher;
bool m_show_quartz;
bool m_show_tiger_eye;
bool m_show_rejuv_potion;
bool m_show_full_rejuv_potion;
bool m_show_hp1;
bool m_show_hp2;
bool m_show_hp3;
bool m_show_hp4;
bool m_show_hp5;
bool m_show_mp1;
bool m_show_mp2;
bool m_show_mp3;
bool m_show_mp4;
bool m_show_mp5;
bool m_show_close;
bool quality_settings[static_cast<size_t>(diablo2::structures::item_quality_t::ITEM_QUALITY_COUNT)]; bool quality_settings[static_cast<size_t>(diablo2::structures::item_quality_t::ITEM_QUALITY_COUNT)];
char reserved[1004]; char reserved[1004];

View File

@@ -4,6 +4,9 @@
#include <d2tweaks/ui/menu.h> #include <d2tweaks/ui/menu.h>
#include <chrono> // Add this line
#include <diablo2/d2common.h>
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {
struct unit; struct unit;
@@ -26,6 +29,98 @@ namespace d2_tweaks {
ui::controls::checkbox* m_show_runes; ui::controls::checkbox* m_show_runes;
ui::controls::checkbox* m_show_gems; ui::controls::checkbox* m_show_gems;
ui::controls::checkbox* m_show_ruby;
ui::controls::checkbox* m_show_sapphire;
ui::controls::checkbox* m_show_emerald;
ui::controls::checkbox* m_show_diamond;
ui::controls::checkbox* m_show_topaz;
ui::controls::checkbox* m_show_amethyst;
ui::controls::checkbox* m_show_skull;
ui::controls::checkbox* m_show_r01;
ui::controls::checkbox* m_show_r02;
ui::controls::checkbox* m_show_r03;
ui::controls::checkbox* m_show_r04;
ui::controls::checkbox* m_show_r05;
ui::controls::checkbox* m_show_r06;
ui::controls::checkbox* m_show_r07;
ui::controls::checkbox* m_show_r08;
ui::controls::checkbox* m_show_r09;
ui::controls::checkbox* m_show_r10;
ui::controls::checkbox* m_show_r11;
ui::controls::checkbox* m_show_r12;
ui::controls::checkbox* m_show_r13;
ui::controls::checkbox* m_show_r14;
ui::controls::checkbox* m_show_r15;
ui::controls::checkbox* m_show_r16;
ui::controls::checkbox* m_show_r17;
ui::controls::checkbox* m_show_r18;
ui::controls::checkbox* m_show_r19;
ui::controls::checkbox* m_show_r20;
ui::controls::checkbox* m_show_r21;
ui::controls::checkbox* m_show_r22;
ui::controls::checkbox* m_show_r23;
ui::controls::checkbox* m_show_r24;
ui::controls::checkbox* m_show_r25;
ui::controls::checkbox* m_show_r26;
ui::controls::checkbox* m_show_r27;
ui::controls::checkbox* m_show_r28;
ui::controls::checkbox* m_show_r29;
ui::controls::checkbox* m_show_r30;
ui::controls::checkbox* m_show_r31;
ui::controls::checkbox* m_show_r32;
ui::controls::checkbox* m_show_r33;
ui::controls::checkbox* m_show_chipped;
ui::controls::checkbox* m_show_flawed;
ui::controls::checkbox* m_show_normal;
ui::controls::checkbox* m_show_flawless;
ui::controls::checkbox* m_show_perfect;
ui::controls::checkbox* m_show_flourite;
ui::controls::checkbox* m_show_jade;
ui::controls::checkbox* m_show_argonite;
ui::controls::checkbox* m_show_azurite;
ui::controls::checkbox* m_show_sulpher;
ui::controls::checkbox* m_show_quartz;
ui::controls::checkbox* m_show_tiger_eye;
ui::controls::checkbox* m_show_rough;
ui::controls::checkbox* m_show_faded;
ui::controls::checkbox* m_show_blemished;
ui::controls::checkbox* m_show_cleaned;
ui::controls::checkbox* m_show_triangle;
ui::controls::checkbox* m_show_trangle_cut;
ui::controls::checkbox* m_show_square;
ui::controls::checkbox* m_show_square_cut;
ui::controls::checkbox* m_show_regular;
ui::controls::checkbox* m_show_regular_cut;
ui::controls::checkbox* m_show_star;
ui::controls::checkbox* m_show_star_cut;
ui::controls::checkbox* m_show_imperial;
ui::controls::checkbox* m_show_imperial_cut;
ui::controls::checkbox* m_show_royal;
ui::controls::checkbox* m_show_royal_cut;
ui::controls::checkbox* m_show_spectacular;
ui::controls::checkbox* m_show_legendary;
ui::controls::checkbox* m_show_legendary_cut;
ui::controls::checkbox* m_show_rejuv_potion;
ui::controls::checkbox* m_show_full_rejuv_potion;
ui::controls::checkbox* m_show_hp1;
ui::controls::checkbox* m_show_hp2;
ui::controls::checkbox* m_show_hp3;
ui::controls::checkbox* m_show_hp4;
ui::controls::checkbox* m_show_hp5;
ui::controls::checkbox* m_show_mp1;
ui::controls::checkbox* m_show_mp2;
ui::controls::checkbox* m_show_mp3;
ui::controls::checkbox* m_show_mp4;
ui::controls::checkbox* m_show_mp5;
ui::controls::checkbox* m_close;
void(__fastcall* m_draw_dropped_items_names_original)(void*, void*); void(__fastcall* m_draw_dropped_items_names_original)(void*, void*);
void(__fastcall* m_handle_dropped_items_original)(void*, void*); void(__fastcall* m_handle_dropped_items_original)(void*, void*);
public: public:
@@ -34,11 +129,109 @@ namespace d2_tweaks {
void reload_settings(); void reload_settings();
void draw() override; void draw() override;
private: private:
std::string m_selected_gem;
std::chrono::steady_clock::time_point m_last_packet_sent;
void gem_checkbox_clicked(const std::string& gem);
void stone_checkbox_clicked(const std::string& gem);
void register_misc_checkboxes(); void register_misc_checkboxes();
void register_quality_checkboxes(); void register_quality_checkboxes();
void update_alt_only(bool value); void update_alt_only(bool value);
void extract_item(bool value, int prop, uint32_t val, uint32_t rune, diablo2::unit_stats_t stat);
void extract_r01(bool value);
void extract_r02(bool value);
void extract_r03(bool value);
void extract_r04(bool value);
void extract_r05(bool value);
void extract_r06(bool value);
void extract_r07(bool value);
void extract_r08(bool value);
void extract_r09(bool value);
void extract_r10(bool value);
void extract_r11(bool value);
void extract_r12(bool value);
void extract_r13(bool value);
void extract_r14(bool value);
void extract_r15(bool value);
void extract_r16(bool value);
void extract_r17(bool value);
void extract_r18(bool value);
void extract_r19(bool value);
void extract_r20(bool value);
void extract_r21(bool value);
void extract_r22(bool value);
void extract_r23(bool value);
void extract_r24(bool value);
void extract_r25(bool value);
void extract_r26(bool value);
void extract_r27(bool value);
void extract_r28(bool value);
void extract_r29(bool value);
void extract_r30(bool value);
void extract_r31(bool value);
void extract_r32(bool value);
void extract_r33(bool value);
void extract_chipped(bool value);
void extract_flawed(bool value);
void extract_normal(bool value);
void extract_flawless(bool value);
void extract_perfect(bool value);
void extract_rough(bool value);
void extract_faded(bool value);
void extract_blemished(bool value);
void extract_cleaned(bool value);
void extract_triangle(bool value);
void extract_trangle_cut(bool value);
void extract_square(bool value);
void extract_square_cut(bool value);
void extract_regular(bool value);
void extract_regular_cut(bool value);
void extract_star(bool value);
void extract_star_cut(bool value);
void extract_imperial(bool value);
void extract_imperial_cut(bool value);
void extract_royal(bool value);
void extract_royal_cut(bool value);
void extract_spectacular(bool value);
void extract_legendary(bool value);
void extract_legendary_cut(bool value);
void extract_rejuv_potion(bool value);
void extract_full_rejuv_potion(bool value);
void extract_hp1(bool value);
void extract_hp2(bool value);
void extract_hp3(bool value);
void extract_hp4(bool value);
void extract_hp5(bool value);
void extract_mp1(bool value);
void extract_mp2(bool value);
void extract_mp3(bool value);
void extract_mp4(bool value);
void extract_mp5(bool value);
void close_window(bool value);
//void extract_flourite(bool value);
//void extract_jade(bool value);
//void extract_argonite(bool value);
//void extract_azurite(bool value);
//void extract_sulpher(bool value);
//void extract_quartz(bool value);
//void extract_tiger_eye(bool value);
void update_show_gold(bool value); void update_show_gold(bool value);
void update_show_runes(bool value); void update_show_runes(bool value);
void update_show_gems(bool value); void update_show_gems(bool value);
@@ -61,7 +254,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

@@ -17,14 +17,33 @@ namespace d2_tweaks {
class loot_filter_settings_toggle_menu final : public ui::menu, singleton<loot_filter_settings_toggle_menu> { class loot_filter_settings_toggle_menu final : public ui::menu, singleton<loot_filter_settings_toggle_menu> {
ui::controls::button* m_toggle_filter_settings_btn; ui::controls::button* m_toggle_filter_settings_btn;
ui::controls::button* m_btn_toggle_stats; ui::controls::button* m_btn_toggle_stats;
menu* m_filter_settings_menu; ui::controls::button* m_btn_toggle_help;
bool m_show; ui::controls::button* m_btn_toggle_cube;
ui::controls::button* m_btn_toggle_stash;
ui::controls::button* m_btn_toggle_bag;
public: public:
menu* m_filter_settings_menu;
menu* m_menu;
bool m_show;
bool m_show_bag;
explicit loot_filter_settings_toggle_menu(token); explicit loot_filter_settings_toggle_menu(token);
void toggle_show() {
m_show = !m_show;
set_enabled(m_show);
set_visible(m_show);
}
void toggle_filter_settings_click(); void toggle_filter_settings_click();
void toggle_stats_settings_click(); void toggle_stats_settings_click();
void toggle_help_click();
void toggle_cube_click();
void toggle_stash_click();
void toggle_bag_click();
void draw() override; void draw() override;
bool key_event(uint32_t key, bool up) override; bool key_event(uint32_t key, bool up) override;

View File

@@ -201,6 +201,7 @@ namespace d2_tweaks {
MESSAGE_TYPE_ITEM_DROPPED_INFO, MESSAGE_TYPE_ITEM_DROPPED_INFO,
MESSAGE_TYPE_TRANSMUTE, MESSAGE_TYPE_TRANSMUTE,
MESSAGE_TYPE_TRADER_UPDATE, MESSAGE_TYPE_TRADER_UPDATE,
MESSAGE_TYPE_INTERACT = 1,
MESSAGE_TYPE_COUNT MESSAGE_TYPE_COUNT
}; };
@@ -235,11 +236,18 @@ namespace d2_tweaks {
struct item_move_cs : packet_header { struct item_move_cs : packet_header {
uint32_t item_guid; uint32_t item_guid;
const char* item_code;
uint8_t target_page; uint8_t target_page;
uint32_t bag_guid = 0; uint32_t bag_guid = 0;
bool updateBag; bool updateBag;
bool removeFromBag;
int prop; int prop;
int val; int val;
int tmog;
int x;
int y;
bool extract;
uint32_t iCode;
item_move_cs() : item_guid(0), target_page(0) { item_move_cs() : item_guid(0), target_page(0) {
message_type = MESSAGE_TYPE_ITEM_MOVE; message_type = MESSAGE_TYPE_ITEM_MOVE;
@@ -270,7 +278,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;
@@ -296,7 +303,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

@@ -112,6 +112,8 @@ namespace d2_tweaks {
virtual void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) = 0; virtual void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) = 0;
virtual void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) = 0; virtual void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) = 0;
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; 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

@@ -81,6 +81,8 @@ namespace d2_tweaks {
virtual bool left_mouse(bool up); virtual bool left_mouse(bool up);
virtual bool right_mouse(bool up); virtual bool right_mouse(bool up);
virtual bool middle_mouse(bool up);
virtual bool mouse_wheel(bool up);
virtual bool key_event(uint32_t key, bool up); virtual bool key_event(uint32_t key, bool up);
}; };

View File

@@ -32,6 +32,8 @@ namespace d2_tweaks {
bool process_left_mouse(bool up); bool process_left_mouse(bool up);
bool process_right_mouse(bool up); bool process_right_mouse(bool up);
bool process_middle_mouse(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);
@@ -86,5 +85,9 @@ namespace diablo2 {
static bool is_gamble_open(); static bool is_gamble_open();
static uint8_t current_interact_menu(); static uint8_t current_interact_menu();
static void resync_vendor_inventory(structures::unit* ptNPC); static void resync_vendor_inventory(structures::unit* ptNPC);
static int32_t send_to_server_9(BYTE type, DWORD num, DWORD unk1);
static void set_ui_toggle(int nToggle, int nUIState, BOOL bToggle);
}; };
} }

View File

@@ -92,6 +92,66 @@ 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 +457,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,
@@ -884,19 +943,19 @@ namespace diablo2 {
UNIT_STAT_UNUSED_65 = 481, UNIT_STAT_UNUSED_65 = 481,
UNIT_STAT_UNUSED_66 = 482, UNIT_STAT_UNUSED_66 = 482,
UNIT_STAT_UNUSED_67 = 483, UNIT_STAT_UNUSED_67 = 483,
UNIT_STAT_UNUSED_68 = 484, UNIT_STAT_gembag_PotionsHP = 484,
UNIT_STAT_UNUSED_69 = 485, UNIT_STAT_gembag_PotionsMana = 485,
UNIT_STAT_UNUSED_70 = 486, UNIT_STAT_gembag_Potions = 486,
UNIT_STAT_UNUSED_71 = 487, UNIT_STAT_gembag_Stones_Flourite = 487,
UNIT_STAT_UNUSED_72 = 488, UNIT_STAT_gembag_Stones_Jade = 488,
UNIT_STAT_UNUSED_73 = 489, UNIT_STAT_gembag_Stones_Argonite = 489,
UNIT_STAT_UNUSED_74 = 490, UNIT_STAT_gembag_Stones_Azurite = 490,
UNIT_STAT_UNUSED_75 = 491, UNIT_STAT_gembag_Stones_Sulpher = 491,
UNIT_STAT_UNUSED_76 = 492, UNIT_STAT_gembag_Stones_Quartz = 492,
UNIT_STAT_UNUSED_77 = 493, UNIT_STAT_gembag_Stones_TigerEye = 493,
UNIT_STAT_UNUSED_78 = 494, UNIT_STAT_BoH_Desc = 494,
UNIT_STAT_UNUSED_79 = 495, UNIT_STAT_runebag_RunesE = 495,
UNIT_STAT_UNUSED_80 = 496, UNIT_STAT_runebag_RunesF = 496,
UNIT_STAT_passive_sum_mastery = 497, UNIT_STAT_passive_sum_mastery = 497,
UNIT_STAT_item_socketmultiplier = 498, UNIT_STAT_item_socketmultiplier = 498,
UNIT_STAT_gembag_Ruby = 499, UNIT_STAT_gembag_Ruby = 499,
@@ -909,14 +968,10 @@ namespace diablo2 {
UNIT_STAT_runebag_RunesA = 506, UNIT_STAT_runebag_RunesA = 506,
UNIT_STAT_runebag_RunesB = 507, UNIT_STAT_runebag_RunesB = 507,
UNIT_STAT_runebag_RunesC = 508, UNIT_STAT_runebag_RunesC = 508,
UNIT_STAT_UNUSED_83 = 509, UNIT_STAT_runebag_RunesD = 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 +1038,17 @@ 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);
//D2Common.0x6FD57720 (#10602)
//int __stdcall DATATBLS_GetItemIdFromItemCode(uint32_t dwCode)
static int get_item_id_from_item_code(uint32_t dwCode);
//D2Common.0x6FD576D0 (#10601)
// D2ItemsTxt* __stdcall DATATBLS_GetItemRecordFromItemCode(uint32_t dwCode, int* pItemId)
static structures::items_line* get_item_record_from_item_code(uint32_t dwCode, int* pItemId);
}; };
} }

View File

@@ -47,5 +47,13 @@ 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);
//D2Game.0x6FC4ED80
static structures::unit* __fastcall D2GAME_CreateItemEx_6FC4ED80(structures::game* pGame, structures::D2ItemDropStrc* pItemDrop, int32_t a3);
//D2Game.0x6FC4A660
static int32_t __fastcall D2GAME_Transmogrify_6FC4A660(structures::game* pGame, structures::unit* pPlayer, structures::unit* pItem);
static diablo2::structures::unit* __fastcall diablo2::d2_game::QUESTS_CreateItem(diablo2::structures::game* pGame, diablo2::structures::unit* pPlayer, uint32_t dwCode, int32_t nLevel, uint8_t nQuality, int32_t bDroppable);
}; };
} }

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

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include "room.h"
#include <windows.h>
#pragma pack(push, 1) #pragma pack(push, 1)
@@ -23,7 +25,18 @@ namespace diablo2 {
struct quest_record; struct quest_record;
struct npc_record; struct npc_record;
enum D2C_ItemQualities
{
ITEMQUAL_INFERIOR = 0x01, //0x01 Inferior
ITEMQUAL_NORMAL = 0x02, //0x02 Normal
ITEMQUAL_SUPERIOR = 0x03, //0x03 Superior
ITEMQUAL_MAGIC = 0x04, //0x04 Magic
ITEMQUAL_SET = 0x05, //0x05 Set
ITEMQUAL_RARE = 0x06, //0x06 Rare
ITEMQUAL_UNIQUE = 0x07, //0x07 Unique
ITEMQUAL_CRAFT = 0x08, //0x08 Crafted
ITEMQUAL_TEMPERED = 0x09 //0x09 Tempered
};
enum class unit_type_t : int32_t { enum class unit_type_t : int32_t {
UNIT_TYPE_PLAYER = 0, UNIT_TYPE_PLAYER = 0,
@@ -76,7 +89,55 @@ namespace diablo2 {
ITEMFLAG_ITEM = 0x08000000 ITEMFLAG_ITEM = 0x08000000
}; };
struct D2SeedStrc
{
union
{
struct
{
uint32_t nLowSeed; //0x00
uint32_t nHighSeed; //0x04
};
uint64_t lSeed; //0x00
};
};
struct D2CoordStrc //sizeof 0x08
{
int nX; //0x00
int nY; //0x04
};
struct D2ItemDropStrc
{
diablo2::structures::unit* pUnit; //0x00
D2SeedStrc* pSeed; //0x04
diablo2::structures::game* pGame; //0x08
int32_t nItemLvl; //0x0C
uint32_t unk0x10; //0x10
int32_t nId; //0x14
int32_t nSpawnType; //0x18 [3 for ground spawn, 4 for inv spawn]
int32_t nX; //0x1C
int32_t nY; //0x20
diablo2::structures::room* pRoom; //0x24
uint16_t wUnitInitFlags; //0x28
uint16_t wItemFormat; //0x2A [ptGame0x0x78]
BOOL bForce; //0x2C
int32_t nQuality; //0x30
int32_t nQuantity; //0x34
int32_t nMinDur; //0x38
int32_t nMaxDur; //0x3C
int32_t nItemIndex; //0x40
uint32_t dwFlags1; //0x44 - itemflag override (used when force is true)
uint32_t dwSeed; //0x48 - overrides the seed, used when force is true
uint32_t dwItemSeed; //0x4C - overrides the item seed when force is true
int32_t eEarLvl; //0x50
int32_t nQtyOverride; //0x54
char szName[16]; //0x58
int32_t nPrefix[3]; //0x68
int32_t nSuffix[3]; //0x74
uint32_t dwFlags2; //0x80
};
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);
}; };
} }
} }

14
resource.h Normal file
View File

@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by D2tweaks.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> GamePacketReceivedIntercept // handle packet <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 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(); /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> d2 gl static auto& instance = singleton<client>::instance(); /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 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) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equiv1 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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

@@ -4,7 +4,6 @@
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <d2tweaks/common/common.h> #include <d2tweaks/common/common.h>
#include <d2tweaks/common/protocol.h> #include <d2tweaks/common/protocol.h>
#include <d2tweaks/common/asset_manager.h> #include <d2tweaks/common/asset_manager.h>
@@ -20,7 +19,6 @@
#include <diablo2/d2gfx.h> #include <diablo2/d2gfx.h>
#include <diablo2/d2cmp.h> #include <diablo2/d2cmp.h>
#include <diablo2/structures/unit.h> #include <diablo2/structures/unit.h>
#include <diablo2/structures/inventory.h> #include <diablo2/structures/inventory.h>
#include <diablo2/structures/item_data.h> #include <diablo2/structures/item_data.h>
@@ -45,10 +43,19 @@
#include <string> #include <string>
#include <map> #include <map>
#include <DllNotify.h> #include <DllNotify.h>
#include <D2Template.h> #include <D2Template.h>
#include <diablo2/d2gfx.h>
#include <string>
#include <vector>
#include <sstream>
#include <string>
#include <locale>
#include <codecvt>
MODULE_INIT(autosort) MODULE_INIT(autosort)
enum ColorEnum { enum ColorEnum {
@@ -88,7 +95,6 @@ std::map<int, diablo2::ui_font_t> fontMap = {
{13, diablo2::ui_font_t::UI_FONT_INGAMECHAT} {13, diablo2::ui_font_t::UI_FONT_INGAMECHAT}
}; };
class inventory_sort_menu : public d2_tweaks::ui::menu { class inventory_sort_menu : public d2_tweaks::ui::menu {
d2_tweaks::common::asset* m_buttons_img; d2_tweaks::common::asset* m_buttons_img;
@@ -115,8 +121,6 @@ public:
m_sort_cube_btn = get_button("m_sort_cube_btn", std::bind(&inventory_sort_menu::sort_cube_click, this)); m_sort_cube_btn = get_button("m_sort_cube_btn", std::bind(&inventory_sort_menu::sort_cube_click, this));
} }
// Function to find the Diablo II window handle // Function to find the Diablo II window handle
HWND FindDiabloIIWindow() { HWND FindDiabloIIWindow() {
return FindWindow(NULL, "Diablo II"); return FindWindow(NULL, "Diablo II");
@@ -132,18 +136,85 @@ public:
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
} }
int statsFont = GetPrivateProfileIntA("Options", "statsFont", 0, "./d2tweaks.ini"); int statsFont = GetPrivateProfileIntA("Options", "statsFont", 0, "./d2tweaks.ini");
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);
std::string item;
std::vector<std::string> tokens;
while (getline(ss, item, delim)) {
tokens.push_back(item);
}
return tokens;
}
std::wstring stringToWstring(const std::string& str) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(str);
}
// Function to justify a line of text
void justifyLine(const std::vector<std::string>& words, int start, int end, int maxLineLength, int& xPos, int yPos, int padding) {
int lineLength = 0;
for (int i = start; i <= end; i++) {
lineLength += words[i].length() * 8; // Assuming each character has a width of 8 pixels
}
int numSpaces = end - start;
int extraSpaces = maxLineLength - lineLength - padding * 2;
int spaceWidth = 8;
int extraSpacePerGap = numSpaces > 0 ? extraSpaces / numSpaces : 0;
int remainingSpaces = numSpaces > 0 ? extraSpaces % numSpaces : 0;
for (int i = start; i <= end; i++) {
diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(stringToWstring(words[i]).c_str()), xPos + padding, yPos, 0, 0, diablo2::UI_COLOR_WHITE); // Assuming paletteIndex, transTbl, and color are 0
xPos += words[i].length() * 8 + spaceWidth + extraSpacePerGap + padding;
if (remainingSpaces > 0) {
xPos += 1; // Add an extra pixel for the remaining spaces
remainingSpaces--;
}
}
}
// Function to draw justified text inside a box with padding
void drawJustifiedTextInBox(const std::string& text, int boxX, int boxY, int boxWidth, int boxHeight, int padding) {
std::vector<std::string> words = split(text, ' ');
int maxLineLength = boxWidth;
int xPos = boxX + padding;
int yPos = boxY + padding;
for (size_t i = 0; i < words.size(); ) {
int start = i;
int end = i;
int lineLength = 0;
// Find the end index for the current line
while (end < words.size() && lineLength + words[end].length() <= maxLineLength) {
lineLength += words[end].length();
if (end > start) {
lineLength++; // Add space width
}
end++;
}
justifyLine(words, start, end - 1, maxLineLength, xPos, yPos, padding);
yPos += 16; // Assuming each line is 16 pixels tall
xPos = boxX + padding;
i = end;
}
}
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
const auto player = diablo2::d2_client::get_local_player(); const auto player = diablo2::d2_client::get_local_player();
auto name = player->player_data->name;
// Add all items to vector // Add all items to vector
std::vector<diablo2::structures::unit*> items; std::vector<diablo2::structures::unit*> items;
@@ -157,132 +228,71 @@ 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) {
int param = stat.param;
int op = stat.op;
auto statline = diablo2::d2_common::get_item_stat_cost_record(stat.stat);
auto opBase = statline->wOpBase;
auto opStat = statline->wOpStat[0];
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);
double param = 6; if (stat.is_item_stat == 0) {
int32_t statvalue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
int32_t spirits = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(185), NULL); int basevalue = 1;
int32_t soulscaptured = statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(184), NULL); switch (op) {
case 0:
switch (stat.stat) { statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
// 2. (statValue <- this is probably op stat1 ? * baseValue <- this is probably op base ) / 2 ^ param break;
case 1: // Formula: opstatbasevalue * statvalue / 100
// (op stat1 value * base stat value) / (2 ^ param) statValue = static_cast<int32_t>(opBaseValue) / 100;
// let's try this fucking thing break;
case 2: // Formula: (statvalue * basevalue) / (2 ^ param)
case 190: { statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
// str/spirits break;
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str case 3: // Percentage-based version of op #2
break; statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
} break;
case 191: { case 4: // Item-based stat increase
// dex/spirits statValue = static_cast<int32_t>((opBaseValue) / pow(op, param));
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str break;
break; case 5: // Percentage-based item increase
} statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
case 192: { break;
// vit/spirits case 11: // Similar to op #1 and #13
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
break; break;
} case 13:
case 193: { statValue = static_cast<int32_t>((opBaseValue) / pow(op, param)) / 100;
// enr/spirits break;
statValue = static_cast<int32_t>((1 * spirits) / pow(2, param)); // what is the value of opStat_str default:
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: {
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); statValue = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
break; 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);
}
} }
} }
else { else {
// set randStat value to random number 1 and 2^(32) = 4294967296 for (auto item : items) {
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), randomNumber, 0); const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
//diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), randomBool, 0); if (record->type == stat.item_type_id) {
statValue = diablo2::d2_common::get_stat(item, static_cast<diablo2::unit_stats_t>(stat.stat), NULL);
int statValue1 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStat), NULL); }
int statValue2 = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), NULL); }
if (statValue1 > 0 ) {
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStat), 0, 0);
diablo2::d2_common::set_stat(player, static_cast<diablo2::unit_stats_t>(randStatBool), 0, 0);
} }
} // write code to get player name and display it using MessageBox
*/ const auto player = diablo2::d2_client::get_local_player();
auto name = player->player_data->name;
auto statValueStr = std::to_wstring(statValue); auto statValueStr = std::to_wstring(statValue);
std::wstring statText = std::wstring(stat.stat_display_string);// .append(L" " + statValueStr); std::wstring statText = std::wstring(stat.stat_display_string);// .append(L" " + statValueStr);
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_client::get_ui_window_state(diablo2::UI_WINDOW_CHARACTER) && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_CHARACTER)
// && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_INVENTORY)
// && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_SKILL)
&& !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_CHAT) && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_CHAT)
&& !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_NPCMENU) && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_NPCMENU)
&& !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_MAINMENU) && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_MAINMENU)
@@ -301,30 +311,39 @@ public:
&& !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_HELP) && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_HELP)
&& !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_MERC) && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_MERC)
&& !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_SCROLL)) { && !diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_SCROLL)) {
// Draw stats // Draw stats
diablo2::d2_win::set_current_font(fontMap[statsFont]); // Set font to FONT16 diablo2::d2_win::set_current_font(fontMap[statsFont]); // Set font to FONT16
diablo2::d2_win::draw_text(const_cast<wchar_t*>(statText.c_str()), stat.x1, stat.y1 + textOffset, stat.colorStat, 0); diablo2::d2_win::draw_text(const_cast<wchar_t*>(statText.c_str()), stat.x1, stat.y1 + textOffset, stat.colorStat, 0);
diablo2::d2_win::set_current_font(fontMap[statsFont]); // Set font to FONT16 diablo2::d2_win::set_current_font(fontMap[statsFont]); // Set font to FONT16
diablo2::d2_win::draw_text(const_cast<wchar_t*>(statValueStr.c_str()), stat.x2, stat.y2 + textOffset, stat.colorStatValue, 0); diablo2::d2_win::draw_text(const_cast<wchar_t*>(statValueStr.c_str()), stat.x2, stat.y2 + textOffset, stat.colorStatValue, 0);
}
//diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(statText.c_str()), stat.x1, stat.y1 + textOffset, 1, 0, stat.colorStat); //diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(statText.c_str()), stat.x1, stat.y1 + textOffset, 1, 0, stat.colorStat);
//diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(statValueStr.c_str()), stat.x2, stat.y2 + textOffset, 1, 4, stat.colorStatValue); //diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(statValueStr.c_str()), stat.x2, stat.y2 + textOffset, 1, 4, stat.colorStatValue);
// 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
//diablo2::structures::d2_cmp::init_gfx_data(&g_gfxdata); //diablo2::structures::d2_cmp::init_gfx_data(&g_gfxdata);
//diablo2::d2_gfx::draw_image(&g_gfxdata, 200, 200, 1, 5, 0); //diablo2::d2_gfx::draw_image(&g_gfxdata, 200, 200, 1, 5, 0);
// 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) {
//const int windowWidth = 1280;
//const int windowHeight = 768;
//const int boxWidth = 1000;
//const int boxHeight = 680;
//const int boxX = (windowWidth - boxWidth) / 2;
//const int boxY = (windowHeight - boxHeight) / 2;
//const std::string helpText = "This is a sample help screen! You can put help text in here!?";
//// 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; 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
// Get current HP, Mana, and Stamina along with their maximum values // Get current HP, Mana, and Stamina along with their maximum values
int statHP = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(6), NULL) / 256; int statHP = diablo2::d2_common::get_stat(player, static_cast<diablo2::unit_stats_t>(6), NULL) / 256;
@@ -349,17 +368,12 @@ public:
float manaPercentage = static_cast<float>(statMana) / static_cast<float>(statMaxMana); float manaPercentage = static_cast<float>(statMana) / static_cast<float>(statMaxMana);
float staminaPercentage = static_cast<float>(statStamina) / static_cast<float>(statMaxStamina); float staminaPercentage = static_cast<float>(statStamina) / static_cast<float>(statMaxStamina);
int sHeight = 768; int sHeight = 768;
int sWidth = 1280; int sWidth = 1280;
int sHCenter = sHeight / 2; int sHCenter = sHeight / 2;
int sWCenter = sWidth / 2; int sWCenter = sWidth / 2;
//spdlog::info("healthPercentage: {}", healthPercentage);
// Define default bar color // Define default bar color
DWORD barColor = 0; DWORD barColor = 0;
@@ -374,52 +388,51 @@ public:
barColor = 5; barColor = 5;
} }
//spdlog::info("barColor: {}", barColor);
// Define the dimensions for the bars // Define the dimensions for the bars
int barWidth = 200; // Width of the bars int pbarWidth = GetPrivateProfileIntA("Options", "pbarWidth", 200, "./d2tweaks.ini");
int barHeight = 16; // Height of the bars int pbarHeight = GetPrivateProfileIntA("Options", "pbarHeight", 16, "./d2tweaks.ini");
// Define the coordinates for the bars // Define the coordinates for the bars
int barX = sWCenter - 100; // Left coordinate of the bars int barX = 245; // Left coordinate of the bars
int barY_HP = 654; // Top coordinate of the HP bar int barY_HP = 728; // Top coordinate of the HP bar
int barY_Mana = barY_HP + barHeight + 4; // Top coordinate of the Mana bar with separator int barY_Mana = barY_HP + pbarHeight + 4; // Top coordinate of the Mana bar with separator
int barY_Stamina = barY_Mana + barHeight + 4; // Top coordinate of the Stamina bar with separator int barY_Stamina = barY_Mana + pbarHeight + 4; // Top coordinate of the Stamina bar with separator
std::wstring life = L"L: " + strHP + L" / " + strMaxHP;
std::wstring mana = L"M: " + strMana + L" / " + strMaxMana;
std::wstring stamina = L"" + strStamina + L" / " + strMaxStamina;
int lifeWidth = diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(life.c_str()));
int manaWidth = diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(mana.c_str()));
int staminaWidth = diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(stamina.c_str()));
std::wstring life = strHP + L" / " + strMaxHP;
std::wstring mana = strMana + L" / " + strMaxMana;
std::wstring stamina = strStamina + L" / " + strMaxStamina;
// Calculate the filled widths of the bars // Calculate the filled widths of the bars
int filledHPWidth = static_cast<int>(healthPercentage * barWidth); int filledHPWidth = static_cast<int>(healthPercentage * pbarWidth);
int filledManaWidth = static_cast<int>(manaPercentage * barWidth); int filledManaWidth = static_cast<int>(manaPercentage * pbarWidth);
int filledStaminaWidth = static_cast<int>(staminaPercentage * barWidth); int filledStaminaWidth = static_cast<int>(staminaPercentage * pbarWidth);
// at 345 we need to minus the width of the text // at 345 we need to minus the width of the text
sWCenter = barX + 100 - (diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(mana.c_str())) / 2); sWCenter = barX + 100 - (diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(mana.c_str())) / 2);
HWND diabloIIWnd = FindDiabloIIWindow(); HWND diabloIIWnd = FindDiabloIIWindow();
// Get player_bars_enabled from [Options] in d2tweaks.ini
int player_bars_enabled_hp = GetPrivateProfileIntA("Options", "player_bars_hp_enabled", 1, "./d2tweaks.ini");
int player_bars_X_hp = GetPrivateProfileIntA("Options", "player_bars_hp_X", barX, "./d2tweaks.ini");
int player_bars_Y_hp = GetPrivateProfileIntA("Options", "player_bars_hp_Y", barY_HP, "./d2tweaks.ini");
int player_bars_enabled_mana = GetPrivateProfileIntA("Options", "player_bars_mana_enabled", 1, "./d2tweaks.ini");
int player_bars_X_mana = GetPrivateProfileIntA("Options", "player_bars_mana_X", barX, "./d2tweaks.ini");
int player_bars_Y_mana = GetPrivateProfileIntA("Options", "player_bars_mana_Y", barY_Mana, "./d2tweaks.ini");
if (player_bars_enabled_hp == 1) {
// Draw the filled HP bar // Draw the filled HP bar
diablo2::d2_gfx::draw_filled_rect(barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, barColor, 255); diablo2::d2_gfx::draw_filled_rect(player_bars_X_hp, player_bars_Y_hp, barX + filledHPWidth, barY_HP + pbarHeight, barColor, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP //DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP
diablo2::d2_win::draw_text(const_cast<wchar_t*>(life.c_str()), sWCenter, barY_HP + 15, diablo2::UI_COLOR_WHITE, 0);
diablo2::d2_win::draw_text(const_cast<wchar_t*>(life.c_str()), sWCenter, barY_HP + 15, stat.colorStatValue, 0); }
if (player_bars_enabled_mana == 1) {
// Draw the filled Mana bar // Draw the filled Mana bar
diablo2::d2_gfx::draw_filled_rect(barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, 140, 255); diablo2::d2_gfx::draw_filled_rect(player_bars_X_mana, player_bars_Y_mana, barX + filledManaWidth, barY_Mana + pbarHeight, 140, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana //DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana
diablo2::d2_win::draw_text(const_cast<wchar_t*>(mana.c_str()), sWCenter, barY_Mana + 15, stat.colorStatValue, 0); diablo2::d2_win::draw_text(const_cast<wchar_t*>(mana.c_str()), sWCenter, barY_Mana + 15, diablo2::UI_COLOR_WHITE, 0);
}
/* /*
// Define the number of separators // Define the number of separators
int numColors = 256; int numColors = 256;
@@ -448,10 +461,6 @@ public:
} }
*/ */
// Draw the filled Stamina bar // Draw the filled Stamina bar
// diablo2::d2_gfx::draw_filled_rect(barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, 12, 255); // diablo2::d2_gfx::draw_filled_rect(barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, 12, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, RGB(255, 255, 0)); // Green color for Stamina //DrawFilledRect(diabloIIWnd, barX, barY_Stamina, barX + filledStaminaWidth, barY_Stamina + barHeight, RGB(255, 255, 0)); // Green color for Stamina
@@ -462,14 +471,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);
@@ -546,12 +547,9 @@ private:
} }
}; };
void d2_tweaks::client::modules::autosort::init_early() { void d2_tweaks::client::modules::autosort::init_early() {
} }
void d2_tweaks::client::modules::autosort::init() { void d2_tweaks::client::modules::autosort::init() {
char acPathToIni[MAX_PATH] = { 0 }; char acPathToIni[MAX_PATH] = { 0 };
const char* pcIniFile = "\\d2tweaks.ini"; const char* pcIniFile = "\\d2tweaks.ini";
@@ -584,4 +582,3 @@ void d2_tweaks::client::modules::autosort::handle_packet(common::packet_header*
diablo2::d2_common::inv_add_item(player->inventory, item, inventorySort->tx, inventorySort->ty, inventoryIndex, true, item->item_data->page); diablo2::d2_common::inv_add_item(player->inventory, item, inventorySort->tx, inventorySort->ty, inventoryIndex, true, item->item_data->page);
diablo2::d2_common::inv_update_item(player->inventory, item, true); diablo2::d2_common::inv_update_item(player->inventory, item, true);
} }

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

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