From d7fab9d077b08d3eca5d3afb066140a5c8d96444 Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Sat, 27 Apr 2024 12:37:53 -0600 Subject: [PATCH] right in npc inv no longer causes issue --- .../modules/autosort/autosort_client.cpp | 2 +- src/d2tweaks/ui/ui_manager.cpp | 46 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/d2tweaks/client/modules/autosort/autosort_client.cpp b/src/d2tweaks/client/modules/autosort/autosort_client.cpp index 8089437..826c598 100644 --- a/src/d2tweaks/client/modules/autosort/autosort_client.cpp +++ b/src/d2tweaks/client/modules/autosort/autosort_client.cpp @@ -403,7 +403,7 @@ public: int filledStaminaWidth = static_cast(staminaPercentage * barWidth); // at 345 we need to minus the width of the text - int sWCenter = barX + 100 - (diablo2::d2_win::get_text_pixel_width(const_cast(mana.c_str())) / 2); + sWCenter = barX + 100 - (diablo2::d2_win::get_text_pixel_width(const_cast(mana.c_str())) / 2); HWND diabloIIWnd = FindDiabloIIWindow(); diff --git a/src/d2tweaks/ui/ui_manager.cpp b/src/d2tweaks/ui/ui_manager.cpp index 4414941..40834a0 100644 --- a/src/d2tweaks/ui/ui_manager.cpp +++ b/src/d2tweaks/ui/ui_manager.cpp @@ -459,33 +459,33 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, auto currentPage = diablo2::d2_common::get_item_page(g_hoverItem); if (currentPage == 0 || currentPage == 3 || currentPage == 4) { + if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH) || diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_CUBE) || diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_INVENTORY)) { + for (const auto& gem : gemTypes) { + // Accessing key and value + const std::string& key = gem.first; + const GemType& value = gem.second; + if (strncmp(normCode, key.c_str(), 3) == 0) { + D2PropertyStrc itemProperty = {}; + itemProperty.nProperty = value.rowID - 3; + itemProperty.nLayer = 0; + itemProperty.nMin = value.chippedCount; + itemProperty.nMax = value.chippedCount; + diablo2::d2_common::add_property(gemBag, &itemProperty, 0); + diablo2::d2_client::play_sound(record->drop_sound, nullptr, 0, 0, 0); - for (const auto& gem : gemTypes) { - // Accessing key and value - const std::string& key = gem.first; - const GemType& value = gem.second; - if (strncmp(normCode, key.c_str(), 3) == 0) { - D2PropertyStrc itemProperty = {}; - itemProperty.nProperty = value.rowID - 3; - itemProperty.nLayer = 0; - itemProperty.nMin = value.chippedCount; - itemProperty.nMax = value.chippedCount; - diablo2::d2_common::add_property(gemBag, &itemProperty, 0); - diablo2::d2_client::play_sound(record->drop_sound, nullptr, 0, 0, 0); - - static d2_tweaks::common::item_move_cs packet; - packet.item_guid = g_hoverItem->guid; - packet.bag_guid = gemBagGuid; - packet.updateBag = 1; - packet.prop = itemProperty.nProperty; - packet.val = itemProperty.nMin; - packet.target_page = 99; - diablo2::d2_client::send_to_server(&packet, sizeof packet); + static d2_tweaks::common::item_move_cs packet; + packet.item_guid = g_hoverItem->guid; + packet.bag_guid = gemBagGuid; + packet.updateBag = 1; + packet.prop = itemProperty.nProperty; + packet.val = itemProperty.nMin; + packet.target_page = 99; + diablo2::d2_client::send_to_server(&packet, sizeof packet); + } } } + } - - } block = instance.process_right_mouse(false);