Cleanup and fix itemtypes checks

This commit is contained in:
Hash Borgir 2024-05-04 02:10:56 -06:00
parent aec114d05c
commit 69965f77d1
3 changed files with 45 additions and 21 deletions

View File

@ -152,7 +152,6 @@ namespace diablo2 {
uint16_t pad0x13E; //0x13E
uint32_t dwStuff; //0x140
};
}
enum unit_stats_t {
@ -1038,7 +1037,7 @@ namespace diablo2 {
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);
//D2Common.0x6FDA42B0
// D2ItemStatCostTxt* __fastcall ITEMS_GetItemStatCostTxtRecord(int nStatId)
// Write a function signature for this function
@ -1047,8 +1046,5 @@ namespace diablo2 {
//D2Common.0x6FD57720 (#10602)
//int __stdcall DATATBLS_GetItemIdFromItemCode(uint32_t dwCode)
static int get_item_id_from_item_code(uint32_t dwCode);
};
}

View File

@ -392,7 +392,6 @@ public:
int pbarWidth = GetPrivateProfileIntA("Options", "pbarWidth", 200, "./d2tweaks.ini");
int pbarHeight = GetPrivateProfileIntA("Options", "pbarHeight", 16, "./d2tweaks.ini");
// Define the coordinates for the bars
int barX = 245; // Left coordinate of the bars
int barY_HP = 728; // Top coordinate of the HP bar
@ -422,8 +421,6 @@ public:
int player_bars_X_mana = GetPrivateProfileIntA("Options", "player_bars_mana_X", barX, "./d2tweaks.ini");
int player_bars_Y_mana = GetPrivateProfileIntA("Options", "player_bars_mana_Y", barY_Mana, "./d2tweaks.ini");
if (player_bars_enabled_hp == 1) {
// Draw the filled HP bar
diablo2::d2_gfx::draw_filled_rect(player_bars_X_hp, player_bars_Y_hp, barX + filledHPWidth, barY_HP + pbarHeight, barColor, 255);

View File

@ -767,9 +767,28 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
}
}
if (isArmorOrWeaponCode(normCode) ||
(record->type >= 109 && record->type <= 125) ||
(record->type >= 1 && record->type <= 50)) {
if (isArmorOrWeaponCode(normCode)
|| record->type == 109
|| record->type == 111
|| record->type == 112
|| record->type == 113
|| record->type == 120
|| record->type == 113
|| record->type == 122
|| record->type == 123
|| record->type == 125
|| record->type == 4 - 3
|| record->type == 5 - 3
|| record->type == 17 - 3
|| record->type == 18 - 3
|| record->type == 21 - 3
|| record->type == 26 - 3
|| record->type == 27 - 3
|| record->type == 28 - 3
|| record->type == 29 - 3
|| record->type == 30 - 3
|| record->type == 31 - 3
|| record->type == 32 - 3) {
// Create a packet to move an item
static d2_tweaks::common::item_move_cs packet;
@ -911,16 +930,28 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
}
}
if (isArmorOrWeaponCode(normCode) ||
record->type == 109 ||
record->type == 111 ||
record->type == 112 ||
record->type == 113 ||
record->type == 120 ||
record->type == 122 ||
record->type == 123 ||
record->type == 125 ||
(record->type >= (1) && record->type <= (50))) {
if (isArmorOrWeaponCode(normCode)
|| record->type == 109
|| record->type == 111
|| record->type == 112
|| record->type == 113
|| record->type == 120
|| record->type == 113
|| record->type == 122
|| record->type == 123
|| record->type == 125
|| record->type == 4 - 3
|| record->type == 5 - 3
|| record->type == 17 - 3
|| record->type == 18 - 3
|| record->type == 21 - 3
|| record->type == 26 - 3
|| record->type == 27 - 3
|| record->type == 28 - 3
|| record->type == 29 - 3
|| record->type == 30 - 3
|| record->type == 31 - 3
|| record->type == 32 - 3) {
char currentPage;
// open the cube