From 058db50095e45aab86ebe90c27f8844ca7b4d0ad Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Thu, 9 May 2024 09:13:42 -0600 Subject: [PATCH] Added 250ms delay to sendPacketAndUpdateProperty --- .../loot_filter/loot_filter_settings_menu.cpp | 10 ++++- .../loot_filter_settings_toggle_menu.cpp | 1 - src/d2tweaks/ui/ui_manager.cpp | 37 +++++++++++-------- 3 files changed, 29 insertions(+), 19 deletions(-) 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 851ec9c..491f68d 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 @@ -159,8 +159,8 @@ void displayStat() { // get the value of x , y, and z from the d2tweaks.ini file using getprofileint int x = GetPrivateProfileInt("Options", "bagStatsx", 360, "d2tweaks.ini"); - int y = GetPrivateProfileInt("Options", "bagStatsy", 155, "d2tweaks.ini"); - int z = GetPrivateProfileInt("Options", "bagStatsz", 160, "d2tweaks.ini"); + int y = GetPrivateProfileInt("Options", "bagStatsy", 25, "d2tweaks.ini"); + int z = GetPrivateProfileInt("Options", "bagStatsz", 140, "d2tweaks.ini"); for (auto item = 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); @@ -310,6 +310,12 @@ void displayStat() { diablo2::d2_win::draw_text(const_cast((L"Gem/Rune/Stone/Potion storage & extraction menu")), 10, 25, diablo2::UI_COLOR_YELLOW, 0); diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); + + + diablo2::d2_gfx::draw_filled_rect(0, 0, 100, 100, 113, 0); + + + } } 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 da3f7d8..1d95b89 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 @@ -263,7 +263,6 @@ bool d2_tweaks::client::modules::loot_filter_settings_toggle_menu::key_event(uin m_btn_toggle_stats->set_enabled(true); m_btn_toggle_stats->set_visible(true); } - return menu::key_event(key, up); if (key == VK_ESCAPE && m_show) { diff --git a/src/d2tweaks/ui/ui_manager.cpp b/src/d2tweaks/ui/ui_manager.cpp index b37dee5..4e1c031 100644 --- a/src/d2tweaks/ui/ui_manager.cpp +++ b/src/d2tweaks/ui/ui_manager.cpp @@ -510,28 +510,33 @@ bool isStoneCode(const char* normCode) { return false; } +auto D2CLIENT_StoredTickCount1 = GetTickCount(); + void sendPacketAndUpdateProperty(int gemBagGuid, uint32_t iCode, int prop, int val, int item_guid, diablo2::structures::unit* gemBag) { // get item using item guid + if (250 < GetTickCount() - D2CLIENT_StoredTickCount1) { + D2CLIENT_StoredTickCount1 = GetTickCount(); - // Create the packet - static d2_tweaks::common::item_move_cs packet; - packet.bag_guid = gemBagGuid; - packet.updateBag = 1; - packet.iCode = iCode; - packet.prop = prop - 3; - packet.val = val; - packet.item_guid = item_guid; - packet.target_page = 99; - diablo2::d2_client::send_to_server(&packet, sizeof packet); + // Create the packet + static d2_tweaks::common::item_move_cs packet; + packet.bag_guid = gemBagGuid; + packet.updateBag = 1; + packet.iCode = iCode; + packet.prop = prop - 3; + packet.val = val; + packet.item_guid = item_guid; + packet.target_page = 99; + diablo2::d2_client::send_to_server(&packet, sizeof packet); - D2PropertyStrc itemProperty = {}; - itemProperty.nProperty = prop - 3; // Adjust the property ID - itemProperty.nLayer = 0; - itemProperty.nMin = val; - itemProperty.nMax = val; - diablo2::d2_common::add_property(gemBag, &itemProperty, 0); + D2PropertyStrc itemProperty = {}; + itemProperty.nProperty = prop - 3; // Adjust the property ID + itemProperty.nLayer = 0; + itemProperty.nMin = val; + itemProperty.nMax = val; + diablo2::d2_common::add_property(gemBag, &itemProperty, 0); + } }