mirror of
https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
synced 2025-09-19 01:52:08 +00:00
right click add gem works
This commit is contained in:
@@ -157,6 +157,13 @@ public:
|
||||
// Initialize statValue
|
||||
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) {
|
||||
for (const auto& stat : stats) {
|
||||
|
||||
@@ -441,6 +448,10 @@ public:
|
||||
diablo2::d2_win::set_current_font(diablo2::UI_FONT_16); // Set font to FONT16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -222,7 +222,7 @@ static void draw_damage_labels() {
|
||||
// Determine the color based on healthPercentage
|
||||
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
|
||||
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;
|
||||
|
||||
// Define default bar color
|
||||
diablo2::ui_color_t barColor;
|
||||
int barColor;
|
||||
|
||||
// Determine bar color based on health percentage
|
||||
if (healthPercentage > .80) {
|
||||
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GREEN;
|
||||
barColor = 132;
|
||||
}
|
||||
else if (healthPercentage > .50) {
|
||||
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GOLD;
|
||||
barColor = 12;
|
||||
}
|
||||
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)
|
||||
//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);
|
||||
@@ -263,8 +266,8 @@ static void draw_damage_labels() {
|
||||
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::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, barColor, 0);
|
||||
diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * 60, textY + _barHeight, 5, 255);
|
||||
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 * 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)));
|
||||
my -= offset;
|
||||
|
@@ -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) {
|
||||
static auto& instance = singleton<client>::instance();
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include <DllNotify.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) {
|
||||
m_show = false;
|
||||
|
@@ -62,7 +62,28 @@ void d2_tweaks::server::modules::autosort::init() {
|
||||
|
||||
bool d2_tweaks::server::modules::autosort::handle_packet(diablo2::structures::game* game,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#include <diablo2/structures/item_data.h>
|
||||
#include <diablo2/structures/player_data.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
MODULE_INIT(item_move)
|
||||
|
||||
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,
|
||||
diablo2::structures::unit* player, common::packet_header* packet) {
|
||||
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 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)
|
||||
return true; //block further packet processing
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user