HP/Mana storage working

This commit is contained in:
Hash Borgir 2024-05-07 08:31:54 -06:00
parent 41a4c4d181
commit 551f3e44f2
5 changed files with 248 additions and 37 deletions

View File

@ -94,6 +94,18 @@ namespace d2_tweaks {
bool m_show_rejuv_potion;
bool m_show_full_rejuv_potion;
bool m_show_hp1;
bool m_show_hp2;
bool m_show_hp3;
bool m_show_hp4;
bool m_show_hp5;
bool m_show_mp1;
bool m_show_mp2;
bool m_show_mp3;
bool m_show_mp4;
bool m_show_mp5;
bool quality_settings[static_cast<size_t>(diablo2::structures::item_quality_t::ITEM_QUALITY_COUNT)];
char reserved[1004];

View File

@ -107,6 +107,19 @@ namespace d2_tweaks {
ui::controls::checkbox* m_show_rejuv_potion;
ui::controls::checkbox* m_show_full_rejuv_potion;
ui::controls::checkbox* m_show_hp1;
ui::controls::checkbox* m_show_hp2;
ui::controls::checkbox* m_show_hp3;
ui::controls::checkbox* m_show_hp4;
ui::controls::checkbox* m_show_hp5;
ui::controls::checkbox* m_show_mp1;
ui::controls::checkbox* m_show_mp2;
ui::controls::checkbox* m_show_mp3;
ui::controls::checkbox* m_show_mp4;
ui::controls::checkbox* m_show_mp5;
void(__fastcall* m_draw_dropped_items_names_original)(void*, void*);
void(__fastcall* m_handle_dropped_items_original)(void*, void*);
public:
@ -194,6 +207,20 @@ namespace d2_tweaks {
void extract_rejuv_potion(bool value);
void extract_full_rejuv_potion(bool value);
void extract_hp1(bool value);
void extract_hp2(bool value);
void extract_hp3(bool value);
void extract_hp4(bool value);
void extract_hp5(bool value);
void extract_mp1(bool value);
void extract_mp2(bool value);
void extract_mp3(bool value);
void extract_mp4(bool value);
void extract_mp5(bool value);
//void extract_flourite(bool value);
//void extract_jade(bool value);
//void extract_argonite(bool value);

View File

@ -943,8 +943,8 @@ namespace diablo2 {
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_gembag_PotionsHP = 484,
UNIT_STAT_gembag_PotionsMana = 485,
UNIT_STAT_gembag_Potions = 486,
UNIT_STAT_gembag_Stones_Flourite = 487,
UNIT_STAT_gembag_Stones_Jade = 488,

View File

@ -382,6 +382,19 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_misc_checkb
m_show_rejuv_potion = get_control<ui::controls::checkbox>("m_show_rejuv_potion");
m_show_full_rejuv_potion = get_control<ui::controls::checkbox>("m_show_full_rejuv_potion");
m_show_hp1 = get_control<ui::controls::checkbox>("m_show_hp1");
m_show_hp2 = get_control<ui::controls::checkbox>("m_show_hp2");
m_show_hp3 = get_control<ui::controls::checkbox>("m_show_hp3");
m_show_hp4 = get_control<ui::controls::checkbox>("m_show_hp4");
m_show_hp5 = get_control<ui::controls::checkbox>("m_show_hp5");
m_show_mp1 = get_control<ui::controls::checkbox>("m_show_mp1");
m_show_mp2 = get_control<ui::controls::checkbox>("m_show_mp2");
m_show_mp3 = get_control<ui::controls::checkbox>("m_show_mp3");
m_show_mp4 = get_control<ui::controls::checkbox>("m_show_mp4");
m_show_mp5 = get_control<ui::controls::checkbox>("m_show_mp5");
// potions
{
if (m_show_rejuv_potion) {
@ -395,6 +408,70 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::register_misc_checkb
m_show_full_rejuv_potion->set_on_click(std::bind(&loot_filter_settings_menu::extract_full_rejuv_potion,
this, std::placeholders::_1));
}
if (m_show_hp1) {
m_show_hp1->set_state(loot_filter_settings::get().m_show_hp1);
m_show_hp1->set_on_click(std::bind(&loot_filter_settings_menu::extract_hp1,
this, std::placeholders::_1));
}
if (m_show_hp2) {
m_show_hp2->set_state(loot_filter_settings::get().m_show_hp2);
m_show_hp2->set_on_click(std::bind(&loot_filter_settings_menu::extract_hp2,
this, std::placeholders::_1));
}
if (m_show_hp3) {
m_show_hp3->set_state(loot_filter_settings::get().m_show_hp3);
m_show_hp3->set_on_click(std::bind(&loot_filter_settings_menu::extract_hp3,
this, std::placeholders::_1));
}
if (m_show_hp4) {
m_show_hp4->set_state(loot_filter_settings::get().m_show_hp4);
m_show_hp4->set_on_click(std::bind(&loot_filter_settings_menu::extract_hp4,
this, std::placeholders::_1));
}
if (m_show_hp5) {
m_show_hp5->set_state(loot_filter_settings::get().m_show_hp5);
m_show_hp5->set_on_click(std::bind(&loot_filter_settings_menu::extract_hp5,
this, std::placeholders::_1));
}
if (m_show_mp1) {
m_show_mp1->set_state(loot_filter_settings::get().m_show_mp1);
m_show_mp1->set_on_click(std::bind(&loot_filter_settings_menu::extract_mp1,
this, std::placeholders::_1));
}
if (m_show_mp2) {
m_show_mp2->set_state(loot_filter_settings::get().m_show_mp2);
m_show_mp2->set_on_click(std::bind(&loot_filter_settings_menu::extract_mp2,
this, std::placeholders::_1));
}
if (m_show_mp3) {
m_show_mp3->set_state(loot_filter_settings::get().m_show_mp3);
m_show_mp3->set_on_click(std::bind(&loot_filter_settings_menu::extract_mp3,
this, std::placeholders::_1));
}
if (m_show_mp4) {
m_show_mp4->set_state(loot_filter_settings::get().m_show_mp4);
m_show_mp4->set_on_click(std::bind(&loot_filter_settings_menu::extract_mp4,
this, std::placeholders::_1));
}
if (m_show_mp5) {
m_show_mp5->set_state(loot_filter_settings::get().m_show_mp5);
m_show_mp5->set_on_click(std::bind(&loot_filter_settings_menu::extract_mp5,
this, std::placeholders::_1));
}
}
// gems
@ -891,7 +968,6 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::extract_full_rejuv_p
extract_item(value, 396, 3, 'rvl ', diablo2::UNIT_STAT_gembag_Potions);
}
// stones
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_rough(bool value) {
@ -2058,8 +2134,6 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::extract_perfect(bool
// runes
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_r01(bool value) {
loot_filter_settings::get().m_show_r01 = value;
extract_item(value, 388, 1, 'r01 ', diablo2::UNIT_STAT_runebag_RunesA);
@ -2193,6 +2267,60 @@ void d2_tweaks::client::modules::loot_filter_settings_menu::extract_r33(bool val
extract_item(value, 393, 4, 'r33 ', diablo2::UNIT_STAT_runebag_RunesF);
}
// potions
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_hp1(bool value) {
loot_filter_settings::get().m_show_hp1 = value;
extract_item(value, 397, 1, 'hp1 ', diablo2::UNIT_STAT_gembag_PotionsHP);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_hp2(bool value) {
loot_filter_settings::get().m_show_hp2 = value;
extract_item(value, 397, 3, 'hp2 ', diablo2::UNIT_STAT_gembag_PotionsHP);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_hp3(bool value) {
loot_filter_settings::get().m_show_hp3 = value;
extract_item(value, 397, 9, 'hp3 ', diablo2::UNIT_STAT_gembag_PotionsHP);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_hp4(bool value) {
loot_filter_settings::get().m_show_hp4 = value;
extract_item(value, 397, 27, 'hp4 ', diablo2::UNIT_STAT_gembag_PotionsHP);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_hp5(bool value) {
loot_filter_settings::get().m_show_hp5 = value;
extract_item(value, 397, 81, 'hp5 ', diablo2::UNIT_STAT_gembag_PotionsHP);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_mp1(bool value) {
loot_filter_settings::get().m_show_mp1 = value;
extract_item(value, 398, 1, 'mp1 ', diablo2::UNIT_STAT_gembag_PotionsMana);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_mp2(bool value) {
loot_filter_settings::get().m_show_mp2 = value;
extract_item(value, 398, 3, 'mp2 ', diablo2::UNIT_STAT_gembag_PotionsMana);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_mp3(bool value) {
loot_filter_settings::get().m_show_mp3 = value;
extract_item(value, 398, 9, 'mp3 ', diablo2::UNIT_STAT_gembag_PotionsMana);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_mp4(bool value) {
loot_filter_settings::get().m_show_mp4 = value;
extract_item(value, 398, 27, 'mp4 ', diablo2::UNIT_STAT_gembag_PotionsMana);
}
void d2_tweaks::client::modules::loot_filter_settings_menu::extract_mp5(bool value) {
loot_filter_settings::get().m_show_mp5 = value;
extract_item(value, 398, 81, 'mp5 ', diablo2::UNIT_STAT_gembag_PotionsMana);
}
// End Rune Extraction Functions
// Rejuv Potions

View File

@ -510,6 +510,28 @@ bool isStoneCode(const char* normCode) {
return false;
}
void sendPacketAndUpdateProperty(int gemBagGuid, uint32_t iCode, int prop, int val, int item_guid, diablo2::structures::unit* gemBag) {
// 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);
}
LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
static auto& instance = singleton<ui_manager>::instance();
@ -1163,43 +1185,65 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
if (strncmp(normCode, "rvs", 3) == 0) {
// Create the packet
static d2_tweaks::common::item_move_cs packet;
packet.bag_guid = gemBagGuid;
packet.updateBag = 1;
packet.iCode = 'rvs ';
packet.prop = 396 - 3;
packet.val = 1;
packet.item_guid = g_hoverItem->guid;
packet.target_page = 99;
diablo2::d2_client::send_to_server(&packet, sizeof packet);
D2PropertyStrc itemProperty = {};
itemProperty.nProperty = 396 - 3; // Adjust the property ID
itemProperty.nLayer = 0;
itemProperty.nMin = 1;
itemProperty.nMax = 1;
diablo2::d2_common::add_property(gemBag, &itemProperty, 0);
sendPacketAndUpdateProperty(gemBagGuid, 'rvs ', 396, 1, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "rvl", 3) == 0) {
// Create the packet
static d2_tweaks::common::item_move_cs packet;
packet.bag_guid = gemBagGuid;
packet.updateBag = 1;
packet.iCode = 'rvl ';
packet.prop = 396 - 3;
packet.val = 3;
packet.item_guid = g_hoverItem->guid;
packet.target_page = 99;
diablo2::d2_client::send_to_server(&packet, sizeof packet);
D2PropertyStrc itemProperty = {};
itemProperty.nProperty = 396 - 3; // Adjust the property ID
itemProperty.nLayer = 0;
itemProperty.nMin = 3;
itemProperty.nMax = 3;
diablo2::d2_common::add_property(gemBag, &itemProperty, 0);
sendPacketAndUpdateProperty(gemBagGuid, 'rvl ', 396, 3, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "hp1", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'hp1 ', 397, 1, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "mp1", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'mp1 ', 398, 1, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "hp2", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'hp2 ', 397, 3, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "mp2", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'mp2 ', 398, 3, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "hp3", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'hp3 ', 397, 9, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "mp3", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'mp3 ', 398, 9, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "hp4", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'hp4 ', 397, 27, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "mp4", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'mp4 ', 398, 27, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "hp5", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'hp5 ', 397, 81, g_hoverItem->guid, gemBag);
}
if (strncmp(normCode, "mp5", 3) == 0) {
sendPacketAndUpdateProperty(gemBagGuid, 'mp5 ', 398, 81, g_hoverItem->guid, gemBag);
}
if (isArmorOrWeaponCode(normCode)
|| record->type == 61 - 3 // jewel
|| record->type == 43 - 3 // key