2 Commits

Author SHA1 Message Date
Hash Borgir
df8d43422e middle clicks gems to store 2024-05-19 20:46:16 -06:00
Hash Borgir
488e2a0c2e close button working.Need to add misc pots 2024-05-19 19:35:35 -06:00
5 changed files with 78 additions and 1 deletions

View File

@@ -106,6 +106,8 @@ namespace d2_tweaks {
bool m_show_mp4;
bool m_show_mp5;
bool m_show_close;
bool quality_settings[static_cast<size_t>(diablo2::structures::item_quality_t::ITEM_QUALITY_COUNT)];
char reserved[1004];

View File

@@ -119,6 +119,7 @@ namespace d2_tweaks {
ui::controls::checkbox* m_show_mp4;
ui::controls::checkbox* m_show_mp5;
ui::controls::checkbox* m_close;
void(__fastcall* m_draw_dropped_items_names_original)(void*, void*);
void(__fastcall* m_handle_dropped_items_original)(void*, void*);
@@ -220,6 +221,7 @@ namespace d2_tweaks {
void extract_mp4(bool value);
void extract_mp5(bool value);
void close_window(bool value);
//void extract_flourite(bool value);

View File

@@ -22,11 +22,14 @@ namespace d2_tweaks {
ui::controls::button* m_btn_toggle_stash;
ui::controls::button* m_btn_toggle_bag;
public:
menu* m_filter_settings_menu;
menu* m_menu;
bool m_show;
bool m_show_bag;
public:
explicit loot_filter_settings_toggle_menu(token);
void toggle_show() {

View File

@@ -623,6 +623,14 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_misc_checkb
m_show_mp4 = get_control<ui::controls::checkbox>("m_show_mp4");
m_show_mp5 = get_control<ui::controls::checkbox>("m_show_mp5");
m_close = get_control<ui::controls::checkbox>("m_close");
if (m_close) {
m_close->set_state(loot_filter_settings::get().m_show_close);
m_close->set_on_click(std::bind(&loot_filter_settings_menu::close_window,
this, std::placeholders::_1));
}
// potions
{
@@ -1190,6 +1198,21 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::extract_item(bool va
// potions
#include <d2tweaks/client/modules/loot_filter/loot_filter_settings_toggle_menu.h>
void d2_tweaks::client::modules::loot_filter_settings_menu::close_window(bool value) {
auto& toggle_menu = singleton<loot_filter_settings_toggle_menu>::instance();
toggle_menu.m_show = false;
m_stats_enabled = true;
toggle_menu.m_filter_settings_menu->set_enabled(false);
toggle_menu.m_filter_settings_menu->set_visible(false);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_rejuv_potion(bool value) {
loot_filter_settings::get().m_show_rejuv_potion = value;
extract_item(value, 396, 1, 'rvs ', diablo2::UNIT_STAT_gembag_Potions);

View File

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