mirror of
https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
synced 2024-11-30 12:45:58 +00:00
middle clicks gems to store
This commit is contained in:
parent
488e2a0c2e
commit
df8d43422e
@ -1259,8 +1259,55 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get current page
|
||||||
|
char currentPage = diablo2::d2_common::get_item_page(g_hoverItem);
|
||||||
|
|
||||||
|
if ((
|
||||||
|
diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_INVENTORY) ||
|
||||||
|
diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH) ||
|
||||||
|
diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_CUBE)
|
||||||
|
) && currentPage == 0) {
|
||||||
|
// Iterate through each gem type in the gemTypes map
|
||||||
|
for (const auto& gem : gemTypes) {
|
||||||
|
// Accessing the key and value of the gemTypes map
|
||||||
|
const std::string& _key = gem.first;
|
||||||
|
auto key = gem.first.c_str();
|
||||||
|
|
||||||
|
const GemType& value = gem.second;
|
||||||
|
|
||||||
|
// Check if the code of the hovered item matches the current gem type
|
||||||
|
if (strncmp(normCode, key, 3) == 0) {
|
||||||
|
// Create a D2PropertyStrc structure to represent the gem property
|
||||||
|
D2PropertyStrc itemProperty = {};
|
||||||
|
itemProperty.nProperty = value.rowID - 3; // Adjust the property ID
|
||||||
|
itemProperty.nLayer = 0;
|
||||||
|
itemProperty.nMin = value.chippedCount;
|
||||||
|
itemProperty.nMax = value.chippedCount;
|
||||||
|
|
||||||
|
// Add the gem property to the gem bag
|
||||||
|
diablo2::d2_common::add_property(gemBag, &itemProperty, 0);
|
||||||
|
|
||||||
|
// Play the drop sound associated with the hovered item
|
||||||
|
diablo2::d2_client::play_sound(record->drop_sound, nullptr, 0, 0, 0);
|
||||||
|
|
||||||
|
// Create and send a packet to the server to move the item
|
||||||
|
static d2_tweaks::common::item_move_cs packet;
|
||||||
|
packet.item_guid = g_hoverItem->guid;
|
||||||
|
packet.item_code = key;
|
||||||
|
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);
|
||||||
|
|
||||||
|
diablo2::d2_common::inv_remove_item(player->inventory, g_hoverItem);
|
||||||
|
|
||||||
|
// Clear the hovered item after processing
|
||||||
|
(*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4)) = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user