Added 250ms delay to sendPacketAndUpdateProperty

This commit is contained in:
Hash Borgir 2024-05-09 09:13:42 -06:00
parent 43defeb6d8
commit 058db50095
3 changed files with 29 additions and 19 deletions

View File

@ -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<wchar_t*>((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);
}
}

View File

@ -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) {

View File

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