diff --git a/build/Debug/D2tweaks.ilk b/build/Debug/D2tweaks.ilk index 98afa0e..a789d5e 100644 Binary files a/build/Debug/D2tweaks.ilk and b/build/Debug/D2tweaks.ilk differ diff --git a/build/Debug/D2tweaks.log b/build/Debug/D2tweaks.log index ce277a5..ae7cdff 100644 --- a/build/Debug/D2tweaks.log +++ b/build/Debug/D2tweaks.log @@ -1,3 +1,11 @@ - loot_filter.cpp - loot_filter_settings_toggle_menu.cpp + autosort_client.cpp +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(197,15): warning C4018: '<': signed/unsigned mismatch +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(197,66): warning C4018: '<=': signed/unsigned mismatch +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(252,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(255,43): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(258,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(261,43): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(264,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(282,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data +D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\autosort\autosort_client.cpp(288,41): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data D2tweaks.vcxproj -> D:\Diablo II\MODS\ironman-dev\D2tweaks.dll diff --git a/build/Debug/D2tweaks.tlog/CL.command.1.tlog b/build/Debug/D2tweaks.tlog/CL.command.1.tlog index 048c954..edf5b32 100644 Binary files a/build/Debug/D2tweaks.tlog/CL.command.1.tlog and b/build/Debug/D2tweaks.tlog/CL.command.1.tlog differ diff --git a/build/Debug/D2tweaks.tlog/CL.read.1.tlog b/build/Debug/D2tweaks.tlog/CL.read.1.tlog index 296b599..56a34b9 100644 Binary files a/build/Debug/D2tweaks.tlog/CL.read.1.tlog and b/build/Debug/D2tweaks.tlog/CL.read.1.tlog differ diff --git a/build/Debug/D2tweaks.tlog/CL.write.1.tlog b/build/Debug/D2tweaks.tlog/CL.write.1.tlog index 92fb763..509a5ea 100644 Binary files a/build/Debug/D2tweaks.tlog/CL.write.1.tlog and b/build/Debug/D2tweaks.tlog/CL.write.1.tlog differ diff --git a/build/Debug/src/common/asm_code.obj b/build/Debug/src/common/asm_code.obj index f314002..799eb18 100644 Binary files a/build/Debug/src/common/asm_code.obj and b/build/Debug/src/common/asm_code.obj differ diff --git a/build/Debug/src/common/config.obj b/build/Debug/src/common/config.obj index 4b72bc5..0bdd168 100644 Binary files a/build/Debug/src/common/config.obj and b/build/Debug/src/common/config.obj differ diff --git a/build/Debug/src/common/hooking.obj b/build/Debug/src/common/hooking.obj index 3c617f1..c92c7e2 100644 Binary files a/build/Debug/src/common/hooking.obj and b/build/Debug/src/common/hooking.obj differ diff --git a/build/Debug/src/common/ini.obj b/build/Debug/src/common/ini.obj index 0f726a0..bcdf91b 100644 Binary files a/build/Debug/src/common/ini.obj and b/build/Debug/src/common/ini.obj differ diff --git a/build/Debug/src/common/string_utils.obj b/build/Debug/src/common/string_utils.obj index 60db805..aa38da3 100644 Binary files a/build/Debug/src/common/string_utils.obj and b/build/Debug/src/common/string_utils.obj differ diff --git a/build/Debug/src/d2tweaks/client/client.obj b/build/Debug/src/d2tweaks/client/client.obj index e55eb8f..fc8d246 100644 Binary files a/build/Debug/src/d2tweaks/client/client.obj and b/build/Debug/src/d2tweaks/client/client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.obj b/build/Debug/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.obj index 0ddd64a..72ed981 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.obj and b/build/Debug/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.obj b/build/Debug/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.obj index b334383..2e1893a 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.obj and b/build/Debug/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/autosort/autosort_client.obj b/build/Debug/src/d2tweaks/client/modules/autosort/autosort_client.obj index 04e4f7c..0f01f22 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/autosort/autosort_client.obj and b/build/Debug/src/d2tweaks/client/modules/autosort/autosort_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/client_module.obj b/build/Debug/src/d2tweaks/client/modules/client_module.obj index 3c974bc..9c4bd3a 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/client_module.obj and b/build/Debug/src/d2tweaks/client/modules/client_module.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/damage_display/damage_display_client.obj b/build/Debug/src/d2tweaks/client/modules/damage_display/damage_display_client.obj index 7e5f60a..ec43548 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/damage_display/damage_display_client.obj and b/build/Debug/src/d2tweaks/client/modules/damage_display/damage_display_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.obj b/build/Debug/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.obj index 08bc35e..82df900 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.obj and b/build/Debug/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/item_move/item_move_client.obj b/build/Debug/src/d2tweaks/client/modules/item_move/item_move_client.obj index 12c3864..fc2d283 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/item_move/item_move_client.obj and b/build/Debug/src/d2tweaks/client/modules/item_move/item_move_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter.obj b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter.obj index f51c357..400695b 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter.obj and b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.obj b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.obj index b8df515..36cfc7e 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.obj and b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.obj b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.obj index c8e6602..58bd88a 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.obj and b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.obj b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.obj index 7212a43..7e79c27 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.obj and b/build/Debug/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/small_patches/small_patches.obj b/build/Debug/src/d2tweaks/client/modules/small_patches/small_patches.obj index b55589f..cc0680a 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/small_patches/small_patches.obj and b/build/Debug/src/d2tweaks/client/modules/small_patches/small_patches.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/test/test.obj b/build/Debug/src/d2tweaks/client/modules/test/test.obj index 0f79904..6926f5f 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/test/test.obj and b/build/Debug/src/d2tweaks/client/modules/test/test.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/trader_update/trader_update_client.obj b/build/Debug/src/d2tweaks/client/modules/trader_update/trader_update_client.obj index 3154795..e23cff3 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/trader_update/trader_update_client.obj and b/build/Debug/src/d2tweaks/client/modules/trader_update/trader_update_client.obj differ diff --git a/build/Debug/src/d2tweaks/client/modules/transmute/transmute_client.obj b/build/Debug/src/d2tweaks/client/modules/transmute/transmute_client.obj index e165e6f..e83204f 100644 Binary files a/build/Debug/src/d2tweaks/client/modules/transmute/transmute_client.obj and b/build/Debug/src/d2tweaks/client/modules/transmute/transmute_client.obj differ diff --git a/build/Debug/src/d2tweaks/common/asset_manager.obj b/build/Debug/src/d2tweaks/common/asset_manager.obj index a26416f..1fe3b36 100644 Binary files a/build/Debug/src/d2tweaks/common/asset_manager.obj and b/build/Debug/src/d2tweaks/common/asset_manager.obj differ diff --git a/build/Debug/src/d2tweaks/common/common.obj b/build/Debug/src/d2tweaks/common/common.obj index 786f173..ec17bf7 100644 Binary files a/build/Debug/src/d2tweaks/common/common.obj and b/build/Debug/src/d2tweaks/common/common.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.obj b/build/Debug/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.obj index 7a3a4fd..7c3f467 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.obj and b/build/Debug/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.obj b/build/Debug/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.obj index 2d96ecc..7be5b70 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.obj and b/build/Debug/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/autosort/autosort_server.obj b/build/Debug/src/d2tweaks/server/modules/autosort/autosort_server.obj index 659304a..6090204 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/autosort/autosort_server.obj and b/build/Debug/src/d2tweaks/server/modules/autosort/autosort_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/damage_display/damage_display_server.obj b/build/Debug/src/d2tweaks/server/modules/damage_display/damage_display_server.obj index f01b02f..56d6994 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/damage_display/damage_display_server.obj and b/build/Debug/src/d2tweaks/server/modules/damage_display/damage_display_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.obj b/build/Debug/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.obj index abeaa80..49990e9 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.obj and b/build/Debug/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.obj b/build/Debug/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.obj index 65e91af..51df1b4 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.obj and b/build/Debug/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/item_move/item_move_server.obj b/build/Debug/src/d2tweaks/server/modules/item_move/item_move_server.obj index c62725e..9a8bd94 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/item_move/item_move_server.obj and b/build/Debug/src/d2tweaks/server/modules/item_move/item_move_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/server_module.obj b/build/Debug/src/d2tweaks/server/modules/server_module.obj index ea11f41..5d74cd3 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/server_module.obj and b/build/Debug/src/d2tweaks/server/modules/server_module.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/test/test.obj b/build/Debug/src/d2tweaks/server/modules/test/test.obj index ea55b1e..412667d 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/test/test.obj and b/build/Debug/src/d2tweaks/server/modules/test/test.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/trader_update/trader_update_server.obj b/build/Debug/src/d2tweaks/server/modules/trader_update/trader_update_server.obj index 3619385..f12b4d2 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/trader_update/trader_update_server.obj and b/build/Debug/src/d2tweaks/server/modules/trader_update/trader_update_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/modules/transmute/transmute_server.obj b/build/Debug/src/d2tweaks/server/modules/transmute/transmute_server.obj index 7e1fb7f..208bf4a 100644 Binary files a/build/Debug/src/d2tweaks/server/modules/transmute/transmute_server.obj and b/build/Debug/src/d2tweaks/server/modules/transmute/transmute_server.obj differ diff --git a/build/Debug/src/d2tweaks/server/server.obj b/build/Debug/src/d2tweaks/server/server.obj index 0918e31..b6d6635 100644 Binary files a/build/Debug/src/d2tweaks/server/server.obj and b/build/Debug/src/d2tweaks/server/server.obj differ diff --git a/build/Debug/src/d2tweaks/ui/controls/button.obj b/build/Debug/src/d2tweaks/ui/controls/button.obj index cbf0fde..5151384 100644 Binary files a/build/Debug/src/d2tweaks/ui/controls/button.obj and b/build/Debug/src/d2tweaks/ui/controls/button.obj differ diff --git a/build/Debug/src/d2tweaks/ui/controls/checkbox.obj b/build/Debug/src/d2tweaks/ui/controls/checkbox.obj index 1a9aff4..d9fcdd5 100644 Binary files a/build/Debug/src/d2tweaks/ui/controls/checkbox.obj and b/build/Debug/src/d2tweaks/ui/controls/checkbox.obj differ diff --git a/build/Debug/src/d2tweaks/ui/controls/group.obj b/build/Debug/src/d2tweaks/ui/controls/group.obj index e280fca..eb803ee 100644 Binary files a/build/Debug/src/d2tweaks/ui/controls/group.obj and b/build/Debug/src/d2tweaks/ui/controls/group.obj differ diff --git a/build/Debug/src/d2tweaks/ui/controls/image.obj b/build/Debug/src/d2tweaks/ui/controls/image.obj index aa0ef4e..88f9f13 100644 Binary files a/build/Debug/src/d2tweaks/ui/controls/image.obj and b/build/Debug/src/d2tweaks/ui/controls/image.obj differ diff --git a/build/Debug/src/d2tweaks/ui/controls/label.obj b/build/Debug/src/d2tweaks/ui/controls/label.obj index 642d23e..64ae32c 100644 Binary files a/build/Debug/src/d2tweaks/ui/controls/label.obj and b/build/Debug/src/d2tweaks/ui/controls/label.obj differ diff --git a/build/Debug/src/d2tweaks/ui/menu.obj b/build/Debug/src/d2tweaks/ui/menu.obj index 42f3e34..965923a 100644 Binary files a/build/Debug/src/d2tweaks/ui/menu.obj and b/build/Debug/src/d2tweaks/ui/menu.obj differ diff --git a/build/Debug/src/d2tweaks/ui/ui_manager.obj b/build/Debug/src/d2tweaks/ui/ui_manager.obj index 8c65edb..a1e2b03 100644 Binary files a/build/Debug/src/d2tweaks/ui/ui_manager.obj and b/build/Debug/src/d2tweaks/ui/ui_manager.obj differ diff --git a/build/Debug/src/diablo2/d2client.obj b/build/Debug/src/diablo2/d2client.obj index 1d044ca..514206d 100644 Binary files a/build/Debug/src/diablo2/d2client.obj and b/build/Debug/src/diablo2/d2client.obj differ diff --git a/build/Debug/src/diablo2/d2cmp.obj b/build/Debug/src/diablo2/d2cmp.obj index cc0540e..94236a8 100644 Binary files a/build/Debug/src/diablo2/d2cmp.obj and b/build/Debug/src/diablo2/d2cmp.obj differ diff --git a/build/Debug/src/diablo2/d2common.obj b/build/Debug/src/diablo2/d2common.obj index 40c11ee..08617ba 100644 Binary files a/build/Debug/src/diablo2/d2common.obj and b/build/Debug/src/diablo2/d2common.obj differ diff --git a/build/Debug/src/diablo2/d2game.obj b/build/Debug/src/diablo2/d2game.obj index 250f47a..ce19ca2 100644 Binary files a/build/Debug/src/diablo2/d2game.obj and b/build/Debug/src/diablo2/d2game.obj differ diff --git a/build/Debug/src/diablo2/d2gfx.obj b/build/Debug/src/diablo2/d2gfx.obj index 421ccc0..c977401 100644 Binary files a/build/Debug/src/diablo2/d2gfx.obj and b/build/Debug/src/diablo2/d2gfx.obj differ diff --git a/build/Debug/src/diablo2/d2lang.obj b/build/Debug/src/diablo2/d2lang.obj index 527eb36..d07f666 100644 Binary files a/build/Debug/src/diablo2/d2lang.obj and b/build/Debug/src/diablo2/d2lang.obj differ diff --git a/build/Debug/src/diablo2/d2launch.obj b/build/Debug/src/diablo2/d2launch.obj index 9aa8760..46832cd 100644 Binary files a/build/Debug/src/diablo2/d2launch.obj and b/build/Debug/src/diablo2/d2launch.obj differ diff --git a/build/Debug/src/diablo2/d2net.obj b/build/Debug/src/diablo2/d2net.obj index 50e4f3b..4044dab 100644 Binary files a/build/Debug/src/diablo2/d2net.obj and b/build/Debug/src/diablo2/d2net.obj differ diff --git a/build/Debug/src/diablo2/d2win.obj b/build/Debug/src/diablo2/d2win.obj index 1efa49e..60c116f 100644 Binary files a/build/Debug/src/diablo2/d2win.obj and b/build/Debug/src/diablo2/d2win.obj differ diff --git a/build/Debug/src/diablo2/fog.obj b/build/Debug/src/diablo2/fog.obj index da4f70a..e2c2461 100644 Binary files a/build/Debug/src/diablo2/fog.obj and b/build/Debug/src/diablo2/fog.obj differ diff --git a/build/Debug/src/diablo2/storm.obj b/build/Debug/src/diablo2/storm.obj index 927bfee..3551764 100644 Binary files a/build/Debug/src/diablo2/storm.obj and b/build/Debug/src/diablo2/storm.obj differ diff --git a/build/Debug/src/diablo2/utils/mpq_ifstream.obj b/build/Debug/src/diablo2/utils/mpq_ifstream.obj index 4ac15a8..c3df778 100644 Binary files a/build/Debug/src/diablo2/utils/mpq_ifstream.obj and b/build/Debug/src/diablo2/utils/mpq_ifstream.obj differ diff --git a/build/Debug/src/diablo2/utils/screen.obj b/build/Debug/src/diablo2/utils/screen.obj index 7adc746..ab679ef 100644 Binary files a/build/Debug/src/diablo2/utils/screen.obj and b/build/Debug/src/diablo2/utils/screen.obj differ diff --git a/build/Debug/src/main.obj b/build/Debug/src/main.obj index 59aa554..85f753d 100644 Binary files a/build/Debug/src/main.obj and b/build/Debug/src/main.obj differ diff --git a/build/Debug/vc143.pdb b/build/Debug/vc143.pdb index 7f6685c..93a3328 100644 Binary files a/build/Debug/vc143.pdb and b/build/Debug/vc143.pdb differ diff --git a/build/Debug/vendor/D2Template/D2Template.obj b/build/Debug/vendor/D2Template/D2Template.obj index 8f016bc..6ec04ed 100644 Binary files a/build/Debug/vendor/D2Template/D2Template.obj and b/build/Debug/vendor/D2Template/D2Template.obj differ diff --git a/build/Debug/vendor/DllNotify/DllNotify.obj b/build/Debug/vendor/DllNotify/DllNotify.obj index 59a3af3..2a9e947 100644 Binary files a/build/Debug/vendor/DllNotify/DllNotify.obj and b/build/Debug/vendor/DllNotify/DllNotify.obj differ diff --git a/build/Debug/vendor/minhook/src/buffer.obj b/build/Debug/vendor/minhook/src/buffer.obj index 5f1e861..fcc2e1d 100644 Binary files a/build/Debug/vendor/minhook/src/buffer.obj and b/build/Debug/vendor/minhook/src/buffer.obj differ diff --git a/build/Debug/vendor/minhook/src/hde/hde32.obj b/build/Debug/vendor/minhook/src/hde/hde32.obj index 5435c43..c23e436 100644 Binary files a/build/Debug/vendor/minhook/src/hde/hde32.obj and b/build/Debug/vendor/minhook/src/hde/hde32.obj differ diff --git a/build/Debug/vendor/minhook/src/hde/hde64.obj b/build/Debug/vendor/minhook/src/hde/hde64.obj index bc04670..2fbc0c9 100644 Binary files a/build/Debug/vendor/minhook/src/hde/hde64.obj and b/build/Debug/vendor/minhook/src/hde/hde64.obj differ diff --git a/build/Debug/vendor/minhook/src/hook.obj b/build/Debug/vendor/minhook/src/hook.obj index 2ae3e3c..dc9309b 100644 Binary files a/build/Debug/vendor/minhook/src/hook.obj and b/build/Debug/vendor/minhook/src/hook.obj differ diff --git a/build/Debug/vendor/minhook/src/trampoline.obj b/build/Debug/vendor/minhook/src/trampoline.obj index 50bb62f..743903a 100644 Binary files a/build/Debug/vendor/minhook/src/trampoline.obj and b/build/Debug/vendor/minhook/src/trampoline.obj differ diff --git a/include/common/Ini.h b/include/common/Ini.h index 7e4a0da..f435138 100644 --- a/include/common/Ini.h +++ b/include/common/Ini.h @@ -4,7 +4,7 @@ // "CIni" is a simple API wrap class used for ini file access. // The purpose of this class is to make ini file access more // convenient than direct API calls. -// +// // This file is distributed "as is" and without any expressed or implied // warranties. The author holds no responsibilities for any possible damages // or loss of data that are caused by use of this file. The user must assume @@ -42,7 +42,7 @@ // If MFC is linked, we will use CStringArray for great convenience #ifdef __AFXWIN_H__ - #include +#include #endif // Number bases @@ -59,11 +59,11 @@ // string, the 2nd parameter is a 32-bit user defined data, this parameter can // be NULL. The parsing will terminate if this function returns zero. To use // the callback, function pointer needs to be passed to "CIni::ParseDNTString". -typedef BOOL (CALLBACK *SUBSTRPROC)(LPCTSTR, LPVOID); +typedef BOOL(CALLBACK* SUBSTRPROC)(LPCTSTR, LPVOID); class CIni { -public: +public: //----------------------------------------------------------- // Constructors & Destructor @@ -80,10 +80,10 @@ public: #ifdef __AFXWIN_H__ CString GetPathName() const; #endif - + //------------------------------------------------------------ // String Access - //------------------------------------------------------------ + //------------------------------------------------------------ DWORD GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDefault = NULL) const; #ifdef __AFXWIN_H__ CString GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault = NULL) const; @@ -93,32 +93,32 @@ public: // Read a string from the ini file, append it with another string then write it // back to the ini file. BOOL AppendString(LPCTSTR Section, LPCTSTR lpKey, LPCTSTR lpString) const; - + //------------------------------------------------------------ // Ini File String Array Access - //------------------------------------------------------------ + //------------------------------------------------------------ // Parse the string retrieved from the ini file and split it into a set of sub strings. DWORD GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const; #ifdef __AFXWIN_H__ void GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const; BOOL WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount = -1, LPCTSTR lpDelimiter = NULL) const; -#endif - +#endif + //------------------------------------------------------------ // Primitive Data Type Access //------------------------------------------------------------ int GetInt(LPCTSTR lpSection, LPCTSTR lpKey, int nDefault, int nBase = BASE_DECIMAL) const; BOOL WriteInt(LPCTSTR lpSection, LPCTSTR lpKey, int nValue, int nBase = BASE_DECIMAL) const; BOOL IncreaseInt(LPCTSTR lpSection, LPCTSTR lpKey, int nIncrease = 1, int nBase = BASE_DECIMAL) const; - + UINT GetUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nDefault, int nBase = BASE_DECIMAL) const; BOOL WriteUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nValue, int nBase = BASE_DECIMAL) const; BOOL IncreaseUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nIncrease = 1, int nBase = BASE_DECIMAL) const; - + BOOL GetBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bDefault) const; BOOL WriteBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bValue) const; BOOL InvertBool(LPCTSTR lpSection, LPCTSTR lpKey) const; - + double GetDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fDefault) const; BOOL WriteDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fValue, int nPrecision = -1) const; BOOL IncreaseDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fIncrease, int nPrecision = -1) const; @@ -131,14 +131,14 @@ public: //------------------------------------------------------------ POINT GetPoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT ptDefault) const; BOOL WritePoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT pt) const; - + RECT GetRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rcDefault) const; BOOL WriteRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rc) const; DWORD GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWORD dwBufSize, DWORD dwOffset = 0) const; BOOL WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const; BOOL AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const; - + //------------------------------------------------------------ // Section Operations //------------------------------------------------------------ @@ -150,17 +150,17 @@ public: BOOL CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist) const; BOOL MoveSection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist = TRUE) const; BOOL DeleteSection(LPCTSTR lpSection) const; - + //------------------------------------------------------------ // Key Operations //------------------------------------------------------------ - BOOL IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const; + BOOL IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const; DWORD GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const; #ifdef __AFXWIN_H__ void GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const; #endif DWORD GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const; -#ifdef __AFXWIN_H__ +#ifdef __AFXWIN_H__ void GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const; #endif BOOL CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection, LPCTSTR lpDestKey, BOOL bFailIfExist) const; @@ -176,8 +176,8 @@ public: // Check for Whether a String Representing TRUE or FALSE //------------------------------------------------------------ static BOOL StringToBool(LPCTSTR lpString, BOOL bDefault = FALSE); - -protected: + +protected: //------------------------------------------------------------ // Helper Functions @@ -191,7 +191,7 @@ protected: static void __IntToString(int nNumber, LPTSTR lpBuffer, int nBase); static void __UIntToString(UINT nNumber, LPTSTR lpBuffer, int nBase); static BOOL CALLBACK __SubStrCompare(LPCTSTR lpString1, LPVOID lpParam); - static BOOL CALLBACK __KeyPairProc(LPCTSTR lpString, LPVOID lpParam); + static BOOL CALLBACK __KeyPairProc(LPCTSTR lpString, LPVOID lpParam); #ifdef __AFXWIN_H__ static BOOL CALLBACK __SubStrAdd(LPCTSTR lpString, LPVOID lpParam); #endif diff --git a/include/common/config.h b/include/common/config.h index ba9e008..17b0d04 100644 --- a/include/common/config.h +++ b/include/common/config.h @@ -9,7 +9,7 @@ class config : public singleton { bool m_unlock_fps; bool m_prevent_minimize; uint32_t m_gold_pickup_range; - + public: explicit config(token); }; \ No newline at end of file diff --git a/include/common/hooking.h b/include/common/hooking.h index 5cf2b85..52e0065 100644 --- a/include/common/hooking.h +++ b/include/common/hooking.h @@ -62,7 +62,7 @@ namespace hooking { template mh_status_t hook(void* base, void* detour, TOrig** original) { auto fn = GetProcAddress(reinterpret_cast(base), - reinterpret_cast(TOrdinal)); + reinterpret_cast(TOrdinal)); return hook(fn, detour, original); } diff --git a/include/common/ptr_wrapper.h b/include/common/ptr_wrapper.h index bd5e965..eaed8e6 100644 --- a/include/common/ptr_wrapper.h +++ b/include/common/ptr_wrapper.h @@ -45,7 +45,7 @@ namespace details { TRet operator()(Args... args) { if (!m_function_ptr) { m_function_ptr = reinterpret_cast(GetProcAddress(reinterpret_cast(m_base), - reinterpret_cast(m_ordinal))); + reinterpret_cast(m_ordinal))); } return reinterpret_cast(m_function_ptr)(args...); @@ -67,7 +67,7 @@ namespace details { TRet operator()(Args... args) { if (!m_function_ptr) { m_function_ptr = reinterpret_cast(GetProcAddress(reinterpret_cast(m_base), - reinterpret_cast(m_ordinal))); + reinterpret_cast(m_ordinal))); } return reinterpret_cast(m_function_ptr)(args...); @@ -89,7 +89,7 @@ namespace details { TRet operator()(Args... args) { if (!m_function_ptr) { m_function_ptr = reinterpret_cast(GetProcAddress(reinterpret_cast(m_base), - reinterpret_cast(m_ordinal))); + reinterpret_cast(m_ordinal))); } return reinterpret_cast(m_function_ptr)(args...); diff --git a/include/d2tweaks/client/client.h b/include/d2tweaks/client/client.h index 31de10f..a20b689 100644 --- a/include/d2tweaks/client/client.h +++ b/include/d2tweaks/client/client.h @@ -13,25 +13,16 @@ struct StatEntry { std::wstring stat_display_string; diablo2::ui_color_t colorStat, colorStatValue; - int x1, y1, x2, y2, is_item_stat, item_type_id, stat = 0; // x1,y1 stat_display_string | x2,y2 statValue + int x1, y1, x2, y2, is_item_stat, item_type_id, stat, op, param = 0; // x1,y1 stat_display_string | x2,y2 statValue }; extern std::vector globalStatsVector; // Declaration of the global variable extern diablo2::structures::gfxdata g_gfxdata; // global gfxdata -extern int randStat; -extern int randStatRangeLow; -extern int randStatRangeHigh; -extern int randStatBool; - - extern bool m_stats_enabled; - extern bool m_help_enabled; - extern bool m_cube_enabled; - extern bool m_stash_enabled; namespace diablo2 { diff --git a/include/d2tweaks/client/modules/loot_filter/loot_filter_settings.h b/include/d2tweaks/client/modules/loot_filter/loot_filter_settings.h index b8bc33a..c02a3e4 100644 --- a/include/d2tweaks/client/modules/loot_filter/loot_filter_settings.h +++ b/include/d2tweaks/client/modules/loot_filter/loot_filter_settings.h @@ -24,7 +24,7 @@ namespace d2_tweaks { static void save(const char* name); static void load(const char* name); static void remove(const char* name); - + private: loot_filter_settings() : size(sizeof(loot_filter_settings)), alt_only(false), show_gold(true), show_runes(true), show_gems(true), reserved{} diff --git a/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.h b/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.h index 02e5bc9..366600f 100644 --- a/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.h +++ b/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.h @@ -61,7 +61,6 @@ namespace d2_tweaks { //handle hovering over item and actual click static void __fastcall handle_dropped_items(diablo2::structures::unit* unit, void* edx); }; - } } } diff --git a/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.h b/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.h index c6e54e4..1f560ad 100644 --- a/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.h +++ b/include/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.h @@ -20,6 +20,7 @@ namespace d2_tweaks { ui::controls::button* m_btn_toggle_help; ui::controls::button* m_btn_toggle_cube; ui::controls::button* m_btn_toggle_stash; + menu* m_filter_settings_menu; bool m_show; public: diff --git a/include/d2tweaks/common/protocol.h b/include/d2tweaks/common/protocol.h index 48ba086..772f13e 100644 --- a/include/d2tweaks/common/protocol.h +++ b/include/d2tweaks/common/protocol.h @@ -226,7 +226,6 @@ namespace d2_tweaks { packet_header() : d2_packet_type(0xBB), message_type(0) {} }; - struct d2_entity_action_cs : packet_header { uint32_t action; uint32_t entity_id; @@ -274,7 +273,6 @@ namespace d2_tweaks { } }; - struct inventory_sort_sc : packet_header { uint8_t page; uint8_t tx; @@ -300,7 +298,6 @@ namespace d2_tweaks { damage_type_t damage_type; uint32_t damage; - uint32_t currentHp; // New field for current hit points uint32_t maxHp; // New field for maximum hit points @@ -400,7 +397,7 @@ namespace d2_tweaks { message_type = MESSAGE_TYPE_TRADER_UPDATE; } }; - + #pragma pack(pop) } } \ No newline at end of file diff --git a/include/d2tweaks/server/modules/autosort/autosort_server.h b/include/d2tweaks/server/modules/autosort/autosort_server.h index b09d0fa..fc364c3 100644 --- a/include/d2tweaks/server/modules/autosort/autosort_server.h +++ b/include/d2tweaks/server/modules/autosort/autosort_server.h @@ -24,11 +24,11 @@ namespace d2_tweaks { void init() override; bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, - common::packet_header* packet) override; + common::packet_header* packet) override; private: bool sort(diablo2::structures::game* game, diablo2::structures::unit* player, uint8_t page); bool find_free_space(diablo2::structures::inventory* inv, - diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y, bool isCharmZone); + diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y, bool isCharmZone); }; } } diff --git a/include/d2tweaks/server/modules/damage_display/damage_display_server.h b/include/d2tweaks/server/modules/damage_display/damage_display_server.h index 6bbff58..2c91bae 100644 --- a/include/d2tweaks/server/modules/damage_display/damage_display_server.h +++ b/include/d2tweaks/server/modules/damage_display/damage_display_server.h @@ -24,7 +24,7 @@ namespace d2_tweaks { void init() override; bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, - common::packet_header* packet) override; + common::packet_header* packet) override; void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override; }; } diff --git a/include/d2tweaks/server/modules/item_move/item_move_server.h b/include/d2tweaks/server/modules/item_move/item_move_server.h index 0599b27..d697de1 100644 --- a/include/d2tweaks/server/modules/item_move/item_move_server.h +++ b/include/d2tweaks/server/modules/item_move/item_move_server.h @@ -24,10 +24,10 @@ namespace d2_tweaks { void init() override; bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, - common::packet_header* packet) override; + common::packet_header* packet) override; private: bool find_free_space(diablo2::structures::inventory* inv, - diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y); + diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y); }; } } diff --git a/include/d2tweaks/server/modules/trader_update/trader_update_server.h b/include/d2tweaks/server/modules/trader_update/trader_update_server.h index 25186fa..74d7a5d 100644 --- a/include/d2tweaks/server/modules/trader_update/trader_update_server.h +++ b/include/d2tweaks/server/modules/trader_update/trader_update_server.h @@ -22,10 +22,10 @@ namespace d2_tweaks { void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override; bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override; - //private: - // bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y); - // bool send_to_cube(diablo2::structures::game* game, diablo2::structures::unit* player, diablo2::structures::unit* item); - // bool move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet); + //private: + // bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y); + // bool send_to_cube(diablo2::structures::game* game, diablo2::structures::unit* player, diablo2::structures::unit* item); + // bool move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet); }; } } diff --git a/include/d2tweaks/server/server.h b/include/d2tweaks/server/server.h index b59ec3b..57bf63e 100644 --- a/include/d2tweaks/server/server.h +++ b/include/d2tweaks/server/server.h @@ -47,7 +47,7 @@ namespace d2_tweaks { diablo2::structures::unit* get_server_unit(diablo2::structures::game* game, uint32_t guid, diablo2::structures::unit_type_t type); void iterate_server_units(diablo2::structures::game* game, diablo2::structures::unit_type_t type, - const std::function& cb); + const std::function& cb); private: static int32_t __fastcall net_tick(diablo2::structures::game* game, diablo2::structures::unit* unit, int32_t a3, int32_t a4); }; diff --git a/include/d2tweaks/ui/controls/button.h b/include/d2tweaks/ui/controls/button.h index 71f3554..53b484c 100644 --- a/include/d2tweaks/ui/controls/button.h +++ b/include/d2tweaks/ui/controls/button.h @@ -40,7 +40,7 @@ namespace d2_tweaks { std::vector m_respos; public: button(menu* menu, const rect& rect, const std::function& onClick, - common::asset* image, int32_t frameDown, int32_t frameUp, int32_t clickSound = -1); + common::asset* image, int32_t frameDown, int32_t frameUp, int32_t clickSound = -1); explicit button(menu* menu, const pugi::xml_node& node); virtual ~button(); diff --git a/include/d2tweaks/ui/controls/checkbox.h b/include/d2tweaks/ui/controls/checkbox.h index 764880d..24cd078 100644 --- a/include/d2tweaks/ui/controls/checkbox.h +++ b/include/d2tweaks/ui/controls/checkbox.h @@ -35,7 +35,7 @@ namespace d2_tweaks { std::function m_on_click; public: explicit checkbox(menu* menu, const std::wstring& text, const rect& rect, const std::function& onClick, - common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound = -1); + common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound = -1); explicit checkbox(menu* menu, const pugi::xml_node& node); void set_x(int32_t value) override; diff --git a/include/d2tweaks/ui/controls/control.h b/include/d2tweaks/ui/controls/control.h index 19c4438..f4e94ad 100644 --- a/include/d2tweaks/ui/controls/control.h +++ b/include/d2tweaks/ui/controls/control.h @@ -115,7 +115,6 @@ namespace d2_tweaks { virtual void middle_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {} virtual void mouse_wheel(int32_t offsetX, int32_t offsetY, bool up, bool& block) {} - virtual void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) = 0; }; } diff --git a/include/d2tweaks/ui/controls/label.h b/include/d2tweaks/ui/controls/label.h index 6381744..9844434 100644 --- a/include/d2tweaks/ui/controls/label.h +++ b/include/d2tweaks/ui/controls/label.h @@ -9,7 +9,6 @@ namespace d2_tweaks { namespace ui { namespace controls { - class label : public control { std::wstring m_text; bool m_text_owned; @@ -19,8 +18,8 @@ namespace d2_tweaks { std::vector m_respos; public: explicit label(menu* menu, const std::wstring& text, int32_t x = 0, int32_t y = 0, - diablo2::ui_color_t color = diablo2::UI_COLOR_WHITE, - diablo2::ui_font_t font = diablo2::UI_FONT_16); + diablo2::ui_color_t color = diablo2::UI_COLOR_WHITE, + diablo2::ui_font_t font = diablo2::UI_FONT_16); explicit label(menu* menu, const pugi::xml_node& node); void set_text(const std::wstring& text) { @@ -31,7 +30,6 @@ namespace d2_tweaks { return m_text; } - diablo2::ui_color_t get_color() const { return m_color; } diff --git a/include/d2tweaks/ui/ui_manager.h b/include/d2tweaks/ui/ui_manager.h index 303e5ee..f0b0b8a 100644 --- a/include/d2tweaks/ui/ui_manager.h +++ b/include/d2tweaks/ui/ui_manager.h @@ -35,7 +35,6 @@ namespace d2_tweaks { bool process_middle_mouse(bool up); bool process_mouse_wheel(bool up); - bool process_key_event(uint32_t key, bool up); }; } diff --git a/include/diablo2/d2client.h b/include/diablo2/d2client.h index 255e896..5c14fd5 100644 --- a/include/diablo2/d2client.h +++ b/include/diablo2/d2client.h @@ -53,13 +53,12 @@ namespace diablo2 { static int32_t get_view_offset_x(); static int32_t get_view_offset_y(); - + static uint32_t get_mouse_x(); static uint32_t get_mouse_y(); static bool get_ui_window_state(ui_window_t window); static void* get_buysellbtn(); - static void play_sound(uint32_t soundId, structures::unit* u, uint32_t ticks, BOOL prePick, uint32_t cache); static structures::unit* get_unit_by_guid(int32_t type, int32_t guid); @@ -68,14 +67,14 @@ namespace diablo2 { static void print_chat(wchar_t* string, uint32_t color); static bool cache_gfx_data(structures::gfxdata* gfxData, - structures::unit* unit, - structures::cellfile* cellfFile, - int32_t direction, - int32_t frame, - int32_t* outIndex, - int8_t flags, - int32_t colorTint); - + structures::unit* unit, + structures::cellfile* cellfFile, + int32_t direction, + int32_t frame, + int32_t* outIndex, + int8_t flags, + int32_t colorTint); + static structures::cellfile* load_gfx_resource(char* path); static int32_t unload_gfx_resource(structures::cellfile* handle); static int32_t send_to_server_7(BYTE type, DWORD num, DWORD unk1, DWORD unk2); @@ -90,6 +89,5 @@ namespace diablo2 { static int32_t send_to_server_9(BYTE type, DWORD num, DWORD unk1); static void set_ui_toggle(int nToggle, int nUIState, BOOL bToggle); - }; } \ No newline at end of file diff --git a/include/diablo2/d2common.h b/include/diablo2/d2common.h index 4bc66f4..aada8d3 100644 --- a/include/diablo2/d2common.h +++ b/include/diablo2/d2common.h @@ -92,6 +92,67 @@ namespace diablo2 { struct items_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 { @@ -397,526 +458,521 @@ namespace diablo2 { UNIT_STAT_ITEM_TOHIT_UNDEAD_BYTIME = 0x12B, UNIT_STAT_ITEM_CRUSHINGBLOW_BYTIME = 0x12C, - // unit_stats_t from Ironman mod - UNIT_STAT_strength = 0, - UNIT_STAT_energy = 1, - UNIT_STAT_dexterity = 2, - UNIT_STAT_vitality = 3, - UNIT_STAT_statpts = 4, - UNIT_STAT_newskills = 5, - UNIT_STAT_hitpoints = 6, - UNIT_STAT_maxhp = 7, - UNIT_STAT_mana = 8, - UNIT_STAT_maxmana = 9, - UNIT_STAT_stamina = 10, - UNIT_STAT_maxstamina = 11, - UNIT_STAT_level = 12, - UNIT_STAT_experience = 13, - UNIT_STAT_gold = 14, - UNIT_STAT_goldbank = 15, - UNIT_STAT_item_armor_percent = 16, - UNIT_STAT_item_maxdamage_percent = 17, - UNIT_STAT_item_mindamage_percent = 18, - UNIT_STAT_tohit = 19, - UNIT_STAT_toblock = 20, - UNIT_STAT_mindamage = 21, - UNIT_STAT_maxdamage = 22, - UNIT_STAT_secondary_mindamage = 23, - UNIT_STAT_secondary_maxdamage = 24, - UNIT_STAT_damagepercent = 25, - UNIT_STAT_manarecovery = 26, - UNIT_STAT_manarecoverybonus = 27, - UNIT_STAT_staminarecoverybonus = 28, - UNIT_STAT_lastexp = 29, - UNIT_STAT_nextexp = 30, - UNIT_STAT_armorclass = 31, - UNIT_STAT_armorclass_vs_missile = 32, - UNIT_STAT_armorclass_vs_hth = 33, - UNIT_STAT_normal_damage_reduction = 34, - UNIT_STAT_magic_damage_reduction = 35, - UNIT_STAT_damageresist = 36, - UNIT_STAT_magicresist = 37, - UNIT_STAT_maxmagicresist = 38, - UNIT_STAT_fireresist = 39, - UNIT_STAT_maxfireresist = 40, - UNIT_STAT_lightresist = 41, - UNIT_STAT_maxlightresist = 42, - UNIT_STAT_coldresist = 43, - UNIT_STAT_maxcoldresist = 44, - UNIT_STAT_poisonresist = 45, - UNIT_STAT_maxpoisonresist = 46, - UNIT_STAT_damageaura = 47, - UNIT_STAT_firemindam = 48, - UNIT_STAT_firemaxdam = 49, - UNIT_STAT_lightmindam = 50, - UNIT_STAT_lightmaxdam = 51, - UNIT_STAT_magicmindam = 52, - UNIT_STAT_magicmaxdam = 53, - UNIT_STAT_coldmindam = 54, - UNIT_STAT_coldmaxdam = 55, - UNIT_STAT_coldlength = 56, - UNIT_STAT_poisonmindam = 57, - UNIT_STAT_poisonmaxdam = 58, - UNIT_STAT_poisonlength = 59, - UNIT_STAT_lifedrainmindam = 60, - UNIT_STAT_lifedrainmaxdam = 61, - UNIT_STAT_manadrainmindam = 62, - UNIT_STAT_manadrainmaxdam = 63, - UNIT_STAT_stamdrainmindam = 64, - UNIT_STAT_stamdrainmaxdam = 65, - UNIT_STAT_stunlength = 66, - UNIT_STAT_velocitypercent = 67, - UNIT_STAT_attackrate = 68, - UNIT_STAT_other_animrate = 69, - UNIT_STAT_quantity = 70, - UNIT_STAT_value = 71, - UNIT_STAT_durability = 72, - UNIT_STAT_maxdurability = 73, - UNIT_STAT_hpregen = 74, - UNIT_STAT_item_maxdurability_percent = 75, - UNIT_STAT_item_maxhp_percent = 76, - UNIT_STAT_item_maxmana_percent = 77, - UNIT_STAT_item_attackertakesdamage = 78, - UNIT_STAT_item_goldbonus = 79, - UNIT_STAT_item_magicbonus = 80, - UNIT_STAT_item_knockback = 81, - UNIT_STAT_item_timeduration = 82, - UNIT_STAT_item_addclassskills = 83, - UNIT_STAT_unsentparam1 = 84, - UNIT_STAT_item_addexperience = 85, - UNIT_STAT_item_healafterkill = 86, - UNIT_STAT_item_reducedprices = 87, - UNIT_STAT_item_doubleherbduration = 88, - UNIT_STAT_item_lightradius = 89, - UNIT_STAT_item_lightcolor = 90, - UNIT_STAT_item_req_percent = 91, - UNIT_STAT_item_levelreq = 92, - UNIT_STAT_item_fasterattackrate = 93, - UNIT_STAT_item_levelreqpct = 94, - UNIT_STAT_lastblockframe = 95, - UNIT_STAT_item_fastermovevelocity = 96, - UNIT_STAT_item_nonclassskill = 97, - UNIT_STAT_state = 98, - UNIT_STAT_item_fastergethitrate = 99, - UNIT_STAT_monster_playercount = 100, - UNIT_STAT_skill_poison_override_length = 101, - UNIT_STAT_item_fasterblockrate = 102, - UNIT_STAT_skill_bypass_undead = 103, - UNIT_STAT_skill_bypass_demons = 104, - UNIT_STAT_item_fastercastrate = 105, - UNIT_STAT_skill_bypass_beasts = 106, - UNIT_STAT_item_singleskill = 107, - UNIT_STAT_item_restinpeace = 108, - UNIT_STAT_curse_resistance = 109, - UNIT_STAT_item_poisonlengthresist = 110, - UNIT_STAT_item_normaldamage = 111, - UNIT_STAT_item_howl = 112, - UNIT_STAT_item_stupidity = 113, - UNIT_STAT_item_damagetomana = 114, - UNIT_STAT_item_ignoretargetac = 115, - UNIT_STAT_item_fractionaltargetac = 116, - UNIT_STAT_item_preventheal = 117, - UNIT_STAT_item_halffreezeduration = 118, - UNIT_STAT_item_tohit_percent = 119, - UNIT_STAT_item_damagetargetac = 120, - UNIT_STAT_item_demondamage_percent = 121, - UNIT_STAT_item_undeaddamage_percent = 122, - UNIT_STAT_item_demon_tohit = 123, - UNIT_STAT_item_undead_tohit = 124, - UNIT_STAT_item_throwable = 125, - UNIT_STAT_item_elemskill = 126, - UNIT_STAT_item_allskills = 127, - UNIT_STAT_item_attackertakeslightdamage = 128, - UNIT_STAT_ironmaiden_level = 129, - UNIT_STAT_lifetap_level = 130, - UNIT_STAT_thorns_percent = 131, - UNIT_STAT_bonearmor = 132, - UNIT_STAT_bonearmormax = 133, - UNIT_STAT_item_freeze = 134, - UNIT_STAT_item_openwounds = 135, - UNIT_STAT_item_crushingblow = 136, - UNIT_STAT_item_kickdamage = 137, - UNIT_STAT_item_manaafterkill = 138, - UNIT_STAT_item_healafterdemonkill = 139, - UNIT_STAT_item_extrablood = 140, - UNIT_STAT_item_deadlystrike = 141, - UNIT_STAT_item_absorbfire_percent = 142, - UNIT_STAT_item_absorbfire = 143, - UNIT_STAT_item_absorblight_percent = 144, - UNIT_STAT_item_absorblight = 145, - UNIT_STAT_item_absorbmagic_percent = 146, - UNIT_STAT_item_absorbmagic = 147, - UNIT_STAT_item_absorbcold_percent = 148, - UNIT_STAT_item_absorbcold = 149, - UNIT_STAT_item_slow = 150, - UNIT_STAT_item_aura = 151, - UNIT_STAT_item_indesctructible = 152, - UNIT_STAT_item_cannotbefrozen = 153, - UNIT_STAT_item_staminadrainpct = 154, - UNIT_STAT_item_reanimate = 155, - UNIT_STAT_item_pierce = 156, - UNIT_STAT_item_magicarrow = 157, - UNIT_STAT_item_explosivearrow = 158, - UNIT_STAT_item_throw_mindamage = 159, - UNIT_STAT_item_throw_maxdamage = 160, - UNIT_STAT_skill_handofathena = 161, - UNIT_STAT_skill_staminapercent = 162, - UNIT_STAT_skill_passive_staminapercent = 163, - UNIT_STAT_skill_concentration = 164, - UNIT_STAT_skill_enchant = 165, - UNIT_STAT_skill_pierce = 166, - UNIT_STAT_skill_conviction = 167, - UNIT_STAT_skill_chillingarmor = 168, - UNIT_STAT_skill_frenzy = 169, - UNIT_STAT_skill_decrepify = 170, - UNIT_STAT_skill_armor_percent = 171, - UNIT_STAT_alignment = 172, - UNIT_STAT_target0 = 173, - UNIT_STAT_target1 = 174, - UNIT_STAT_goldlost = 175, - UNIT_STAT_conversion_level = 176, - UNIT_STAT_conversion_maxhp = 177, - UNIT_STAT_unit_dooverlay = 178, - UNIT_STAT_attack_vs_montype = 179, - UNIT_STAT_damage_vs_montype = 180, - UNIT_STAT_fade = 181, - UNIT_STAT_armor_override_percent = 182, - UNIT_STAT_killcounter = 183, - UNIT_STAT_soulscaptured = 184, - UNIT_STAT_spirits = 185, - UNIT_STAT_skill_more = 186, - UNIT_STAT_item_corrupted = 187, - UNIT_STAT_item_addskill_tab = 188, - UNIT_STAT_hidden_corruption = 189, - UNIT_STAT_item_strength_spirits = 190, - UNIT_STAT_item_dexterity_spirits = 191, - UNIT_STAT_item_vitality_spirits = 192, - UNIT_STAT_item_energy_spirits = 193, - UNIT_STAT_item_numsockets = 194, - UNIT_STAT_item_skillonattack = 195, - UNIT_STAT_item_skillonkill = 196, - UNIT_STAT_item_skillondeath = 197, - UNIT_STAT_item_skillonhit = 198, - UNIT_STAT_item_skillonlevelup = 199, - UNIT_STAT_item_skill_souls = 200, - UNIT_STAT_item_skillongethit = 201, - UNIT_STAT_UNUSED_2 = 202, - UNIT_STAT_UNUSED_3 = 203, - UNIT_STAT_item_charged_skill = 204, - UNIT_STAT_UNUSED_5 = 205, - UNIT_STAT_UNUSED_6 = 206, - UNIT_STAT_UNUSED_7 = 207, - UNIT_STAT_UNUSED_8 = 208, - UNIT_STAT_UNUSED_9 = 209, - UNIT_STAT_UNUSED_10 = 210, - UNIT_STAT_UNUSED_11 = 211, - UNIT_STAT_UNUSED_12 = 212, - UNIT_STAT_UNUSED_13 = 213, - UNIT_STAT_item_armor_perlevel = 214, - UNIT_STAT_item_armorpercent_perlevel = 215, - UNIT_STAT_item_hp_perlevel = 216, - UNIT_STAT_item_mana_perlevel = 217, - UNIT_STAT_item_maxdamage_perlevel = 218, - UNIT_STAT_item_maxdamage_percent_perlevel = 219, - UNIT_STAT_item_strength_perlevel = 220, - UNIT_STAT_item_dexterity_perlevel = 221, - UNIT_STAT_item_energy_perlevel = 222, - UNIT_STAT_item_vitality_perlevel = 223, - UNIT_STAT_item_tohit_perlevel = 224, - UNIT_STAT_item_tohitpercent_perlevel = 225, - UNIT_STAT_item_cold_damagemax_perlevel = 226, - UNIT_STAT_item_fire_damagemax_perlevel = 227, - UNIT_STAT_item_ltng_damagemax_perlevel = 228, - UNIT_STAT_item_pois_damagemax_perlevel = 229, - UNIT_STAT_item_resist_cold_perlevel = 230, - UNIT_STAT_item_resist_fire_perlevel = 231, - UNIT_STAT_item_resist_ltng_perlevel = 232, - UNIT_STAT_item_resist_pois_perlevel = 233, - UNIT_STAT_item_absorb_cold_perlevel = 234, - UNIT_STAT_item_absorb_fire_perlevel = 235, - UNIT_STAT_item_absorb_ltng_perlevel = 236, - UNIT_STAT_item_absorb_pois_perlevel = 237, - UNIT_STAT_item_thorns_perlevel = 238, - UNIT_STAT_UNUSED_84 = 239, - UNIT_STAT_item_find_magic_perlevel = 240, - UNIT_STAT_item_regenstamina_perlevel = 241, - UNIT_STAT_item_stamina_perlevel = 242, - UNIT_STAT_item_damage_demon_perlevel = 243, - UNIT_STAT_item_damage_undead_perlevel = 244, - UNIT_STAT_item_tohit_demon_perlevel = 245, - UNIT_STAT_item_tohit_undead_perlevel = 246, - UNIT_STAT_item_crushingblow_perlevel = 247, - UNIT_STAT_item_openwounds_perlevel = 248, - UNIT_STAT_item_kick_damage_perlevel = 249, - UNIT_STAT_item_deadlystrike_perlevel = 250, - UNIT_STAT_item_find_gems_perlevel = 251, - UNIT_STAT_item_replenish_durability = 252, - UNIT_STAT_item_replenish_quantity = 253, - UNIT_STAT_item_extra_stack = 254, - UNIT_STAT_item_find_item = 255, - UNIT_STAT_item_slash_damage = 256, - UNIT_STAT_item_slash_damage_percent = 257, - UNIT_STAT_item_crush_damage = 258, - UNIT_STAT_item_crush_damage_percent = 259, - UNIT_STAT_item_thrust_damage = 260, - UNIT_STAT_item_thrust_damage_percent = 261, - UNIT_STAT_item_absorb_slash = 262, - UNIT_STAT_item_absorb_crush = 263, - UNIT_STAT_item_absorb_thrust = 264, - UNIT_STAT_item_absorb_slash_percent = 265, - UNIT_STAT_item_absorb_crush_percent = 266, - UNIT_STAT_item_absorb_thrust_percent = 267, - UNIT_STAT_UNUSED_14 = 268, - UNIT_STAT_UNUSED_15 = 269, - UNIT_STAT_UNUSED_16 = 270, - UNIT_STAT_UNUSED_17 = 271, - UNIT_STAT_UNUSED_18 = 272, - UNIT_STAT_UNUSED_19 = 273, - UNIT_STAT_UNUSED_20 = 274, - UNIT_STAT_UNUSED_21 = 275, - UNIT_STAT_UNUSED_22 = 276, - UNIT_STAT_UNUSED_23 = 277, - UNIT_STAT_UNUSED_24 = 278, - UNIT_STAT_UNUSED_25 = 279, - UNIT_STAT_UNUSED_26 = 280, - UNIT_STAT_UNUSED_27 = 281, - UNIT_STAT_UNUSED_28 = 282, - UNIT_STAT_UNUSED_29 = 283, - UNIT_STAT_UNUSED_30 = 284, - UNIT_STAT_UNUSED_31 = 285, - UNIT_STAT_UNUSED_32 = 286, - UNIT_STAT_UNUSED_33 = 287, - UNIT_STAT_UNUSED_34 = 288, - UNIT_STAT_UNUSED_35 = 289, - UNIT_STAT_UNUSED_36 = 290, - UNIT_STAT_UNUSED_37 = 291, - UNIT_STAT_UNUSED_38 = 292, - UNIT_STAT_UNUSED_39 = 293, - UNIT_STAT_UNUSED_40 = 294, - UNIT_STAT_UNUSED_41 = 295, - UNIT_STAT_UNUSED_42 = 296, - UNIT_STAT_UNUSED_43 = 297, - UNIT_STAT_UNUSED_44 = 298, - UNIT_STAT_display_spirits = 299, - UNIT_STAT_display_souls_captured = 300, - UNIT_STAT_magharv = 301, - UNIT_STAT_dummy = 302, - UNIT_STAT_display_kills = 303, - UNIT_STAT_iforge = 304, - UNIT_STAT_item_pierce_cold = 305, - UNIT_STAT_item_pierce_fire = 306, - UNIT_STAT_item_pierce_ltng = 307, - UNIT_STAT_item_pierce_pois = 308, - UNIT_STAT_item_damage_vs_monster = 309, - UNIT_STAT_item_damage_percent_vs_monster = 310, - UNIT_STAT_item_tohit_vs_monster = 311, - UNIT_STAT_item_tohit_percent_vs_monster = 312, - UNIT_STAT_item_ac_vs_monster = 313, - UNIT_STAT_item_ac_percent_vs_monster = 314, - UNIT_STAT_firelength = 315, - UNIT_STAT_burningmin = 316, - UNIT_STAT_burningmax = 317, - UNIT_STAT_progressive_damage = 318, - UNIT_STAT_progressive_steal = 319, - UNIT_STAT_progressive_other = 320, - UNIT_STAT_progressive_fire = 321, - UNIT_STAT_progressive_cold = 322, - UNIT_STAT_progressive_lightning = 323, - UNIT_STAT_item_extra_charges = 324, - UNIT_STAT_progressive_tohit = 325, - UNIT_STAT_poison_count = 326, - UNIT_STAT_damage_framerate = 327, - UNIT_STAT_pierce_idx = 328, - UNIT_STAT_passive_fire_mastery = 329, - UNIT_STAT_passive_ltng_mastery = 330, - UNIT_STAT_passive_cold_mastery = 331, - UNIT_STAT_passive_pois_mastery = 332, - UNIT_STAT_passive_fire_pierce = 333, - UNIT_STAT_passive_ltng_pierce = 334, - UNIT_STAT_passive_cold_pierce = 335, - UNIT_STAT_passive_pois_pierce = 336, - UNIT_STAT_passive_critical_strike = 337, - UNIT_STAT_passive_dodge = 338, - UNIT_STAT_passive_avoid = 339, - UNIT_STAT_passive_evade = 340, - UNIT_STAT_passive_warmth = 341, - UNIT_STAT_passive_mastery_melee_th = 342, - UNIT_STAT_passive_mastery_melee_dmg = 343, - UNIT_STAT_passive_mastery_melee_crit = 344, - UNIT_STAT_passive_mastery_throw_th = 345, - UNIT_STAT_passive_mastery_throw_dmg = 346, - UNIT_STAT_passive_mastery_throw_crit = 347, - UNIT_STAT_passive_weaponblock = 348, - UNIT_STAT_passive_summon_resist = 349, - UNIT_STAT_modifierlist_skill = 350, - UNIT_STAT_modifierlist_level = 351, - UNIT_STAT_last_sent_hp_pct = 352, - UNIT_STAT_source_unit_type = 353, - UNIT_STAT_source_unit_id = 354, - UNIT_STAT_shortparam1 = 355, - UNIT_STAT_questitemdifficulty = 356, - UNIT_STAT_passive_mag_mastery = 357, - UNIT_STAT_passive_mag_pierce = 358, - UNIT_STAT_item_strength_percent = 359, - UNIT_STAT_item_dexterity_percent = 360, - UNIT_STAT_item_vitality_percent = 361, - UNIT_STAT_item_energy_percent = 362, - UNIT_STAT_item_strengthpercent_perlevel = 363, - UNIT_STAT_item_dexteritypercent_perlevel = 364, - UNIT_STAT_item_energypercent_perlevel = 365, - UNIT_STAT_item_vitalitypercent_perlevel = 366, - UNIT_STAT_item_attackergetsblind = 367, - UNIT_STAT_item_attackerflees = 368, - UNIT_STAT_item_attackertakesfiredamage = 369, - UNIT_STAT_item_attackertakescolddamage = 370, - UNIT_STAT_item_maxdamage_perstr = 371, - UNIT_STAT_item_maxdamage_perdex = 372, - UNIT_STAT_item_mindamage_perlvl = 373, - UNIT_STAT_item_mindamage_perstr = 374, - UNIT_STAT_item_mindamage_perdex = 375, - UNIT_STAT_item_maxdamage_percent_perstr = 376, - UNIT_STAT_item_maxdamage_percent_perdex = 377, - UNIT_STAT_item_openwounds_perdex = 378, - UNIT_STAT_item_openwounds_perstr = 379, - UNIT_STAT_item_deadlystrike_perdex = 380, - UNIT_STAT_item_deadlystrike_perstr = 381, - UNIT_STAT_item_armor_perstr = 382, - UNIT_STAT_item_armor_perdex = 383, - UNIT_STAT_item_tohit_perstr = 384, - UNIT_STAT_item_tohit_perDex = 385, - UNIT_STAT_item_hp_pervitality = 386, - UNIT_STAT_item_mana_perenr = 387, - UNIT_STAT_item_fastercastrate_perenr = 388, - UNIT_STAT_item_fasterblockrate_perdex = 389, - UNIT_STAT_item_fastermovevelocity_pervitality = 390, - UNIT_STAT_item_fasterswingvelocity_perstrength = 391, - UNIT_STAT_item_mindamage_percent_perstr = 392, - UNIT_STAT_item_mindamage_percent_perdex = 393, - UNIT_STAT_item_mindamage_percent_perlvl = 394, - UNIT_STAT_item_crushingblow_perstr = 395, - UNIT_STAT_item_crushingblow_perdex = 396, - UNIT_STAT_item_elemskillcold = 397, - UNIT_STAT_item_elemskilllight = 398, - UNIT_STAT_item_elemskillpoison = 399, - UNIT_STAT_item_elemskillmagic = 400, - UNIT_STAT_item_elemskillfire = 401, - UNIT_STAT_item_armorpercent_perstr = 402, - UNIT_STAT_item_armorpercent_perdex = 403, - UNIT_STAT_item_tohitpercent_perstr = 404, - UNIT_STAT_item_tohitpercent_perdex = 405, - UNIT_STAT_item_fasterswingvelocity_perdex = 406, - UNIT_STAT_item_fasterswingvelocity_perlvl = 407, - UNIT_STAT_item_fasterblockrate_perstr = 408, - UNIT_STAT_item_fasterblockrate_perlvl = 409, - UNIT_STAT_item_fastermovevelocity_perdex = 410, - UNIT_STAT_item_fastermovevelocity_perlvl = 411, - UNIT_STAT_item_fastercastrate_perlvl = 412, - UNIT_STAT_item_fasterhitrecovery_pervit = 413, - UNIT_STAT_item_fasterhitrecovery_perlvl = 414, - UNIT_STAT_item_increasedblock_perdex = 415, - UNIT_STAT_item_increasedblock_perlvl = 416, - UNIT_STAT_item_addexperience_perlvl = 417, - UNIT_STAT_item_addexperience_perenr = 418, - UNIT_STAT_item_reducedprices_perlvl = 419, - UNIT_STAT_item_pierce_perlvl = 420, - UNIT_STAT_item_pierce_perstr = 421, - UNIT_STAT_resmax_display_all_zero = 422, - UNIT_STAT_maxmagres_percent = 423, - UNIT_STAT_maxfireres_percent = 424, - UNIT_STAT_maxlightres_percent = 425, - UNIT_STAT_maxcoldres_percent = 426, - UNIT_STAT_maxpoisres_percent = 427, - UNIT_STAT_magicresist_hidden = 428, - UNIT_STAT_maxmagicresist_hidden = 429, - UNIT_STAT_fireresist_hidden = 430, - UNIT_STAT_maxfireresist_hidden = 431, - UNIT_STAT_lightresist_hidden = 432, - UNIT_STAT_maxlightresist_hidden = 433, - UNIT_STAT_coldresist_hidden = 434, - UNIT_STAT_maxcoldresist_hidden = 435, - UNIT_STAT_poisonresist_hidden = 436, - UNIT_STAT_maxpoisonresist_hidden = 437, - UNIT_STAT_hiddenresist_dummy = 438, - UNIT_STAT_item_slow_perlvl = 439, - UNIT_STAT_item_kick_damage_perstr = 440, - UNIT_STAT_item_kick_damage_perdex = 441, - UNIT_STAT_damageresist_perlvl = 442, - UNIT_STAT_damageresist_pervit = 443, - UNIT_STAT_magic_damage_reduction_perlvl = 444, - UNIT_STAT_magic_damage_reduction_perenr = 445, - UNIT_STAT_magicresist_perlvl = 446, - UNIT_STAT_magicresist_perenr = 447, - UNIT_STAT_item_stupidity_perlvl = 448, - UNIT_STAT_item_freeze_perlvl = 449, - UNIT_STAT_item_freeze_perenr = 450, - UNIT_STAT_item_poisonlengthresist_perlvl = 451, - UNIT_STAT_item_poisonlengthresist_pervit = 452, - UNIT_STAT_curse_resistance_perlvl = 453, - UNIT_STAT_curse_resistance_perenr = 454, - UNIT_STAT_curse_resistance_length = 455, - UNIT_STAT_item_manaafterkill_perlvl = 456, - UNIT_STAT_item_manaafterkill_perenr = 457, - UNIT_STAT_item_damagetomana_perlvl = 458, - UNIT_STAT_item_damagetomana_perenr = 459, - UNIT_STAT_item_damagetomana_permana = 460, - UNIT_STAT_UNUSED_45 = 461, - UNIT_STAT_UNUSED_46 = 462, - UNIT_STAT_UNUSED_47 = 463, - UNIT_STAT_UNUSED_48 = 464, - UNIT_STAT_UNUSED_49 = 465, - UNIT_STAT_UNUSED_50 = 466, - UNIT_STAT_UNUSED_51 = 467, - UNIT_STAT_UNUSED_52 = 468, - UNIT_STAT_UNUSED_53 = 469, - UNIT_STAT_UNUSED_54 = 470, - UNIT_STAT_UNUSED_55 = 471, - UNIT_STAT_UNUSED_56 = 472, - UNIT_STAT_UNUSED_57 = 473, - UNIT_STAT_UNUSED_58 = 474, - UNIT_STAT_UNUSED_59 = 475, - UNIT_STAT_UNUSED_60 = 476, - UNIT_STAT_UNUSED_61 = 477, - UNIT_STAT_UNUSED_62 = 478, - UNIT_STAT_UNUSED_63 = 479, - UNIT_STAT_UNUSED_64 = 480, - UNIT_STAT_UNUSED_65 = 481, - UNIT_STAT_UNUSED_66 = 482, - UNIT_STAT_UNUSED_67 = 483, - UNIT_STAT_UNUSED_68 = 484, - UNIT_STAT_UNUSED_69 = 485, - UNIT_STAT_UNUSED_70 = 486, - UNIT_STAT_UNUSED_71 = 487, - UNIT_STAT_UNUSED_72 = 488, - UNIT_STAT_UNUSED_73 = 489, - UNIT_STAT_UNUSED_74 = 490, - UNIT_STAT_UNUSED_75 = 491, - UNIT_STAT_UNUSED_76 = 492, - UNIT_STAT_UNUSED_77 = 493, - UNIT_STAT_UNUSED_78 = 494, - UNIT_STAT_UNUSED_79 = 495, - UNIT_STAT_UNUSED_80 = 496, - UNIT_STAT_passive_sum_mastery = 497, - UNIT_STAT_item_socketmultiplier = 498, - UNIT_STAT_gembag_Ruby = 499, - UNIT_STAT_gembag_Amethyst = 500, - UNIT_STAT_gembag_Diamond = 501, - UNIT_STAT_gembag_Emerald = 502, - UNIT_STAT_gembag_Sapphire = 503, - UNIT_STAT_gembag_Topaz = 504, - UNIT_STAT_gembag_Skull = 505, - UNIT_STAT_runebag_RunesA = 506, - UNIT_STAT_runebag_RunesB = 507, - UNIT_STAT_runebag_RunesC = 508, - UNIT_STAT_UNUSED_83 = 509, - UNIT_STAT_item_aura_display = 510, - - + UNIT_STAT_strength = 0, + UNIT_STAT_energy = 1, + UNIT_STAT_dexterity = 2, + UNIT_STAT_vitality = 3, + UNIT_STAT_statpts = 4, + UNIT_STAT_newskills = 5, + UNIT_STAT_hitpoints = 6, + UNIT_STAT_maxhp = 7, + UNIT_STAT_mana = 8, + UNIT_STAT_maxmana = 9, + UNIT_STAT_stamina = 10, + UNIT_STAT_maxstamina = 11, + UNIT_STAT_level = 12, + UNIT_STAT_experience = 13, + UNIT_STAT_gold = 14, + UNIT_STAT_goldbank = 15, + UNIT_STAT_item_armor_percent = 16, + UNIT_STAT_item_maxdamage_percent = 17, + UNIT_STAT_item_mindamage_percent = 18, + UNIT_STAT_tohit = 19, + UNIT_STAT_toblock = 20, + UNIT_STAT_mindamage = 21, + UNIT_STAT_maxdamage = 22, + UNIT_STAT_secondary_mindamage = 23, + UNIT_STAT_secondary_maxdamage = 24, + UNIT_STAT_damagepercent = 25, + UNIT_STAT_manarecovery = 26, + UNIT_STAT_manarecoverybonus = 27, + UNIT_STAT_staminarecoverybonus = 28, + UNIT_STAT_lastexp = 29, + UNIT_STAT_nextexp = 30, + UNIT_STAT_armorclass = 31, + UNIT_STAT_armorclass_vs_missile = 32, + UNIT_STAT_armorclass_vs_hth = 33, + UNIT_STAT_normal_damage_reduction = 34, + UNIT_STAT_magic_damage_reduction = 35, + UNIT_STAT_damageresist = 36, + UNIT_STAT_magicresist = 37, + UNIT_STAT_maxmagicresist = 38, + UNIT_STAT_fireresist = 39, + UNIT_STAT_maxfireresist = 40, + UNIT_STAT_lightresist = 41, + UNIT_STAT_maxlightresist = 42, + UNIT_STAT_coldresist = 43, + UNIT_STAT_maxcoldresist = 44, + UNIT_STAT_poisonresist = 45, + UNIT_STAT_maxpoisonresist = 46, + UNIT_STAT_damageaura = 47, + UNIT_STAT_firemindam = 48, + UNIT_STAT_firemaxdam = 49, + UNIT_STAT_lightmindam = 50, + UNIT_STAT_lightmaxdam = 51, + UNIT_STAT_magicmindam = 52, + UNIT_STAT_magicmaxdam = 53, + UNIT_STAT_coldmindam = 54, + UNIT_STAT_coldmaxdam = 55, + UNIT_STAT_coldlength = 56, + UNIT_STAT_poisonmindam = 57, + UNIT_STAT_poisonmaxdam = 58, + UNIT_STAT_poisonlength = 59, + UNIT_STAT_lifedrainmindam = 60, + UNIT_STAT_lifedrainmaxdam = 61, + UNIT_STAT_manadrainmindam = 62, + UNIT_STAT_manadrainmaxdam = 63, + UNIT_STAT_stamdrainmindam = 64, + UNIT_STAT_stamdrainmaxdam = 65, + UNIT_STAT_stunlength = 66, + UNIT_STAT_velocitypercent = 67, + UNIT_STAT_attackrate = 68, + UNIT_STAT_other_animrate = 69, + UNIT_STAT_quantity = 70, + UNIT_STAT_value = 71, + UNIT_STAT_durability = 72, + UNIT_STAT_maxdurability = 73, + UNIT_STAT_hpregen = 74, + UNIT_STAT_item_maxdurability_percent = 75, + UNIT_STAT_item_maxhp_percent = 76, + UNIT_STAT_item_maxmana_percent = 77, + UNIT_STAT_item_attackertakesdamage = 78, + UNIT_STAT_item_goldbonus = 79, + UNIT_STAT_item_magicbonus = 80, + UNIT_STAT_item_knockback = 81, + UNIT_STAT_item_timeduration = 82, + UNIT_STAT_item_addclassskills = 83, + UNIT_STAT_unsentparam1 = 84, + UNIT_STAT_item_addexperience = 85, + UNIT_STAT_item_healafterkill = 86, + UNIT_STAT_item_reducedprices = 87, + UNIT_STAT_item_doubleherbduration = 88, + UNIT_STAT_item_lightradius = 89, + UNIT_STAT_item_lightcolor = 90, + UNIT_STAT_item_req_percent = 91, + UNIT_STAT_item_levelreq = 92, + UNIT_STAT_item_fasterattackrate = 93, + UNIT_STAT_item_levelreqpct = 94, + UNIT_STAT_lastblockframe = 95, + UNIT_STAT_item_fastermovevelocity = 96, + UNIT_STAT_item_nonclassskill = 97, + UNIT_STAT_state = 98, + UNIT_STAT_item_fastergethitrate = 99, + UNIT_STAT_monster_playercount = 100, + UNIT_STAT_skill_poison_override_length = 101, + UNIT_STAT_item_fasterblockrate = 102, + UNIT_STAT_skill_bypass_undead = 103, + UNIT_STAT_skill_bypass_demons = 104, + UNIT_STAT_item_fastercastrate = 105, + UNIT_STAT_skill_bypass_beasts = 106, + UNIT_STAT_item_singleskill = 107, + UNIT_STAT_item_restinpeace = 108, + UNIT_STAT_curse_resistance = 109, + UNIT_STAT_item_poisonlengthresist = 110, + UNIT_STAT_item_normaldamage = 111, + UNIT_STAT_item_howl = 112, + UNIT_STAT_item_stupidity = 113, + UNIT_STAT_item_damagetomana = 114, + UNIT_STAT_item_ignoretargetac = 115, + UNIT_STAT_item_fractionaltargetac = 116, + UNIT_STAT_item_preventheal = 117, + UNIT_STAT_item_halffreezeduration = 118, + UNIT_STAT_item_tohit_percent = 119, + UNIT_STAT_item_damagetargetac = 120, + UNIT_STAT_item_demondamage_percent = 121, + UNIT_STAT_item_undeaddamage_percent = 122, + UNIT_STAT_item_demon_tohit = 123, + UNIT_STAT_item_undead_tohit = 124, + UNIT_STAT_item_throwable = 125, + UNIT_STAT_item_elemskill = 126, + UNIT_STAT_item_allskills = 127, + UNIT_STAT_item_attackertakeslightdamage = 128, + UNIT_STAT_ironmaiden_level = 129, + UNIT_STAT_lifetap_level = 130, + UNIT_STAT_thorns_percent = 131, + UNIT_STAT_bonearmor = 132, + UNIT_STAT_bonearmormax = 133, + UNIT_STAT_item_freeze = 134, + UNIT_STAT_item_openwounds = 135, + UNIT_STAT_item_crushingblow = 136, + UNIT_STAT_item_kickdamage = 137, + UNIT_STAT_item_manaafterkill = 138, + UNIT_STAT_item_healafterdemonkill = 139, + UNIT_STAT_item_extrablood = 140, + UNIT_STAT_item_deadlystrike = 141, + UNIT_STAT_item_absorbfire_percent = 142, + UNIT_STAT_item_absorbfire = 143, + UNIT_STAT_item_absorblight_percent = 144, + UNIT_STAT_item_absorblight = 145, + UNIT_STAT_item_absorbmagic_percent = 146, + UNIT_STAT_item_absorbmagic = 147, + UNIT_STAT_item_absorbcold_percent = 148, + UNIT_STAT_item_absorbcold = 149, + UNIT_STAT_item_slow = 150, + UNIT_STAT_item_aura = 151, + UNIT_STAT_item_indesctructible = 152, + UNIT_STAT_item_cannotbefrozen = 153, + UNIT_STAT_item_staminadrainpct = 154, + UNIT_STAT_item_reanimate = 155, + UNIT_STAT_item_pierce = 156, + UNIT_STAT_item_magicarrow = 157, + UNIT_STAT_item_explosivearrow = 158, + UNIT_STAT_item_throw_mindamage = 159, + UNIT_STAT_item_throw_maxdamage = 160, + UNIT_STAT_skill_handofathena = 161, + UNIT_STAT_skill_staminapercent = 162, + UNIT_STAT_skill_passive_staminapercent = 163, + UNIT_STAT_skill_concentration = 164, + UNIT_STAT_skill_enchant = 165, + UNIT_STAT_skill_pierce = 166, + UNIT_STAT_skill_conviction = 167, + UNIT_STAT_skill_chillingarmor = 168, + UNIT_STAT_skill_frenzy = 169, + UNIT_STAT_skill_decrepify = 170, + UNIT_STAT_skill_armor_percent = 171, + UNIT_STAT_alignment = 172, + UNIT_STAT_target0 = 173, + UNIT_STAT_target1 = 174, + UNIT_STAT_goldlost = 175, + UNIT_STAT_conversion_level = 176, + UNIT_STAT_conversion_maxhp = 177, + UNIT_STAT_unit_dooverlay = 178, + UNIT_STAT_attack_vs_montype = 179, + UNIT_STAT_damage_vs_montype = 180, + UNIT_STAT_fade = 181, + UNIT_STAT_armor_override_percent = 182, + UNIT_STAT_killcounter = 183, + UNIT_STAT_soulscaptured = 184, + UNIT_STAT_spirits = 185, + UNIT_STAT_skill_more = 186, + UNIT_STAT_item_corrupted = 187, + UNIT_STAT_item_addskill_tab = 188, + UNIT_STAT_hidden_corruption = 189, + UNIT_STAT_item_strength_spirits = 190, + UNIT_STAT_item_dexterity_spirits = 191, + UNIT_STAT_item_vitality_spirits = 192, + UNIT_STAT_item_energy_spirits = 193, + UNIT_STAT_item_numsockets = 194, + UNIT_STAT_item_skillonattack = 195, + UNIT_STAT_item_skillonkill = 196, + UNIT_STAT_item_skillondeath = 197, + UNIT_STAT_item_skillonhit = 198, + UNIT_STAT_item_skillonlevelup = 199, + UNIT_STAT_item_skill_souls = 200, + UNIT_STAT_item_skillongethit = 201, + UNIT_STAT_UNUSED_2 = 202, + UNIT_STAT_UNUSED_3 = 203, + UNIT_STAT_item_charged_skill = 204, + UNIT_STAT_UNUSED_5 = 205, + UNIT_STAT_UNUSED_6 = 206, + UNIT_STAT_UNUSED_7 = 207, + UNIT_STAT_UNUSED_8 = 208, + UNIT_STAT_UNUSED_9 = 209, + UNIT_STAT_UNUSED_10 = 210, + UNIT_STAT_UNUSED_11 = 211, + UNIT_STAT_UNUSED_12 = 212, + UNIT_STAT_UNUSED_13 = 213, + UNIT_STAT_item_armor_perlevel = 214, + UNIT_STAT_item_armorpercent_perlevel = 215, + UNIT_STAT_item_hp_perlevel = 216, + UNIT_STAT_item_mana_perlevel = 217, + UNIT_STAT_item_maxdamage_perlevel = 218, + UNIT_STAT_item_maxdamage_percent_perlevel = 219, + UNIT_STAT_item_strength_perlevel = 220, + UNIT_STAT_item_dexterity_perlevel = 221, + UNIT_STAT_item_energy_perlevel = 222, + UNIT_STAT_item_vitality_perlevel = 223, + UNIT_STAT_item_tohit_perlevel = 224, + UNIT_STAT_item_tohitpercent_perlevel = 225, + UNIT_STAT_item_cold_damagemax_perlevel = 226, + UNIT_STAT_item_fire_damagemax_perlevel = 227, + UNIT_STAT_item_ltng_damagemax_perlevel = 228, + UNIT_STAT_item_pois_damagemax_perlevel = 229, + UNIT_STAT_item_resist_cold_perlevel = 230, + UNIT_STAT_item_resist_fire_perlevel = 231, + UNIT_STAT_item_resist_ltng_perlevel = 232, + UNIT_STAT_item_resist_pois_perlevel = 233, + UNIT_STAT_item_absorb_cold_perlevel = 234, + UNIT_STAT_item_absorb_fire_perlevel = 235, + UNIT_STAT_item_absorb_ltng_perlevel = 236, + UNIT_STAT_item_absorb_pois_perlevel = 237, + UNIT_STAT_item_thorns_perlevel = 238, + UNIT_STAT_UNUSED_84 = 239, + UNIT_STAT_item_find_magic_perlevel = 240, + UNIT_STAT_item_regenstamina_perlevel = 241, + UNIT_STAT_item_stamina_perlevel = 242, + UNIT_STAT_item_damage_demon_perlevel = 243, + UNIT_STAT_item_damage_undead_perlevel = 244, + UNIT_STAT_item_tohit_demon_perlevel = 245, + UNIT_STAT_item_tohit_undead_perlevel = 246, + UNIT_STAT_item_crushingblow_perlevel = 247, + UNIT_STAT_item_openwounds_perlevel = 248, + UNIT_STAT_item_kick_damage_perlevel = 249, + UNIT_STAT_item_deadlystrike_perlevel = 250, + UNIT_STAT_item_find_gems_perlevel = 251, + UNIT_STAT_item_replenish_durability = 252, + UNIT_STAT_item_replenish_quantity = 253, + UNIT_STAT_item_extra_stack = 254, + UNIT_STAT_item_find_item = 255, + UNIT_STAT_item_slash_damage = 256, + UNIT_STAT_item_slash_damage_percent = 257, + UNIT_STAT_item_crush_damage = 258, + UNIT_STAT_item_crush_damage_percent = 259, + UNIT_STAT_item_thrust_damage = 260, + UNIT_STAT_item_thrust_damage_percent = 261, + UNIT_STAT_item_absorb_slash = 262, + UNIT_STAT_item_absorb_crush = 263, + UNIT_STAT_item_absorb_thrust = 264, + UNIT_STAT_item_absorb_slash_percent = 265, + UNIT_STAT_item_absorb_crush_percent = 266, + UNIT_STAT_item_absorb_thrust_percent = 267, + UNIT_STAT_UNUSED_14 = 268, + UNIT_STAT_UNUSED_15 = 269, + UNIT_STAT_UNUSED_16 = 270, + UNIT_STAT_UNUSED_17 = 271, + UNIT_STAT_UNUSED_18 = 272, + UNIT_STAT_UNUSED_19 = 273, + UNIT_STAT_UNUSED_20 = 274, + UNIT_STAT_UNUSED_21 = 275, + UNIT_STAT_UNUSED_22 = 276, + UNIT_STAT_UNUSED_23 = 277, + UNIT_STAT_UNUSED_24 = 278, + UNIT_STAT_UNUSED_25 = 279, + UNIT_STAT_UNUSED_26 = 280, + UNIT_STAT_UNUSED_27 = 281, + UNIT_STAT_UNUSED_28 = 282, + UNIT_STAT_UNUSED_29 = 283, + UNIT_STAT_UNUSED_30 = 284, + UNIT_STAT_UNUSED_31 = 285, + UNIT_STAT_UNUSED_32 = 286, + UNIT_STAT_UNUSED_33 = 287, + UNIT_STAT_UNUSED_34 = 288, + UNIT_STAT_UNUSED_35 = 289, + UNIT_STAT_UNUSED_36 = 290, + UNIT_STAT_UNUSED_37 = 291, + UNIT_STAT_UNUSED_38 = 292, + UNIT_STAT_UNUSED_39 = 293, + UNIT_STAT_UNUSED_40 = 294, + UNIT_STAT_UNUSED_41 = 295, + UNIT_STAT_UNUSED_42 = 296, + UNIT_STAT_UNUSED_43 = 297, + UNIT_STAT_UNUSED_44 = 298, + UNIT_STAT_display_spirits = 299, + UNIT_STAT_display_souls_captured = 300, + UNIT_STAT_magharv = 301, + UNIT_STAT_dummy = 302, + UNIT_STAT_display_kills = 303, + UNIT_STAT_iforge = 304, + UNIT_STAT_item_pierce_cold = 305, + UNIT_STAT_item_pierce_fire = 306, + UNIT_STAT_item_pierce_ltng = 307, + UNIT_STAT_item_pierce_pois = 308, + UNIT_STAT_item_damage_vs_monster = 309, + UNIT_STAT_item_damage_percent_vs_monster = 310, + UNIT_STAT_item_tohit_vs_monster = 311, + UNIT_STAT_item_tohit_percent_vs_monster = 312, + UNIT_STAT_item_ac_vs_monster = 313, + UNIT_STAT_item_ac_percent_vs_monster = 314, + UNIT_STAT_firelength = 315, + UNIT_STAT_burningmin = 316, + UNIT_STAT_burningmax = 317, + UNIT_STAT_progressive_damage = 318, + UNIT_STAT_progressive_steal = 319, + UNIT_STAT_progressive_other = 320, + UNIT_STAT_progressive_fire = 321, + UNIT_STAT_progressive_cold = 322, + UNIT_STAT_progressive_lightning = 323, + UNIT_STAT_item_extra_charges = 324, + UNIT_STAT_progressive_tohit = 325, + UNIT_STAT_poison_count = 326, + UNIT_STAT_damage_framerate = 327, + UNIT_STAT_pierce_idx = 328, + UNIT_STAT_passive_fire_mastery = 329, + UNIT_STAT_passive_ltng_mastery = 330, + UNIT_STAT_passive_cold_mastery = 331, + UNIT_STAT_passive_pois_mastery = 332, + UNIT_STAT_passive_fire_pierce = 333, + UNIT_STAT_passive_ltng_pierce = 334, + UNIT_STAT_passive_cold_pierce = 335, + UNIT_STAT_passive_pois_pierce = 336, + UNIT_STAT_passive_critical_strike = 337, + UNIT_STAT_passive_dodge = 338, + UNIT_STAT_passive_avoid = 339, + UNIT_STAT_passive_evade = 340, + UNIT_STAT_passive_warmth = 341, + UNIT_STAT_passive_mastery_melee_th = 342, + UNIT_STAT_passive_mastery_melee_dmg = 343, + UNIT_STAT_passive_mastery_melee_crit = 344, + UNIT_STAT_passive_mastery_throw_th = 345, + UNIT_STAT_passive_mastery_throw_dmg = 346, + UNIT_STAT_passive_mastery_throw_crit = 347, + UNIT_STAT_passive_weaponblock = 348, + UNIT_STAT_passive_summon_resist = 349, + UNIT_STAT_modifierlist_skill = 350, + UNIT_STAT_modifierlist_level = 351, + UNIT_STAT_last_sent_hp_pct = 352, + UNIT_STAT_source_unit_type = 353, + UNIT_STAT_source_unit_id = 354, + UNIT_STAT_shortparam1 = 355, + UNIT_STAT_questitemdifficulty = 356, + UNIT_STAT_passive_mag_mastery = 357, + UNIT_STAT_passive_mag_pierce = 358, + UNIT_STAT_item_strength_percent = 359, + UNIT_STAT_item_dexterity_percent = 360, + UNIT_STAT_item_vitality_percent = 361, + UNIT_STAT_item_energy_percent = 362, + UNIT_STAT_item_strengthpercent_perlevel = 363, + UNIT_STAT_item_dexteritypercent_perlevel = 364, + UNIT_STAT_item_energypercent_perlevel = 365, + UNIT_STAT_item_vitalitypercent_perlevel = 366, + UNIT_STAT_item_attackergetsblind = 367, + UNIT_STAT_item_attackerflees = 368, + UNIT_STAT_item_attackertakesfiredamage = 369, + UNIT_STAT_item_attackertakescolddamage = 370, + UNIT_STAT_item_maxdamage_perstr = 371, + UNIT_STAT_item_maxdamage_perdex = 372, + UNIT_STAT_item_mindamage_perlvl = 373, + UNIT_STAT_item_mindamage_perstr = 374, + UNIT_STAT_item_mindamage_perdex = 375, + UNIT_STAT_item_maxdamage_percent_perstr = 376, + UNIT_STAT_item_maxdamage_percent_perdex = 377, + UNIT_STAT_item_openwounds_perdex = 378, + UNIT_STAT_item_openwounds_perstr = 379, + UNIT_STAT_item_deadlystrike_perdex = 380, + UNIT_STAT_item_deadlystrike_perstr = 381, + UNIT_STAT_item_armor_perstr = 382, + UNIT_STAT_item_armor_perdex = 383, + UNIT_STAT_item_tohit_perstr = 384, + UNIT_STAT_item_tohit_perDex = 385, + UNIT_STAT_item_hp_pervitality = 386, + UNIT_STAT_item_mana_perenr = 387, + UNIT_STAT_item_fastercastrate_perenr = 388, + UNIT_STAT_item_fasterblockrate_perdex = 389, + UNIT_STAT_item_fastermovevelocity_pervitality = 390, + UNIT_STAT_item_fasterswingvelocity_perstrength = 391, + UNIT_STAT_item_mindamage_percent_perstr = 392, + UNIT_STAT_item_mindamage_percent_perdex = 393, + UNIT_STAT_item_mindamage_percent_perlvl = 394, + UNIT_STAT_item_crushingblow_perstr = 395, + UNIT_STAT_item_crushingblow_perdex = 396, + UNIT_STAT_item_elemskillcold = 397, + UNIT_STAT_item_elemskilllight = 398, + UNIT_STAT_item_elemskillpoison = 399, + UNIT_STAT_item_elemskillmagic = 400, + UNIT_STAT_item_elemskillfire = 401, + UNIT_STAT_item_armorpercent_perstr = 402, + UNIT_STAT_item_armorpercent_perdex = 403, + UNIT_STAT_item_tohitpercent_perstr = 404, + UNIT_STAT_item_tohitpercent_perdex = 405, + UNIT_STAT_item_fasterswingvelocity_perdex = 406, + UNIT_STAT_item_fasterswingvelocity_perlvl = 407, + UNIT_STAT_item_fasterblockrate_perstr = 408, + UNIT_STAT_item_fasterblockrate_perlvl = 409, + UNIT_STAT_item_fastermovevelocity_perdex = 410, + UNIT_STAT_item_fastermovevelocity_perlvl = 411, + UNIT_STAT_item_fastercastrate_perlvl = 412, + UNIT_STAT_item_fasterhitrecovery_pervit = 413, + UNIT_STAT_item_fasterhitrecovery_perlvl = 414, + UNIT_STAT_item_increasedblock_perdex = 415, + UNIT_STAT_item_increasedblock_perlvl = 416, + UNIT_STAT_item_addexperience_perlvl = 417, + UNIT_STAT_item_addexperience_perenr = 418, + UNIT_STAT_item_reducedprices_perlvl = 419, + UNIT_STAT_item_pierce_perlvl = 420, + UNIT_STAT_item_pierce_perstr = 421, + UNIT_STAT_resmax_display_all_zero = 422, + UNIT_STAT_maxmagres_percent = 423, + UNIT_STAT_maxfireres_percent = 424, + UNIT_STAT_maxlightres_percent = 425, + UNIT_STAT_maxcoldres_percent = 426, + UNIT_STAT_maxpoisres_percent = 427, + UNIT_STAT_magicresist_hidden = 428, + UNIT_STAT_maxmagicresist_hidden = 429, + UNIT_STAT_fireresist_hidden = 430, + UNIT_STAT_maxfireresist_hidden = 431, + UNIT_STAT_lightresist_hidden = 432, + UNIT_STAT_maxlightresist_hidden = 433, + UNIT_STAT_coldresist_hidden = 434, + UNIT_STAT_maxcoldresist_hidden = 435, + UNIT_STAT_poisonresist_hidden = 436, + UNIT_STAT_maxpoisonresist_hidden = 437, + UNIT_STAT_hiddenresist_dummy = 438, + UNIT_STAT_item_slow_perlvl = 439, + UNIT_STAT_item_kick_damage_perstr = 440, + UNIT_STAT_item_kick_damage_perdex = 441, + UNIT_STAT_damageresist_perlvl = 442, + UNIT_STAT_damageresist_pervit = 443, + UNIT_STAT_magic_damage_reduction_perlvl = 444, + UNIT_STAT_magic_damage_reduction_perenr = 445, + UNIT_STAT_magicresist_perlvl = 446, + UNIT_STAT_magicresist_perenr = 447, + UNIT_STAT_item_stupidity_perlvl = 448, + UNIT_STAT_item_freeze_perlvl = 449, + UNIT_STAT_item_freeze_perenr = 450, + UNIT_STAT_item_poisonlengthresist_perlvl = 451, + UNIT_STAT_item_poisonlengthresist_pervit = 452, + UNIT_STAT_curse_resistance_perlvl = 453, + UNIT_STAT_curse_resistance_perenr = 454, + UNIT_STAT_curse_resistance_length = 455, + UNIT_STAT_item_manaafterkill_perlvl = 456, + UNIT_STAT_item_manaafterkill_perenr = 457, + UNIT_STAT_item_damagetomana_perlvl = 458, + UNIT_STAT_item_damagetomana_perenr = 459, + UNIT_STAT_item_damagetomana_permana = 460, + UNIT_STAT_UNUSED_45 = 461, + UNIT_STAT_UNUSED_46 = 462, + UNIT_STAT_UNUSED_47 = 463, + UNIT_STAT_UNUSED_48 = 464, + UNIT_STAT_UNUSED_49 = 465, + UNIT_STAT_UNUSED_50 = 466, + UNIT_STAT_UNUSED_51 = 467, + UNIT_STAT_UNUSED_52 = 468, + UNIT_STAT_UNUSED_53 = 469, + UNIT_STAT_UNUSED_54 = 470, + UNIT_STAT_UNUSED_55 = 471, + UNIT_STAT_UNUSED_56 = 472, + UNIT_STAT_UNUSED_57 = 473, + UNIT_STAT_UNUSED_58 = 474, + UNIT_STAT_UNUSED_59 = 475, + UNIT_STAT_UNUSED_60 = 476, + UNIT_STAT_UNUSED_61 = 477, + UNIT_STAT_UNUSED_62 = 478, + UNIT_STAT_UNUSED_63 = 479, + UNIT_STAT_UNUSED_64 = 480, + UNIT_STAT_UNUSED_65 = 481, + UNIT_STAT_UNUSED_66 = 482, + UNIT_STAT_UNUSED_67 = 483, + UNIT_STAT_UNUSED_68 = 484, + UNIT_STAT_UNUSED_69 = 485, + UNIT_STAT_UNUSED_70 = 486, + UNIT_STAT_UNUSED_71 = 487, + UNIT_STAT_UNUSED_72 = 488, + UNIT_STAT_UNUSED_73 = 489, + UNIT_STAT_UNUSED_74 = 490, + UNIT_STAT_UNUSED_75 = 491, + UNIT_STAT_UNUSED_76 = 492, + UNIT_STAT_UNUSED_77 = 493, + UNIT_STAT_UNUSED_78 = 494, + UNIT_STAT_UNUSED_79 = 495, + UNIT_STAT_UNUSED_80 = 496, + UNIT_STAT_passive_sum_mastery = 497, + UNIT_STAT_item_socketmultiplier = 498, + UNIT_STAT_gembag_Ruby = 499, + UNIT_STAT_gembag_Amethyst = 500, + UNIT_STAT_gembag_Diamond = 501, + UNIT_STAT_gembag_Emerald = 502, + UNIT_STAT_gembag_Sapphire = 503, + UNIT_STAT_gembag_Topaz = 504, + UNIT_STAT_gembag_Skull = 505, + UNIT_STAT_runebag_RunesA = 506, + UNIT_STAT_runebag_RunesB = 507, + UNIT_STAT_runebag_RunesC = 508, + UNIT_STAT_UNUSED_83 = 509, + UNIT_STAT_item_aura_display = 510, }; - - class d2_common { public: static char* get_base(); @@ -929,9 +985,9 @@ namespace diablo2 { static int32_t get_inventory_index(structures::unit* item, char page, BOOL lod); static void* get_inventory_data(int32_t index, int32_t zero, char* data); static structures::unit* get_item_at_cell(structures::inventory* inv, uint32_t cellx, uint32_t celly, - uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page); + uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page); static uint32_t can_put_into_slot(structures::inventory* inv, structures::unit* item, uint32_t x, uint32_t y, - uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page); + uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page); static uint32_t get_item_type(structures::unit* item); static uint32_t get_item_type_class(structures::unit* item); @@ -940,7 +996,7 @@ namespace diablo2 { static structures::unit* inv_remove_item(structures::inventory* inventory, structures::unit* item); static BOOL inv_add_item(structures::inventory* inv, structures::unit* item, uint32_t x, uint32_t y, - uint32_t invIndex, BOOL isClient, uint8_t page); + uint32_t invIndex, BOOL isClient, uint8_t page); static BOOL inv_update_item(structures::inventory* inv, structures::unit* item, BOOL isClient); static structures::items_line* get_item_record(uint32_t guid); @@ -982,6 +1038,11 @@ namespace diablo2 { 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); + + //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); }; } diff --git a/include/diablo2/d2game.h b/include/diablo2/d2game.h index 4a43f1e..0adc437 100644 --- a/include/diablo2/d2game.h +++ b/include/diablo2/d2game.h @@ -43,10 +43,9 @@ namespace diablo2 { static bool __fastcall pickup_item(structures::game* game, structures::unit* player, uint32_t guid, uint32_t* ptrItemCarried); static structures::unit* get_unit_owner(structures::game* game, structures::unit* unit); static void* iterate_unit_pets(structures::game* game, structures::unit* unit, - const std::function& cb); + const std::function& cb); static void update_inventory_items(structures::game* game, structures::unit* player); static uint32_t __fastcall diablo2::d2_game::transmogrify(diablo2::structures::game* game, diablo2::structures::unit* player); - }; } diff --git a/include/diablo2/d2gfx.h b/include/diablo2/d2gfx.h index dbf5d68..c9efe7f 100644 --- a/include/diablo2/d2gfx.h +++ b/include/diablo2/d2gfx.h @@ -18,6 +18,5 @@ namespace diablo2 { static int32_t get_resolution_mode(); static void draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma, int32_t drawType, void* palette); static void draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl); - }; } \ No newline at end of file diff --git a/include/diablo2/structures/UniqueItems.h b/include/diablo2/structures/UniqueItems.h index 5b9c6e6..47b0399 100644 --- a/include/diablo2/structures/UniqueItems.h +++ b/include/diablo2/structures/UniqueItems.h @@ -26,7 +26,7 @@ namespace diablo2 { uint32_t dwCostAdd; //0x80 uint16_t wDropSound; //0x84 uint16_t wUseSound; //0x86 - uint32_t dwDropSfxFrame; //0x88 + uint32_t dwDropSfxFrame; //0x88 uint32_t dwProp1; //0x8C uint32_t dwPar1; //0x90 uint32_t dwMin1; //0x94 diff --git a/include/diablo2/structures/data_tables.h b/include/diablo2/structures/data_tables.h index 0f56657..6b57ae1 100644 --- a/include/diablo2/structures/data_tables.h +++ b/include/diablo2/structures/data_tables.h @@ -106,7 +106,7 @@ namespace diablo2 { uint32_t* pHirelings; //+000001A0 055D8CD8 hirelings.txt (limit = 256) int nHirelings; //+000001A4 00000078 # of hirelings records int pMercFirst[256]; //+000001A8 00000000 array of 256 integers (namefirst column from hirelings.txt) - int pMercLast[256]; //+000005A8 0000000C array of 256 integers (namelast column from hirelings.txt) + int pMercLast[256]; //+000005A8 0000000C array of 256 integers (namelast column from hirelings.txt) void* pNPCs; //+000009A8 05724F74 npcs.txt int nNPCs; //+000009AC 00000011 # of npcs records void* pColours; //+000009B0 01417568 colors.txt diff --git a/include/diablo2/structures/item_data.h b/include/diablo2/structures/item_data.h index fcd257c..a7acf1c 100644 --- a/include/diablo2/structures/item_data.h +++ b/include/diablo2/structures/item_data.h @@ -69,9 +69,9 @@ namespace diablo2 { ITEMFLAG_FROMPLAYER = 0x01000000, ITEMFLAG_RUNEuint16_t = 0x04000000 */ - uint32_t guid1; //+1C Global Unique ID 1 - uint32_t guid2; //+20 Global Unique ID 2 - uint32_t guid3; //+24 Global Unique ID 3 + uint32_t guid1; //+1C Global Unique ID 1 + uint32_t guid2; //+20 Global Unique ID 2 + uint32_t guid3; //+24 Global Unique ID 3 uint32_t unique_id; //+28 uint8_t ilvl; //+2C uint8_t uk1[0x03]; //+2D @@ -108,7 +108,7 @@ namespace diablo2 { uint8_t item_data3; //+47 //D2Common10854 D2Common10853 uint8_t p_ear_level; //+48 uint8_t var_gfx; //+49 - char i_name[0x12]; //+4A //inscribed/ear get_name + char i_name[0x12]; //+4A //inscribed/ear get_name inventory* inventory; //+5C unit* pt_prev_item; //+60 unit* pt_next_item; //+64 diff --git a/include/diablo2/structures/net_client.h b/include/diablo2/structures/net_client.h index 33a553a..9db6a59 100644 --- a/include/diablo2/structures/net_client.h +++ b/include/diablo2/structures/net_client.h @@ -5,7 +5,7 @@ namespace diablo2 { namespace structures { struct game; - + struct net_client { uint32_t client_id; //+00 uint8_t uk1[0x06]; //+04 diff --git a/include/diablo2/structures/npc_record.h b/include/diablo2/structures/npc_record.h index f75b196..5cf808d 100644 --- a/include/diablo2/structures/npc_record.h +++ b/include/diablo2/structures/npc_record.h @@ -4,52 +4,52 @@ namespace diablo2 { namespace structures { - struct inventory; + struct inventory; - struct npc_gamble //sizeof 0xC - { - inventory* pInventory; //+00 - uint32_t dwGUID; //+04 npc_gamble* pNext; //+08 - }; + struct npc_gamble //sizeof 0xC + { + inventory* pInventory; //+00 + uint32_t dwGUID; //+04 npc_gamble* pNext; //+08 + }; - struct npc_record //sizeof 0x44 - { - int nNPC; //+00 - inventory* pInventory; //+04 - npc_gamble* pGamble; //+08 - bool bGambleInit; //+0C - uint32_t* pMercData; //+10 //D2MercDataStrc* - uint32_t* pEvent; //+14 //D2NPCEventStrc* - uint32_t* pVendorChain; //+18 //D2VendorChainStrc* - bool bTrading; //+1C - union - { - struct - { - union - { - bool bFlags[8]; //+20 - struct - { - bool bVendorInit; //+20 - bool bHireInit; //+21 - uint8_t nAct; //+22 - bool bTrader; //+23 - bool bLevelRefresh; //+24 - bool bInited; //+25 - bool bForceVendor; //+26 - bool bRefreshInventory; //+27 - }; - }; + struct npc_record //sizeof 0x44 + { + int nNPC; //+00 + inventory* pInventory; //+04 + npc_gamble* pGamble; //+08 + bool bGambleInit; //+0C + uint32_t* pMercData; //+10 //D2MercDataStrc* + uint32_t* pEvent; //+14 //D2NPCEventStrc* + uint32_t* pVendorChain; //+18 //D2VendorChainStrc* + bool bTrading; //+1C + union + { + struct + { + union + { + bool bFlags[8]; //+20 + struct + { + bool bVendorInit; //+20 + bool bHireInit; //+21 + uint8_t nAct; //+22 + bool bTrader; //+23 + bool bLevelRefresh; //+24 + bool bInited; //+25 + bool bForceVendor; //+26 + bool bRefreshInventory; //+27 + }; + }; - uint32_t dwTicks; //+28 - uint32_t pProxy[4]; //+2C //D2UnitProxyStrc - uint32_t dwUnk; //+3C - uint32_t dwNPCGUID; //+40 - }; + uint32_t dwTicks; //+28 + uint32_t pProxy[4]; //+2C //D2UnitProxyStrc + uint32_t dwUnk; //+3C + uint32_t dwNPCGUID; //+40 + }; - uint32_t pTrade; //+20 //D2NPCTradeStrc - }; - }; - } + uint32_t pTrade; //+20 //D2NPCTradeStrc + }; + }; + } } \ No newline at end of file diff --git a/include/diablo2/structures/player_data.h b/include/diablo2/structures/player_data.h index 1c33122..7f02cc9 100644 --- a/include/diablo2/structures/player_data.h +++ b/include/diablo2/structures/player_data.h @@ -5,20 +5,20 @@ namespace diablo2 { namespace structures { struct net_client; - + struct player_data { - char name[0x10]; //+00 Player Name - void* pt_quest[3]; //+10 Quest Pointers for each difficulty + char name[0x10]; //+00 Player Name + void* pt_quest[3]; //+10 Quest Pointers for each difficulty uint8_t uk1[0x18]; //+1C //before : 0x14 - void* pt_arena_unit; //+34 ptArena for the Unit + void* pt_arena_unit; //+34 ptArena for the Unit uint8_t uk2[0x4]; //+38 //before : 0x7 - uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID + uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID uint8_t uk3[0x2]; //+3E - uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID - uint8_t uk4[0x06]; //+42 - uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals - uint8_t uk5[0x53]; //+49 - net_client* net_client; //+9C ptClient + uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID + uint8_t uk4[0x06]; //+42 + uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals + uint8_t uk5[0x53]; //+49 + net_client* net_client; //+9C ptClient }; } } \ No newline at end of file diff --git a/include/diablo2/structures/room.h b/include/diablo2/structures/room.h index 6b05fe2..12ff8da 100644 --- a/include/diablo2/structures/room.h +++ b/include/diablo2/structures/room.h @@ -5,7 +5,7 @@ namespace diablo2 { namespace structures { struct unit; - + struct room//size=0x80 { //ptRoom +48 0 = spawn new units (monster, objects e.tc), 1 = don't spawn any new units diff --git a/include/diablo2/structures/unit.h b/include/diablo2/structures/unit.h index 917af82..965ce97 100644 --- a/include/diablo2/structures/unit.h +++ b/include/diablo2/structures/unit.h @@ -22,8 +22,6 @@ namespace diablo2 { struct statslistex; struct quest_record; struct npc_record; - - enum class unit_type_t : int32_t { UNIT_TYPE_PLAYER = 0, @@ -76,8 +74,6 @@ namespace diablo2 { ITEMFLAG_ITEM = 0x08000000 }; - - struct unit { unit_type_t type; diff --git a/include/diablo2/utils/mpq_ifstream.h b/include/diablo2/utils/mpq_ifstream.h index 67be04a..3fee977 100644 --- a/include/diablo2/utils/mpq_ifstream.h +++ b/include/diablo2/utils/mpq_ifstream.h @@ -15,7 +15,7 @@ namespace diablo2 { public: explicit mpq_streambuf(const std::string& path); ~mpq_streambuf(); - + protected: int_type underflow() override; }; @@ -23,8 +23,6 @@ namespace diablo2 { mpq_streambuf m_streambuf; public: explicit mpq_ifstream(const std::string& path); - - }; } } diff --git a/resource.h b/resource.h index 0e34598..f8ea59b 100644 --- a/resource.h +++ b/resource.h @@ -3,7 +3,7 @@ // Used by D2tweaks.rc // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 diff --git a/src/common/asm_code.cpp b/src/common/asm_code.cpp index 84ed69a..49e21be 100644 --- a/src/common/asm_code.cpp +++ b/src/common/asm_code.cpp @@ -10,4 +10,4 @@ void asm_code::build() { for (auto addr : m_addresses) { addr->build(m_code); } -} +} \ No newline at end of file diff --git a/src/common/config.cpp b/src/common/config.cpp index e2e0c2b..00c8ecd 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -15,4 +15,4 @@ config::config(token) { m_json->parse(ss.str()); } -} +} \ No newline at end of file diff --git a/src/common/hooking.cpp b/src/common/hooking.cpp index 826195f..3963f68 100644 --- a/src/common/hooking.cpp +++ b/src/common/hooking.cpp @@ -13,7 +13,7 @@ static void* allocate_function_stub(void* origin, void* ptr, size_t size) { if (!current_stub) { current_stub = VirtualAlloc(nullptr, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, - PAGE_EXECUTE_READWRITE); + PAGE_EXECUTE_READWRITE); } if (!current_stub) @@ -85,4 +85,4 @@ void* hooking::get_call(void* address) { target += reinterpret_cast(address) + 5; return reinterpret_cast(target); -} +} \ No newline at end of file diff --git a/src/common/ini.cpp b/src/common/ini.cpp index cc3d868..d96b6ed 100644 --- a/src/common/ini.cpp +++ b/src/common/ini.cpp @@ -4,7 +4,7 @@ // "CIni" is a simple API wrap class used for ini file access. // The purpose of this class is to make ini file access more // convenient than direct API calls. -// +// // This file is distributed "as is" and without any expressed or implied // warranties. The author holds no responsibilities for any possible damages // or loss of data that are caused by use of this file. The user must assume @@ -74,7 +74,7 @@ CIni::CIni(LPCTSTR lpPathName) CIni::~CIni() { if (m_pszPathName != NULL) - delete [] m_pszPathName; + delete[] m_pszPathName; } ///////////////////////////////////////////////////////////////////////////////// @@ -92,7 +92,7 @@ void CIni::SetPathName(LPCTSTR lpPathName) else { if (m_pszPathName != NULL) - delete [] m_pszPathName; + delete[] m_pszPathName; m_pszPathName = _tcsdup(lpPathName); } @@ -143,7 +143,7 @@ DWORD CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD d dwLen = min(dwLen, dwBufSize); } - delete [] psz; + delete[] psz; return dwLen; } @@ -152,7 +152,7 @@ CString CIni::GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault) con { LPTSTR psz = __GetStringDynamic(lpSection, lpKey, lpDefault); CString str(psz); - delete [] psz; + delete[] psz; return str; } #endif @@ -177,8 +177,8 @@ BOOL CIni::AppendString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpString) cons TCHAR* pNewString = new TCHAR[_tcslen(psz) + _tcslen(lpString) + 1]; _stprintf(pNewString, _T("%s%s"), psz, lpString); const BOOL RES = WriteString(lpSection, lpKey, pNewString); - delete [] pNewString; - delete [] psz; + delete[] pNewString; + delete[] psz; return RES; } @@ -193,10 +193,10 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw *lpBuffer = _T('\0'); if (lpSection == NULL || lpKey == NULL) - return 0; + return 0; LPTSTR psz = __GetStringDynamic(lpSection, lpKey); - + DWORD dwCopied = 0; if (*psz != _T('\0')) @@ -207,20 +207,20 @@ DWORD CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dw const DWORD MAX_LEN = _tcslen(psz) + 2; LPTSTR p = new TCHAR[MAX_LEN + 1]; dwCopied = __StringSplit(psz, p, MAX_LEN, lpDelimiter, bTrimString); - delete [] p; + delete[] p; } else { dwCopied = __StringSplit(psz, lpBuffer, dwBufSize, lpDelimiter, bTrimString); } - } + } - delete [] psz; + delete[] psz; return dwCopied; } #ifdef __AFXWIN_H__ -void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCTSTR lpDelimiter, BOOL bTrimString) const +void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter, BOOL bTrimString) const { if (pArray != NULL) pArray->RemoveAll(); @@ -232,12 +232,12 @@ void CIni::GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray *pArray, LPCT LPTSTR psz = new TCHAR[LEN + 3]; GetArray(lpSection, lpKey, psz, LEN + 2, lpDelimiter); ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray); - delete [] psz; + delete[] psz; } #endif #ifdef __AFXWIN_H__ -BOOL CIni::WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray *pArray, int nWriteCount, LPCTSTR lpDelimiter) const +BOOL CIni::WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount, LPCTSTR lpDelimiter) const { if (pArray == NULL) return FALSE; @@ -385,7 +385,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR DWORD dwLen = _tcslen(psz) / 2; if (dwLen <= dwOffset) { - delete [] psz; + delete[] psz; return 0; } @@ -401,7 +401,7 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR } else { - delete [] psz; + delete[] psz; return 0; } } @@ -414,18 +414,18 @@ DWORD CIni::GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWOR dwProcLen = min(dwLen - dwOffset, dwBufSize); LPCTSTR p = &psz[dwOffset * 2]; for (DWORD i = 0; i < dwProcLen; i++) - { + { TCHAR sz[3] = _T(""); - _tcsncpy(sz, p, 2); + _tcsncpy(sz, p, 2); lpb[i] = BYTE(_tcstoul(sz, NULL, 16)); p = &p[2]; - } + } } else { dwProcLen = dwLen - dwOffset; } - delete [] psz; + delete[] psz; return dwProcLen; } @@ -441,7 +441,7 @@ BOOL CIni::WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWOR for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2) _stprintf(&psz[j], _T("%02X"), lpb[i]); const BOOL RES = WriteString(lpSection, lpKey, psz); - delete [] psz; + delete[] psz; return RES; } @@ -457,7 +457,7 @@ BOOL CIni::AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWO for (DWORD i = 0, j = 0; i < dwDataSize; i++, j += 2) _stprintf(&psz[j], _T("%02X"), lpb[i]); const BOOL RES = AppendString(lpSection, lpKey, psz); - delete [] psz; + delete[] psz; return RES; } @@ -502,7 +502,7 @@ DWORD CIni::GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con *lpBuffer = _T('\0'); if (lpSection == NULL) - return 0; + return 0; if (lpBuffer == NULL) { @@ -514,12 +514,12 @@ DWORD CIni::GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con while (dwCopied + 2 >= dwLen) { dwLen += DEF_PROFILE_THRESHOLD; - delete [] psz; + delete[] psz; psz = new TCHAR[dwLen + 1]; dwCopied = ::GetPrivateProfileSection(lpSection, psz, dwLen, m_pszPathName); } - delete [] psz; + delete[] psz; return dwCopied + 2; } else @@ -535,9 +535,9 @@ DWORD CIni::GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con *lpBuffer = _T('\0'); if (lpSection == NULL) - return 0; + return 0; - STR_LIMIT sl; + STR_LIMIT sl; sl.lpTarget = lpBuffer; sl.dwRemain = dwBufSize; sl.dwTotalCopied = 0; @@ -549,7 +549,7 @@ DWORD CIni::GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) con LPTSTR psz = new TCHAR[LEN + 1]; GetKeyLines(lpSection, psz, LEN); ParseDNTString(psz, __KeyPairProc, (LPVOID)(&sl)); - delete [] psz; + delete[] psz; if (lpBuffer != NULL) lpBuffer[sl.dwTotalCopied] = _T('\0'); return sl.dwTotalCopied; @@ -567,12 +567,12 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const while (dwCopied + 2 >= dwLen) { dwLen += DEF_PROFILE_THRESHOLD; - delete [] psz; + delete[] psz; psz = new TCHAR[dwLen + 1]; dwCopied = ::GetPrivateProfileSectionNames(psz, dwLen, m_pszPathName); } - - delete [] psz; + + delete[] psz; return dwCopied + 2; } else @@ -582,7 +582,7 @@ DWORD CIni::GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const } #ifdef __AFXWIN_H__ -void CIni::GetSectionNames(CStringArray *pArray) const +void CIni::GetSectionNames(CStringArray* pArray) const { if (pArray != NULL) pArray->RemoveAll(); @@ -594,13 +594,13 @@ void CIni::GetSectionNames(CStringArray *pArray) const LPTSTR psz = new TCHAR[LEN + 1]; GetSectionNames(psz, LEN); ParseDNTString(psz, __SubStrAdd, pArray); - delete [] psz; + delete[] psz; } #endif #ifdef __AFXWIN_H__ // Retrieve a list of key-lines(key-pairs) of the specified section -void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const +void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const { if (pArray != NULL) pArray->RemoveAll(); @@ -612,13 +612,13 @@ void CIni::GetKeyLines(LPCTSTR lpSection, CStringArray *pArray) const LPTSTR psz = new TCHAR[LEN + 1]; GetKeyLines(lpSection, psz, LEN); ParseDNTString(psz, __SubStrAdd, pArray); - delete [] psz; + delete[] psz; } #endif #ifdef __AFXWIN_H__ // Retrieve a list of key names of the specified section -void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const +void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const { if (pArray == NULL) return; @@ -628,7 +628,7 @@ void CIni::GetKeyNames(LPCTSTR lpSection, CStringArray *pArray) const LPTSTR psz = new TCHAR[LEN + 1]; GetKeyNames(lpSection, psz, LEN); ParseDNTString(psz, __SubStrAdd, (LPVOID)pArray); - delete [] psz; + delete[] psz; } #endif @@ -658,7 +658,7 @@ BOOL CIni::IsSectionExist(LPCTSTR lpSection) const LPTSTR psz = new TCHAR[LEN + 1]; GetSectionNames(psz, LEN); BOOL RES = !ParseDNTString(psz, __SubStrCompare, (LPVOID)lpSection); - delete [] psz; + delete[] psz; return RES; } @@ -670,7 +670,7 @@ BOOL CIni::IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const // Test it with the default unique string LPTSTR psz = __GetStringDynamic(lpSection, lpKey, DEF_PROFILE_TESTSTRING); const BOOL RES = (_tcscmp(psz, DEF_PROFILE_TESTSTRING) != 0); - delete [] psz; + delete[] psz; return RES; } @@ -693,9 +693,9 @@ BOOL CIni::CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIf const DWORD SRC_LEN = GetKeyLines(lpSrcSection, NULL, 0); LPTSTR psz = new TCHAR[SRC_LEN + 2]; //memset(psz, 0, sizeof(TCHAR) * (SRC_LEN + 2)); - GetKeyLines(lpSrcSection, psz, SRC_LEN); + GetKeyLines(lpSrcSection, psz, SRC_LEN); const BOOL RES = ::WritePrivateProfileSection(lpDestSection, psz, m_pszPathName); - delete [] psz; + delete[] psz; return RES; } @@ -714,10 +714,10 @@ BOOL CIni::CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection if (bFailIfExist && IsKeyExist(lpDestSection, lpDestKey)) return FALSE; - + LPTSTR psz = __GetStringDynamic(lpSrcSection, lpSrcKey); const BOOL RES = WriteString(lpDestSection, lpDestKey, psz); - delete [] psz; + delete[] psz; return RES; } @@ -758,23 +758,23 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa psz = new TCHAR[_tcslen(lpDefault) + 1]; _tcscpy(psz, lpDefault); } - + return psz; } - + // Keep enlarging the buffer size until being certain on that the string we // retrieved was original(not truncated). DWORD dwLen = DEF_PROFILE_THRESHOLD; psz = new TCHAR[dwLen + 1]; DWORD dwCopied = ::GetPrivateProfileString(lpSection, lpKey, lpDefault == NULL ? _T("") : lpDefault, psz, dwLen, m_pszPathName); while (dwCopied + 1 >= dwLen) - { + { dwLen += DEF_PROFILE_THRESHOLD; - delete [] psz; + delete[] psz; psz = new TCHAR[dwLen + 1]; dwCopied = ::GetPrivateProfileString(lpSection, lpKey, lpDefault == NULL ? _T("") : lpDefault, psz, dwLen, m_pszPathName); } - + return psz; // !!! Requires the caller to free this memory !!! } @@ -788,7 +788,7 @@ LPTSTR CIni::__GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefa DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter, BOOL bTrimString) { if (lpString == NULL || lpBuffer == NULL || dwBufSize == 0) - return 0; + return 0; DWORD dwCopied = 0; *lpBuffer = _T('\0'); @@ -828,8 +828,8 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP lpTarget[COPY_LEN] = _T('\0'); lpTarget = &lpTarget[SEG_LEN + 1]; } - delete [] pszSeg; - lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search + delete[] pszSeg; + lpPos = &lpEnd[DEL_LEN]; // Advance the pointer for next search lpEnd = _tcsstr(lpPos, pszDel); } @@ -849,9 +849,9 @@ DWORD CIni::__StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LP lpTarget[COPY_LEN] = _T('\0'); } - delete [] pszSeg; + delete[] pszSeg; lpBuffer[dwCopied] = _T('\0'); - delete [] pszDel; + delete[] pszDel; return dwCopied; } @@ -876,7 +876,7 @@ BOOL CIni::ParseDNTString(LPCTSTR lpString, SUBSTRPROC lpFnStrProc, LPVOID lpPar return TRUE; } -// Callback function used to compare elements inside of a +// Callback function used to compare elements inside of a // "double null terminated string" with a given string. Useful for // searching in the section names list. BOOL CALLBACK CIni::__SubStrCompare(LPCTSTR lpString1, LPVOID lpParam) @@ -890,16 +890,16 @@ BOOL CALLBACK CIni::__SubStrCompare(LPCTSTR lpString1, LPVOID lpParam) // Callback function used to process a key-pair, it extracts the // key name from the key-pair string -BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam) +BOOL CALLBACK CIni::__KeyPairProc(LPCTSTR lpString, LPVOID lpParam) { STR_LIMIT* psl = (STR_LIMIT*)lpParam; - if (lpString == NULL || psl== NULL) + if (lpString == NULL || psl == NULL) return FALSE; - + LPCTSTR p = _tcschr(lpString, _T('=')); if (p == NULL || p == lpString) return TRUE; - + // extract the sub-string on left side of the '=' LPTSTR psz = new TCHAR[_tcslen(lpString) + 1]; int i = 0; @@ -911,14 +911,14 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam) __TrimString(psz); DWORD dwNameLen = _tcslen(psz); DWORD dwCopyLen = 0; - + //copy to the buffer if (psl->lpTarget != NULL) { dwCopyLen = (psl->dwRemain > 1) ? min(dwNameLen, psl->dwRemain - 1) : 0; _tcsncpy(psl->lpTarget, psz, dwCopyLen); psl->lpTarget[dwCopyLen] = _T('\0'); - psl->lpTarget = &(psl->lpTarget[dwCopyLen + 1]); + psl->lpTarget = &(psl->lpTarget[dwCopyLen + 1]); psl->dwRemain -= dwCopyLen + 1; } else @@ -926,13 +926,13 @@ BOOL CALLBACK CIni:: __KeyPairProc(LPCTSTR lpString, LPVOID lpParam) dwCopyLen = dwNameLen; } - delete [] psz; + delete[] psz; psl->dwTotalCopied += dwCopyLen + 1; return TRUE; } #ifdef __AFXWIN_H__ -// Callback function used to add elements that are extracted from a +// Callback function used to add elements that are extracted from a // "double null terminated string" to an MFC CStringArray. BOOL CALLBACK CIni::__SubStrAdd(LPCTSTR lpString, LPVOID lpParam) { @@ -950,8 +950,8 @@ void CIni::__ToBinaryString(UINT nNumber, LPTSTR lpBuffer, DWORD dwBufSize) { if (dwBufSize == 0) return; - - DWORD dwIndex = 0; + + DWORD dwIndex = 0; do { lpBuffer[dwIndex++] = (nNumber % 2) ? _T('1') : _T('0'); @@ -993,7 +993,7 @@ void CIni::__IntToString(int nNumber, LPTSTR lpBuffer, int nBase) default: _stprintf(lpBuffer, _T("%d"), nNumber); break; - } + } } // Convert an unsigned integer into string representation, based on its base @@ -1016,7 +1016,7 @@ void CIni::__UIntToString(UINT nNumber, LPTSTR lpBuffer, int nBase) default: _stprintf(lpBuffer, _T("%u"), nNumber); break; - } + } } BOOL CIni::StringToBool(LPCTSTR lpString, BOOL bDefault) @@ -1041,7 +1041,7 @@ BOOL CIni::__TrimString(LPTSTR lpString) int nLen = _tcslen(lpString); // '\n' and '\r' are actually not possible in this case, but anyway... - + // Trim right side while (nLen > 0 && (lpString[nLen - 1] == _T(' ') @@ -1050,15 +1050,15 @@ BOOL CIni::__TrimString(LPTSTR lpString) || lpString[nLen - 1] == _T('\n'))) { lpString[--nLen] = _T('\0'); - bTrimmed = TRUE; + bTrimmed = TRUE; } // Trim left side - LPCTSTR p = lpString; + LPCTSTR p = lpString; while (*p == _T(' ') - || *p == _T('\t') - || *p == _T('\r') - || *p == _T('\n')) + || *p == _T('\t') + || *p == _T('\r') + || *p == _T('\n')) { p = &p[1]; bTrimmed = TRUE; @@ -1068,7 +1068,7 @@ BOOL CIni::__TrimString(LPTSTR lpString) { LPTSTR psz = _tcsdup(p); _tcscpy(lpString, psz); - delete [] psz; + delete[] psz; } return bTrimmed; diff --git a/src/common/string_utils.cpp b/src/common/string_utils.cpp index a89ddf8..148918b 100644 --- a/src/common/string_utils.cpp +++ b/src/common/string_utils.cpp @@ -11,4 +11,4 @@ std::wstring string_utils::string_to_wstring(const std::string& str) { MultiByteToWideChar(CP_ACP, 0, &str[0], static_cast(str.size()), &wstrTo[0], sizeNeeded); return wstrTo; -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/client.cpp b/src/d2tweaks/client/client.cpp index 0e9505c..198503c 100644 --- a/src/d2tweaks/client/client.cpp +++ b/src/d2tweaks/client/client.cpp @@ -8,7 +8,6 @@ #include #include - #include #include #include @@ -45,12 +44,6 @@ std::vector globalStatsVector; diablo2::structures::gfxdata g_gfxdata; // global gfxdata -int randStat; -int randStatRangeLow; -int randStatRangeHigh; -int randStatBool; - - std::wstring ConvertCharToWString(const std::string& charString) { std::wstring_convert> converter; return converter.from_bytes(charString); @@ -99,8 +92,6 @@ diablo2::ui_color_t mapColorToEnum(const std::string& colorName) { return diablo2::ui_color_t::UI_COLOR_WHITE; } - - // Define a struct to hold key-value pairs within a section struct Section { std::map assignments; @@ -166,6 +157,14 @@ void ParseIniFile(const std::string& iniFilePath) { else if (key == "item_type_id") { entry.item_type_id = std::stoi(value); } + // add op and param + else if (key == "op") { + entry.op = std::stoi(value); + } + // add op and param + else if (key == "param") { + entry.param = std::stoi(value); + } } } } @@ -214,8 +213,8 @@ __declspec (naked) void handle_cs_packet_wrapper() { __asm { pushad; pushfd; - call [d2_tweaks::client::client::handle_cs_packet] - popfd; + call[d2_tweaks::client::client::handle_cs_packet] + popfd; popad; // îðèãèíàëüíûå èíñòðóêöèè sub esp, 0x200; @@ -223,13 +222,12 @@ __declspec (naked) void handle_cs_packet_wrapper() { RET_TO_RVA(DLLBASE_D2CLIENT, 0xD856); } - __declspec (naked) void handle_sc_standart_packet_wrapper() { __asm { pushad; pushfd; call[d2_tweaks::client::client::handle_standart_packet] - popfd; + popfd; popad; // îðèãèíàëüíûå èíñòðóêöèè sub esp, 0x54; @@ -239,7 +237,6 @@ __declspec (naked) void handle_sc_standart_packet_wrapper() { RET_TO_RVA(DLLBASE_D2CLIENT, 0x150B5); } - static const DLLPatchStrc gpt_handle_cs_packet[] = { {D2DLL_D2CLIENT, 0xD850 + 0, PATCH_JMP, FALSE, 0x1}, @@ -248,7 +245,6 @@ static const DLLPatchStrc gpt_handle_cs_packet[] = {D2DLL_INVALID} }; - static const DLLPatchStrc gpt_handle_sc_standart_packet[] = { {D2DLL_D2CLIENT, 0x150B0 + 0, PATCH_JMP, FALSE, 0x1}, @@ -256,7 +252,6 @@ static const DLLPatchStrc gpt_handle_sc_standart_packet[] = {D2DLL_INVALID} }; - void d2_tweaks::client::client::init() { // handle packet îáðàáàòûâàåò ïàêåò ïåðåä GamePacketReceivedIntercept hooking::hook(diablo2::d2_client::get_base() + 0x11CB0, handle_packet, reinterpret_cast(&g_handle_packet)); @@ -272,23 +267,10 @@ void d2_tweaks::client::client::init() { if (m_module == nullptr) break; - //randStat = GetPrivateProfileIntA("RandStat", "stat", 0, lpIniFilePath); - //randStatRangeLow = GetPrivateProfileIntA("RandStat", "statRangeLow", 0, lpIniFilePath); - //randStatRangeHigh = GetPrivateProfileIntA("RandStat", "statRangeHigh", 0, lpIniFilePath); - //randStatBool = GetPrivateProfileIntA("RandStat", "statBool", 0, lpIniFilePath); - - //spdlog::info("randStat = {0}", randStat); - //spdlog::info("randStatRangeLow = {0}", randStatRangeLow); - //spdlog::info("randStatRangeHigh = {0}", randStatRangeHigh); - - - // Load and parse the INI file ParseIniFile(iniFilePath); } - - D2TEMPLATE_ApplyPatch(gpt_handle_cs_packet); //D2TEMPLATE_ApplyPatch(gpt_handle_sc_standart_packet); @@ -300,13 +282,12 @@ void d2_tweaks::client::client::init() { } } - static int32_t g_ebp_send_to_client; void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet, size_t size) { #ifndef NDEBUG __asm { - push [ebp + 0x2C]; - pop [g_ebp_send_to_client]; + push[ebp + 0x2C]; + pop[g_ebp_send_to_client]; } spdlog::warn("[d2client SEND] Packet {} Message {} Size {} CallFrom {}", (void*)packet->d2_packet_type, (void*)packet->message_type, size, (void*)g_ebp_send_to_client); #endif @@ -325,7 +306,6 @@ void d2_tweaks::client::client::handle_cs_packet(common::packet_header* packet, handler->handle_cs_packet(packet); } - void d2_tweaks::client::client::handle_standart_packet(common::packet_header* packet, size_t size) { if (size == -1) return; @@ -337,7 +317,6 @@ void d2_tweaks::client::client::handle_standart_packet(common::packet_header* pa return; } - void d2_tweaks::client::client::handle_packet(common::packet_header* packet, size_t size) { static common::packet_header dummy; static auto& instance = singleton::instance(); @@ -362,10 +341,8 @@ void d2_tweaks::client::client::handle_packet(common::packet_header* packet, siz handler->handle_packet(packet); } - static bool g_is_init = false; void d2_tweaks::client::client::game_tick() { - static auto& instance = singleton::instance(); /// êîíôëèêò ñ òåêñòîì íà d2 gl if (g_is_init == false) { @@ -380,7 +357,7 @@ void d2_tweaks::client::client::game_tick() { g_is_init = true; } - for (auto & tick_handler : instance.m_tick_handlers) { + for (auto& tick_handler : instance.m_tick_handlers) { if (tick_handler == nullptr) break; @@ -390,7 +367,6 @@ void d2_tweaks::client::client::game_tick() { return; } - int32_t d2_tweaks::client::client::draw_game_ui() { static auto& ui = singleton::instance(); @@ -401,8 +377,6 @@ int32_t d2_tweaks::client::client::draw_game_ui() { return result; } - - void d2_tweaks::client::client::register_module(modules::client_module* module) { m_modules[m_module_id_counter++] = module; } @@ -439,4 +413,4 @@ diablo2::structures::unit* d2_tweaks::client::client::get_client_unit(uint32_t t } return result; -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.cpp b/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.cpp index 1a44439..99da126 100644 --- a/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.cpp +++ b/src/d2tweaks/client/modules/auto_gold_pickup/auto_gold_pickup_client.cpp @@ -67,12 +67,9 @@ public: } }; - void d2_tweaks::client::modules::auto_gold_pickup::init_early() { - } - void d2_tweaks::client::modules::auto_gold_pickup::init() { char acPathToIni[MAX_PATH] = { 0 }; const char* pcIniFile = "\\d2tweaks.ini"; @@ -89,7 +86,6 @@ void d2_tweaks::client::modules::auto_gold_pickup::init() { } } - void d2_tweaks::client::modules::auto_gold_pickup::tick() { const auto unit = diablo2::d2_client::get_local_player(); @@ -133,9 +129,8 @@ void d2_tweaks::client::modules::auto_gold_pickup::tick() { } } - void d2_tweaks::client::modules::auto_gold_pickup::handle_packet(common::packet_header* packet) { const auto info = static_cast(packet); m_nLastUpdate = GetTickCount(); m_nGoldValue += info->gold; -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.cpp b/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.cpp index a066a5d..70a33d8 100644 --- a/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.cpp +++ b/src/d2tweaks/client/modules/auto_item_pickup/auto_item_pickup_client.cpp @@ -67,7 +67,6 @@ static char m_acPathToIni[MAX_PATH] = { 0 }; static const char* m_pcIniFile = "\\d2tweaks.ini"; void d2_tweaks::client::modules::auto_item_pickup::init_early() { - } void ReloadFilters(char* szPathToIni) { @@ -120,7 +119,6 @@ void ReloadFilters(char* szPathToIni) { } } - /// Parse ItemCode dwLenght = lstrlen(m_pcItemListAll); memcpy(m_pcItemListAllTemp, m_pcItemListAll, dwLenght + 1); @@ -196,7 +194,6 @@ void ReloadFilters(char* szPathToIni) { token_string_itemcode = strtok(NULL, " ,|"); } - /// Parse ItemType Code dwLenght = lstrlen(m_pcItemTypesAll); memcpy(m_pcItemTypesAllTemp, m_pcItemTypesAll, dwLenght + 1); @@ -272,7 +269,6 @@ void ReloadFilters(char* szPathToIni) { } } - class auto_item_pickup_menu : public d2_tweaks::ui::menu { d2_tweaks::common::asset* m_buttons_img; d2_tweaks::ui::controls::button* m_auto_pickup_btn; @@ -304,7 +300,7 @@ public: //diablo2::d2_client::print_chat(L"AUTO TRANSMUTE OFF", 2); m_auto_pickup_btn->set_current_frame(6); } - + if (m_bToggleAutoItemPickup && m_bInventoryFull) { m_auto_pickup_btn->set_current_frame(7); } @@ -359,7 +355,6 @@ private: } }; - void d2_tweaks::client::modules::auto_item_pickup::init() { GetCurrentDirectory(MAX_PATH, m_acPathToIni); lstrcat(m_acPathToIni, m_pcIniFile); @@ -375,7 +370,6 @@ void d2_tweaks::client::modules::auto_item_pickup::init() { } } - bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) { char data[0x18]; @@ -396,7 +390,6 @@ bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::u return false; } - void d2_tweaks::client::modules::auto_item_pickup::tick() { static common::item_pickup_info_sc packet; const auto unit = diablo2::d2_client::get_local_player(); @@ -476,7 +469,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() { } } - if (itemtype_record_equiv2) { if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) { // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1 @@ -527,7 +519,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() { } } - for (uint32_t i = 0; i < m_nCountItemListAll; i++) { if (record->string_code[0] == m_stItemList[i].code0 && @@ -560,7 +551,6 @@ void d2_tweaks::client::modules::auto_item_pickup::tick() { } } - void d2_tweaks::client::modules::auto_item_pickup::handle_packet(common::packet_header* packet) { const auto info = static_cast(packet); @@ -571,4 +561,4 @@ void d2_tweaks::client::modules::auto_item_pickup::handle_packet(common::packet_ // g_tick_between_item_pickup = g_delay_between_item_pickup; //} //g_value += info->gold; -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/autosort/autosort_client.cpp b/src/d2tweaks/client/modules/autosort/autosort_client.cpp index 5f2c214..83262bf 100644 --- a/src/d2tweaks/client/modules/autosort/autosort_client.cpp +++ b/src/d2tweaks/client/modules/autosort/autosort_client.cpp @@ -140,7 +140,6 @@ public: ULONGLONG lastSendTime = GetTickCount64(); - // Function to split a string into words std::vector split(const std::string& s, char delim) { std::stringstream ss(s); @@ -210,9 +209,6 @@ public: } } - - - void draw() override { auto stats = globalStatsVector; int textOffset = 40; // Initial offset for the first line @@ -232,119 +228,72 @@ public: // Initialize statValue int32_t statValue = 0; - if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) { - diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50); - } + //if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) { + // diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50); + //} if (m_stats_enabled) { for (const auto& stat : stats) { - double param = 6; + int param = stat.param; + int op = stat.op; int32_t spirits = diablo2::d2_common::get_stat(player, static_cast(185), NULL); int32_t soulscaptured = statValue = diablo2::d2_common::get_stat(player, static_cast(184), NULL); - switch (stat.stat) { - // 2. (statValue <- this is probably op stat1 ? * baseValue <- this is probably op base ) / 2 ^ param + auto statline = diablo2::d2_common::get_item_stat_cost_record(stat.stat); - // (op stat1 value * base stat value) / (2 ^ param) - // let's try this fucking thing + auto opBase = statline->wOpBase; + auto opStat = statline->wOpStat[0]; - case 190: { - // str/spirits - statValue = static_cast((1 * spirits) / pow(2, param)); // what is the value of opStat_str - break; - } - case 191: { - // dex/spirits - statValue = static_cast((1 * spirits) / pow(2, param)); // what is the value of opStat_str - break; - } - case 192: { - // vit/spirits - statValue = static_cast((1 * spirits) / pow(2, param)); // what is the value of opStat_str - break; - } - case 193: { - // enr/spirits - statValue = static_cast((1 * spirits) / pow(2, param)); // what is the value of opStat_str - break; - } - case 200: { - // skills/souls - param = 8; - statValue = static_cast((1 * soulscaptured) / pow(2, param)); // what is the value of opStat_str - break; - } + auto opBaseValue = diablo2::d2_common::get_stat(player, static_cast(opBase), NULL); + auto opStatValue = diablo2::d2_common::get_stat(player, static_cast(opStat), NULL); - case 301: { - for (auto item : items) { - const auto record = diablo2::d2_common::get_item_record(item->data_record_index); - if (record->type == 104) { - statValue = diablo2::d2_common::get_stat(item, static_cast(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(stat.stat), NULL); - } - } - break; - } - - default: { - // By default, get player stats - statValue = diablo2::d2_common::get_stat(player, static_cast(stat.stat), NULL); - break; - } - } - - /* - int32_t diablo2::d2_common::set_stat(structures::unit* unit, unit_stats_t stat, uint32_t value, int16_t param) { - static wrap_func_std_import 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(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(randStat), randomNumber, 0); - diablo2::d2_common::set_stat(item, static_cast(randStatBool), randomBool, 0); - } + if (stat.is_item_stat == 0) { + int32_t statvalue = diablo2::d2_common::get_stat(player, static_cast(stat.stat), NULL); + int basevalue = 1; + switch (op) { + case 0: + statValue = diablo2::d2_common::get_stat(player, static_cast(stat.stat), NULL); + break; + case 1: // Formula: opstatbasevalue * statvalue / 100 + statValue = static_cast(opBaseValue) / 100; + break; + case 2: // Formula: (statvalue * basevalue) / (2 ^ param) + statValue = static_cast((opBaseValue) / pow(op, param)); + break; + case 3: // Percentage-based version of op #2 + statValue = static_cast((opBaseValue) / pow(op, param)) / 100; + break; + case 4: // Item-based stat increase + statValue = static_cast((opBaseValue) / pow(op, param)); + break; + case 5: // Percentage-based item increase + statValue = static_cast((opBaseValue) / pow(op, param)) / 100; + break; + case 11: // Similar to op #1 and #13 + statValue = static_cast((opBaseValue) / pow(op, param)) / 100; + break; + case 13: + statValue = static_cast((opBaseValue) / pow(op, param)) / 100; + break; + default: + statValue = diablo2::d2_common::get_stat(player, static_cast(stat.stat), NULL); + break; } } else { - // set randStat value to random number 1 and 2^(32) = 4294967296 - //diablo2::d2_common::set_stat(player, static_cast(randStat), randomNumber, 0); - //diablo2::d2_common::set_stat(player, static_cast(randStatBool), randomBool, 0); - - int statValue1 = diablo2::d2_common::get_stat(player, static_cast(randStat), NULL); - int statValue2 = diablo2::d2_common::get_stat(player, static_cast(randStatBool), NULL); - - if (statValue1 > 0 ) { - diablo2::d2_common::set_stat(player, static_cast(randStat), 0, 0); - diablo2::d2_common::set_stat(player, static_cast(randStatBool), 0, 0); + for (auto item : items) { + const auto record = diablo2::d2_common::get_item_record(item->data_record_index); + if (record->type == stat.item_type_id) { + statValue = diablo2::d2_common::get_stat(item, static_cast(stat.stat), NULL); + } } } - */ + + // write code to get player name and display it using MessageBox + const auto player = diablo2::d2_client::get_local_player(); + auto name = player->player_data->name; + auto statValueStr = std::to_wstring(statValue); std::wstring statText = std::wstring(stat.stat_display_string);// .append(L" " + statValueStr); @@ -389,13 +338,9 @@ public: // instead try to load direct jpg with gdi and insetad ofloading jpg file, specify it bb64 encoded and decode it. } - - - } if (m_help_enabled) { - const int windowWidth = 1280; const int windowHeight = 768; @@ -410,14 +355,10 @@ public: // Draw filled background box diablo2::d2_gfx::draw_filled_rect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0, 255); - // Draw justified text inside the box with padding drawJustifiedTextInBox(helpText, boxX, boxY, boxWidth, boxHeight, 0); - - } - diablo2::ui_color_t::UI_COLOR_WHITE; // print player health, mana, and stamina bars, lastexp, nextexp, and level @@ -540,15 +481,6 @@ public: diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16 - - - - - - - - - if (!should_draw()) { m_sort_inventory_btn->set_enabled(false); m_sort_inventory_btn->set_visible(false); diff --git a/src/d2tweaks/client/modules/client_module.cpp b/src/d2tweaks/client/modules/client_module.cpp index e8aabf3..f38c698 100644 --- a/src/d2tweaks/client/modules/client_module.cpp +++ b/src/d2tweaks/client/modules/client_module.cpp @@ -12,4 +12,4 @@ void d2_tweaks::client::modules::client_module::tick() {} void d2_tweaks::client::modules::client_module::handle_packet(common::packet_header* packet) {} -void d2_tweaks::client::modules::client_module::handle_cs_packet(common::packet_header* packet) {} +void d2_tweaks::client::modules::client_module::handle_cs_packet(common::packet_header* packet) {} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/damage_display/damage_display_client.cpp b/src/d2tweaks/client/modules/damage_display/damage_display_client.cpp index d9acb2f..883551a 100644 --- a/src/d2tweaks/client/modules/damage_display/damage_display_client.cpp +++ b/src/d2tweaks/client/modules/damage_display/damage_display_client.cpp @@ -48,7 +48,6 @@ struct damage_label { } }; - static growing_object_pool g_label_pool([]() { return new damage_label(); }); @@ -99,12 +98,10 @@ static unsigned int g_font_player = 1; static unsigned int g_player_label_posx = 70; static unsigned int g_player_label_posy = 500; - HWND findDiabloIIWindow() { return FindWindow(nullptr, TEXT("Diablo II")); // Change "Diablo II" to the exact title of the game window } - // Function to draw the health bar using Windows GDI void drawHealthBar(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) { HDC hdc = GetDC(hWnd); @@ -139,15 +136,12 @@ void OnLoad() { } static void onDraw(HWND hWnd, int x, int y, int maxWidth, int height, float healthPercentage, COLORREF fillColor, COLORREF outlineColor) { - if (GetTickCount64() >= nEndTime) { nEndTime = GetTickCount64() + DURATION; } drawHealthBar(hWnd, x, y, maxWidth, height, healthPercentage, fillColor, outlineColor); - } - static void draw_damage_labels() { const auto player = diablo2::d2_client::get_local_player(); @@ -272,18 +266,12 @@ static void draw_damage_labels() { const auto offset = static_cast(lerp(static_cast(label->unit_height) + 5.f, static_cast(label->unit_height) + 30.f, static_cast(delta) / static_cast(DISPLAY_TIME))); my -= offset; - - - // Draw damage label std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" "; const wchar_t* dmgTextPtr = dmgText.c_str(); diablo2::d2_win::set_current_font(diablo2::UI_FONT_6); diablo2::d2_win::draw_text(const_cast(dmgTextPtr), textX + diablo2::d2_win::get_text_pixel_width(const_cast(combinedTextPtr)) / 2, my + label->unit_height / 2, textColor, 0); - } - - } } @@ -309,7 +297,6 @@ static diablo2::ui_color_t damage_type_to_color(d2_tweaks::common::damage_type_t } void d2_tweaks::client::modules::damage_display::init_early() { - } void d2_tweaks::client::modules::damage_display::init() { @@ -410,5 +397,4 @@ void d2_tweaks::client::modules::damage_display::handle_packet(common::packet_he } void d2_tweaks::client::modules::damage_display::tick() { - -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.cpp b/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.cpp index f0d266d..6b6d299 100644 --- a/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.cpp +++ b/src/d2tweaks/client/modules/item_drop_message/item_drop_message_client.cpp @@ -28,7 +28,7 @@ struct message { char arr_itemtype_codestr_equivstr[20][5]; message(bool active, uint32_t hires_posx, uint32_t hires_posy, uint32_t lowres_posx, uint32_t lowres_posy, uint32_t quality) - : active(active), + : active(active), text_width(0), quality(quality) { start = 0;//GetTickCount(); memset(item_text, 0x00, sizeof item_text); @@ -47,9 +47,9 @@ struct message { static uint32_t m_nMsgCount = 0; static message m_stMsg[32]; -static wchar_t* m_apwcColorStr[17] = {L"ÿc0", L"ÿc1", L"ÿc2", L"ÿc3", L"ÿc4", L"ÿc5", L"ÿc6", L"ÿc7", L"ÿc8", L"ÿc9", L"ÿc:", L"ÿc;", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0" }; -static wchar_t* m_apwcQualityStr[10] = {L"", L"(Cracked)", L"(Normal)", L"(Superior)", L"(Magic)", L"(Set)", L"(Rare)", L"(Unique)", L"(Crafted)", L"(Tempered)"}; -static char* m_apcQualityStr[10] = {"", "(Cracked)", "(Normal)", "(Superior)", "(Magic)", "(Set)", "(Rare)", "(Unique)", "(Crafted)", "(Tempered)"}; +static wchar_t* m_apwcColorStr[17] = { L"ÿc0", L"ÿc1", L"ÿc2", L"ÿc3", L"ÿc4", L"ÿc5", L"ÿc6", L"ÿc7", L"ÿc8", L"ÿc9", L"ÿc:", L"ÿc;", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0", L"ÿc0" }; +static wchar_t* m_apwcQualityStr[10] = { L"", L"(Cracked)", L"(Normal)", L"(Superior)", L"(Magic)", L"(Set)", L"(Rare)", L"(Unique)", L"(Crafted)", L"(Tempered)" }; +static char* m_apcQualityStr[10] = { "", "(Cracked)", "(Normal)", "(Superior)", "(Magic)", "(Set)", "(Rare)", "(Unique)", "(Crafted)", "(Tempered)" }; static uint32_t m_nHookMethod = 1; static uint32_t m_anQualityColor[10] = { 0 }; @@ -77,7 +77,6 @@ public: } }; - void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept(uint8_t* packet, size_t size) { if (packet == 0 || size == 0) return; @@ -94,9 +93,8 @@ void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedIntercept( return; } - __declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacketReceivedInterceptASM() { - __asm + __asm { // call our function (__fastcall) pushad; @@ -107,16 +105,13 @@ __declspec (naked) void d2_tweaks::client::modules::item_drop_message::GamePacke popfd; popad; - jmp [fn_GamePacketReceivedIntercept] + jmp[fn_GamePacketReceivedIntercept] } } - void d2_tweaks::client::modules::item_drop_message::init_early() { - } - void d2_tweaks::client::modules::item_drop_message::init() { char acPathToIni[MAX_PATH] = { 0 }; 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) { const auto info = static_cast(packet); const auto item_dropped_packet = static_cast(packet); @@ -209,21 +203,21 @@ void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet mbstowcs(m_aawcItemtypeEquiv[8], m_stMsg[i].arr_itemtype_codestr_equivstr[9], 4); mbstowcs(m_aawcItemtypeEquiv[9], m_stMsg[i].arr_itemtype_codestr_equivstr[10], 4); - swprintf_s(buffer, L"%s ÿc0Code: %s Quality: %i %s Type: %s Equiv: %s %s %s %s %s %s %s %s %s %s", - m_stMsg[i].item_text, - m_awcCode, - m_stMsg[i].quality, - m_apwcQualityStr[m_stMsg[i].quality], + swprintf_s(buffer, L"%s ÿc0Code: %s Quality: %i %s Type: %s Equiv: %s %s %s %s %s %s %s %s %s %s", + m_stMsg[i].item_text, + m_awcCode, + m_stMsg[i].quality, + m_apwcQualityStr[m_stMsg[i].quality], m_awcItemtypeCode, - m_aawcItemtypeEquiv[0], + m_aawcItemtypeEquiv[0], m_aawcItemtypeEquiv[1], - m_aawcItemtypeEquiv[2], + m_aawcItemtypeEquiv[2], m_aawcItemtypeEquiv[3], - m_aawcItemtypeEquiv[4], + m_aawcItemtypeEquiv[4], m_aawcItemtypeEquiv[5], - m_aawcItemtypeEquiv[6], + m_aawcItemtypeEquiv[6], m_aawcItemtypeEquiv[7], - m_aawcItemtypeEquiv[8], + m_aawcItemtypeEquiv[8], m_aawcItemtypeEquiv[9]); } @@ -264,4 +258,4 @@ void d2_tweaks::client::modules::item_drop_message::handle_packet(common::packet } } } -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/item_move/item_move_client.cpp b/src/d2tweaks/client/modules/item_move/item_move_client.cpp index dcdf200..c060126 100644 --- a/src/d2tweaks/client/modules/item_move/item_move_client.cpp +++ b/src/d2tweaks/client/modules/item_move/item_move_client.cpp @@ -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() { char acPathToIni[MAX_PATH] = { 0 }; const char* pcIniFile = "\\d2tweaks.ini"; @@ -138,7 +136,6 @@ void d2_tweaks::client::modules::item_move::init() { } } - // handle packet coming from the server void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* packet) { static auto& instance = singleton::instance(); @@ -165,4 +162,4 @@ void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* diablo2::d2_client::play_sound(itemRecord->drop_sound, nullptr, 0, 0, 0); else diablo2::d2_client::play_sound(4, nullptr, 0, 0, 0); -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/loot_filter/loot_filter.cpp b/src/d2tweaks/client/modules/loot_filter/loot_filter.cpp index fe3462b..3dcac9d 100644 --- a/src/d2tweaks/client/modules/loot_filter/loot_filter.cpp +++ b/src/d2tweaks/client/modules/loot_filter/loot_filter.cpp @@ -28,7 +28,6 @@ static HANDLE __fastcall delete_save_file(char* name, char* a2) { return g_delete_save_file_original(name, a2); } - void d2_tweaks::client::modules::loot_filter::init_early() { char acPathToIni[MAX_PATH] = { 0 }; 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() { char acPathToIni[MAX_PATH] = { 0 }; const char* pcIniFile = "\\d2tweaks.ini"; @@ -54,4 +52,4 @@ void d2_tweaks::client::modules::loot_filter::init() { singleton::instance().add_menu(&singleton::instance()); singleton::instance().add_menu(&singleton::instance()); } -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.cpp b/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.cpp index 81080c0..d5a0389 100644 --- a/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.cpp +++ b/src/d2tweaks/client/modules/loot_filter/loot_filter_settings.cpp @@ -82,5 +82,4 @@ void loot_filter_settings::remove(const char* name) { std::filesystem::remove(buffer); memset(g_buffer, 0x00, sizeof g_buffer); -} - +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.cpp b/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.cpp index eadff2e..4b865fb 100644 --- a/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.cpp +++ b/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_menu.cpp @@ -56,25 +56,25 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_misc_checkb if (m_altonly) { m_altonly->set_state(loot_filter_settings::get().alt_only); m_altonly->set_on_click(std::bind(&loot_filter_settings_menu::update_alt_only, - this, std::placeholders::_1)); + this, std::placeholders::_1)); } if (m_show_gold) { m_show_gold->set_state(loot_filter_settings::get().show_gold); m_show_gold->set_on_click(std::bind(&loot_filter_settings_menu::update_show_gold, - this, std::placeholders::_1)); + this, std::placeholders::_1)); } if (m_show_runes) { m_show_runes->set_state(loot_filter_settings::get().show_runes); m_show_runes->set_on_click(std::bind(&loot_filter_settings_menu::update_show_runes, - this, std::placeholders::_1)); + this, std::placeholders::_1)); } if (m_show_gems) { m_show_gems->set_state(loot_filter_settings::get().show_gems); m_show_gems->set_on_click(std::bind(&loot_filter_settings_menu::update_show_gems, - this, std::placeholders::_1)); + this, std::placeholders::_1)); } } @@ -113,13 +113,13 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::update_show_gems(boo } void d2_tweaks::client::modules::loot_filter_settings_menu::update_quality_allowance(bool value, - diablo2::structures::item_quality_t quality) { + diablo2::structures::item_quality_t quality) { loot_filter_settings::get().quality_settings[static_cast(quality)] = value; loot_filter_settings::get().save(diablo2::d2_client::get_local_player_name()); } void d2_tweaks::client::modules::loot_filter_settings_menu::register_quality_checkbox(const std::string& name, - diablo2::structures::item_quality_t quality) { + diablo2::structures::item_quality_t quality) { auto control = get_control(name); if (!control) @@ -127,7 +127,7 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_quality_che control->set_state(loot_filter_settings::get().quality_settings[static_cast(quality)]); control->set_on_click(std::bind(&loot_filter_settings_menu::update_quality_allowance, - this, std::placeholders::_1, quality)); + this, std::placeholders::_1, quality)); } void d2_tweaks::client::modules::loot_filter_settings_menu::setup_hooks() { @@ -148,7 +148,7 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::setup_alt_hook() con asm_code asmCode; asmCode.add({ 0x83, 0x7D, 0x00, 0x04 }); //cmp dword ptr [ebp+0], 4 asmCode.add({ 0x0F, 0x85 }, - new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //jnz D2Client.dll+6A399 + new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //jnz D2Client.dll+6A399 asmCode.add({ 0x56 }); //push esi asmCode.add({ 0xB8 }, new asm_address_static(1, check_alt_item)); //mov eax, check_alt_item @@ -158,9 +158,9 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::setup_alt_hook() con asmCode.add({ 0x84, 0xC0 }); //test al, al asmCode.add({ 0x0F, 0x84 }, - new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //je D2Client.dll+6A399 + new asm_address_relative(2, 6, diablo2::d2_client::get_base() + 0x6A399)); //je D2Client.dll+6A399 asmCode.add({ 0xE9 }, - new asm_address_relative(1, 5, diablo2::d2_client::get_base() + 0x6A027)); //jmp D2Client.dll+6A027 + new asm_address_relative(1, 5, diablo2::d2_client::get_base() + 0x6A027)); //jmp D2Client.dll+6A027 auto addr = diablo2::d2_client::get_base() + 0x6A022; @@ -283,7 +283,7 @@ bool d2_tweaks::client::modules::loot_filter_settings_menu::check_alt_item(diabl } void d2_tweaks::client::modules::loot_filter_settings_menu::draw_dropped_items_names(diablo2::structures::unit* unit, - void* edx) { + void* edx) { static auto& instance = singleton::instance(); if (!unit || unit->type != diablo2::structures::unit_type_t::UNIT_TYPE_ITEM) { @@ -315,7 +315,7 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::draw_dropped_items_n } void d2_tweaks::client::modules::loot_filter_settings_menu::handle_dropped_items(diablo2::structures::unit* unit, - void* edx) { + void* edx) { static auto& instance = singleton::instance(); if (!unit || unit->type != diablo2::structures::unit_type_t::UNIT_TYPE_ITEM) { @@ -344,4 +344,4 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::handle_dropped_items return; instance.m_handle_dropped_items_original(unit, edx); -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.cpp b/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.cpp index 5f53ca9..b6836b9 100644 --- a/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.cpp +++ b/src/d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.cpp @@ -9,7 +9,6 @@ #include #include - #include #include @@ -98,10 +97,10 @@ #pragma pack(push, 1) using namespace d2_tweaks::client::modules; -bool m_stats_enabled = false; +bool m_stats_enabled = true; bool m_help_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) { m_show = false; @@ -124,13 +123,11 @@ d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settin m_filter_settings_menu = singleton::instance().get_menu("loot_filter_settings_menu"); - m_btn_toggle_stats = static_cast(get_control("m_toggle_stats")); m_btn_toggle_stats->set_enabled(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_help = static_cast(get_control("m_toggle_help")); m_btn_toggle_help->set_enabled(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_stash = static_cast(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_visible(true); - break; - } - } - m_btn_toggle_stash->set_on_click(std::bind(&loot_filter_settings_toggle_menu::toggle_stash_click, this)); + m_btn_toggle_stash->set_enabled(true); + m_btn_toggle_stash->set_visible(true); + //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)); } 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; } - void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_click() { m_cube_enabled = !m_cube_enabled; if (m_cube_enabled) { @@ -197,7 +197,7 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_cube_c //uint8_t MsgID; // 0x02 uint32_t guid; // 0x06 uint32_t tx; // 0x07 - uint32_t ty; // 0x09 + uint32_t ty; // 0x09 }; D2GSPacketClt20 packet; packet.PacketId = 0x20; @@ -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 diablo2::d2_client::send_to_server_7(0x4F, 0x17, 0, 0); } - - } void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_click() { - m_stash_enabled = !m_stash_enabled; if (m_stash_enabled) { const auto player = diablo2::d2_client::get_local_player(); @@ -237,7 +234,7 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_ uint8_t PacketId; // 0x01 uint32_t guid; // 0x06 uint32_t tx; // 0x07 - uint32_t ty; // 0x09 + uint32_t ty; // 0x09 }; D2GSPacketClt20 packet; packet.PacketId = 0x20; @@ -247,16 +244,14 @@ void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_stash_ diablo2::d2_client::send_to_server(&packet, sizeof packet); } else { - //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); - + // send to server7 to close cube packet 0x4F diablo2::d2_client::send_to_server_7(0x4F, 0x17, 0, 0); } } - void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::toggle_help_click() { //m_help_enabled = !m_help_enabled; // 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 // You can add handling for other platforms here #endif - } void d2_tweaks::client::modules::loot_filter_settings_toggle_menu::draw() { diff --git a/src/d2tweaks/client/modules/small_patches/small_patches.cpp b/src/d2tweaks/client/modules/small_patches/small_patches.cpp index da07726..44c0971 100644 --- a/src/d2tweaks/client/modules/small_patches/small_patches.cpp +++ b/src/d2tweaks/client/modules/small_patches/small_patches.cpp @@ -39,4 +39,4 @@ void d2_tweaks::client::modules::small_patches::init() { // //Window auto-hiding on focus loss // hooking::hook<10026>(diablo2::d2_gfx::get_base(), is_iconic, &g_is_iconic_original); //} -} +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/test/test.cpp b/src/d2tweaks/client/modules/test/test.cpp index 0fb5640..f40fcb6 100644 --- a/src/d2tweaks/client/modules/test/test.cpp +++ b/src/d2tweaks/client/modules/test/test.cpp @@ -61,7 +61,6 @@ private: static test_menu* g_test_menu; void d2_tweaks::client::modules::test::init_early() { - } void d2_tweaks::client::modules::test::init() { diff --git a/src/d2tweaks/client/modules/trader_update/trader_update_client.cpp b/src/d2tweaks/client/modules/trader_update/trader_update_client.cpp index 944af22..0f2bb63 100644 --- a/src/d2tweaks/client/modules/trader_update/trader_update_client.cpp +++ b/src/d2tweaks/client/modules/trader_update/trader_update_client.cpp @@ -48,7 +48,6 @@ enum trader_command { COMMAND_ABORT }; - class trader_update_menu : public d2_tweaks::ui::menu { d2_tweaks::common::asset* m_buttons_img; d2_tweaks::ui::controls::button* m_trader_update_btn; @@ -98,7 +97,7 @@ private: void trader_update_click() { const auto unit = diablo2::d2_client::get_local_player(); - + static d2_tweaks::common::trader_update_cs request_packet_cs; request_packet_cs.client_id = unit->guid; request_packet_cs.npc_id = diablo2::d2_client::current_vendor_guid(); @@ -116,12 +115,9 @@ private: } }; - void d2_tweaks::client::modules::trader_update::init_early() { - } - void d2_tweaks::client::modules::trader_update::init() { char szDir[MAX_PATH]; char szPath[MAX_PATH]; @@ -139,28 +135,25 @@ void d2_tweaks::client::modules::trader_update::init() { } } - 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) { static auto& instance = singleton::instance(); const auto income_packet_cs = static_cast(packet); - + #ifndef NDEBUG - spdlog::debug("[D2CLIENT C > S] ENTITY ACTION! message {} action {} entity_id {} complement {}", (uint8_t) income_packet_cs->message_type, (void*)(income_packet_cs->action >> 24), (void*)(income_packet_cs->entity_id >> 24), (void*)income_packet_cs->complement); + spdlog::debug("[D2CLIENT C > S] ENTITY ACTION! message {} action {} entity_id {} complement {}", (uint8_t)income_packet_cs->message_type, (void*)(income_packet_cs->action >> 24), (void*)(income_packet_cs->entity_id >> 24), (void*)income_packet_cs->complement); #endif m_nMenuOpen = (uint8_t)income_packet_cs->message_type; // 1 = trade, 2 = gamble m_nNpcId = (income_packet_cs->action >> 24); } - void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_header* packet) { static auto& instance = singleton::instance(); const auto income_packet_sc = static_cast(packet); - + if (!diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_NPCSHOP)) return; @@ -200,5 +193,4 @@ void d2_tweaks::client::modules::trader_update::handle_packet(common::packet_hea diablo2::d2_client::send_to_server(&request_packet_cs, sizeof request_packet_cs); } } -} - +} \ No newline at end of file diff --git a/src/d2tweaks/client/modules/transmute/transmute_client.cpp b/src/d2tweaks/client/modules/transmute/transmute_client.cpp index be20e1b..a433bca 100644 --- a/src/d2tweaks/client/modules/transmute/transmute_client.cpp +++ b/src/d2tweaks/client/modules/transmute/transmute_client.cpp @@ -149,7 +149,7 @@ private: //request_packet_cs.transmute_start_flag = m_bToggleTransmute; //request_packet_cs.command = COMMAND_TRANSMUTE_START; //diablo2::d2_client::send_to_server(&request_packet_cs, sizeof request_packet_cs); - + if (m_bToggleTransmute) { diablo2::d2_client::print_chat(L"AUTO TRANSMUTE ON", 1); } @@ -170,7 +170,7 @@ void __fastcall hook_play_sound(uint32_t soundId, uint32_t* unit, const uint32_t return; } -void __stdcall hook_game_end () { +void __stdcall hook_game_end() { m_game_init_done = false; m_bToggleTransmute = false; return; @@ -184,12 +184,11 @@ __declspec (naked) void hook_game_end_asm() { popfd; popad; - jmp [fn_hook_game_end]; + jmp[fn_hook_game_end]; } } void d2_tweaks::client::modules::transmute::init_early() { - } void d2_tweaks::client::modules::transmute::init() { @@ -229,8 +228,8 @@ void d2_tweaks::client::modules::transmute::init() { sprintf_s(m_acBuffer, sizeof(m_acBuffer), "ItemList%d", i + 1); dwLenght = config.GetString("AutoTransmute", m_acBuffer, m_aacItemList[i], MAX_STRING_LENGHT - 1); if (dwLenght != 0) { - lstrcat(m_acItemListAll, m_aacItemList[i]); - lstrcat(m_acItemListAll, "|"); + lstrcat(m_acItemListAll, m_aacItemList[i]); + lstrcat(m_acItemListAll, "|"); } } @@ -238,12 +237,12 @@ void d2_tweaks::client::modules::transmute::init() { sprintf_s(m_acBuffer, sizeof(m_acBuffer), "ItemTypeList%d", i + 1); dwLenght = config.GetString("AutoTransmute", m_acBuffer, m_aacItemTypes[i], MAX_STRING_LENGHT - 1); if (dwLenght != 0) { - lstrcat(m_acItemTypesAll, m_aacItemTypes[i]); + lstrcat(m_acItemTypesAll, m_aacItemTypes[i]); lstrcat(m_acItemTypesAll, "|"); } } -/////// Parse ItemCode + /////// Parse ItemCode dwLenght = lstrlen(m_acItemListAll); memcpy(m_acItemListAllTemp, m_acItemListAll, dwLenght + 1); // ñ÷èòàåì êîëè÷åñòâî âñåõ ïðåäìåòîâ @@ -316,8 +315,7 @@ void d2_tweaks::client::modules::transmute::init() { token_string_itemcode = strtok(NULL, " ,|"); } - -/////// Parse ItemType + /////// Parse ItemType dwLenght = lstrlen(m_acItemTypesAll); memcpy(m_acItemTypesAllTemp, m_acItemTypesAll, dwLenght + 1); char* token_string_itemtype_code = strtok(m_acItemTypesAllTemp, ",|"); @@ -394,7 +392,7 @@ void d2_tweaks::client::modules::transmute::init() { if (m_nTransmuteSound == false) { hooking::hook(diablo2::d2_client::get_base() + 0xB5820, hook_play_sound, reinterpret_cast(&fn_hook_play_sound)); } - + hooking::hook(diablo2::d2_client::get_base() + 0xB528, hook_game_end_asm, reinterpret_cast(&fn_hook_game_end)); singleton::instance().add_menu(new auto_transmute_menu()); @@ -403,7 +401,6 @@ void d2_tweaks::client::modules::transmute::init() { } } - void d2_tweaks::client::modules::transmute::tick() { const auto unit = diablo2::d2_client::get_local_player(); @@ -412,7 +409,7 @@ void d2_tweaks::client::modules::transmute::tick() { m_bToggleTransmute = false; } - if (!unit) + if (!unit) return; if (unit->type != diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER) @@ -421,7 +418,7 @@ void d2_tweaks::client::modules::transmute::tick() { if (!m_bToggleTransmute) return; - if (m_nCountFrames > m_nDelayFrames) + if (m_nCountFrames > m_nDelayFrames) { m_nCountFrames = 0; @@ -449,7 +446,7 @@ void d2_tweaks::client::modules::transmute::tick() { // index second code in array uint32_t index_arr_itemtype = 1; - // ïîäãîòîâèòü ìàññèâ equiv1 + // ïîäãîòîâèòü ìàññèâ equiv1 if (itemtype_record_equiv1) { if (*(DWORD*)itemtype_record_equiv1->code != 0x20202020) { // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1 @@ -529,7 +526,6 @@ L1:; m_nCountFrames++; } - void d2_tweaks::client::modules::transmute::handle_packet(common::packet_header* packet) { static auto& instance = singleton::instance(); const auto income_packet_sc = static_cast(packet); @@ -554,12 +550,12 @@ void d2_tweaks::client::modules::transmute::handle_packet(common::packet_header* // send 'transmute' command request_packet_cs.command = COMMAND_CALL_TRANSMUTE; diablo2::d2_client::send_to_server(&request_packet_cs, sizeof request_packet_cs); - + //diablo2::d2_client::send_to_server_7(0x4F, 0x18, 0, 0); } - + if (income_packet_sc->command == COMMAND_ABORT) { m_bToggleTransmute = false; - diablo2::d2_client::print_chat(L"WRONG RECIPE, AUTO TRANSMUTE OFF", 2); + diablo2::d2_client::print_chat(L"WRONG RECIPE, AUTO TRANSMUTE OFF", 2); } -} +} \ No newline at end of file diff --git a/src/d2tweaks/common/asset_manager.cpp b/src/d2tweaks/common/asset_manager.cpp index bd18ec6..3e6d08e 100644 --- a/src/d2tweaks/common/asset_manager.cpp +++ b/src/d2tweaks/common/asset_manager.cpp @@ -71,9 +71,9 @@ d2_tweaks::common::asset* d2_tweaks::common::asset_manager::get_mpq_file(const s void* d2_tweaks::common::asset_manager::load_asset_data(const std::string& path, mpq_file_type_t type) { switch (type) { - case MPQ_FILE_TYPE_DC6: - return diablo2::d2_client::load_gfx_resource(const_cast(path.c_str())); - default: - return nullptr; + case MPQ_FILE_TYPE_DC6: + return diablo2::d2_client::load_gfx_resource(const_cast(path.c_str())); + default: + return nullptr; } -} +} \ No newline at end of file diff --git a/src/d2tweaks/common/common.cpp b/src/d2tweaks/common/common.cpp index 4ee714d..34a15cf 100644 --- a/src/d2tweaks/common/common.cpp +++ b/src/d2tweaks/common/common.cpp @@ -18,8 +18,8 @@ static int32_t g_ebp_send_to_server; static int32_t g_ebp_send_to_client; static int32_t __stdcall net_send_to_server(int32_t queue, d2_tweaks::common::packet_header* packet, size_t size) { __asm { - push [ebp + 4] - pop [g_ebp_send_to_server] + push[ebp + 4] + pop[g_ebp_send_to_server] } spdlog::debug("[d2net SEND C >>> S] Queue {} Packet {} Size {} CallFrom {}", queue, (void*)packet->d2_packet_type, size, (void*)g_ebp_send_to_server); @@ -29,8 +29,8 @@ static int32_t __stdcall net_send_to_server(int32_t queue, d2_tweaks::common::pa static int32_t __stdcall net_send_to_client(int32_t queue, int32_t clientId, d2_tweaks::common::packet_header* packet, size_t size) { __asm { - push [ebp+4] - pop [g_ebp_send_to_client] + push[ebp + 4] + pop[g_ebp_send_to_client] } spdlog::error("[d2net SEND S >>> C] Queue {} Packet {} Size {} ClientID {} CallFrom {}", queue, (void*)packet->d2_packet_type, size, clientId, (void*)g_ebp_send_to_client); @@ -88,94 +88,94 @@ void d2_tweaks::common::common::init() { bool d2_tweaks::common::common::get_packet_size_cs(packet_header* packet, size_t& size) { switch (packet->message_type) { - case MESSAGE_TYPE_ITEM_MOVE: - { - size = sizeof item_move_cs; - return true; - } - case MESSAGE_TYPE_INVENTORY_SORT: - { - size = sizeof inventory_sort_cs; - return true; - } - case MESSAGE_TYPE_DAMAGE_INFO: - { - size = sizeof damage_info_cs; - return true; - } - case MESSAGE_TYPE_GOLD_PICKUP_INFO: - { - size = sizeof gold_pickup_info_cs; - return true; - } - case MESSAGE_TYPE_ITEM_PICKUP_INFO: - { - size = sizeof item_pickup_info_cs; - return true; - } - case MESSAGE_TYPE_ITEM_DROPPED_INFO: - { - size = sizeof item_dropped_info_cs; - return true; - } - case MESSAGE_TYPE_TRANSMUTE: - { - size = sizeof transmute_info_cs; - return true; - } - case MESSAGE_TYPE_TRADER_UPDATE: - { - size = sizeof trader_update_cs; - return true; - } - default: - return false; + case MESSAGE_TYPE_ITEM_MOVE: + { + size = sizeof item_move_cs; + return true; + } + case MESSAGE_TYPE_INVENTORY_SORT: + { + size = sizeof inventory_sort_cs; + return true; + } + case MESSAGE_TYPE_DAMAGE_INFO: + { + size = sizeof damage_info_cs; + return true; + } + case MESSAGE_TYPE_GOLD_PICKUP_INFO: + { + size = sizeof gold_pickup_info_cs; + return true; + } + case MESSAGE_TYPE_ITEM_PICKUP_INFO: + { + size = sizeof item_pickup_info_cs; + return true; + } + case MESSAGE_TYPE_ITEM_DROPPED_INFO: + { + size = sizeof item_dropped_info_cs; + return true; + } + case MESSAGE_TYPE_TRANSMUTE: + { + size = sizeof transmute_info_cs; + return true; + } + case MESSAGE_TYPE_TRADER_UPDATE: + { + size = sizeof trader_update_cs; + return true; + } + default: + return false; } } bool d2_tweaks::common::common::get_packet_size_sc(packet_header* packet, size_t& size) { switch (packet->message_type) { - case MESSAGE_TYPE_ITEM_MOVE: - { - size = sizeof item_move_sc; - return true; - } - case MESSAGE_TYPE_INVENTORY_SORT: - { - size = sizeof inventory_sort_sc; - return true; - } - case MESSAGE_TYPE_DAMAGE_INFO: - { - size = sizeof damage_info_sc; - return true; - } - case MESSAGE_TYPE_GOLD_PICKUP_INFO: - { - size = sizeof gold_pickup_info_sc; - return true; - } - case MESSAGE_TYPE_ITEM_PICKUP_INFO: - { - size = sizeof item_pickup_info_sc; - return true; - } - case MESSAGE_TYPE_ITEM_DROPPED_INFO: - { - size = sizeof item_dropped_info_sc; - return true; - } - case MESSAGE_TYPE_TRANSMUTE: - { - size = sizeof transmute_info_sc; - return true; - } - case MESSAGE_TYPE_TRADER_UPDATE: - { - size = sizeof trader_update_sc; - return true; - } - default: - return false; + case MESSAGE_TYPE_ITEM_MOVE: + { + size = sizeof item_move_sc; + return true; } -} + case MESSAGE_TYPE_INVENTORY_SORT: + { + size = sizeof inventory_sort_sc; + return true; + } + case MESSAGE_TYPE_DAMAGE_INFO: + { + size = sizeof damage_info_sc; + return true; + } + case MESSAGE_TYPE_GOLD_PICKUP_INFO: + { + size = sizeof gold_pickup_info_sc; + return true; + } + case MESSAGE_TYPE_ITEM_PICKUP_INFO: + { + size = sizeof item_pickup_info_sc; + return true; + } + case MESSAGE_TYPE_ITEM_DROPPED_INFO: + { + size = sizeof item_dropped_info_sc; + return true; + } + case MESSAGE_TYPE_TRANSMUTE: + { + size = sizeof transmute_info_sc; + return true; + } + case MESSAGE_TYPE_TRADER_UPDATE: + { + size = sizeof trader_update_sc; + return true; + } + default: + return false; + } +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.cpp b/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.cpp index 7868d09..14b37e3 100644 --- a/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.cpp +++ b/src/d2tweaks/server/modules/auto_gold_pickup/auto_gold_pickup_server.cpp @@ -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) { const auto income_packet_cs = static_cast(packet); static auto& instance = singleton::instance(); @@ -39,7 +38,6 @@ bool d2_tweaks::server::modules::auto_gold_pickup::handle_packet(diablo2::struct 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) { static common::gold_pickup_info_sc packet; @@ -58,9 +56,8 @@ bool d2_tweaks::server::modules::auto_gold_pickup::au_pickup_gold(diablo2::struc return TRUE; } - 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 auto& instance = singleton::instance(); //if (!game || !unit) @@ -101,5 +98,4 @@ void d2_tweaks::server::modules::auto_gold_pickup::tick(diablo2::structures::gam // continue; //} -} - +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.cpp b/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.cpp index 658a600..2cd7b13 100644 --- a/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.cpp +++ b/src/d2tweaks/server/modules/auto_item_pickup/auto_item_pickup_server.cpp @@ -30,7 +30,7 @@ void d2_tweaks::server::modules::auto_item_pickup::init() { } void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::game* game, - diablo2::structures::unit* unit) { + diablo2::structures::unit* unit) { //static common::item_pickup_info_sc packet; //static auto& instance = singleton::instance(); //if (!game || !unit) @@ -44,7 +44,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam //if (!room) // return; - //for (auto item = room->unit; item; item = item->prev_unit_in_room) { // if (!item) // continue; @@ -92,7 +91,6 @@ void d2_tweaks::server::modules::auto_item_pickup::tick(diablo2::structures::gam // } // } - // if (itemtype_record_equiv2) { // if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) { // // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé 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 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++) // { // 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); } - 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; @@ -156,17 +151,16 @@ bool d2_tweaks::server::modules::auto_item_pickup::au_pickup_item(diablo2::struc uint32_t ptrNull = 0; //if (g_tick_between_item_pickup >= 25) { // true - if item picked up, false - if inventory full - if (diablo2::d2_game::pickup_item(game, unit, guid, &ptrNull) != true) - { - //packet.inventory_full = true; - //singleton::instance().send_packet(unit->player_data->net_client, &packet, sizeof packet); - } + if (diablo2::d2_game::pickup_item(game, unit, guid, &ptrNull) != true) + { + //packet.inventory_full = true; + //singleton::instance().send_packet(unit->player_data->net_client, &packet, sizeof packet); + } //} - + return true; } - 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(packet); static auto& instance = singleton::instance(); diff --git a/src/d2tweaks/server/modules/autosort/autosort_server.cpp b/src/d2tweaks/server/modules/autosort/autosort_server.cpp index 5fbc96a..8e31784 100644 --- a/src/d2tweaks/server/modules/autosort/autosort_server.cpp +++ b/src/d2tweaks/server/modules/autosort/autosort_server.cpp @@ -36,17 +36,17 @@ struct packed_area { uint8_t h; }; -// Define the inventory zone -int iminValidX = 0; -int imaxValidX = 15; -int iminValidY = 0; -int imaxValidY = 12; +// Define variables to store the inventory zone values +int iminValidX = GetPrivateProfileInt("InventoryZone", "iminValidX", 0, "./D2Tweaks.ini"); +int imaxValidX = GetPrivateProfileInt("InventoryZone", "imaxValidX", 0, "./D2Tweaks.ini"); +int iminValidY = GetPrivateProfileInt("InventoryZone", "iminValidY", 0, "./D2Tweaks.ini"); +int imaxValidY = GetPrivateProfileInt("InventoryZone", "imaxValidY", 0, "./D2Tweaks.ini"); -// Define the charm zone -int cminValidX = 0; -int cmaxValidX = 15; -int cminValidY = 12; -int cmaxValidY = 15; +// Define variables to store the charm zone values +int cminValidX = GetPrivateProfileInt("CharmZone", "cminValidX", 0, "./D2Tweaks.ini"); +int cmaxValidX = GetPrivateProfileInt("CharmZone", "cmaxValidX", 0, "./D2Tweaks.ini"); +int cminValidY = GetPrivateProfileInt("CharmZone", "cminValidY", 0, "./D2Tweaks.ini"); +int cmaxValidY = GetPrivateProfileInt("CharmZone", "cmaxValidY", 0, "./D2Tweaks.ini"); void d2_tweaks::server::modules::autosort::init() { char acPathToIni[MAX_PATH] = { 0 }; @@ -61,8 +61,7 @@ void d2_tweaks::server::modules::autosort::init() { } 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(packet)->remItem == 1) { diablo2::d2_common::inv_remove_item(player->inventory, static_cast(packet)->item_to_remove); 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) { if (item == static_cast(packet)->item_to_remove) { - diablo2::d2_common::inv_remove_item(player->inventory, item); diablo2::d2_game::update_inventory_items(game, player); } - - } MessageBoxA(NULL, "Item removed", "Item removed", MB_OK); @@ -148,7 +144,7 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game, spdlog::info("is_charm: {0}\n\n", is_charm); } - if (occupied_cells > inventoryHeight* inventoryWidth) { + if (occupied_cells > inventoryHeight * inventoryWidth) { //should never be happen in normal cases spdlog::warn("occupied_cells > inventoryHeight* inventoryWidth"); return false; @@ -163,11 +159,9 @@ bool d2_tweaks::server::modules::autosort::sort(diablo2::structures::game* game, const auto itemsCount = items.size(); const auto charmsCount = charms.size(); - if (itemsCount == 0) return true; //there's nothing to sort - auto success = NULL; 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); } - } if (charmsCount > 0) { @@ -365,7 +358,8 @@ bool d2_tweaks::server::modules::autosort::find_free_space(diablo2::structures:: } } return false; - } else { + } + else { for (x = minValidX; x <= maxValidX - record->inv_width + 1; x++) { for (y = minValidY; y <= inventoryMaxValidY - record->inv_height + 1; y++) { diablo2::structures::unit* blockingUnit = nullptr; @@ -378,4 +372,4 @@ bool d2_tweaks::server::modules::autosort::find_free_space(diablo2::structures:: } return false; } -} +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/damage_display/damage_display_server.cpp b/src/d2tweaks/server/modules/damage_display/damage_display_server.cpp index 5d46981..ddfaf6e 100644 --- a/src/d2tweaks/server/modules/damage_display/damage_display_server.cpp +++ b/src/d2tweaks/server/modules/damage_display/damage_display_server.cpp @@ -14,14 +14,13 @@ #include - MODULE_INIT(damage_display) static char(__fastcall* g_apply_attack_results_origin)(diablo2::structures::game* game, - diablo2::structures::unit* attacker, - diablo2::structures::unit* defender, - BOOL recalculateDamage, - diablo2::structures::damage* dmg); + diablo2::structures::unit* attacker, + diablo2::structures::unit* defender, + BOOL recalculateDamage, + diablo2::structures::damage* dmg); #define PRINT_DMG_DELIMITER(name, delimiter) if(dmg->name > 0) spdlog::debug(#name ": {0}", dmg->name / delimiter) #define PRINT_DMG(name) PRINT_DMG_DELIMITER(name, 256) @@ -76,7 +75,6 @@ static void send_damage_data(diablo2::structures::unit* defender, spdlog::info("maxHp: {0}", packet.maxHp); spdlog::info("damage: {0}", packet.damage); - if (packet.damage_type == d2_tweaks::common::DAMAGE_TYPE_UNKNOWN) return; @@ -87,23 +85,23 @@ static void send_damage_data(diablo2::structures::unit* defender, } static bool has_players(diablo2::structures::unit* attacker, - diablo2::structures::unit* defender) { + diablo2::structures::unit* defender) { return attacker->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER || defender->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER; } static bool has_hirelings(diablo2::structures::unit* attacker, - diablo2::structures::unit* defender) { + diablo2::structures::unit* defender) { return attacker && attacker->is_hireling() || defender && defender->is_hireling(); } static bool has_pets(diablo2::structures::unit* attacker, - diablo2::structures::unit* defender) { + diablo2::structures::unit* defender) { return attacker && attacker->is_pet() || defender && defender->is_pet(); } static diablo2::structures::unit* get_hireling_owner(diablo2::structures::game* game, - diablo2::structures::unit* unit) { + diablo2::structures::unit* unit) { static auto& instance = singleton::instance(); if (!unit) @@ -123,7 +121,7 @@ static diablo2::structures::unit* get_hireling_owner(diablo2::structures::game* } return true; - }); + }); if (guid == 0) return nullptr; @@ -134,7 +132,7 @@ static diablo2::structures::unit* get_hireling_owner(diablo2::structures::game* } static diablo2::structures::unit* get_pet_owner(diablo2::structures::game* game, - diablo2::structures::unit* unit) { + diablo2::structures::unit* unit) { static auto& instance = singleton::instance(); if (!unit) @@ -148,14 +146,14 @@ static diablo2::structures::unit* get_pet_owner(diablo2::structures::game* game, instance.iterate_server_units(game, diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER, [&](diablo2::structures::unit* player) { diablo2::d2_game::iterate_unit_pets( game, player, [&](diablo2::structures::game*, diablo2::structures::unit*, diablo2::structures::unit* u) { - if (u != unit) - return; + if (u != unit) + return; - guid = player->guid; - }); + guid = player->guid; + }); return guid == 0; - }); + }); if (guid == 0) return nullptr; @@ -166,8 +164,8 @@ static diablo2::structures::unit* get_pet_owner(diablo2::structures::game* game, } static void process_players_damage(diablo2::structures::unit* attacker, - diablo2::structures::unit* defender, - diablo2::structures::damage* dmg) { + diablo2::structures::unit* defender, + diablo2::structures::damage* dmg) { diablo2::structures::net_client* client = nullptr; if (attacker->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER) @@ -179,14 +177,15 @@ static void process_players_damage(diablo2::structures::unit* attacker, } static void process_hireling_damage(diablo2::structures::game* game, - diablo2::structures::unit* attacker, - diablo2::structures::unit* defender, - diablo2::structures::damage* dmg) { + diablo2::structures::unit* attacker, + diablo2::structures::unit* defender, + diablo2::structures::damage* dmg) { diablo2::structures::unit* owner = nullptr; if (attacker->is_hireling()) { owner = get_hireling_owner(game, attacker); - } else if (defender->is_hireling()) { + } + else if (defender->is_hireling()) { owner = get_hireling_owner(game, defender); } @@ -197,14 +196,15 @@ static void process_hireling_damage(diablo2::structures::game* game, } static void process_pet_damage(diablo2::structures::game* game, - diablo2::structures::unit* attacker, - diablo2::structures::unit* defender, - diablo2::structures::damage* dmg) { + diablo2::structures::unit* attacker, + diablo2::structures::unit* defender, + diablo2::structures::damage* dmg) { diablo2::structures::unit* owner = nullptr; if (attacker->is_pet()) { owner = get_pet_owner(game, attacker); - } else if (defender->is_pet()) { + } + else if (defender->is_pet()) { owner = get_pet_owner(game, defender); } @@ -215,10 +215,10 @@ static void process_pet_damage(diablo2::structures::game* game, } static char __fastcall apply_attack_results(diablo2::structures::game* game, - diablo2::structures::unit* attacker, - diablo2::structures::unit* defender, - BOOL recalculateDamage, - diablo2::structures::damage* dmg) { + diablo2::structures::unit* attacker, + diablo2::structures::unit* defender, + BOOL recalculateDamage, + diablo2::structures::damage* dmg) { static auto& instance = singleton::instance(); static char result = 0; @@ -257,8 +257,8 @@ void d2_tweaks::server::modules::damage_display::init() { } bool d2_tweaks::server::modules::damage_display::handle_packet(diablo2::structures::game* game, - diablo2::structures::unit* player, common::packet_header* packet) { + diablo2::structures::unit* player, common::packet_header* packet) { return true; } -void d2_tweaks::server::modules::damage_display::tick(diablo2::structures::game* game, diablo2::structures::unit* unit) {} +void d2_tweaks::server::modules::damage_display::tick(diablo2::structures::game* game, diablo2::structures::unit* unit) {} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.cpp b/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.cpp index 9b4fd0a..559e659 100644 --- a/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.cpp +++ b/src/d2tweaks/server/modules/identify_on_pickup/identify_on_pickup_server.cpp @@ -19,12 +19,12 @@ static unsigned int g_item_Crafted = 0; static unsigned int g_item_Tempered = 0; static uint32_t(__fastcall* g_pickup_item_original)(diablo2::structures::game*, - diablo2::structures::unit*, - uint32_t, uint32_t); + diablo2::structures::unit*, + uint32_t, uint32_t); static uint32_t __fastcall pickup_item(diablo2::structures::game* game, - diablo2::structures::unit* player, - uint32_t guid, - uint32_t a4) { + diablo2::structures::unit* player, + uint32_t guid, + uint32_t a4) { static auto& instance = singleton::instance(); if (!game || !player || player->type != diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER) @@ -66,12 +66,12 @@ static uint32_t __fastcall pickup_item(diablo2::structures::game* game, } static uint32_t(__fastcall* g_pickup_item_cursor_original)(diablo2::structures::game*, - diablo2::structures::unit*, - uint32_t, uint32_t); + diablo2::structures::unit*, + uint32_t, uint32_t); static uint32_t __fastcall pickup_item_cursor(diablo2::structures::game* game, - diablo2::structures::unit* player, - uint32_t guid, - uint32_t a4) { + diablo2::structures::unit* player, + uint32_t guid, + uint32_t a4) { static auto& instance = singleton::instance(); if (!game || !player || player->type != diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER) @@ -132,5 +132,4 @@ void d2_tweaks::server::modules::identify_on_pickup::init() { g_item_Crafted = GetPrivateProfileInt("IdentifyOnPickup", "Crafted", 1, acPathToIni); g_item_Tempered = GetPrivateProfileInt("IdentifyOnPickup", "Tempered", 1, acPathToIni); } -} - +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.cpp b/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.cpp index 364bd41..8fd31e1 100644 --- a/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.cpp +++ b/src/d2tweaks/server/modules/item_drop_message/item_drop_message_server.cpp @@ -34,7 +34,6 @@ static char m_acBuffer[1024] = { 0 }; static item_code* m_stItemList; static item_type* m_stItemTypes; - void d2_tweaks::server::modules::item_drop_message::init() { uint32_t dwLenght = 0; char acPathToIni[MAX_PATH] = { 0 }; @@ -62,7 +61,7 @@ void d2_tweaks::server::modules::item_drop_message::init() { } } -/////// Parse ItemCode + /////// Parse ItemCode dwLenght = lstrlen(m_acItemListAll); memcpy(m_acItemListAllTemp, m_acItemListAll, dwLenght + 1); // ñ÷èòàåì êîëè÷åñòâî âñåõ ïðåäìåòîâ @@ -137,8 +136,7 @@ void d2_tweaks::server::modules::item_drop_message::init() { token_string_itemcode = strtok(NULL, " ,|"); } - -/// Parse ItemType + /// Parse ItemType dwLenght = lstrlen(m_acItemTypesAll); memcpy(m_acItemTypesAllTemp, m_acItemTypesAll, dwLenght + 1); char* token_string_itemtype_code = strtok(m_acItemTypesAllTemp, ",|"); @@ -218,7 +216,7 @@ void d2_tweaks::server::modules::item_drop_message::init() { } void d2_tweaks::server::modules::item_drop_message::tick(diablo2::structures::game* game, - diablo2::structures::unit* unit) { + diablo2::structures::unit* unit) { static common::item_pickup_info_sc packet; static auto& instance = singleton::instance(); if (!game || !unit) @@ -228,12 +226,11 @@ void d2_tweaks::server::modules::item_drop_message::tick(diablo2::structures::ga return; } - bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) { const auto income_item_dropped_packet = static_cast(packet); static common::item_dropped_info_sc response_item_dropped_packet; - - switch (income_item_dropped_packet->message_type) + + switch (income_item_dropped_packet->message_type) { case common::message_types_t::MESSAGE_TYPE_ITEM_DROPPED_INFO: auto current_unit = diablo2::d2_game::get_server_unit(game, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM, income_item_dropped_packet->item_id); @@ -248,7 +245,7 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc const auto itemtype_record = diablo2::d2_common::get_item_type_record(record->type); auto itemtype_record_equiv1 = diablo2::d2_common::get_item_type_record(itemtype_record->equiv1); auto itemtype_record_equiv2 = diablo2::d2_common::get_item_type_record(itemtype_record->equiv2); - + wcstombs(string_mb, string_wc, 256); memset(response_item_dropped_packet.arr_itemtype_codestr_equivstr, 0, sizeof response_item_dropped_packet.arr_itemtype_codestr_equivstr); @@ -258,7 +255,7 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc uint32_t index_arr_itemtype = 1; if (itemtype_record_equiv1) { - // + // if (*(DWORD*)itemtype_record_equiv1->code != 0x20202020) { // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1 *(DWORD*)response_item_dropped_packet.arr_itemtype_codestr_equivstr[index_arr_itemtype] = *(DWORD*)itemtype_record_equiv1->code; @@ -269,13 +266,12 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc itemtype_record_equiv1 = diablo2::d2_common::get_item_type_record(itemtype_record_equiv1->equiv1); if (*(DWORD*)itemtype_record_equiv1->code != 0x20202020) { *(DWORD*)response_item_dropped_packet.arr_itemtype_codestr_equivstr[index_arr_itemtype] = *(DWORD*)itemtype_record_equiv1->code; - } + } else break; } } } - if (itemtype_record_equiv2) { if (*(DWORD*)itemtype_record_equiv2->code != 0x20202020) { // ñîõðàíèòü ïåðâûé ðàíåå ïîëó÷åíûé equiv1 @@ -293,7 +289,6 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc } } - if (GetKeyState(VK_SCROLL) != 0) { response_item_dropped_packet.item = income_item_dropped_packet->item_id; response_item_dropped_packet.code[0] = record->string_code[0]; @@ -312,7 +307,6 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc break; } - for (uint32_t i = 0; i < m_nCountItemTypesAll; i++) { for (uint32_t count = 0; count < index_arr_itemtype; count++) @@ -342,7 +336,6 @@ bool d2_tweaks::server::modules::item_drop_message::handle_packet(diablo2::struc } } - for (uint32_t i = 0; i < m_nCountItemListAll; i++) { if (record->string_code[0] == m_stItemList[i].code0 && diff --git a/src/d2tweaks/server/modules/item_move/item_move_server.cpp b/src/d2tweaks/server/modules/item_move/item_move_server.cpp index 742ac9b..248bc41 100644 --- a/src/d2tweaks/server/modules/item_move/item_move_server.cpp +++ b/src/d2tweaks/server/modules/item_move/item_move_server.cpp @@ -24,7 +24,6 @@ #include // Include Windows API header for MessageBox - #include // For std::setw void serialize_item(const std::string& itemcode, const diablo2::structures::unit& item, std::ofstream& file) { @@ -54,11 +53,9 @@ void d2_tweaks::server::modules::item_move::init() { } } - - // handle packet coming from the client bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::game* game, - diablo2::structures::unit* player, common::packet_header* packet) { + diablo2::structures::unit* player, common::packet_header* packet) { static common::item_move_sc resp; static auto& instance = singleton::instance(); @@ -71,7 +68,6 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g const auto item = instance.get_server_unit(game, itemMove->item_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item const auto record = diablo2::d2_common::get_item_record(item->data_record_index); - const char* itemcode = itemMove->item_code; const auto bag = instance.get_server_unit(game, itemMove->bag_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item @@ -83,7 +79,6 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g itemProperty.nMax = itemMove->val; diablo2::d2_common::add_property(bag, &itemProperty, 1); - if (item == nullptr) return true; //block further packet processing @@ -114,24 +109,17 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g diablo2::d2_net::send_to_client(1, client->client_id, &resp, sizeof resp); if (itemMove->removeFromBag == 1) { - // here we need to add item to inventory diablo2::structures::unit* item; - // or I can do something like this, - // when extractor is clicked, send the bag and extractor to cube, + // or I can do something like this, + // when extractor is clicked, send the bag and extractor to cube, const auto player = diablo2::d2_client::get_local_player(); - - } - - - if (itemMove->updateBag == 1) { - // Serialize item data into binary file std::string playerName = player->player_data->name; std::string fileName = "./Save/" + playerName + ".boh"; @@ -146,12 +134,11 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g outFile.close(); } - return true; } bool d2_tweaks::server::modules::item_move::find_free_space(diablo2::structures::inventory* inv, - diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) { + diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y) { char data[0x18]; diablo2::d2_common::get_inventory_data(inventoryIndex, 0, data); @@ -170,4 +157,4 @@ bool d2_tweaks::server::modules::item_move::find_free_space(diablo2::structures: } return false; -} +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/server_module.cpp b/src/d2tweaks/server/modules/server_module.cpp index bdbee27..1120942 100644 --- a/src/d2tweaks/server/modules/server_module.cpp +++ b/src/d2tweaks/server/modules/server_module.cpp @@ -7,9 +7,9 @@ d2_tweaks::server::modules::server_module::server_module() { } bool d2_tweaks::server::modules::server_module::handle_packet(diablo2::structures::game* game, - diablo2::structures::unit* player, common::packet_header* packet) { + diablo2::structures::unit* player, common::packet_header* packet) { return false; } void d2_tweaks::server::modules::server_module::tick(diablo2::structures::game* game, - diablo2::structures::unit* unit) {} \ No newline at end of file + diablo2::structures::unit* unit) {} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/test/test.cpp b/src/d2tweaks/server/modules/test/test.cpp index 1947592..db4a720 100644 --- a/src/d2tweaks/server/modules/test/test.cpp +++ b/src/d2tweaks/server/modules/test/test.cpp @@ -10,14 +10,13 @@ MODULE_INIT(test) static int(__stdcall* g_set_stat_original)(diablo2::structures::unit* unit, - diablo2::unit_stats_t stat, - uint32_t value, int16_t param); + diablo2::unit_stats_t stat, + uint32_t value, int16_t param); static int __stdcall set_stat(diablo2::structures::unit* unit, - diablo2::unit_stats_t stat, - uint32_t value, int16_t param) { + diablo2::unit_stats_t stat, + uint32_t value, int16_t param) { if (unit->type == diablo2::structures::unit_type_t::UNIT_TYPE_PLAYER && stat == diablo2::UNIT_STAT_GOLD) { - spdlog::debug("Setting UNIT_STAT_GOLD stat!"); } @@ -25,7 +24,7 @@ static int __stdcall set_stat(diablo2::structures::unit* unit, } static int32_t(__stdcall* g_set_stat_in_list_original)(void*, diablo2::unit_stats_t stat, - uint32_t value, uint32_t param); + uint32_t value, uint32_t param); static int32_t __stdcall set_stat_in_list(void* a1, diablo2::unit_stats_t stat, uint32_t value, uint32_t param) { if (stat == diablo2::UNIT_STAT_GOLD) { spdlog::debug("Setting UNIT_STAT_GOLD stat!"); @@ -46,4 +45,4 @@ void d2_tweaks::server::modules::test::init() { hooking::hook<10517>(diablo2::d2_common::get_base(), set_stat, &g_set_stat_original); hooking::hook(diablo2::d2_game::get_base() + 0x50F80, regen_tick, &g_regen_tick_original); -} +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/trader_update/trader_update_server.cpp b/src/d2tweaks/server/modules/trader_update/trader_update_server.cpp index 64b4fc1..f6376c4 100644 --- a/src/d2tweaks/server/modules/trader_update/trader_update_server.cpp +++ b/src/d2tweaks/server/modules/trader_update/trader_update_server.cpp @@ -78,7 +78,7 @@ static uint32_t m_nParam4 = 1; //__declspec (naked) void click_trade_menu() { // __asm { // pushad; //+0x24 esp -// pushfd; // +// pushfd; // // //mov eax, [esp + 0x28];//+0x4 // //mov [m_nNpcId], eax; // mov eax, [esp + 0x34];//+0x10 @@ -99,7 +99,7 @@ static uint32_t m_nParam4 = 1; //__declspec (naked) void click_gamble_menu() { // __asm { // pushad; //+0x24 esp -// pushfd; // +// pushfd; // // //mov eax, [esp + 0x28];//+0x4 // //mov [m_nNpcId], eax; // mov eax, [esp + 0x34];//+0x10 @@ -133,7 +133,6 @@ static uint32_t m_nParam4 = 1; // {D2DLL_INVALID} //}; - void d2_tweaks::server::modules::trader_update::init() { char szDir[MAX_PATH]; char szPath[MAX_PATH]; @@ -151,30 +150,27 @@ void d2_tweaks::server::modules::trader_update::init() { } } - void d2_tweaks::server::modules::trader_update::tick(diablo2::structures::game* game, diablo2::structures::unit* unit) { return; } - struct ClientFromNumber { uint8_t padding[0x174]; diablo2::structures::net_client* net_cleint; }; - bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) { const auto income_packet_cs = static_cast(packet); static common::trader_update_sc response_packet_sc; - + diablo2::structures::unit* temp_ptNPC = diablo2::d2_game::get_server_unit(game, diablo2::structures::unit_type_t::UNIT_TYPE_MONSTER, income_packet_cs->npc_id); diablo2::structures::npc_record* npcrecord = diablo2::d2_game::get_npc_record(game, temp_ptNPC, &temp_ptNPC); diablo2::structures::unit* ptNPC = diablo2::d2_game::get_server_unit(game, diablo2::structures::unit_type_t::UNIT_TYPE_MONSTER, income_packet_cs->npc_id); - + if (!ptNPC) return true; - - // íàæàòèå êíîïêè, ÷èñòèì èíâåíòàðü òîðãîâöà íà ñåðâåðå + + // íàæàòèå êíîïêè, ÷èñòèì èíâåíòàðü òîðãîâöà íà ñåðâåðå if (income_packet_cs->command == COMMAND_FREE_NPC_INVENTORY) { // îòïðàâèòü ïàêåò îá îáíîâëåíèè âñåì ïîäëêëþ÷åííûì êëèåíòàì // id net client - 1 âñåãäà õîñò, ïîòîì êàæäûé íå÷åòíûé, 3, 5, 7, 9, 11, 13, 15 @@ -189,7 +185,6 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure } } - if (income_packet_cs->command == COMMAND_FREE_NPC_GAMBLE) { npcrecord->pGamble->pInventory = 0; npcrecord->pGamble->dwGUID = 0; @@ -200,7 +195,6 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure singleton::instance().send_packet(player->player_data->net_client, &response_packet_sc, sizeof response_packet_sc); } - if (income_packet_cs->command == COMMAND_FILL_NPC_INVENTORY) { // çàïîëíèòü èíâåíòàðü òîðãîâöà npcrecord->bRefreshInventory = true; @@ -220,7 +214,6 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure } } - if (income_packet_cs->command == COMMAND_FILL_NPC_GAMBLE) { diablo2::d2_game::create_vendor_cache1(game, player, ptNPC, 1, true); response_packet_sc.command = COMMAND_FILL_NPC_GAMBLE; @@ -230,4 +223,4 @@ bool d2_tweaks::server::modules::trader_update::handle_packet(diablo2::structure } return true; -} +} \ No newline at end of file diff --git a/src/d2tweaks/server/modules/transmute/transmute_server.cpp b/src/d2tweaks/server/modules/transmute/transmute_server.cpp index 89e6422..c56cbe5 100644 --- a/src/d2tweaks/server/modules/transmute/transmute_server.cpp +++ b/src/d2tweaks/server/modules/transmute/transmute_server.cpp @@ -53,7 +53,6 @@ void d2_tweaks::server::modules::transmute::tick(diablo2::structures::game* game return; } - inline uint64_t TimeStart() { _asm { cpuid @@ -61,33 +60,31 @@ inline uint64_t TimeStart() { } } - inline uint64_t TimeEnd() { _asm { rdtsc } } - bool d2_tweaks::server::modules::transmute::handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) { const auto income_packet_cs = static_cast(packet); static common::transmute_info_sc response_packet_sc; // îáðàáàòûâàåì çàïðîñ îò êëèåíòà if (income_packet_cs->command == COMMAND_CALL_TRANSMUTE) { - #ifndef NDEBUG +#ifndef NDEBUG uint64_t time = TimeStart(); - #endif +#endif // âîçâðàùàåò ñãåíåðèðîâàíûé item, èëè getmaxcuberecipes åñëè íåóäà÷íî if (diablo2::d2_game::transmogrify(game, player) == diablo2::d2_common::get_max_cube_recipes()) { response_packet_sc.command = COMMAND_ABORT; singleton::instance().send_packet(player->player_data->net_client, &response_packet_sc, sizeof response_packet_sc); //diablo2::d2_net::send_to_client(1, client->client_id, &response_packet_sc, sizeof response_packet_sc); } - #ifndef NDEBUG +#ifndef NDEBUG time = (TimeEnd() - time); spdlog::debug("Time {}", time); - #endif +#endif } if (income_packet_cs->command == COMMAND_MOVE_ITEM) { @@ -97,8 +94,6 @@ bool d2_tweaks::server::modules::transmute::handle_packet(diablo2::structures::g return true; } - - bool d2_tweaks::server::modules::transmute::move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) { static common::transmute_info_sc resp; static auto& instance = singleton::instance(); @@ -134,8 +129,6 @@ bool d2_tweaks::server::modules::transmute::move_item_to(diablo2::structures::ga return true; } - - bool d2_tweaks::server::modules::transmute::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]; @@ -156,5 +149,4 @@ bool d2_tweaks::server::modules::transmute::find_free_space(diablo2::structures: } return false; -} - +} \ No newline at end of file diff --git a/src/d2tweaks/server/server.cpp b/src/d2tweaks/server/server.cpp index b5c7c17..b9cdb66 100644 --- a/src/d2tweaks/server/server.cpp +++ b/src/d2tweaks/server/server.cpp @@ -17,13 +17,13 @@ #include #include #include +#include static int32_t(__fastcall* g_get_incoming_packet_info_original)(d2_tweaks::common::packet_header* data, unsigned int dataSize, size_t* packetSizeOut, size_t* someOffset, int* packetGroup, int32_t* a6, int a7, int a8); static int32_t(__fastcall* g_handle_packet_original)(diablo2::structures::game* game, diablo2::structures::unit* player, d2_tweaks::common::packet_header* data, size_t size); static int32_t(__fastcall* g_net_tick_original)(diablo2::structures::game*, diablo2::structures::unit*, int32_t, int32_t); - //returns some kind of processing type (i.e. resultGroup == 0x04 means drop packet) static int32_t __fastcall get_incoming_packet_info(d2_tweaks::common::packet_header* data, unsigned int dataSize, size_t* packetSizeOut, size_t* someOffset, int* packetGroup, int32_t* a6, int a7, int a8) { static d2_tweaks::common::packet_header dummy; @@ -69,8 +69,8 @@ static int32_t g_ebp_send_to_client; void __fastcall hook_sc_packet_before_sent(uint32_t* client_strc, d2_tweaks::common::packet_header* packet, size_t size) { #ifndef NDEBUG __asm { - push [ebp + 0x30]; - pop [g_ebp_send_to_client]; + push[ebp + 0x30]; + pop[g_ebp_send_to_client]; } if (size == -1) @@ -82,20 +82,19 @@ void __fastcall hook_sc_packet_before_sent(uint32_t* client_strc, d2_tweaks::com return; } - __declspec (naked) void hook_sc_packet_before_sent_wrapper() { __asm { pushad; pushfd; - push [esp+0x28] - call [hook_sc_packet_before_sent] - popfd; + push[esp + 0x28] + call[hook_sc_packet_before_sent] + popfd; popad; // îðèãèíàëüíûå èíñòðóêöèè push ecx - push ebp - push esi - mov esi, ecx + push ebp + push esi + mov esi, ecx } RET_TO_RVA(DLLBASE_D2GAME, 0xC715); } @@ -108,7 +107,6 @@ static const DLLPatchStrc gpt_hook_sc_packet_before_sent[] = {D2DLL_INVALID} }; - void d2_tweaks::server::server::init() { hooking::hook(reinterpret_cast(diablo2::d2_game::get_base() + 0x59320), ::handle_packet, &g_handle_packet_original); hooking::hook(reinterpret_cast(diablo2::d2_game::get_base() + 0x50F80), net_tick, &g_net_tick_original); @@ -137,8 +135,8 @@ void d2_tweaks::server::server::send_packet(diablo2::structures::net_client* cli } bool d2_tweaks::server::server::handle_packet(diablo2::structures::game* game, - diablo2::structures::unit* player, - common::packet_header* packet) { + diablo2::structures::unit* player, + common::packet_header* packet) { auto handler = m_packet_handlers[packet->message_type]; if (!handler) @@ -187,7 +185,7 @@ diablo2::structures::unit* d2_tweaks::server::server::get_server_unit(diablo2::s } void d2_tweaks::server::server::iterate_server_units(diablo2::structures::game* game, diablo2::structures::unit_type_t type, - const std::function& cb) { + const std::function& cb) { if (!cb) return; @@ -225,4 +223,4 @@ int32_t d2_tweaks::server::server::net_tick(diablo2::structures::game* game, dia } return g_net_tick_original(game, unit, a3, a4); -} +} \ No newline at end of file diff --git a/src/d2tweaks/ui/controls/button.cpp b/src/d2tweaks/ui/controls/button.cpp index 4a50703..1f8cfbc 100644 --- a/src/d2tweaks/ui/controls/button.cpp +++ b/src/d2tweaks/ui/controls/button.cpp @@ -10,13 +10,13 @@ #include d2_tweaks::ui::controls::button::button(menu* menu, - const rect& rect, const std::function& onClick, - common::asset* image, - int32_t frameDown, int32_t frameUp, int32_t clickSound) : control(menu, - rect.get_x(), - rect.get_y(), - rect.get_width(), - rect.get_height()) { + const rect& rect, const std::function& onClick, + common::asset* image, + int32_t frameDown, int32_t frameUp, int32_t clickSound) : control(menu, + rect.get_x(), + rect.get_y(), + rect.get_width(), + rect.get_height()) { control::set_enabled(true); control::set_visible(true); @@ -42,8 +42,6 @@ d2_tweaks::ui::controls::button::button(menu* menu, // uint32_t pos_y; //}; - - d2_tweaks::ui::controls::button::button(menu* menu, const pugi::xml_node& node) : control(menu, 0, 0, 0, 0) { char buf[32] = { 0 }; @@ -51,7 +49,7 @@ d2_tweaks::ui::controls::button::button(menu* menu, const pugi::xml_node& node) auto cy = node.attribute("default_pos_y").as_int(0); m_res_count = node.attribute("resolution_count").as_int(1); - + respos temp; for (uint32_t i = 1; i <= m_res_count; i++) { sprintf_s(buf, "res%d_x", i); @@ -143,9 +141,9 @@ void d2_tweaks::ui::controls::button::draw(int32_t offsetX, int32_t offsetY) { !m_popup.empty()) { diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); diablo2::d2_win::set_popup_properties(const_cast(m_popup.c_str()), - get_x() + offsetX + m_rect.get_width() / 2, - get_y() + offsetY - m_rect.get_height(), - diablo2::UI_COLOR_WHITE, TRUE); + get_x() + offsetX + m_rect.get_width() / 2, + get_y() + offsetY - m_rect.get_height(), + diablo2::UI_COLOR_WHITE, TRUE); diablo2::d2_win::draw_popup(); } @@ -185,4 +183,4 @@ void d2_tweaks::ui::controls::button::left_mouse(int32_t offsetX, int32_t offset void d2_tweaks::ui::controls::button::right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {} -void d2_tweaks::ui::controls::button::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} +void d2_tweaks::ui::controls::button::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} \ No newline at end of file diff --git a/src/d2tweaks/ui/controls/checkbox.cpp b/src/d2tweaks/ui/controls/checkbox.cpp index 777e287..03e89bd 100644 --- a/src/d2tweaks/ui/controls/checkbox.cpp +++ b/src/d2tweaks/ui/controls/checkbox.cpp @@ -9,13 +9,13 @@ const int32_t PADDING = 3; d2_tweaks::ui::controls::checkbox::checkbox(menu* menu, const std::wstring& text, const rect& rect, - const std::function& onClick, - common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound) + const std::function& onClick, + common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound) : control(menu, - rect.get_x(), - rect.get_y(), - rect.get_width(), - rect.get_height()) { + rect.get_x(), + rect.get_y(), + rect.get_width(), + rect.get_height()) { control::set_enabled(true); control::set_visible(true); @@ -72,7 +72,7 @@ d2_tweaks::ui::controls::checkbox::checkbox(menu* menu, const pugi::xml_node& no m_image = new image(menu, cimg, cx, cy, m_frame_unchecked); m_label = new label(menu, string_utils::string_to_wstring(ctext), cx + m_image->get_width() + PADDING, cy, - static_cast(ccolor), static_cast(cfont)); + static_cast(ccolor), static_cast(cfont)); checkbox::set_x(cx); checkbox::set_y(cy); @@ -103,9 +103,9 @@ void d2_tweaks::ui::controls::checkbox::draw(int32_t offsetX, int32_t offsetY) { !m_popup.empty()) { diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); diablo2::d2_win::set_popup_properties(const_cast(m_popup.c_str()), - get_x() + offsetX + m_rect.get_width() / 2, - get_y() + offsetY - m_rect.get_height(), - diablo2::UI_COLOR_WHITE, TRUE); + get_x() + offsetX + m_rect.get_width() / 2, + get_y() + offsetY - m_rect.get_height(), + diablo2::UI_COLOR_WHITE, TRUE); diablo2::d2_win::draw_popup(); } @@ -152,4 +152,4 @@ void d2_tweaks::ui::controls::checkbox::left_mouse(int32_t offsetX, int32_t offs void d2_tweaks::ui::controls::checkbox::right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {} -void d2_tweaks::ui::controls::checkbox::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} +void d2_tweaks::ui::controls::checkbox::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} \ No newline at end of file diff --git a/src/d2tweaks/ui/controls/group.cpp b/src/d2tweaks/ui/controls/group.cpp index c73f28d..3c1194a 100644 --- a/src/d2tweaks/ui/controls/group.cpp +++ b/src/d2tweaks/ui/controls/group.cpp @@ -88,7 +88,7 @@ void d2_tweaks::ui::controls::group::right_mouse(int32_t offsetX, int32_t offset } void d2_tweaks::ui::controls::group::key_event(int32_t offsetX, int32_t offsetY, - uint32_t key, bool up, bool& block) { + uint32_t key, bool up, bool& block) { for (auto control : m_controls) { if (!control->get_enabled()) continue; @@ -105,4 +105,4 @@ void d2_tweaks::ui::controls::group::add_control(control* control) { return; get_menu()->add_control(control); -} +} \ No newline at end of file diff --git a/src/d2tweaks/ui/controls/image.cpp b/src/d2tweaks/ui/controls/image.cpp index 1b0f5da..0671885 100644 --- a/src/d2tweaks/ui/controls/image.cpp +++ b/src/d2tweaks/ui/controls/image.cpp @@ -92,4 +92,4 @@ void d2_tweaks::ui::controls::image::right_mouse(int32_t offsetX, int32_t offset block = m_rect.contains(diablo2::d2_client::get_mouse_x(), diablo2::d2_client::get_mouse_y(), offsetX, offsetY); } -void d2_tweaks::ui::controls::image::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} +void d2_tweaks::ui::controls::image::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} \ No newline at end of file diff --git a/src/d2tweaks/ui/controls/label.cpp b/src/d2tweaks/ui/controls/label.cpp index 6471928..bbf99d3 100644 --- a/src/d2tweaks/ui/controls/label.cpp +++ b/src/d2tweaks/ui/controls/label.cpp @@ -3,7 +3,7 @@ #include d2_tweaks::ui::controls::label::label(menu* menu, const std::wstring& text, int32_t x, int32_t y, diablo2::ui_color_t color, - diablo2::ui_font_t font) : control(menu, x, y, 0, 0) { + diablo2::ui_font_t font) : control(menu, x, y, 0, 0) { control::set_enabled(true); control::set_visible(true); @@ -97,4 +97,4 @@ void d2_tweaks::ui::controls::label::left_mouse(int32_t offsetX, int32_t offsetY void d2_tweaks::ui::controls::label::right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) {} -void d2_tweaks::ui::controls::label::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} +void d2_tweaks::ui::controls::label::key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) {} \ No newline at end of file diff --git a/src/d2tweaks/ui/menu.cpp b/src/d2tweaks/ui/menu.cpp index 114a415..2862555 100644 --- a/src/d2tweaks/ui/menu.cpp +++ b/src/d2tweaks/ui/menu.cpp @@ -70,7 +70,6 @@ bool d2_tweaks::ui::menu::load_xml(const char* path) { m_respos.push_back(temp); } - m_name = menuNode.node().attribute("name").as_string(); m_width = menuNode.node().attribute("width").as_int(-1); m_height = menuNode.node().attribute("height").as_int(-1); @@ -220,7 +219,6 @@ bool d2_tweaks::ui::menu::mouse_wheel(bool up) { return block; } - bool d2_tweaks::ui::menu::key_event(uint32_t key, bool up) { auto block = false; @@ -234,4 +232,4 @@ bool d2_tweaks::ui::menu::key_event(uint32_t key, bool up) { } return block; -} +} \ No newline at end of file diff --git a/src/d2tweaks/ui/ui_manager.cpp b/src/d2tweaks/ui/ui_manager.cpp index 94aff35..7145f7c 100644 --- a/src/d2tweaks/ui/ui_manager.cpp +++ b/src/d2tweaks/ui/ui_manager.cpp @@ -69,6 +69,8 @@ #include #include // Include for edit control +#include + #pragma pack(push, 1) using namespace std; @@ -220,7 +222,7 @@ diablo2::structures::unit unserialize_item(const std::string& hexString) { } // Create an item object - diablo2::structures::unit item; + diablo2::structures::unit item{}; // Convert the hexadecimal string to binary data for (size_t i = 0; i < hexString.size(); i += 2) { @@ -244,6 +246,38 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, block = true; // block the game from processing this key } + if (wParam == 'V') { + const auto player = diablo2::d2_client::get_local_player(); + int32_t st0Guid = 0; + uint32_t st0X = 0; + uint32_t st0Y = 0; + diablo2::structures::unit* box{}; + 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* st0Code = record->string_code; + if (strncmp(st0Code, "st0", 3) == 0) { + box = item; + st0Guid = box->guid; + st0X = player->path->mapx; + st0Y = player->path->mapy; + } + } + struct D2GSPacketClt20 { + uint8_t PacketId; // 0x01 + uint32_t guid; // 0x06 + uint32_t tx; // 0x07 + uint32_t ty; // 0x09 + }; + D2GSPacketClt20 packet; + packet.PacketId = 0x20; + packet.guid = st0Guid; + packet.tx = st0X; + packet.ty = st0Y; + diablo2::d2_client::send_to_server(&packet, sizeof packet); + m_stash_enabled = false; + block = true; + } + // Send item move packet + transmute packet for certain codes only for runes and gems if (wParam == 'G') { // Call the item_click function using the function pointer @@ -1607,7 +1641,6 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, || record->type == 53 - 3 ) { - // open the cube struct D2GSPacketClt20 { uint8_t PacketId; // 0x01 @@ -1655,7 +1688,6 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, } diablo2::d2_client::send_to_server(&packet, sizeof packet); diablo2::d2_client::send_to_server_7(0x4F, 0x18, 0, 0); - // now move the harvester back to the inv //static d2_tweaks::common::item_move_cs h1packet; @@ -1664,7 +1696,6 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, //diablo2::d2_client::send_to_server(&h1packet, sizeof h1packet); (*reinterpret_cast(diablo2::d2_client::get_base() + 0x1158F4)) = nullptr; - } } diff --git a/src/diablo2/d2client.cpp b/src/diablo2/d2client.cpp index 50d7e81..64d8ca0 100644 --- a/src/diablo2/d2client.cpp +++ b/src/diablo2/d2client.cpp @@ -17,7 +17,7 @@ bool diablo2::d2_client::is_lod() { } diablo2::structures::unit* diablo2::d2_client::get_local_player() { - static wrap_func_std get_local_player(0x883D0, get_base()); + static wrap_func_std get_local_player(0x883D0, get_base()); return get_local_player(); } @@ -56,7 +56,6 @@ uint32_t diablo2::d2_client::get_mouse_y() { return get_mouse_y(); } - bool diablo2::d2_client::get_ui_window_state(const ui_window_t window) { static auto ui_states = reinterpret_cast(get_base() + 0x11A6A8); return ui_states[window]; @@ -67,7 +66,6 @@ void* diablo2::d2_client::get_buysellbtn() { return get_buysellbtn(); } - void diablo2::d2_client::resync_vendor_inventory(structures::unit* ptNPC) { static wrap_func_fastresync_vendor_inventory(0x578E0, get_base()); resync_vendor_inventory(ptNPC); @@ -79,7 +77,7 @@ void diablo2::d2_client::play_sound(const uint32_t soundId, structures::unit* u, } diablo2::structures::unit* diablo2::d2_client::get_unit_by_guid(const int32_t guid, const int32_t type) { - static wrap_func_fast get_unit_by_guid(0x869F0, get_base()); + static wrap_func_fast get_unit_by_guid(0x869F0, get_base()); return get_unit_by_guid(guid, type); } @@ -89,17 +87,17 @@ void diablo2::d2_client::send_to_server(void* data, const size_t size) { } bool diablo2::d2_client::cache_gfx_data(structures::gfxdata* gfxData, structures::unit* unit, - structures::cellfile* cellfFile, int32_t direction, int32_t frame, int32_t* outIndex, int8_t flags, - int32_t colorTint) { + structures::cellfile* cellfFile, int32_t direction, int32_t frame, int32_t* outIndex, int8_t flags, + int32_t colorTint) { static wrap_func_fast cache_gfx_data(0xBEC80, get_base()); + structures::unit*, + structures::cellfile*, + int32_t, int32_t, int32_t*, int8_t, int32_t)> cache_gfx_data(0xBEC80, get_base()); return cache_gfx_data(gfxData, unit, cellfFile, direction, frame, outIndex, flags, colorTint); } diablo2::structures::cellfile* diablo2::d2_client::load_gfx_resource(char* path) { - static wrap_func_fast load_gfx_resource(0x1000, get_base()); + static wrap_func_fast load_gfx_resource(0x1000, get_base()); return load_gfx_resource(path, 0); } @@ -108,7 +106,6 @@ int32_t diablo2::d2_client::unload_gfx_resource(structures::cellfile* handle) { return unload_gfx_resource(handle); } - int32_t diablo2::d2_client::send_to_server_7(BYTE type, DWORD num, DWORD unk1, DWORD unk2) { static wrap_func_fast send_to_server_7(0xD9E0, get_base()); return send_to_server_7(type, num, unk1, unk2); @@ -141,11 +138,9 @@ bool diablo2::d2_client::is_gamble_open() { return *reinterpret_cast(get_base() + 0x115D7C); } - // 1 = talk // 3 = trade or gamble // 7 = imbue / add sockets / personalize uint8_t diablo2::d2_client::current_interact_menu() { return *reinterpret_cast(get_base() + 0x115C3B); -} - +} \ No newline at end of file diff --git a/src/diablo2/d2cmp.cpp b/src/diablo2/d2cmp.cpp index dfd1927..fc5de4c 100644 --- a/src/diablo2/d2cmp.cpp +++ b/src/diablo2/d2cmp.cpp @@ -12,4 +12,4 @@ char* diablo2::structures::d2_cmp::get_base() { bool diablo2::structures::d2_cmp::init_gfx_data(gfxdata* gfxdata) { static wrap_func_std_import init_gfx_data(10055, get_base()); return init_gfx_data(gfxdata, 0, 1) > 0; -} +} \ No newline at end of file diff --git a/src/diablo2/d2common.cpp b/src/diablo2/d2common.cpp index 0769f21..399c893 100644 --- a/src/diablo2/d2common.cpp +++ b/src/diablo2/d2common.cpp @@ -22,18 +22,16 @@ int32_t diablo2::d2_common::get_item_type_from_unit(structures::unit* item) { return get_item_type_from_unit(item); } - //__stdcall UNITS_GetPreviousInteractGUID(D2UnitStrc* pUnit) int32_t diablo2::d2_common::get_previous_interact_guid(structures::unit* player) { static wrap_func_std_import get_previous_interact_guid(10383, get_base()); return get_previous_interact_guid(player); } - //__stdcall INV_EmptyInventory(D2InventoryStrc* pInventory) // deletes items one by one void diablo2::d2_common::empty_inventory_1(structures::inventory* inv) { - static wrap_func_std_import empty_inventory_1(10279, get_base()); + static wrap_func_std_import empty_inventory_1(10279, get_base()); return empty_inventory_1(inv); } @@ -63,7 +61,6 @@ diablo2::structures::unit* diablo2::d2_common::get_next_inventory_item(structure return get_next_inventory_item(prev_item); } - int32_t diablo2::d2_common::get_inventory_index(structures::unit* item, char page, BOOL lod) { static wrap_func_std_import get_inventory_index(10409, get_base()); return get_inventory_index(item, page, lod); @@ -75,33 +72,30 @@ void* diablo2::d2_common::get_inventory_data(int32_t index, int32_t zero, char* } diablo2::structures::unit* diablo2::d2_common::get_item_at_cell(structures::inventory* inv, uint32_t cellx, - uint32_t celly, uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page) { - static wrap_func_std_import get_item_at_cell(10252, get_base()); + uint32_t celly, uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page) { + static wrap_func_std_import get_item_at_cell(10252, get_base()); return get_item_at_cell(inv, cellx, celly, pcellx, pcelly, invIndex, page); } uint32_t diablo2::d2_common::can_put_into_slot(structures::inventory* inv, structures::unit* item, uint32_t x, - uint32_t y, uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page) { + uint32_t y, uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page) { static wrap_func_std_import< uint32_t(structures::inventory*, structures::unit*, uint32_t, uint32_t, - uint32_t, structures::unit**, uint32_t*, uint8_t)> can_put_into_slot( - 10247, get_base()); + uint32_t, structures::unit**, uint32_t*, uint8_t)> can_put_into_slot( + 10247, get_base()); return can_put_into_slot(inv, item, x, y, invIndex, lastBlockingUnit, lastBlockingUnitIndex, page); } - uint32_t diablo2::d2_common::get_item_type(structures::unit* item) { static wrap_func_std_import< uint32_t(structures::unit*)>get_item_type(10751, get_base()); return get_item_type(item); } - uint32_t diablo2::d2_common::get_item_type_class(structures::unit* item) { static wrap_func_std_import< uint32_t(structures::unit*)>get_item_type_class(10739, get_base()); return get_item_type_class(item); } - uint32_t diablo2::d2_common::get_item_primary_weapon_class(structures::unit* item) { static wrap_func_std_import< uint32_t(structures::unit*)>get_item_type_class(10744, get_base()); return get_item_type_class(item); @@ -112,16 +106,15 @@ uint32_t diablo2::d2_common::set_unit_mode(structures::unit* item, uint32_t mode return set_unit_mode(item, mode); } - diablo2::structures::unit* diablo2::d2_common::inv_remove_item(structures::inventory* inventory, structures::unit* item) { - static wrap_func_std_import inv_remove_item(10243, get_base()); + static wrap_func_std_import inv_remove_item(10243, get_base()); return inv_remove_item(inventory, item); } BOOL diablo2::d2_common::inv_add_item(structures::inventory* inv, structures::unit* item, uint32_t x, uint32_t y, - uint32_t invIndex, BOOL isClient, uint8_t page) { + uint32_t invIndex, BOOL isClient, uint8_t page) { static wrap_func_std_import inv_add_item(10249, get_base()); + uint32_t, BOOL, uint8_t)> inv_add_item(10249, get_base()); return inv_add_item(inv, item, x, y, invIndex, isClient, page); } @@ -132,17 +125,17 @@ BOOL diablo2::d2_common::inv_update_item(structures::inventory* inv, structures: } diablo2::structures::items_line* diablo2::d2_common::get_item_record(uint32_t guid) { - static wrap_func_std_import get_item_record(10600, get_base()); + static wrap_func_std_import get_item_record(10600, get_base()); return get_item_record(guid); } diablo2::structures::item_types_line* diablo2::d2_common::get_item_type_record(uint32_t typeId) { - static wrap_func_fastget_item_type_record(0x2B1A0, get_base()); + static wrap_func_fastget_item_type_record(0x2B1A0, get_base()); return get_item_type_record(typeId); } uint32_t diablo2::d2_common::check_item_type_equiv(uint32_t itemtype, uint32_t itemtype_equiv) { - static wrap_func_std_importcheck_item_type_equiv(10730, get_base()); + static wrap_func_std_importcheck_item_type_equiv(10730, get_base()); return check_item_type_equiv(itemtype, itemtype_equiv); } @@ -182,7 +175,7 @@ int32_t diablo2::d2_common::_10116(int32_t x1, int32_t y1, int32_t* x, int32_t* } diablo2::structures::room* diablo2::d2_common::get_room_from_unit(structures::unit* unit) { - static wrap_func_std_import get_room_from_unit(10342, get_base()); + static wrap_func_std_import get_room_from_unit(10342, get_base()); return get_room_from_unit(unit); } @@ -227,12 +220,12 @@ int32_t diablo2::d2_common::get_item_quality(structures::unit* item) { } diablo2::structures::unit* diablo2::d2_common::get_target_from_path(structures::path* path) { - static wrap_func_std_import get_target_from_path(10180, get_base()); + static wrap_func_std_import get_target_from_path(10180, get_base()); return get_target_from_path(path); } void diablo2::d2_common::free_inventory(structures::inventory* inventory) { - static wrap_func_std_import free_inventory(10241, get_base()); + static wrap_func_std_import free_inventory(10241, get_base()); free_inventory(inventory); } @@ -241,7 +234,6 @@ void diablo2::d2_common::refresh_unit_inventory(structures::unit* unit, bool set refresh_unit_inventory(unit, set_update_flags); } - void diablo2::d2_common::update_trade(structures::inventory* inventory, structures::unit* item) { static wrap_func_std_import update_trade(10283, get_base()); update_trade(inventory, item); @@ -260,4 +252,9 @@ void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* pr void diablo2::d2_common::ITEMS_SetItemFlag(structures::unit* item, uint32_t dwFlag, BOOL bSet) { static wrap_func_std_import ITEMS_SetItemFlag(10708, get_base()); ITEMS_SetItemFlag(item, dwFlag, bSet); +} + +diablo2::structures::D2ItemStatCostTxt* diablo2::d2_common::get_item_stat_cost_record(int statId) { + static wrap_func_fast get_item_stat_cost_record(0x642b0, get_base()); + return get_item_stat_cost_record(statId); } \ No newline at end of file diff --git a/src/diablo2/d2game.cpp b/src/diablo2/d2game.cpp index 8e1f8f0..391f992 100644 --- a/src/diablo2/d2game.cpp +++ b/src/diablo2/d2game.cpp @@ -3,7 +3,6 @@ #include #include - char* diablo2::d2_game::get_base() { static auto base = reinterpret_cast(GetModuleHandle("d2game.dll")); return base; @@ -14,13 +13,13 @@ void diablo2::d2_game::enqueue_packet(structures::net_client* client, void* pack enqueue_packet(client, packet, size); } -diablo2::structures::npc_record* diablo2::d2_game::get_npc_record(structures::game* game, structures::unit* npc, structures::unit **ptnpc) { +diablo2::structures::npc_record* diablo2::d2_game::get_npc_record(structures::game* game, structures::unit* npc, structures::unit** ptnpc) { static wrap_func_fastget_npc_record(0x9B910, get_base()); return get_npc_record(game, npc, ptnpc); } void diablo2::d2_game::free_gamble(structures::game* game, structures::unit* player, structures::unit* npc, structures::npc_record* npcrecord) { - static wrap_func_fastfree_gamble(0x9D190, get_base()); + static wrap_func_fastfree_gamble(0x9D190, get_base()); free_gamble(game, player, npc, npcrecord); } @@ -40,18 +39,18 @@ void diablo2::d2_game::create_vendor_cache2(structures::game* game, structures:: } diablo2::structures::unit* diablo2::d2_game::get_server_unit(structures::game* game, structures::unit_type_t type, uint32_t uniqueid) { - static wrap_func_fastget_server_unit(0x8BB00, get_base()); + static wrap_func_fastget_server_unit(0x8BB00, get_base()); return get_server_unit(game, type, uniqueid); } diablo2::structures::game* diablo2::d2_game::get_game_from_client_id(int32_t id) { - static wrap_func_fast get_game_from_client_id(0x94E0, get_base()); + static wrap_func_fast get_game_from_client_id(0x94E0, get_base()); return get_game_from_client_id(id); } // __fastcall D2CLIENTS_GetClientByClientNumber(pGame, int nNumber) diablo2::structures::net_client* diablo2::d2_game::get_net_client_from_id(structures::game* game, int32_t id) { - static wrap_func_fastget_net_client_from_id(0x1DE0, get_base()); + static wrap_func_fastget_net_client_from_id(0x1DE0, get_base()); return get_net_client_from_id(game, id); } @@ -61,8 +60,8 @@ diablo2::structures::net_client* diablo2::d2_game::get_net_client_from_id_2(stru } diablo2::structures::unit* diablo2::d2_game::get_player_pet(structures::game* game, structures::unit* unit, - uint32_t type, uint32_t index) { - static wrap_func_fastget_player_pet(0x4E8B0, get_base()); + uint32_t type, uint32_t index) { + static wrap_func_fastget_player_pet(0x4E8B0, get_base()); return get_player_pet(game, unit, type, index); } @@ -105,37 +104,35 @@ static diablo2::structures::game* (__thiscall* g_get_game)(diablo2::structures:: = decltype(g_get_game)(0xB6A0 + diablo2::d2_game::get_base()); diablo2::structures::game* diablo2::d2_game::get_game(structures::game_server* gs, uint32_t gameId) { - static wrap_func_std get_game(0xB6A0, get_base()); + static wrap_func_std get_game(0xB6A0, get_base()); return g_get_game(gs, gameId, reinterpret_cast(gs) + 0x44); } diablo2::structures::unit* diablo2::d2_game::get_unit_owner(structures::game* game, structures::unit* unit) { - static wrap_func_fast get_unit_owner(0x8BB70, get_base()); + static wrap_func_fast get_unit_owner(0x8BB70, get_base()); return get_unit_owner(game, unit); } static void __fastcall unit_pet_iterator(diablo2::structures::game* game, diablo2::structures::unit* owner, - diablo2::structures::unit* unit, void* arg) { + diablo2::structures::unit* unit, void* arg) { const std::function* cb = reinterpret_cast(arg); cb->operator()(game, owner, unit); } void* diablo2::d2_game::iterate_unit_pets(structures::game* game, structures::unit* unit, - const std::function& cb) { + const std::function& cb) { static wrap_func_fast iterate_unit_pets(0x4E7C0, get_base()); + void(__fastcall*)(structures::game*, structures::unit*, diablo2::structures::unit*, void*), void*)> iterate_unit_pets(0x4E7C0, get_base()); const auto cbref = &cb; // ReSharper disable once CppCStyleCast return iterate_unit_pets(game, unit, unit_pet_iterator, (void*)cbref); } - uint32_t __fastcall diablo2::d2_game::transmogrify(diablo2::structures::game* game, diablo2::structures::unit* player) { static wrap_func_fasttransmogrify(0x62130, get_base()); return transmogrify(game, player); } - // d2game:$0x60010 -// int __fastcall CRAFT_Transmogrify(D2GameStrc* pGame, D2UnitStrc* pPlayer, D2CubemainTXT* pCubeTxt, void* pUnknown) +// int __fastcall CRAFT_Transmogrify(D2GameStrc* pGame, D2UnitStrc* pPlayer, D2CubemainTXT* pCubeTxt, void* pUnknown) \ No newline at end of file diff --git a/src/diablo2/d2gfx.cpp b/src/diablo2/d2gfx.cpp index 2a82f66..ed9323d 100644 --- a/src/diablo2/d2gfx.cpp +++ b/src/diablo2/d2gfx.cpp @@ -27,14 +27,13 @@ int32_t diablo2::d2_gfx::get_resolution_mode() { } void diablo2::d2_gfx::draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma, - int32_t drawType, void* palette) { + int32_t drawType, void* palette) { static wrap_func_std_import draw_image(10072, get_base()); + int32_t, int32_t, void*)> draw_image(10072, get_base()); draw_image(data, x, y, gamma, drawType, palette); } - -void diablo2::d2_gfx::draw_filled_rect(int left , int top, int right, int bottom, DWORD color, int transTbl) { +void diablo2::d2_gfx::draw_filled_rect(int left, int top, int right, int bottom, DWORD color, int transTbl) { static wrap_func_std_import draw_boxed_text(10056, get_base()); draw_boxed_text(left, top, right, bottom, color, transTbl); } \ No newline at end of file diff --git a/src/diablo2/d2launch.cpp b/src/diablo2/d2launch.cpp index e062fb2..2eb78b8 100644 --- a/src/diablo2/d2launch.cpp +++ b/src/diablo2/d2launch.cpp @@ -5,4 +5,4 @@ char* diablo2::d2_launch::get_base() { static char* base = reinterpret_cast(GetModuleHandle("d2launch.dll")); return base; -} +} \ No newline at end of file diff --git a/src/diablo2/d2net.cpp b/src/diablo2/d2net.cpp index ca15bbe..193f089 100644 --- a/src/diablo2/d2net.cpp +++ b/src/diablo2/d2net.cpp @@ -14,5 +14,4 @@ int32_t diablo2::d2_net::send_to_server(int32_t queue, void* data, size_t size) int32_t diablo2::d2_net::send_to_client(int32_t queue, int32_t clientId, void* packet, size_t size) { static wrap_func_std_import send_to_client(10006, get_base()); return send_to_client(queue, clientId, packet, size); -} - +} \ No newline at end of file diff --git a/src/diablo2/d2win.cpp b/src/diablo2/d2win.cpp index 56bfc9d..29ddc4c 100644 --- a/src/diablo2/d2win.cpp +++ b/src/diablo2/d2win.cpp @@ -17,7 +17,7 @@ void diablo2::d2_win::draw_text(wchar_t* str, uint32_t x, uint32_t y, ui_color_t } void diablo2::d2_win::draw_boxed_text(wchar_t* str, uint32_t x, uint32_t y, int32_t paletteIndex, int32_t transTbl, - ui_color_t color) { + ui_color_t color) { static wrap_func_fast_import draw_boxed_text(10132, get_base()); draw_boxed_text(str, x, y, paletteIndex, transTbl, color); } @@ -60,4 +60,4 @@ void* diablo2::d2_win::load_mpq(char* dllName, char* mpqName, char* mpqTitle, in bool diablo2::d2_win::unload_mpq(void* mpq) { static wrap_func_fast unload_mpq(0x012548, get_base()); return unload_mpq(mpq); -} +} \ No newline at end of file diff --git a/src/diablo2/fog.cpp b/src/diablo2/fog.cpp index f9c5bab..b865d54 100644 --- a/src/diablo2/fog.cpp +++ b/src/diablo2/fog.cpp @@ -29,4 +29,4 @@ bool diablo2::fog::mpq_read_file(structures::file_handle* handle, void* buffer, size_t diablo2::fog::mpq_get_file_size(structures::file_handle* handle, size_t* compressedSize) { static wrap_func_fast_import mpq_get_file_size(10105, get_base()); return mpq_get_file_size(handle, compressedSize); -} +} \ No newline at end of file diff --git a/src/diablo2/storm.cpp b/src/diablo2/storm.cpp index f9929c9..00a507d 100644 --- a/src/diablo2/storm.cpp +++ b/src/diablo2/storm.cpp @@ -5,4 +5,4 @@ char* diablo2::storm::get_base() { static auto base = reinterpret_cast(GetModuleHandle("storm.dll")); return base; -} +} \ No newline at end of file diff --git a/src/diablo2/utils/mpq_ifstream.cpp b/src/diablo2/utils/mpq_ifstream.cpp index 6539b1a..4c3b433 100644 --- a/src/diablo2/utils/mpq_ifstream.cpp +++ b/src/diablo2/utils/mpq_ifstream.cpp @@ -14,7 +14,7 @@ diablo2::utils::mpq_ifstream::mpq_streambuf::~mpq_streambuf() { std::basic_streambuf::int_type diablo2::utils::mpq_ifstream::mpq_streambuf::underflow() { if (!m_handle) return EOF; - + if (!fog::mpq_read_file(m_handle, &m_data, 1, nullptr)) return EOF; @@ -24,5 +24,4 @@ std::basic_streambuf::int_type diablo2::utils::mpq_ifstream::mpq_streambuf } diablo2::utils::mpq_ifstream::mpq_ifstream(const std::string& path) : std::istream(&m_streambuf), m_streambuf(path) { - -} +} \ No newline at end of file diff --git a/src/diablo2/utils/screen.cpp b/src/diablo2/utils/screen.cpp index 7ec8ebb..fbe0fef 100644 --- a/src/diablo2/utils/screen.cpp +++ b/src/diablo2/utils/screen.cpp @@ -24,4 +24,4 @@ void diablo2::utils::screen::world_to_screen(int32_t wx, int32_t wy, int32_t& sx sx = x - d2_client::get_view_offset_x(); sy = y - d2_client::get_view_offset_y(); -} +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 48b90a4..434efae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,6 @@ //#pragma comment(lib, "vcruntime.lib") #pragma comment(lib, "mincore_downlevel.lib") - void init_log() { const auto console_err = std::make_shared(); const auto logPath = "d2tweaks.log"; @@ -39,7 +38,6 @@ void init_log() { spdlog::info("Log system initialized"); } - void initialize(uint32_t param) { #ifndef NDEBUG AllocConsole(); @@ -80,34 +78,34 @@ void initialize(uint32_t param) { HANDLE g_hThread = 0; // ReSharper disable once CppInconsistentNaming BOOL APIENTRY DllMain(HMODULE moduleHandle, - DWORD reason, - LPVOID reserved) { + DWORD reason, + LPVOID reserved) { // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement switch (reason) { - case DLL_PROCESS_ATTACH: - { - //dllnotify::DllNotify::Init_Dllnotify(); - DisableThreadLibraryCalls(moduleHandle); - initialize(0); - break; - } + case DLL_PROCESS_ATTACH: + { + //dllnotify::DllNotify::Init_Dllnotify(); + DisableThreadLibraryCalls(moduleHandle); + initialize(0); + break; + } - case DLL_PROCESS_DETACH: - { - if (g_hThread != NULL) { - #ifndef NDEBUG - FreeConsole(); - #endif - CloseHandle(g_hThread); - MH_Uninitialize(); - //dllnotify::DllNotify::Uninit_Dllnotify(); - } - break; + case DLL_PROCESS_DETACH: + { + if (g_hThread != NULL) { +#ifndef NDEBUG + FreeConsole(); +#endif + CloseHandle(g_hThread); + MH_Uninitialize(); + //dllnotify::DllNotify::Uninit_Dllnotify(); } - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - default: - break; + break; + } + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + default: + break; } return true; -} +} \ No newline at end of file diff --git a/vendor/D2Template/D2Template.h b/vendor/D2Template/D2Template.h index a171acb..81ab278 100644 --- a/vendor/D2Template/D2Template.h +++ b/vendor/D2Template/D2Template.h @@ -60,51 +60,50 @@ extern DWORD DLLBASE_SGD2FREERES; struct DLLBaseStrc { - char* szName; - DWORD dwAddress; + char* szName; + DWORD dwAddress; }; struct DLLPatchStrc { - int nDLL; - DWORD dwAddress; - DWORD dwData; - BOOL bRelative; - size_t nPatchSize; + int nDLL; + DWORD dwAddress; + DWORD dwData; + BOOL bRelative; + size_t nPatchSize; }; enum D2TEMPLATE_DLL_FILES { - D2DLL_BINKW32, - D2DLL_BNCLIENT, - D2DLL_D2CLIENT, - D2DLL_D2CMP, - D2DLL_D2COMMON, - D2DLL_D2DDRAW, - D2DLL_D2DIRECT3D, - D2DLL_D2GAME, - D2DLL_D2GDI, - D2DLL_D2GFX, - D2DLL_D2GLIDE, - D2DLL_D2LANG, - D2DLL_D2LAUNCH, - D2DLL_D2MCPCLIENT, - D2DLL_D2MULTI, - D2DLL_D2NET, - D2DLL_D2SOUND, - D2DLL_D2WIN, - D2DLL_FOG, - D2DLL_IJL11, - D2DLL_SMACKW32, - D2DLL_STORM, + D2DLL_BINKW32, + D2DLL_BNCLIENT, + D2DLL_D2CLIENT, + D2DLL_D2CMP, + D2DLL_D2COMMON, + D2DLL_D2DDRAW, + D2DLL_D2DIRECT3D, + D2DLL_D2GAME, + D2DLL_D2GDI, + D2DLL_D2GFX, + D2DLL_D2GLIDE, + D2DLL_D2LANG, + D2DLL_D2LAUNCH, + D2DLL_D2MCPCLIENT, + D2DLL_D2MULTI, + D2DLL_D2NET, + D2DLL_D2SOUND, + D2DLL_D2WIN, + D2DLL_FOG, + D2DLL_IJL11, + D2DLL_SMACKW32, + D2DLL_STORM, D2DLL_UTILITY, D2DLL_PLUGY, D2DLL_D2EXPRES, D2DLL_SGD2FREERES, - D2DLL_INVALID + D2DLL_INVALID }; - static DLLBaseStrc gptDllFiles[] = { {"Binkw32.dll", NULL}, diff --git a/vendor/D2Template/D2TemplateConstants.h b/vendor/D2Template/D2TemplateConstants.h index 4ea42ab..dcbedfb 100644 --- a/vendor/D2Template/D2TemplateConstants.h +++ b/vendor/D2Template/D2TemplateConstants.h @@ -745,8 +745,8 @@ // LNG_POR,// Portuguese // LNG_ITA,// Italian // LNG_JPN,// Japanese -// LNG_KOR,// Korean -// LNG_SIN,// +// LNG_KOR,// Korean +// LNG_SIN,// // LNG_CHI,// Chinese // LNG_POL,// Polish // LNG_RUS,// Russian @@ -1138,7 +1138,7 @@ // DEXTERITY, // VITALITY, // ENERGY, -// MAXMANA, +// MAXMANA, // MAXMANA_PERCENT, // MAXHP, // MAXHP_PERCENT, diff --git a/vendor/D2Template/D2TemplateDataTables.h b/vendor/D2Template/D2TemplateDataTables.h index 71f0457..7ab7670 100644 --- a/vendor/D2Template/D2TemplateDataTables.h +++ b/vendor/D2Template/D2TemplateDataTables.h @@ -48,7 +48,7 @@ struct D2MonstatsTXT; struct D2MonstatsTXT { - //... + //... }; // end of file -------------------------------------------------------------- diff --git a/vendor/D2Template/D2TemplatePacketDef.h b/vendor/D2Template/D2TemplatePacketDef.h index eed0852..f06fc66 100644 --- a/vendor/D2Template/D2TemplatePacketDef.h +++ b/vendor/D2Template/D2TemplatePacketDef.h @@ -21,7 +21,7 @@ struct D2GSPacketSrv03; struct D2GSPacketClt01 { - //... + //... }; // end of file -------------------------------------------------------------- diff --git a/vendor/D2Template/D2TemplatePtrs.h b/vendor/D2Template/D2TemplatePtrs.h index 6d449e9..8b1ccbf 100644 --- a/vendor/D2Template/D2TemplatePtrs.h +++ b/vendor/D2Template/D2TemplatePtrs.h @@ -20,7 +20,7 @@ #define D2FUNC(DLL, NAME, RETURN, CONV, ARGS, OFFSET) typedef RETURN (CONV##* DLL##_##NAME##_t) ARGS; static DLL##_##NAME##_t DLL##_##NAME = (OFFSET < 0) ? ((DLL##_##NAME##_t)GetProcAddress((HMODULE)DLLBASE_##DLL, (LPCSTR)-(OFFSET))) : (DLL##_##NAME##_t)(DLLBASE_##DLL + OFFSET); /// #define D2VAR(DLL, NAME, TYPE, OFFSET) typedef TYPE DLL##_##NAME##_vt; static DLL##_##NAME##_vt * DLL##_##NAME = (DLL##_##NAME##_vt *)(DLLBASE_##DLL + OFFSET); /// -#define D2PTR(DLL, NAME, OFFSET) static DWORD NAME = (DLLBASE_##DLL + OFFSET); +#define D2PTR(DLL, NAME, OFFSET) static DWORD NAME = (DLLBASE_##DLL + OFFSET); extern DWORD __fastcall GetDllOffset(char* ModuleName, DWORD BaseAddress, int Offset); /// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -149,9 +149,9 @@ extern DWORD __fastcall GetDllOffset(char* ModuleName, DWORD BaseAddress, int Of //extern s_shifting shifting; // ////#ifdef MSVC -//#define FASTCALL __fastcall +//#define FASTCALL __fastcall ////#else -////#define FASTCALL __msfastcall +////#define FASTCALL __msfastcall ////#endif //#define STDCALL __stdcall //#define FCT_ASM(N) __declspec(naked) void N() {__asm{ @@ -216,7 +216,7 @@ extern DWORD __fastcall GetDllOffset(char* ModuleName, DWORD BaseAddress, int Of ////6FAECD28 | 53 | push ebx | ebx == 0 ////6FAECD29 | 53 | push ebx | ebx == 0 ////6FAECD2A | BA 18000000 | mov edx, 18 | -////6FAECD2F | B1 4F | mov cl, 4F | +////6FAECD2F | B1 4F | mov cl, 4F | ////6FAECD31 | 891D 505BBB6F | mov dword ptr ds:[6FBB5B50], ebx | ebx == 0 ////6FAECD37 | E8 A40CFCFF | call d2client.6FAAD9E0 | //D2FUNC(D2CLIENT, SendToServer7, void, __fastcall, (BYTE type, DWORD num, DWORD unk1, DWORD unk2), 0xD9E0) @@ -296,7 +296,7 @@ extern DWORD __fastcall GetDllOffset(char* ModuleName, DWORD BaseAddress, int Of //// 6FACBAF0 | A1 E419BB6F | mov eax, dword ptr ds:[D2Client.6FBB19E4] // 1.10 // ////020D90 6F620D90 10010 DRLG_GetLevelDefsRecord int nLevelNo -////Unique fastcall (int nLevelNo) __fastcall DRLG_GetLevelDefsRecord(int nLevelNo) +////Unique fastcall (int nLevelNo) __fastcall DRLG_GetLevelDefsRecord(int nLevelNo) ////6F620D90 DRLG_GetLevelDefsRecord 6F620D90 __fastcall DRLG_GetLevelDefsRecord(int nLevelNo) // ////6FAC5884 $+0x25884 | E8 C3910900 | call // 1.09 InitAutomapLayer @@ -326,7 +326,7 @@ extern DWORD __fastcall GetDllOffset(char* ModuleName, DWORD BaseAddress, int Of //#define D2FUNCPTR(DLL,NAME,t1,t2,OFFSET) typedef t1 DLL##_##NAME##_t t2; DLL##_##NAME##_t *DLL##_##NAME = (DLL##_##NAME##_t *)GetDllOffset(#DLL, DLLBASE_##DLL, OFFSET); //#define D2VARPTR(DLL,NAME,t1,OFFSET) typedef t1 DLL##_##NAME##_t; DLL##_##NAME##_t *p_##DLL##_##NAME = (DLL##_##NAME##_t *)GetDllOffset(#DLL, DLLBASE_##DLL, OFFSET); ////#define D2ASMPTR(d1,v1,o1) DWORD d1##_##v1 = DLLOFFSET(d1,o1); -////#define D2PTR(DLL, NAME, OFFSET) DWORD NAME __attribute__((weak)) = GetDllOffset(#DLL, DLLBASE_##DLL, OFFSET); +////#define D2PTR(DLL, NAME, OFFSET) DWORD NAME __attribute__((weak)) = GetDllOffset(#DLL, DLLBASE_##DLL, OFFSET); ////D2VAR(D2CLIENT, pDrlgAct, DrlgAct *, 0x6FBB0BE4) ////D2VAR(D2CLIENT, pPlayerUnit, UnitAny *, 0x6FBC63F8) //// diff --git a/vendor/D2Template/D2TemplateStructs.h b/vendor/D2Template/D2TemplateStructs.h index 87de31e..09d6ab6 100644 --- a/vendor/D2Template/D2TemplateStructs.h +++ b/vendor/D2Template/D2TemplateStructs.h @@ -1337,7 +1337,7 @@ // DWORD dwMainIndex; //0x18 // DWORD dwSubIndex; //0x1C // DWORD dwFrame; //0x20 -// BYTE _1a; //0x24 DT1's unknown_a ... +// BYTE _1a; //0x24 DT1's unknown_a ... // BYTE _1c; //0x25 // BYTE _1b; //0x26 // BYTE _1d; //0x27 @@ -1347,7 +1347,7 @@ // DWORD _18; //0x44 // DWORD dwDataPtr; //0x48 pointer to sub-block headers // DWORD dwSize; //0x4C length of the sub-blocks -// DWORD dwSubBlocks; //0x50 +// DWORD dwSubBlocks; //0x50 // DT1SubBlock* pBlocks; //0x54 // char* szTileName; //0x58 // DWORD **ptBlock; //0x5C @@ -3209,7 +3209,7 @@ // // UnitAny *pTargetUnit; //+58 // //} *pPos; // +2c // DWORD _2b[11]; -// StatsList * ptStatsList; // 0x5C +// StatsList * ptStatsList; // 0x5C // UnitInventory *pInventory; //+60 // DWORD _4b[12]; // DWORD nOwnerType; // +94 @@ -3382,17 +3382,17 @@ // char szAccountName[0x30]; // char szCharName[0x18]; // char szRealmName[0x18]; -// BYTE _2[0x102];//+E8 -// //BYTE nGameMode; //+1EA +// BYTE _2[0x102];//+E8 +// //BYTE nGameMode; //+1EA // struct // { // BYTE nCharStat:2; // BYTE nHardcore:2; // BYTE _unk1:1; // BYTE nExpansion:1; -// BYTE nLadder:2; -// };//+1EA -// BYTE nReadyAct; //+1EB quest info +// BYTE nLadder:2; +// };//+1EA +// BYTE nReadyAct; //+1EB quest info // BYTE _3[0x3B]; // char szServerVersion[24];//227 battle net gameversion // char szGamePassword[0x18];//+23F @@ -3453,16 +3453,16 @@ // // // -////struct Stats { -//// WORD Param; -//// WORD StatID; -//// DWORD Value; -////}; +////struct Stats { +//// WORD Param; +//// WORD StatID; +//// DWORD Value; +////}; // //struct StatsInfo { -// Stats *pStats; // pointer to an array of Stats structs. -// WORD nUsed; // how many Stats in array -// WORD nSize; // size allocated in Stats +// Stats *pStats; // pointer to an array of Stats structs. +// WORD nUsed; // how many Stats in array +// WORD nSize; // size allocated in Stats //}; // //struct StatsList { @@ -3474,11 +3474,11 @@ // DWORD _4; // 0x38 // StatsList *pNext; // 0x3C // -// StatsList *pSetList; // +40 +// StatsList *pSetList; // +40 // DWORD _5; -// StatsInfo sStats1; // +48 -// StatsInfo sStats2; // +50 unused ??? -// DWORD *ptStateFlags; //+58 - get with 10487(ptUnit,id) return ptUnit->ptStatsList->ptStateFlags[id/32]&(1<<(id%31)) +// StatsInfo sStats1; // +48 +// StatsInfo sStats2; // +50 unused ??? +// DWORD *ptStateFlags; //+58 - get with 10487(ptUnit,id) return ptUnit->ptStatsList->ptStateFlags[id/32]&(1<<(id%31)) //}; // //// end of file -------------------------------------------------------------- @@ -3761,7 +3761,7 @@ //// uint8_t uk4[0x08]; //+54 //// stats* stats; //+5C //// uint8_t pad1[0x24]; -//// inventory* inventory; //+84 //+60 +//// inventory* inventory; //+84 //+60 //// uint8_t uk5[0x1C]; //+64 //// game* game; //+80 //// uint8_t uk6[0x24]; //+84 @@ -3892,9 +3892,9 @@ ////ITEMFLAG_FROMPLAYER = 0x01000000, ////ITEMFLAG_RUNEuint16_t = 0x04000000 ////*/ -//// uint32_t guid1; //+1C Global Unique ID 1 -//// uint32_t guid2; //+20 Global Unique ID 2 -//// uint32_t guid3; //+24 Global Unique ID 3 +//// uint32_t guid1; //+1C Global Unique ID 1 +//// uint32_t guid2; //+20 Global Unique ID 2 +//// uint32_t guid3; //+24 Global Unique ID 3 //// uint32_t unique_id; //+28 //// uint8_t ilvl; //+2C //// uint8_t uk1[0x03]; //+2D @@ -3931,7 +3931,7 @@ //// uint8_t item_data3; //+47 //D2Common10854 D2Common10853 //// uint8_t p_ear_level; //+48 //// uint8_t var_gfx; //+49 -//// char i_name[0x12]; //+4A //inscribed/ear name +//// char i_name[0x12]; //+4A //inscribed/ear name //// inventory* inventory; //+5C //// unit* pt_prev_item; //+60 //// unit* pt_next_item; //+64 @@ -3973,18 +3973,18 @@ //}; // //struct player_data { -// char name[0x10]; //+00 Player Name -// void* pt_quest[3]; //+10 Quest Pointers for each difficulty +// char name[0x10]; //+00 Player Name +// void* pt_quest[3]; //+10 Quest Pointers for each difficulty // uint8_t uk1[0x18]; //+1C //before : 0x14 -// void* pt_arena_unit; //+34 ptArena for the Unit +// void* pt_arena_unit; //+34 ptArena for the Unit // uint8_t uk2[0x4]; //+38 //before : 0x7 -// uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID +// uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID // uint8_t uk3[0x2]; //+3E -// uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID -// uint8_t uk4[0x06]; //+42 -// uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals -// uint8_t uk5[0x94B];//uk5[0x53]; //+49 -// net_client* net_client; //+9C ptClient +// uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID +// uint8_t uk4[0x06]; //+42 +// uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals +// uint8_t uk5[0x94B];//uk5[0x53]; //+49 +// net_client* net_client; //+9C ptClient //}; // //struct position { diff --git a/vendor/DllNotify/DllNotify.cpp b/vendor/DllNotify/DllNotify.cpp index ba19fff..78d1f36 100644 --- a/vendor/DllNotify/DllNotify.cpp +++ b/vendor/DllNotify/DllNotify.cpp @@ -3,7 +3,7 @@ using namespace dllnotify; -DllNotify::DllNotify() +DllNotify::DllNotify() { } @@ -65,7 +65,6 @@ BOOL DllNotify::Init_Dllnotify() return status == 0; } - BOOL DllNotify::Uninit_Dllnotify() { NTSTATUS status = 1; @@ -77,4 +76,4 @@ BOOL DllNotify::Uninit_Dllnotify() } return status == 0; -} +} \ No newline at end of file diff --git a/vendor/DllNotify/DllNotify.h b/vendor/DllNotify/DllNotify.h index 1846bfc..6348784 100644 --- a/vendor/DllNotify/DllNotify.h +++ b/vendor/DllNotify/DllNotify.h @@ -13,7 +13,7 @@ namespace dllnotify public: DllNotify(); virtual ~DllNotify() noexcept {} - + typedef const UNICODE_STRING* PCUNICODE_STRING; typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA { @@ -52,7 +52,6 @@ namespace dllnotify _Out_ PVOID* Cookie ); - typedef NTSTATUS(NTAPI* PLDR_UNREGISTER_DLL_NOTIFICATION)( _In_ PVOID Cookie ); @@ -62,7 +61,6 @@ namespace dllnotify static bool is_d2expres(); static bool is_sgd2freeres(); - private: static VOID CALLBACK LdrDllNotification( _In_ ULONG NotificationReason, diff --git a/vendor/minhook/include/MinHook.h b/vendor/minhook/include/MinHook.h index b02faaf..c0e4f8b 100644 --- a/vendor/minhook/include/MinHook.h +++ b/vendor/minhook/include/MinHook.h @@ -29,12 +29,12 @@ #pragma once #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) - #error MinHook supports only x86 and x64 systems. +#error MinHook supports only x86 and x64 systems. #endif #include -// MinHook Error Codes. + // MinHook Error Codes. typedef enum MH_STATUS { // Unknown error. Should not be returned. @@ -108,7 +108,7 @@ extern "C" { // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. - MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); + MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID* ppOriginal); // Creates a Hook for the specified API function, in disabled state. // Parameters: @@ -122,7 +122,7 @@ extern "C" { // used to call the original target function. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHookApi( - LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID* ppOriginal); // Creates a Hook for the specified API function, in disabled state. // Parameters: @@ -139,7 +139,7 @@ extern "C" { // with other functions. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHookApiEx( - LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID* ppOriginal, LPVOID* ppTarget); // Removes an already created hook. // Parameters: @@ -178,9 +178,8 @@ extern "C" { MH_STATUS WINAPI MH_ApplyQueued(VOID); // Translates the MH_STATUS to its get_name as a string. - const char * WINAPI MH_StatusToString(MH_STATUS status); + const char* WINAPI MH_StatusToString(MH_STATUS status); #ifdef __cplusplus } #endif - diff --git a/vendor/minhook/src/buffer.c b/vendor/minhook/src/buffer.c index 8f9fbce..61f56e4 100644 --- a/vendor/minhook/src/buffer.c +++ b/vendor/minhook/src/buffer.c @@ -29,7 +29,7 @@ #include #include "buffer.h" -// Size of each memory block. (= page size of VirtualAlloc) + // Size of each memory block. (= page size of VirtualAlloc) #define MEMORY_BLOCK_SIZE 0x1000 // Max range for seeking a memory block. (= 1024MB) @@ -44,18 +44,18 @@ typedef struct _MEMORY_SLOT { union { - struct _MEMORY_SLOT *pNext; + struct _MEMORY_SLOT* pNext; UINT8 buffer[MEMORY_SLOT_SIZE]; }; -} MEMORY_SLOT, *PMEMORY_SLOT; +} MEMORY_SLOT, * PMEMORY_SLOT; // Memory block info. Placed at the head of each block. typedef struct _MEMORY_BLOCK { - struct _MEMORY_BLOCK *pNext; + struct _MEMORY_BLOCK* pNext; PMEMORY_SLOT pFree; // First element of the free slot list. UINT usedCount; -} MEMORY_BLOCK, *PMEMORY_BLOCK; +} MEMORY_BLOCK, * PMEMORY_BLOCK; //------------------------------------------------------------------------- // Global Variables: diff --git a/vendor/minhook/src/buffer.h b/vendor/minhook/src/buffer.h index 204d551..4b74563 100644 --- a/vendor/minhook/src/buffer.h +++ b/vendor/minhook/src/buffer.h @@ -28,11 +28,11 @@ #pragma once -// Size of each memory slot. + // Size of each memory slot. #if defined(_M_X64) || defined(__x86_64__) - #define MEMORY_SLOT_SIZE 64 +#define MEMORY_SLOT_SIZE 64 #else - #define MEMORY_SLOT_SIZE 32 +#define MEMORY_SLOT_SIZE 32 #endif VOID InitializeBuffer(VOID); diff --git a/vendor/minhook/src/hde/hde32.c b/vendor/minhook/src/hde/hde32.c index 08fa25b..544d03c 100644 --- a/vendor/minhook/src/hde/hde32.c +++ b/vendor/minhook/src/hde/hde32.c @@ -10,10 +10,10 @@ #include "hde32.h" #include "table32.h" -unsigned int hde32_disasm(const void *code, hde32s *hs) +unsigned int hde32_disasm(const void* code, hde32s* hs) { - uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0; - uint8_t *ht = hde32_table, m_mod, m_reg, m_rm, disp_size = 0; + uint8_t x, c, * p = (uint8_t*)code, cflags, opcode, pref = 0; + uint8_t* ht = hde32_table, m_mod, m_reg, m_rm, disp_size = 0; // Avoid using memset to reduce the footprint. #ifndef _MSC_VER @@ -24,35 +24,35 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) for (x = 16; x; x--) switch (c = *p++) { - case 0xf3: - hs->p_rep = c; - pref |= PRE_F3; - break; - case 0xf2: - hs->p_rep = c; - pref |= PRE_F2; - break; - case 0xf0: - hs->p_lock = c; - pref |= PRE_LOCK; - break; - case 0x26: case 0x2e: case 0x36: - case 0x3e: case 0x64: case 0x65: - hs->p_seg = c; - pref |= PRE_SEG; - break; - case 0x66: - hs->p_66 = c; - pref |= PRE_66; - break; - case 0x67: - hs->p_67 = c; - pref |= PRE_67; - break; - default: - goto pref_done; + case 0xf3: + hs->p_rep = c; + pref |= PRE_F3; + break; + case 0xf2: + hs->p_rep = c; + pref |= PRE_F2; + break; + case 0xf0: + hs->p_lock = c; + pref |= PRE_LOCK; + break; + case 0x26: case 0x2e: case 0x36: + case 0x3e: case 0x64: case 0x65: + hs->p_seg = c; + pref |= PRE_SEG; + break; + case 0x66: + hs->p_66 = c; + pref |= PRE_66; + break; + case 0x67: + hs->p_67 = c; + pref |= PRE_67; + break; + default: + goto pref_done; } - pref_done: +pref_done: hs->flags = (uint32_t)pref << 23; @@ -62,7 +62,8 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) if ((hs->opcode = c) == 0x0f) { hs->opcode2 = c = *p++; ht += DELTA_OPCODES; - } else if (c >= 0xa0 && c <= 0xa3) { + } + else if (c >= 0xa0 && c <= 0xa3) { if (pref & PRE_67) pref |= PRE_66; else @@ -82,7 +83,7 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) x = 0; if (cflags & C_GROUP) { uint16_t t; - t = *(uint16_t *)(ht + (cflags & 0x7f)); + t = *(uint16_t*)(ht + (cflags & 0x7f)); cflags = (uint8_t)t; x = (uint8_t)(t >> 8); } @@ -106,9 +107,10 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) { uint8_t t = opcode - 0xd9; if (m_mod == 3) { - ht = hde32_table + DELTA_FPU_MODRM + t*8; + ht = hde32_table + DELTA_FPU_MODRM + t * 8; t = ht[m_reg] << m_rm; - } else { + } + else { ht = hde32_table + DELTA_FPU_REG; t = ht[t] << m_reg; } @@ -119,12 +121,14 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) if (pref & PRE_LOCK) { if (m_mod == 3) { hs->flags |= F_ERROR | F_ERROR_LOCK; - } else { - uint8_t *table_end, op = opcode; + } + else { + uint8_t* table_end, op = opcode; if (hs->opcode2) { ht = hde32_table + DELTA_OP2_LOCK_OK; table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK; - } else { + } + else { ht = hde32_table + DELTA_OP_LOCK_OK; table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK; op &= -2; @@ -137,47 +141,49 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) break; } hs->flags |= F_ERROR | F_ERROR_LOCK; - no_lock_error: + no_lock_error: ; } } if (hs->opcode2) { switch (opcode) { - case 0x20: case 0x22: - m_mod = 3; - if (m_reg > 4 || m_reg == 1) - goto error_operand; - else - goto no_error_operand; - case 0x21: case 0x23: - m_mod = 3; - if (m_reg == 4 || m_reg == 5) - goto error_operand; - else - goto no_error_operand; + case 0x20: case 0x22: + m_mod = 3; + if (m_reg > 4 || m_reg == 1) + goto error_operand; + else + goto no_error_operand; + case 0x21: case 0x23: + m_mod = 3; + if (m_reg == 4 || m_reg == 5) + goto error_operand; + else + goto no_error_operand; } - } else { + } + else { switch (opcode) { - case 0x8c: - if (m_reg > 5) - goto error_operand; - else - goto no_error_operand; - case 0x8e: - if (m_reg == 1 || m_reg > 5) - goto error_operand; - else - goto no_error_operand; + case 0x8c: + if (m_reg > 5) + goto error_operand; + else + goto no_error_operand; + case 0x8e: + if (m_reg == 1 || m_reg > 5) + goto error_operand; + else + goto no_error_operand; } } if (m_mod == 3) { - uint8_t *table_end; + uint8_t* table_end; if (hs->opcode2) { ht = hde32_table + DELTA_OP2_ONLY_MEM; table_end = ht + sizeof(hde32_table) - DELTA_OP2_ONLY_MEM; - } else { + } + else { ht = hde32_table + DELTA_OP_ONLY_MEM; table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM; } @@ -189,26 +195,28 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) break; } goto no_error_operand; - } else if (hs->opcode2) { + } + else if (hs->opcode2) { switch (opcode) { - case 0x50: case 0xd7: case 0xf7: - if (pref & (PRE_NONE | PRE_66)) - goto error_operand; - break; - case 0xd6: - if (pref & (PRE_F2 | PRE_F3)) - goto error_operand; - break; - case 0xc5: + case 0x50: case 0xd7: case 0xf7: + if (pref & (PRE_NONE | PRE_66)) goto error_operand; + break; + case 0xd6: + if (pref & (PRE_F2 | PRE_F3)) + goto error_operand; + break; + case 0xc5: + goto error_operand; } goto no_error_operand; - } else + } + else goto no_error_operand; - error_operand: + error_operand: hs->flags |= F_ERROR | F_ERROR_OPERAND; - no_error_operand: + no_error_operand: c = *p++; if (m_reg <= 1) { @@ -219,21 +227,22 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) } switch (m_mod) { - case 0: - if (pref & PRE_67) { - if (m_rm == 6) - disp_size = 2; - } else - if (m_rm == 5) - disp_size = 4; - break; - case 1: - disp_size = 1; - break; - case 2: - disp_size = 2; - if (!(pref & PRE_67)) - disp_size <<= 1; + case 0: + if (pref & PRE_67) { + if (m_rm == 6) + disp_size = 2; + } + else + if (m_rm == 5) + disp_size = 4; + break; + case 1: + disp_size = 1; + break; + case 2: + disp_size = 2; + if (!(pref & PRE_67)) + disp_size <<= 1; } if (m_mod != 3 && m_rm == 4 && !(pref & PRE_67)) { @@ -248,27 +257,28 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) p--; switch (disp_size) { - case 1: - hs->flags |= F_DISP8; - hs->disp.disp8 = *p; - break; - case 2: - hs->flags |= F_DISP16; - hs->disp.disp16 = *(uint16_t *)p; - break; - case 4: - hs->flags |= F_DISP32; - hs->disp.disp32 = *(uint32_t *)p; + case 1: + hs->flags |= F_DISP8; + hs->disp.disp8 = *p; + break; + case 2: + hs->flags |= F_DISP16; + hs->disp.disp16 = *(uint16_t*)p; + break; + case 4: + hs->flags |= F_DISP32; + hs->disp.disp32 = *(uint32_t*)p; } p += disp_size; - } else if (pref & PRE_LOCK) + } + else if (pref & PRE_LOCK) hs->flags |= F_ERROR | F_ERROR_LOCK; if (cflags & C_IMM_P66) { if (cflags & C_REL32) { if (pref & PRE_66) { hs->flags |= F_IMM16 | F_RELATIVE; - hs->imm.imm16 = *(uint16_t *)p; + hs->imm.imm16 = *(uint16_t*)p; p += 2; goto disasm_done; } @@ -276,11 +286,12 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) } if (pref & PRE_66) { hs->flags |= F_IMM16; - hs->imm.imm16 = *(uint16_t *)p; + hs->imm.imm16 = *(uint16_t*)p; p += 2; - } else { + } + else { hs->flags |= F_IMM32; - hs->imm.imm32 = *(uint32_t *)p; + hs->imm.imm32 = *(uint32_t*)p; p += 4; } } @@ -288,13 +299,15 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) if (cflags & C_IMM16) { if (hs->flags & F_IMM32) { hs->flags |= F_IMM16; - hs->disp.disp16 = *(uint16_t *)p; - } else if (hs->flags & F_IMM16) { + hs->disp.disp16 = *(uint16_t*)p; + } + else if (hs->flags & F_IMM16) { hs->flags |= F_2IMM16; - hs->disp.disp16 = *(uint16_t *)p; - } else { + hs->disp.disp16 = *(uint16_t*)p; + } + else { hs->flags |= F_IMM16; - hs->imm.imm16 = *(uint16_t *)p; + hs->imm.imm16 = *(uint16_t*)p; } p += 2; } @@ -304,18 +317,19 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) } if (cflags & C_REL32) { - rel32_ok: + rel32_ok: hs->flags |= F_IMM32 | F_RELATIVE; - hs->imm.imm32 = *(uint32_t *)p; + hs->imm.imm32 = *(uint32_t*)p; p += 4; - } else if (cflags & C_REL8) { + } + else if (cflags & C_REL8) { hs->flags |= F_IMM8 | F_RELATIVE; hs->imm.imm8 = *p++; } - disasm_done: +disasm_done: - if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) { + if ((hs->len = (uint8_t)(p - (uint8_t*)code)) > 15) { hs->flags |= F_ERROR | F_ERROR_LENGTH; hs->len = 15; } diff --git a/vendor/minhook/src/hde/hde32.h b/vendor/minhook/src/hde/hde32.h index 1112450..0d91e70 100644 --- a/vendor/minhook/src/hde/hde32.h +++ b/vendor/minhook/src/hde/hde32.h @@ -10,15 +10,15 @@ #ifndef _HDE32_H_ #define _HDE32_H_ -/* stdint.h - C99 standard header - * http://en.wikipedia.org/wiki/stdint.h - * - * if your compiler doesn't contain "stdint.h" header (for - * example, Microsoft Visual C++), you can download file: - * http://www.azillionmonkeys.com/qed/pstdint.h - * and change next line to: - * #include "pstdint.h" - */ + /* stdint.h - C99 standard header + * http://en.wikipedia.org/wiki/stdint.h + * + * if your compiler doesn't contain "stdint.h" header (for + * example, Microsoft Visual C++), you can download file: + * http://www.azillionmonkeys.com/qed/pstdint.h + * and change next line to: + * #include "pstdint.h" + */ #include "pstdint.h" #define F_MODRM 0x00000001 @@ -95,8 +95,8 @@ typedef struct { extern "C" { #endif -/* __cdecl */ -unsigned int hde32_disasm(const void *code, hde32s *hs); + /* __cdecl */ + unsigned int hde32_disasm(const void* code, hde32s* hs); #ifdef __cplusplus } diff --git a/vendor/minhook/src/hde/hde64.c b/vendor/minhook/src/hde/hde64.c index c23e2fc..b75ed63 100644 --- a/vendor/minhook/src/hde/hde64.c +++ b/vendor/minhook/src/hde/hde64.c @@ -10,10 +10,10 @@ #include "hde64.h" #include "table64.h" -unsigned int hde64_disasm(const void *code, hde64s *hs) +unsigned int hde64_disasm(const void* code, hde64s* hs) { - uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0; - uint8_t *ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0; + uint8_t x, c, * p = (uint8_t*)code, cflags, opcode, pref = 0; + uint8_t* ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0; uint8_t op64 = 0; // Avoid using memset to reduce the footprint. @@ -25,35 +25,35 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) for (x = 16; x; x--) switch (c = *p++) { - case 0xf3: - hs->p_rep = c; - pref |= PRE_F3; - break; - case 0xf2: - hs->p_rep = c; - pref |= PRE_F2; - break; - case 0xf0: - hs->p_lock = c; - pref |= PRE_LOCK; - break; - case 0x26: case 0x2e: case 0x36: - case 0x3e: case 0x64: case 0x65: - hs->p_seg = c; - pref |= PRE_SEG; - break; - case 0x66: - hs->p_66 = c; - pref |= PRE_66; - break; - case 0x67: - hs->p_67 = c; - pref |= PRE_67; - break; - default: - goto pref_done; + case 0xf3: + hs->p_rep = c; + pref |= PRE_F3; + break; + case 0xf2: + hs->p_rep = c; + pref |= PRE_F2; + break; + case 0xf0: + hs->p_lock = c; + pref |= PRE_LOCK; + break; + case 0x26: case 0x2e: case 0x36: + case 0x3e: case 0x64: case 0x65: + hs->p_seg = c; + pref |= PRE_SEG; + break; + case 0x66: + hs->p_66 = c; + pref |= PRE_66; + break; + case 0x67: + hs->p_67 = c; + pref |= PRE_67; + break; + default: + goto pref_done; } - pref_done: +pref_done: hs->flags = (uint32_t)pref << 23; @@ -76,7 +76,8 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) if ((hs->opcode = c) == 0x0f) { hs->opcode2 = c = *p++; ht += DELTA_OPCODES; - } else if (c >= 0xa0 && c <= 0xa3) { + } + else if (c >= 0xa0 && c <= 0xa3) { op64++; if (pref & PRE_67) pref |= PRE_66; @@ -88,7 +89,7 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) cflags = ht[ht[opcode / 4] + (opcode % 4)]; if (cflags == C_ERROR) { - error_opcode: + error_opcode: hs->flags |= F_ERROR | F_ERROR_OPCODE; cflags = 0; if ((opcode & -3) == 0x24) @@ -98,7 +99,7 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) x = 0; if (cflags & C_GROUP) { uint16_t t; - t = *(uint16_t *)(ht + (cflags & 0x7f)); + t = *(uint16_t*)(ht + (cflags & 0x7f)); cflags = (uint8_t)t; x = (uint8_t)(t >> 8); } @@ -122,9 +123,10 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) { uint8_t t = opcode - 0xd9; if (m_mod == 3) { - ht = hde64_table + DELTA_FPU_MODRM + t*8; + ht = hde64_table + DELTA_FPU_MODRM + t * 8; t = ht[m_reg] << m_rm; - } else { + } + else { ht = hde64_table + DELTA_FPU_REG; t = ht[t] << m_reg; } @@ -135,12 +137,14 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) if (pref & PRE_LOCK) { if (m_mod == 3) { hs->flags |= F_ERROR | F_ERROR_LOCK; - } else { - uint8_t *table_end, op = opcode; + } + else { + uint8_t* table_end, op = opcode; if (hs->opcode2) { ht = hde64_table + DELTA_OP2_LOCK_OK; table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK; - } else { + } + else { ht = hde64_table + DELTA_OP_LOCK_OK; table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK; op &= -2; @@ -153,47 +157,49 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) break; } hs->flags |= F_ERROR | F_ERROR_LOCK; - no_lock_error: + no_lock_error: ; } } if (hs->opcode2) { switch (opcode) { - case 0x20: case 0x22: - m_mod = 3; - if (m_reg > 4 || m_reg == 1) - goto error_operand; - else - goto no_error_operand; - case 0x21: case 0x23: - m_mod = 3; - if (m_reg == 4 || m_reg == 5) - goto error_operand; - else - goto no_error_operand; + case 0x20: case 0x22: + m_mod = 3; + if (m_reg > 4 || m_reg == 1) + goto error_operand; + else + goto no_error_operand; + case 0x21: case 0x23: + m_mod = 3; + if (m_reg == 4 || m_reg == 5) + goto error_operand; + else + goto no_error_operand; } - } else { + } + else { switch (opcode) { - case 0x8c: - if (m_reg > 5) - goto error_operand; - else - goto no_error_operand; - case 0x8e: - if (m_reg == 1 || m_reg > 5) - goto error_operand; - else - goto no_error_operand; + case 0x8c: + if (m_reg > 5) + goto error_operand; + else + goto no_error_operand; + case 0x8e: + if (m_reg == 1 || m_reg > 5) + goto error_operand; + else + goto no_error_operand; } } if (m_mod == 3) { - uint8_t *table_end; + uint8_t* table_end; if (hs->opcode2) { ht = hde64_table + DELTA_OP2_ONLY_MEM; table_end = ht + sizeof(hde64_table) - DELTA_OP2_ONLY_MEM; - } else { + } + else { ht = hde64_table + DELTA_OP_ONLY_MEM; table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM; } @@ -205,26 +211,28 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) break; } goto no_error_operand; - } else if (hs->opcode2) { + } + else if (hs->opcode2) { switch (opcode) { - case 0x50: case 0xd7: case 0xf7: - if (pref & (PRE_NONE | PRE_66)) - goto error_operand; - break; - case 0xd6: - if (pref & (PRE_F2 | PRE_F3)) - goto error_operand; - break; - case 0xc5: + case 0x50: case 0xd7: case 0xf7: + if (pref & (PRE_NONE | PRE_66)) goto error_operand; + break; + case 0xd6: + if (pref & (PRE_F2 | PRE_F3)) + goto error_operand; + break; + case 0xc5: + goto error_operand; } goto no_error_operand; - } else + } + else goto no_error_operand; - error_operand: + error_operand: hs->flags |= F_ERROR | F_ERROR_OPERAND; - no_error_operand: + no_error_operand: c = *p++; if (m_reg <= 1) { @@ -235,21 +243,22 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) } switch (m_mod) { - case 0: - if (pref & PRE_67) { - if (m_rm == 6) - disp_size = 2; - } else - if (m_rm == 5) - disp_size = 4; - break; - case 1: - disp_size = 1; - break; - case 2: - disp_size = 2; - if (!(pref & PRE_67)) - disp_size <<= 1; + case 0: + if (pref & PRE_67) { + if (m_rm == 6) + disp_size = 2; + } + else + if (m_rm == 5) + disp_size = 4; + break; + case 1: + disp_size = 1; + break; + case 2: + disp_size = 2; + if (!(pref & PRE_67)) + disp_size <<= 1; } if (m_mod != 3 && m_rm == 4) { @@ -264,27 +273,28 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) p--; switch (disp_size) { - case 1: - hs->flags |= F_DISP8; - hs->disp.disp8 = *p; - break; - case 2: - hs->flags |= F_DISP16; - hs->disp.disp16 = *(uint16_t *)p; - break; - case 4: - hs->flags |= F_DISP32; - hs->disp.disp32 = *(uint32_t *)p; + case 1: + hs->flags |= F_DISP8; + hs->disp.disp8 = *p; + break; + case 2: + hs->flags |= F_DISP16; + hs->disp.disp16 = *(uint16_t*)p; + break; + case 4: + hs->flags |= F_DISP32; + hs->disp.disp32 = *(uint32_t*)p; } p += disp_size; - } else if (pref & PRE_LOCK) + } + else if (pref & PRE_LOCK) hs->flags |= F_ERROR | F_ERROR_LOCK; if (cflags & C_IMM_P66) { if (cflags & C_REL32) { if (pref & PRE_66) { hs->flags |= F_IMM16 | F_RELATIVE; - hs->imm.imm16 = *(uint16_t *)p; + hs->imm.imm16 = *(uint16_t*)p; p += 2; goto disasm_done; } @@ -292,21 +302,22 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) } if (op64) { hs->flags |= F_IMM64; - hs->imm.imm64 = *(uint64_t *)p; + hs->imm.imm64 = *(uint64_t*)p; p += 8; - } else if (!(pref & PRE_66)) { + } + else if (!(pref & PRE_66)) { hs->flags |= F_IMM32; - hs->imm.imm32 = *(uint32_t *)p; + hs->imm.imm32 = *(uint32_t*)p; p += 4; - } else + } + else goto imm16_ok; } - if (cflags & C_IMM16) { - imm16_ok: + imm16_ok: hs->flags |= F_IMM16; - hs->imm.imm16 = *(uint16_t *)p; + hs->imm.imm16 = *(uint16_t*)p; p += 2; } if (cflags & C_IMM8) { @@ -315,18 +326,19 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) } if (cflags & C_REL32) { - rel32_ok: + rel32_ok: hs->flags |= F_IMM32 | F_RELATIVE; - hs->imm.imm32 = *(uint32_t *)p; + hs->imm.imm32 = *(uint32_t*)p; p += 4; - } else if (cflags & C_REL8) { + } + else if (cflags & C_REL8) { hs->flags |= F_IMM8 | F_RELATIVE; hs->imm.imm8 = *p++; } - disasm_done: +disasm_done: - if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) { + if ((hs->len = (uint8_t)(p - (uint8_t*)code)) > 15) { hs->flags |= F_ERROR | F_ERROR_LENGTH; hs->len = 15; } diff --git a/vendor/minhook/src/hde/hde64.h b/vendor/minhook/src/hde/hde64.h index ecbf4df..f273a9a 100644 --- a/vendor/minhook/src/hde/hde64.h +++ b/vendor/minhook/src/hde/hde64.h @@ -10,15 +10,15 @@ #ifndef _HDE64_H_ #define _HDE64_H_ -/* stdint.h - C99 standard header - * http://en.wikipedia.org/wiki/stdint.h - * - * if your compiler doesn't contain "stdint.h" header (for - * example, Microsoft Visual C++), you can download file: - * http://www.azillionmonkeys.com/qed/pstdint.h - * and change next line to: - * #include "pstdint.h" - */ + /* stdint.h - C99 standard header + * http://en.wikipedia.org/wiki/stdint.h + * + * if your compiler doesn't contain "stdint.h" header (for + * example, Microsoft Visual C++), you can download file: + * http://www.azillionmonkeys.com/qed/pstdint.h + * and change next line to: + * #include "pstdint.h" + */ #include "pstdint.h" #define F_MODRM 0x00000001 @@ -102,8 +102,8 @@ typedef struct { extern "C" { #endif -/* __cdecl */ -unsigned int hde64_disasm(const void *code, hde64s *hs); + /* __cdecl */ + unsigned int hde64_disasm(const void* code, hde64s* hs); #ifdef __cplusplus } diff --git a/vendor/minhook/src/hde/pstdint.h b/vendor/minhook/src/hde/pstdint.h index 84d82a0..eb40623 100644 --- a/vendor/minhook/src/hde/pstdint.h +++ b/vendor/minhook/src/hde/pstdint.h @@ -28,7 +28,7 @@ #include -// Integer types for HDE. + // Integer types for HDE. typedef INT8 int8_t; typedef INT16 int16_t; typedef INT32 int32_t; diff --git a/vendor/minhook/src/hook.c b/vendor/minhook/src/hook.c index fecfb0b..5bdbe9d 100644 --- a/vendor/minhook/src/hook.c +++ b/vendor/minhook/src/hook.c @@ -35,10 +35,10 @@ #include "trampoline.h" #ifndef ARRAYSIZE - #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) #endif -// Initial capacity of the HOOK_ENTRY buffer. + // Initial capacity of the HOOK_ENTRY buffer. #define INITIAL_HOOK_CAPACITY 32 // Initial capacity of the thread IDs buffer. @@ -65,14 +65,14 @@ typedef struct _HOOK_ENTRY LPVOID pTrampoline; // Address of the trampoline function. UINT8 backup[8]; // Original prologue of the target function. - UINT8 patchAbove : 1; // Uses the hot patch area. - UINT8 isEnabled : 1; // Enabled. + UINT8 patchAbove : 1; // Uses the hot patch area. + UINT8 isEnabled : 1; // Enabled. UINT8 queueEnable : 1; // Queued for enabling/disabling when != isEnabled. UINT nIP : 4; // Count of the instruction boundaries. UINT8 oldIPs[8]; // Instruction boundaries of the target function. UINT8 newIPs[8]; // Instruction boundaries of the trampoline function. -} HOOK_ENTRY, *PHOOK_ENTRY; +} HOOK_ENTRY, * PHOOK_ENTRY; // Suspended threads for Freeze()/Unfreeze(). typedef struct _FROZEN_THREADS @@ -80,7 +80,7 @@ typedef struct _FROZEN_THREADS LPDWORD pItems; // Data heap UINT capacity; // Size of allocated data heap, items UINT size; // Actual number of data items -} FROZEN_THREADS, *PFROZEN_THREADS; +} FROZEN_THREADS, * PFROZEN_THREADS; //------------------------------------------------------------------------- // Global Variables: @@ -203,9 +203,9 @@ static void ProcessThreadIPs(HANDLE hThread, UINT pos, UINT action) CONTEXT c; #if defined(_M_X64) || defined(__x86_64__) - DWORD64 *pIP = &c.Rip; + DWORD64* pIP = &c.Rip; #else - DWORD *pIP = &c.Eip; + DWORD* pIP = &c.Eip; #endif UINT count; @@ -306,9 +306,9 @@ static VOID EnumerateThreads(PFROZEN_THREADS pThreads) //------------------------------------------------------------------------- static VOID Freeze(PFROZEN_THREADS pThreads, UINT pos, UINT action) { - pThreads->pItems = NULL; + pThreads->pItems = NULL; pThreads->capacity = 0; - pThreads->size = 0; + pThreads->size = 0; EnumerateThreads(pThreads); if (pThreads->pItems != NULL) @@ -352,13 +352,13 @@ static MH_STATUS EnableHookLL(UINT pos, BOOL enable) { PHOOK_ENTRY pHook = &g_hooks.pItems[pos]; DWORD oldProtect; - SIZE_T patchSize = sizeof(JMP_REL); + SIZE_T patchSize = sizeof(JMP_REL); LPBYTE pPatchTarget = (LPBYTE)pHook->pTarget; if (pHook->patchAbove) { pPatchTarget -= sizeof(JMP_REL); - patchSize += sizeof(JMP_REL_SHORT); + patchSize += sizeof(JMP_REL_SHORT); } if (!VirtualProtect(pPatchTarget, patchSize, PAGE_EXECUTE_READWRITE, &oldProtect)) @@ -390,7 +390,7 @@ static MH_STATUS EnableHookLL(UINT pos, BOOL enable) // Just-in-case measure. FlushInstructionCache(GetCurrentProcess(), pPatchTarget, patchSize); - pHook->isEnabled = enable; + pHook->isEnabled = enable; pHook->queueEnable = enable; return MH_OK; @@ -516,9 +516,9 @@ MH_STATUS WINAPI MH_Uninitialize(VOID) g_hHeap = NULL; - g_hooks.pItems = NULL; + g_hooks.pItems = NULL; g_hooks.capacity = 0; - g_hooks.size = 0; + g_hooks.size = 0; } } else @@ -532,7 +532,7 @@ MH_STATUS WINAPI MH_Uninitialize(VOID) } //------------------------------------------------------------------------- -MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal) +MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID* ppOriginal) { MH_STATUS status = MH_OK; @@ -550,25 +550,25 @@ MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOrigina { TRAMPOLINE ct; - ct.pTarget = pTarget; - ct.pDetour = pDetour; + ct.pTarget = pTarget; + ct.pDetour = pDetour; ct.pTrampoline = pBuffer; if (CreateTrampolineFunction(&ct)) { PHOOK_ENTRY pHook = AddHookEntry(); if (pHook != NULL) { - pHook->pTarget = ct.pTarget; + pHook->pTarget = ct.pTarget; #if defined(_M_X64) || defined(__x86_64__) - pHook->pDetour = ct.pRelay; + pHook->pDetour = ct.pRelay; #else - pHook->pDetour = ct.pDetour; + pHook->pDetour = ct.pDetour; #endif pHook->pTrampoline = ct.pTrampoline; - pHook->patchAbove = ct.patchAbove; - pHook->isEnabled = FALSE; + pHook->patchAbove = ct.patchAbove; + pHook->isEnabled = FALSE; pHook->queueEnable = FALSE; - pHook->nIP = ct.nIP; + pHook->nIP = ct.nIP; memcpy(pHook->oldIPs, ct.oldIPs, ARRAYSIZE(ct.oldIPs)); memcpy(pHook->newIPs, ct.newIPs, ARRAYSIZE(ct.newIPs)); @@ -833,7 +833,7 @@ MH_STATUS WINAPI MH_ApplyQueued(VOID) //------------------------------------------------------------------------- MH_STATUS WINAPI MH_CreateHookApiEx( LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, - LPVOID *ppOriginal, LPVOID *ppTarget) + LPVOID* ppOriginal, LPVOID* ppTarget) { HMODULE hModule; LPVOID pTarget; @@ -846,7 +846,7 @@ MH_STATUS WINAPI MH_CreateHookApiEx( if (pTarget == NULL) return MH_ERROR_FUNCTION_NOT_FOUND; - if(ppTarget != NULL) + if (ppTarget != NULL) *ppTarget = pTarget; return MH_CreateHook(pTarget, pDetour, ppOriginal); @@ -854,13 +854,13 @@ MH_STATUS WINAPI MH_CreateHookApiEx( //------------------------------------------------------------------------- MH_STATUS WINAPI hookApi( - LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal) + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID* ppOriginal) { - return MH_CreateHookApiEx(pszModule, pszProcName, pDetour, ppOriginal, NULL); + return MH_CreateHookApiEx(pszModule, pszProcName, pDetour, ppOriginal, NULL); } //------------------------------------------------------------------------- -const char * WINAPI MH_StatusToString(MH_STATUS status) +const char* WINAPI MH_StatusToString(MH_STATUS status) { #define MH_ST2STR(x) \ case x: \ @@ -868,19 +868,19 @@ const char * WINAPI MH_StatusToString(MH_STATUS status) switch (status) { MH_ST2STR(MH_UNKNOWN) - MH_ST2STR(MH_OK) - MH_ST2STR(MH_ERROR_ALREADY_INITIALIZED) - MH_ST2STR(MH_ERROR_NOT_INITIALIZED) - MH_ST2STR(MH_ERROR_ALREADY_CREATED) - MH_ST2STR(MH_ERROR_NOT_CREATED) - MH_ST2STR(MH_ERROR_ENABLED) - MH_ST2STR(MH_ERROR_DISABLED) - MH_ST2STR(MH_ERROR_NOT_EXECUTABLE) - MH_ST2STR(MH_ERROR_UNSUPPORTED_FUNCTION) - MH_ST2STR(MH_ERROR_MEMORY_ALLOC) - MH_ST2STR(MH_ERROR_MEMORY_PROTECT) - MH_ST2STR(MH_ERROR_MODULE_NOT_FOUND) - MH_ST2STR(MH_ERROR_FUNCTION_NOT_FOUND) + MH_ST2STR(MH_OK) + MH_ST2STR(MH_ERROR_ALREADY_INITIALIZED) + MH_ST2STR(MH_ERROR_NOT_INITIALIZED) + MH_ST2STR(MH_ERROR_ALREADY_CREATED) + MH_ST2STR(MH_ERROR_NOT_CREATED) + MH_ST2STR(MH_ERROR_ENABLED) + MH_ST2STR(MH_ERROR_DISABLED) + MH_ST2STR(MH_ERROR_NOT_EXECUTABLE) + MH_ST2STR(MH_ERROR_UNSUPPORTED_FUNCTION) + MH_ST2STR(MH_ERROR_MEMORY_ALLOC) + MH_ST2STR(MH_ERROR_MEMORY_PROTECT) + MH_ST2STR(MH_ERROR_MODULE_NOT_FOUND) + MH_ST2STR(MH_ERROR_FUNCTION_NOT_FOUND) } #undef MH_ST2STR diff --git a/vendor/minhook/src/trampoline.c b/vendor/minhook/src/trampoline.c index ac37f0f..5acaeda 100644 --- a/vendor/minhook/src/trampoline.c +++ b/vendor/minhook/src/trampoline.c @@ -29,17 +29,17 @@ #include #ifndef ARRAYSIZE - #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) #endif #if defined(_M_X64) || defined(__x86_64__) - #include "./hde/hde64.h" - typedef hde64s HDE; - #define HDE_DISASM(code, hs) hde64_disasm(code, hs) +#include "./hde/hde64.h" +typedef hde64s HDE; +#define HDE_DISASM(code, hs) hde64_disasm(code, hs) #else - #include "./hde/hde32.h" - typedef hde32s HDE; - #define HDE_DISASM(code, hs) hde32_disasm(code, hs) +#include "./hde/hde32.h" +typedef hde32s HDE; +#define HDE_DISASM(code, hs) hde32_disasm(code, hs) #endif #include "trampoline.h" @@ -47,9 +47,9 @@ // Maximum size of a trampoline function. #if defined(_M_X64) || defined(__x86_64__) - #define TRAMPOLINE_MAX_SIZE (MEMORY_SLOT_SIZE - sizeof(JMP_ABS)) +#define TRAMPOLINE_MAX_SIZE (MEMORY_SLOT_SIZE - sizeof(JMP_ABS)) #else - #define TRAMPOLINE_MAX_SIZE MEMORY_SLOT_SIZE +#define TRAMPOLINE_MAX_SIZE MEMORY_SLOT_SIZE #endif //------------------------------------------------------------------------- @@ -101,23 +101,23 @@ BOOL CreateTrampolineFunction(PTRAMPOLINE ct) }; #endif - UINT8 oldPos = 0; - UINT8 newPos = 0; - ULONG_PTR jmpDest = 0; // Destination address of an internal jump. + UINT8 oldPos = 0; + UINT8 newPos = 0; + ULONG_PTR jmpDest = 0; // Destination address of an internal jump. BOOL finished = FALSE; // Is the function completed? #if defined(_M_X64) || defined(__x86_64__) UINT8 instBuf[16]; #endif ct->patchAbove = FALSE; - ct->nIP = 0; + ct->nIP = 0; do { HDE hs; UINT copySize; LPVOID pCopySrc; - ULONG_PTR pOldInst = (ULONG_PTR)ct->pTarget + oldPos; + ULONG_PTR pOldInst = (ULONG_PTR)ct->pTarget + oldPos; ULONG_PTR pNewInst = (ULONG_PTR)ct->pTrampoline + newPos; copySize = HDE_DISASM((LPVOID)pOldInst, &hs); @@ -238,7 +238,7 @@ BOOL CreateTrampolineFunction(PTRAMPOLINE ct) UINT8 cond = ((hs.opcode != 0x0F ? hs.opcode : hs.opcode2) & 0x0F); #if defined(_M_X64) || defined(__x86_64__) // Invert the condition in x64 mode to simplify the conditional jump logic. - jcc.opcode = 0x71 ^ cond; + jcc.opcode = 0x71 ^ cond; jcc.address = dest; #else jcc.opcode1 = 0x80 | cond; @@ -280,8 +280,7 @@ BOOL CreateTrampolineFunction(PTRAMPOLINE ct) #endif newPos += copySize; oldPos += hs.len; - } - while (!finished); + } while (!finished); // Is there enough place for a long jump? if (oldPos < sizeof(JMP_REL) diff --git a/vendor/minhook/src/trampoline.h b/vendor/minhook/src/trampoline.h index bdffdac..e287759 100644 --- a/vendor/minhook/src/trampoline.h +++ b/vendor/minhook/src/trampoline.h @@ -30,21 +30,21 @@ #pragma pack(push, 1) -// Structs for writing x86/x64 instructions. + // Structs for writing x86/x64 instructions. -// 8-bit relative jump. + // 8-bit relative jump. typedef struct _JMP_REL_SHORT { UINT8 opcode; // EB xx: JMP +2+xx UINT8 operand; -} JMP_REL_SHORT, *PJMP_REL_SHORT; +} JMP_REL_SHORT, * PJMP_REL_SHORT; // 32-bit direct relative jump/call. typedef struct _JMP_REL { UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx UINT32 operand; // Relative destination address -} JMP_REL, *PJMP_REL, CALL_REL; +} JMP_REL, * PJMP_REL, CALL_REL; // 64-bit indirect absolute jump. typedef struct _JMP_ABS @@ -53,7 +53,7 @@ typedef struct _JMP_ABS UINT8 opcode1; UINT32 dummy; UINT64 address; // Absolute destination address -} JMP_ABS, *PJMP_ABS; +} JMP_ABS, * PJMP_ABS; // 64-bit indirect absolute call. typedef struct _CALL_ABS @@ -100,6 +100,6 @@ typedef struct _TRAMPOLINE UINT nIP; // [Out] Number of the instruction boundaries. UINT8 oldIPs[8]; // [Out] Instruction boundaries of the target function. UINT8 newIPs[8]; // [Out] Instruction boundaries of the trampoline function. -} TRAMPOLINE, *PTRAMPOLINE; +} TRAMPOLINE, * PTRAMPOLINE; BOOL CreateTrampolineFunction(PTRAMPOLINE ct);