right click add gem works

This commit is contained in:
Hash Borgir 2024-04-27 10:18:57 -06:00
parent f915859023
commit faf21e0a9d
48 changed files with 863 additions and 247 deletions

Binary file not shown.

View File

@ -1,33 +1,3 @@
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory. C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
client.cpp
autosort_client.cpp
auto_gold_pickup_client.cpp
auto_item_pickup_client.cpp
damage_display_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(138,12): warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(144,31): warning C4244: '=': conversion from 'ULONGLONG' to 'long', possible loss of data
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\damage_display\damage_display_client.cpp(267,59): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
item_drop_message_client.cpp
item_move_client.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\client\modules\item_move\item_move_client.cpp(99,33): warning C4018: '<': signed/unsigned mismatch
loot_filter_settings_menu.cpp
test.cpp
trader_update_client.cpp
transmute_client.cpp
autosort_server.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\autosort\autosort_server.cpp(348,25): warning C4018: '<=': signed/unsigned mismatch
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\autosort\autosort_server.cpp(349,26): warning C4018: '<=': signed/unsigned mismatch
auto_gold_pickup_server.cpp
D:\VSCode\d2tweaks-rnd2k\src\d2tweaks\server\modules\auto_gold_pickup\auto_gold_pickup_server.cpp(51,33): warning C4018: '>': signed/unsigned mismatch
auto_item_pickup_server.cpp
damage_display_server.cpp
identify_on_pickup_server.cpp
item_drop_message_server.cpp
item_move_server.cpp
test.cpp
trader_update_server.cpp
transmute_server.cpp
ui_manager.cpp ui_manager.cpp
d2common.cpp
screen.cpp
D2tweaks.vcxproj -> D:\Diablo II\MODS\ironman-dev\D2tweaks.dll D2tweaks.vcxproj -> D:\Diablo II\MODS\ironman-dev\D2tweaks.dll

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <diablo2/structures/unit.h>
namespace d2_tweaks { namespace d2_tweaks {
namespace common { namespace common {
@ -235,6 +236,10 @@ namespace d2_tweaks {
struct item_move_cs : packet_header { struct item_move_cs : packet_header {
uint32_t item_guid; uint32_t item_guid;
uint8_t target_page; uint8_t target_page;
uint32_t bag_guid = 0;
bool updateBag;
int prop;
int val;
item_move_cs() : item_guid(0), target_page(0) { item_move_cs() : item_guid(0), target_page(0) {
message_type = MESSAGE_TYPE_ITEM_MOVE; message_type = MESSAGE_TYPE_ITEM_MOVE;
@ -246,7 +251,10 @@ namespace d2_tweaks {
uint32_t tx; uint32_t tx;
uint32_t ty; uint32_t ty;
uint8_t target_page; uint8_t target_page;
uint32_t bag_guid = 0;
bool updateBag;
int prop;
int val;
item_move_sc() : item_guid(0), tx(0), ty(0), target_page(0) { item_move_sc() : item_guid(0), tx(0), ty(0), target_page(0) {
message_type = MESSAGE_TYPE_ITEM_MOVE; message_type = MESSAGE_TYPE_ITEM_MOVE;
} }
@ -254,12 +262,15 @@ namespace d2_tweaks {
struct inventory_sort_cs : packet_header { struct inventory_sort_cs : packet_header {
uint8_t page; uint8_t page;
diablo2::structures::unit* item_to_remove;
bool remItem;
inventory_sort_cs() : page(0) { inventory_sort_cs() : page(0) {
message_type = MESSAGE_TYPE_INVENTORY_SORT; message_type = MESSAGE_TYPE_INVENTORY_SORT;
} }
}; };
struct inventory_sort_sc : packet_header { struct inventory_sort_sc : packet_header {
uint8_t page; uint8_t page;
uint8_t tx; uint8_t tx;

View File

@ -981,6 +981,7 @@ namespace diablo2 {
//static void diablo2::d2_common::set_item_flags(structures::unit* item, structures::itemflags_t dwFlag, bool bSet); //static void diablo2::d2_common::set_item_flags(structures::unit* item, structures::itemflags_t dwFlag, bool bSet);
static void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* pProperty, int nUnused); static void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* pProperty, int nUnused);
static void diablo2::d2_common::ITEMS_SetItemFlag(structures::unit* item, uint32_t dwFlag, BOOL bSet);
}; };
} }

View File

@ -157,6 +157,13 @@ public:
// Initialize statValue // Initialize statValue
int32_t statValue = 0; int32_t statValue = 0;
if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH)) {
diablo2::d2_gfx::draw_filled_rect(130, 48, 640, 155, 5, 50);
}
if (m_stats_enabled) { if (m_stats_enabled) {
for (const auto& stat : stats) { for (const auto& stat : stats) {
@ -441,6 +448,10 @@ public:
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16 diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
} }
} }
} }

View File

@ -222,7 +222,7 @@ static void draw_damage_labels() {
// Determine the color based on healthPercentage // Determine the color based on healthPercentage
diablo2::ui_color_t textColor; diablo2::ui_color_t textColor;
textColor = healthPercentage >= 0.67f ? diablo2::UI_COLOR_GREEN : (healthPercentage <= 0.33f ? diablo2::UI_COLOR_RED : diablo2::UI_COLOR_YELLOW); textColor = healthPercentage >= 0.8f ? diablo2::UI_COLOR_GREEN : (healthPercentage <= 0.5f ? diablo2::UI_COLOR_RED : diablo2::UI_COLOR_YELLOW);
// Construct the health fraction string // Construct the health fraction string
std::wstring fractionStr = std::to_wstring(label->currentHp) + L"/" + std::to_wstring(label->maxHp); std::wstring fractionStr = std::to_wstring(label->currentHp) + L"/" + std::to_wstring(label->maxHp);
@ -236,19 +236,22 @@ static void draw_damage_labels() {
uint32_t textY = my; uint32_t textY = my;
// Define default bar color // Define default bar color
diablo2::ui_color_t barColor; int barColor;
// Determine bar color based on health percentage // Determine bar color based on health percentage
if (healthPercentage > .80) { if (healthPercentage > .80) {
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GREEN; barColor = 132;
} }
else if (healthPercentage > .50) { else if (healthPercentage > .50) {
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GOLD; barColor = 12;
} }
else { else {
barColor = diablo2::ui_color_t::UI_COLOR_RED; barColor = 10;
} }
// Get the width of the combinedText string
int32_t combinedTextWidth = diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(combinedTextPtr));
// Draw the combined text (health percentage and bar text) // Draw the combined text (health percentage and bar text)
//diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedTcombinedTextext.c_str()), textX, textY, textColor, 0); //diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedTcombinedTextext.c_str()), textX, textY, textColor, 0);
//diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(fractionStr.c_str()), textX + label->unit_width/2, textY - 12, 0, 0, textColor); //diablo2::d2_win::draw_boxed_text(const_cast<wchar_t*>(fractionStr.c_str()), textX + label->unit_width/2, textY - 12, 0, 0, textColor);
@ -263,8 +266,8 @@ static void draw_damage_labels() {
int _barHeight = GetPrivateProfileIntA("Options", "barHeight", 0, "./D2Tweaks.ini"); int _barHeight = GetPrivateProfileIntA("Options", "barHeight", 0, "./D2Tweaks.ini");
diablo2::d2_win::set_current_font(diablo2::UI_FONT_6); // Set font to FONT16 diablo2::d2_win::set_current_font(diablo2::UI_FONT_6); // Set font to FONT16
diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, barColor, 0); diablo2::d2_win::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, textColor, 0);
diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * 60, textY + _barHeight, 5, 255); diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * combinedTextWidth, textY + _barHeight, barColor, 255);
const auto offset = static_cast<int32_t>(lerp(static_cast<float>(label->unit_height) + 5.f, static_cast<float>(label->unit_height) + 30.f, static_cast<float>(delta) / static_cast<float>(DISPLAY_TIME))); const auto offset = static_cast<int32_t>(lerp(static_cast<float>(label->unit_height) + 5.f, static_cast<float>(label->unit_height) + 30.f, static_cast<float>(delta) / static_cast<float>(DISPLAY_TIME)));
my -= offset; my -= offset;

View File

@ -138,6 +138,8 @@ void d2_tweaks::client::modules::item_move::init() {
} }
} }
// handle packet coming from the server
void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* packet) { void d2_tweaks::client::modules::item_move::handle_packet(common::packet_header* packet) {
static auto& instance = singleton<client>::instance(); static auto& instance = singleton<client>::instance();

View File

@ -9,7 +9,7 @@
#include <DllNotify.h> #include <DllNotify.h>
#include <D2Template.h> #include <D2Template.h>
bool m_stats_enabled = true; bool m_stats_enabled = false;
d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settings_toggle_menu(token) { d2_tweaks::client::modules::loot_filter_settings_toggle_menu::loot_filter_settings_toggle_menu(token) {
m_show = false; m_show = false;

View File

@ -62,7 +62,28 @@ void d2_tweaks::server::modules::autosort::init() {
bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::game* game, bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::game* game,
diablo2::structures::unit* player, common::packet_header* packet) { diablo2::structures::unit* player, common::packet_header* packet) {
sort(game, player, static_cast<common::inventory_sort_cs*>(packet)->page);
if (static_cast<common::inventory_sort_cs*>(packet)->remItem == 1) {
diablo2::d2_common::inv_remove_item(player->inventory, static_cast<common::inventory_sort_cs*>(packet)->item_to_remove);
diablo2::d2_game::update_inventory_items(game, player);
static_cast<common::inventory_sort_cs*>(packet)->item_to_remove = nullptr;
for (auto item = player->inventory->first_item; item != nullptr; item = item->item_data->pt_next_item) {
if (item == static_cast<common::inventory_sort_cs*>(packet)->item_to_remove) {
diablo2::d2_common::inv_remove_item(player->inventory, item);
diablo2::d2_game::update_inventory_items(game, player);
}
}
MessageBoxA(NULL, "Item removed", "Item removed", MB_OK);
}
else {
sort(game, player, static_cast<common::inventory_sort_cs*>(packet)->page);
}
return true; return true;
} }

View File

@ -11,6 +11,8 @@
#include <diablo2/structures/item_data.h> #include <diablo2/structures/item_data.h>
#include <diablo2/structures/player_data.h> #include <diablo2/structures/player_data.h>
#include <spdlog/spdlog.h>
MODULE_INIT(item_move) MODULE_INIT(item_move)
void d2_tweaks::server::modules::item_move::init() { void d2_tweaks::server::modules::item_move::init() {
@ -25,6 +27,8 @@ void d2_tweaks::server::modules::item_move::init() {
} }
} }
// handle packet coming from the client
bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::game* game, bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::game* game,
diablo2::structures::unit* player, common::packet_header* packet) { diablo2::structures::unit* player, common::packet_header* packet) {
static common::item_move_sc resp; static common::item_move_sc resp;
@ -32,6 +36,15 @@ bool d2_tweaks::server::modules::item_move::handle_packet(diablo2::structures::g
const auto itemMove = static_cast<common::item_move_cs*>(packet); const auto itemMove = static_cast<common::item_move_cs*>(packet);
const auto item = instance.get_server_unit(game, itemMove->item_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item const auto item = instance.get_server_unit(game, itemMove->item_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item
const auto bag = instance.get_server_unit(game, itemMove->bag_guid, diablo2::structures::unit_type_t::UNIT_TYPE_ITEM); //0x4 = item
D2PropertyStrc itemProperty = {};
itemProperty.nProperty = itemMove->prop;
itemProperty.nLayer = 0;
itemProperty.nMin = itemMove->val;
itemProperty.nMax = itemMove->val;
diablo2::d2_common::add_property(bag, &itemProperty, 1);
if (item == nullptr) if (item == nullptr)
return true; //block further packet processing return true; //block further packet processing

File diff suppressed because it is too large Load Diff

View File

@ -256,3 +256,8 @@ void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* pr
static wrap_func_std_import<void(structures::unit* item, D2PropertyStrc* prop, int nUnused)> add_property(10868, get_base()); static wrap_func_std_import<void(structures::unit* item, D2PropertyStrc* prop, int nUnused)> add_property(10868, get_base());
add_property(item, prop, nUnused); add_property(item, prop, nUnused);
} }
void diablo2::d2_common::ITEMS_SetItemFlag(structures::unit* item, uint32_t dwFlag, BOOL bSet) {
static wrap_func_std_import<void(structures::unit* item, uint32_t dwFlag, BOOL bSet)> ITEMS_SetItemFlag(10708, get_base());
ITEMS_SetItemFlag(item, dwFlag, bSet);
}