merge fix

This commit is contained in:
Hash Borgir 2024-04-27 12:29:57 -06:00
commit bcadeed0e7
49 changed files with 1052 additions and 83 deletions

Binary file not shown.

View File

@ -1,36 +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
client_module.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(252,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
loot_filter_settings_toggle_menu.cpp
small_patches.cpp
test.cpp
trader_update_client.cpp
transmute_client.cpp
asset_manager.cpp
trader_update_server.cpp
server.cpp
button.cpp
checkbox.cpp
group.cpp
image.cpp
label.cpp
menu.cpp
ui_manager.cpp ui_manager.cpp
d2gfx.cpp
d2win.cpp
main.cpp
D2Template.cpp
DllNotify.cpp
LINK : ..\..\Diablo II\MODS\ironman-dev\D2tweaks.dll not found or not built by the last incremental link; performing full link
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

@ -75,6 +75,14 @@
// //
//extern DataTables* sgptDataTables; //extern DataTables* sgptDataTables;
struct D2PropertyStrc
{
int32_t nProperty; //0x00
int32_t nLayer; //0x04
int32_t nMin; //0x08
int32_t nMax; //0x0C
};
namespace diablo2 { namespace diablo2 {
namespace structures { namespace structures {
struct unit; struct unit;
@ -387,9 +395,528 @@ namespace diablo2 {
UNIT_STAT_ITEM_DAMAGE_UNDEAD_BYTIME = 0x129, UNIT_STAT_ITEM_DAMAGE_UNDEAD_BYTIME = 0x129,
UNIT_STAT_ITEM_TOHIT_DEMON_BYTIME = 0x12A, UNIT_STAT_ITEM_TOHIT_DEMON_BYTIME = 0x12A,
UNIT_STAT_ITEM_TOHIT_UNDEAD_BYTIME = 0x12B, UNIT_STAT_ITEM_TOHIT_UNDEAD_BYTIME = 0x12B,
UNIT_STAT_ITEM_CRUSHINGBLOW_BYTIME = 0x12C UNIT_STAT_ITEM_CRUSHINGBLOW_BYTIME = 0x12C,
// unit_stats_t from Ironman mod
UNIT_STAT_strength = 0,
UNIT_STAT_energy = 1,
UNIT_STAT_dexterity = 2,
UNIT_STAT_vitality = 3,
UNIT_STAT_statpts = 4,
UNIT_STAT_newskills = 5,
UNIT_STAT_hitpoints = 6,
UNIT_STAT_maxhp = 7,
UNIT_STAT_mana = 8,
UNIT_STAT_maxmana = 9,
UNIT_STAT_stamina = 10,
UNIT_STAT_maxstamina = 11,
UNIT_STAT_level = 12,
UNIT_STAT_experience = 13,
UNIT_STAT_gold = 14,
UNIT_STAT_goldbank = 15,
UNIT_STAT_item_armor_percent = 16,
UNIT_STAT_item_maxdamage_percent = 17,
UNIT_STAT_item_mindamage_percent = 18,
UNIT_STAT_tohit = 19,
UNIT_STAT_toblock = 20,
UNIT_STAT_mindamage = 21,
UNIT_STAT_maxdamage = 22,
UNIT_STAT_secondary_mindamage = 23,
UNIT_STAT_secondary_maxdamage = 24,
UNIT_STAT_damagepercent = 25,
UNIT_STAT_manarecovery = 26,
UNIT_STAT_manarecoverybonus = 27,
UNIT_STAT_staminarecoverybonus = 28,
UNIT_STAT_lastexp = 29,
UNIT_STAT_nextexp = 30,
UNIT_STAT_armorclass = 31,
UNIT_STAT_armorclass_vs_missile = 32,
UNIT_STAT_armorclass_vs_hth = 33,
UNIT_STAT_normal_damage_reduction = 34,
UNIT_STAT_magic_damage_reduction = 35,
UNIT_STAT_damageresist = 36,
UNIT_STAT_magicresist = 37,
UNIT_STAT_maxmagicresist = 38,
UNIT_STAT_fireresist = 39,
UNIT_STAT_maxfireresist = 40,
UNIT_STAT_lightresist = 41,
UNIT_STAT_maxlightresist = 42,
UNIT_STAT_coldresist = 43,
UNIT_STAT_maxcoldresist = 44,
UNIT_STAT_poisonresist = 45,
UNIT_STAT_maxpoisonresist = 46,
UNIT_STAT_damageaura = 47,
UNIT_STAT_firemindam = 48,
UNIT_STAT_firemaxdam = 49,
UNIT_STAT_lightmindam = 50,
UNIT_STAT_lightmaxdam = 51,
UNIT_STAT_magicmindam = 52,
UNIT_STAT_magicmaxdam = 53,
UNIT_STAT_coldmindam = 54,
UNIT_STAT_coldmaxdam = 55,
UNIT_STAT_coldlength = 56,
UNIT_STAT_poisonmindam = 57,
UNIT_STAT_poisonmaxdam = 58,
UNIT_STAT_poisonlength = 59,
UNIT_STAT_lifedrainmindam = 60,
UNIT_STAT_lifedrainmaxdam = 61,
UNIT_STAT_manadrainmindam = 62,
UNIT_STAT_manadrainmaxdam = 63,
UNIT_STAT_stamdrainmindam = 64,
UNIT_STAT_stamdrainmaxdam = 65,
UNIT_STAT_stunlength = 66,
UNIT_STAT_velocitypercent = 67,
UNIT_STAT_attackrate = 68,
UNIT_STAT_other_animrate = 69,
UNIT_STAT_quantity = 70,
UNIT_STAT_value = 71,
UNIT_STAT_durability = 72,
UNIT_STAT_maxdurability = 73,
UNIT_STAT_hpregen = 74,
UNIT_STAT_item_maxdurability_percent = 75,
UNIT_STAT_item_maxhp_percent = 76,
UNIT_STAT_item_maxmana_percent = 77,
UNIT_STAT_item_attackertakesdamage = 78,
UNIT_STAT_item_goldbonus = 79,
UNIT_STAT_item_magicbonus = 80,
UNIT_STAT_item_knockback = 81,
UNIT_STAT_item_timeduration = 82,
UNIT_STAT_item_addclassskills = 83,
UNIT_STAT_unsentparam1 = 84,
UNIT_STAT_item_addexperience = 85,
UNIT_STAT_item_healafterkill = 86,
UNIT_STAT_item_reducedprices = 87,
UNIT_STAT_item_doubleherbduration = 88,
UNIT_STAT_item_lightradius = 89,
UNIT_STAT_item_lightcolor = 90,
UNIT_STAT_item_req_percent = 91,
UNIT_STAT_item_levelreq = 92,
UNIT_STAT_item_fasterattackrate = 93,
UNIT_STAT_item_levelreqpct = 94,
UNIT_STAT_lastblockframe = 95,
UNIT_STAT_item_fastermovevelocity = 96,
UNIT_STAT_item_nonclassskill = 97,
UNIT_STAT_state = 98,
UNIT_STAT_item_fastergethitrate = 99,
UNIT_STAT_monster_playercount = 100,
UNIT_STAT_skill_poison_override_length = 101,
UNIT_STAT_item_fasterblockrate = 102,
UNIT_STAT_skill_bypass_undead = 103,
UNIT_STAT_skill_bypass_demons = 104,
UNIT_STAT_item_fastercastrate = 105,
UNIT_STAT_skill_bypass_beasts = 106,
UNIT_STAT_item_singleskill = 107,
UNIT_STAT_item_restinpeace = 108,
UNIT_STAT_curse_resistance = 109,
UNIT_STAT_item_poisonlengthresist = 110,
UNIT_STAT_item_normaldamage = 111,
UNIT_STAT_item_howl = 112,
UNIT_STAT_item_stupidity = 113,
UNIT_STAT_item_damagetomana = 114,
UNIT_STAT_item_ignoretargetac = 115,
UNIT_STAT_item_fractionaltargetac = 116,
UNIT_STAT_item_preventheal = 117,
UNIT_STAT_item_halffreezeduration = 118,
UNIT_STAT_item_tohit_percent = 119,
UNIT_STAT_item_damagetargetac = 120,
UNIT_STAT_item_demondamage_percent = 121,
UNIT_STAT_item_undeaddamage_percent = 122,
UNIT_STAT_item_demon_tohit = 123,
UNIT_STAT_item_undead_tohit = 124,
UNIT_STAT_item_throwable = 125,
UNIT_STAT_item_elemskill = 126,
UNIT_STAT_item_allskills = 127,
UNIT_STAT_item_attackertakeslightdamage = 128,
UNIT_STAT_ironmaiden_level = 129,
UNIT_STAT_lifetap_level = 130,
UNIT_STAT_thorns_percent = 131,
UNIT_STAT_bonearmor = 132,
UNIT_STAT_bonearmormax = 133,
UNIT_STAT_item_freeze = 134,
UNIT_STAT_item_openwounds = 135,
UNIT_STAT_item_crushingblow = 136,
UNIT_STAT_item_kickdamage = 137,
UNIT_STAT_item_manaafterkill = 138,
UNIT_STAT_item_healafterdemonkill = 139,
UNIT_STAT_item_extrablood = 140,
UNIT_STAT_item_deadlystrike = 141,
UNIT_STAT_item_absorbfire_percent = 142,
UNIT_STAT_item_absorbfire = 143,
UNIT_STAT_item_absorblight_percent = 144,
UNIT_STAT_item_absorblight = 145,
UNIT_STAT_item_absorbmagic_percent = 146,
UNIT_STAT_item_absorbmagic = 147,
UNIT_STAT_item_absorbcold_percent = 148,
UNIT_STAT_item_absorbcold = 149,
UNIT_STAT_item_slow = 150,
UNIT_STAT_item_aura = 151,
UNIT_STAT_item_indesctructible = 152,
UNIT_STAT_item_cannotbefrozen = 153,
UNIT_STAT_item_staminadrainpct = 154,
UNIT_STAT_item_reanimate = 155,
UNIT_STAT_item_pierce = 156,
UNIT_STAT_item_magicarrow = 157,
UNIT_STAT_item_explosivearrow = 158,
UNIT_STAT_item_throw_mindamage = 159,
UNIT_STAT_item_throw_maxdamage = 160,
UNIT_STAT_skill_handofathena = 161,
UNIT_STAT_skill_staminapercent = 162,
UNIT_STAT_skill_passive_staminapercent = 163,
UNIT_STAT_skill_concentration = 164,
UNIT_STAT_skill_enchant = 165,
UNIT_STAT_skill_pierce = 166,
UNIT_STAT_skill_conviction = 167,
UNIT_STAT_skill_chillingarmor = 168,
UNIT_STAT_skill_frenzy = 169,
UNIT_STAT_skill_decrepify = 170,
UNIT_STAT_skill_armor_percent = 171,
UNIT_STAT_alignment = 172,
UNIT_STAT_target0 = 173,
UNIT_STAT_target1 = 174,
UNIT_STAT_goldlost = 175,
UNIT_STAT_conversion_level = 176,
UNIT_STAT_conversion_maxhp = 177,
UNIT_STAT_unit_dooverlay = 178,
UNIT_STAT_attack_vs_montype = 179,
UNIT_STAT_damage_vs_montype = 180,
UNIT_STAT_fade = 181,
UNIT_STAT_armor_override_percent = 182,
UNIT_STAT_killcounter = 183,
UNIT_STAT_soulscaptured = 184,
UNIT_STAT_spirits = 185,
UNIT_STAT_skill_more = 186,
UNIT_STAT_item_corrupted = 187,
UNIT_STAT_item_addskill_tab = 188,
UNIT_STAT_hidden_corruption = 189,
UNIT_STAT_item_strength_spirits = 190,
UNIT_STAT_item_dexterity_spirits = 191,
UNIT_STAT_item_vitality_spirits = 192,
UNIT_STAT_item_energy_spirits = 193,
UNIT_STAT_item_numsockets = 194,
UNIT_STAT_item_skillonattack = 195,
UNIT_STAT_item_skillonkill = 196,
UNIT_STAT_item_skillondeath = 197,
UNIT_STAT_item_skillonhit = 198,
UNIT_STAT_item_skillonlevelup = 199,
UNIT_STAT_item_skill_souls = 200,
UNIT_STAT_item_skillongethit = 201,
UNIT_STAT_UNUSED_2 = 202,
UNIT_STAT_UNUSED_3 = 203,
UNIT_STAT_item_charged_skill = 204,
UNIT_STAT_UNUSED_5 = 205,
UNIT_STAT_UNUSED_6 = 206,
UNIT_STAT_UNUSED_7 = 207,
UNIT_STAT_UNUSED_8 = 208,
UNIT_STAT_UNUSED_9 = 209,
UNIT_STAT_UNUSED_10 = 210,
UNIT_STAT_UNUSED_11 = 211,
UNIT_STAT_UNUSED_12 = 212,
UNIT_STAT_UNUSED_13 = 213,
UNIT_STAT_item_armor_perlevel = 214,
UNIT_STAT_item_armorpercent_perlevel = 215,
UNIT_STAT_item_hp_perlevel = 216,
UNIT_STAT_item_mana_perlevel = 217,
UNIT_STAT_item_maxdamage_perlevel = 218,
UNIT_STAT_item_maxdamage_percent_perlevel = 219,
UNIT_STAT_item_strength_perlevel = 220,
UNIT_STAT_item_dexterity_perlevel = 221,
UNIT_STAT_item_energy_perlevel = 222,
UNIT_STAT_item_vitality_perlevel = 223,
UNIT_STAT_item_tohit_perlevel = 224,
UNIT_STAT_item_tohitpercent_perlevel = 225,
UNIT_STAT_item_cold_damagemax_perlevel = 226,
UNIT_STAT_item_fire_damagemax_perlevel = 227,
UNIT_STAT_item_ltng_damagemax_perlevel = 228,
UNIT_STAT_item_pois_damagemax_perlevel = 229,
UNIT_STAT_item_resist_cold_perlevel = 230,
UNIT_STAT_item_resist_fire_perlevel = 231,
UNIT_STAT_item_resist_ltng_perlevel = 232,
UNIT_STAT_item_resist_pois_perlevel = 233,
UNIT_STAT_item_absorb_cold_perlevel = 234,
UNIT_STAT_item_absorb_fire_perlevel = 235,
UNIT_STAT_item_absorb_ltng_perlevel = 236,
UNIT_STAT_item_absorb_pois_perlevel = 237,
UNIT_STAT_item_thorns_perlevel = 238,
UNIT_STAT_UNUSED_84 = 239,
UNIT_STAT_item_find_magic_perlevel = 240,
UNIT_STAT_item_regenstamina_perlevel = 241,
UNIT_STAT_item_stamina_perlevel = 242,
UNIT_STAT_item_damage_demon_perlevel = 243,
UNIT_STAT_item_damage_undead_perlevel = 244,
UNIT_STAT_item_tohit_demon_perlevel = 245,
UNIT_STAT_item_tohit_undead_perlevel = 246,
UNIT_STAT_item_crushingblow_perlevel = 247,
UNIT_STAT_item_openwounds_perlevel = 248,
UNIT_STAT_item_kick_damage_perlevel = 249,
UNIT_STAT_item_deadlystrike_perlevel = 250,
UNIT_STAT_item_find_gems_perlevel = 251,
UNIT_STAT_item_replenish_durability = 252,
UNIT_STAT_item_replenish_quantity = 253,
UNIT_STAT_item_extra_stack = 254,
UNIT_STAT_item_find_item = 255,
UNIT_STAT_item_slash_damage = 256,
UNIT_STAT_item_slash_damage_percent = 257,
UNIT_STAT_item_crush_damage = 258,
UNIT_STAT_item_crush_damage_percent = 259,
UNIT_STAT_item_thrust_damage = 260,
UNIT_STAT_item_thrust_damage_percent = 261,
UNIT_STAT_item_absorb_slash = 262,
UNIT_STAT_item_absorb_crush = 263,
UNIT_STAT_item_absorb_thrust = 264,
UNIT_STAT_item_absorb_slash_percent = 265,
UNIT_STAT_item_absorb_crush_percent = 266,
UNIT_STAT_item_absorb_thrust_percent = 267,
UNIT_STAT_UNUSED_14 = 268,
UNIT_STAT_UNUSED_15 = 269,
UNIT_STAT_UNUSED_16 = 270,
UNIT_STAT_UNUSED_17 = 271,
UNIT_STAT_UNUSED_18 = 272,
UNIT_STAT_UNUSED_19 = 273,
UNIT_STAT_UNUSED_20 = 274,
UNIT_STAT_UNUSED_21 = 275,
UNIT_STAT_UNUSED_22 = 276,
UNIT_STAT_UNUSED_23 = 277,
UNIT_STAT_UNUSED_24 = 278,
UNIT_STAT_UNUSED_25 = 279,
UNIT_STAT_UNUSED_26 = 280,
UNIT_STAT_UNUSED_27 = 281,
UNIT_STAT_UNUSED_28 = 282,
UNIT_STAT_UNUSED_29 = 283,
UNIT_STAT_UNUSED_30 = 284,
UNIT_STAT_UNUSED_31 = 285,
UNIT_STAT_UNUSED_32 = 286,
UNIT_STAT_UNUSED_33 = 287,
UNIT_STAT_UNUSED_34 = 288,
UNIT_STAT_UNUSED_35 = 289,
UNIT_STAT_UNUSED_36 = 290,
UNIT_STAT_UNUSED_37 = 291,
UNIT_STAT_UNUSED_38 = 292,
UNIT_STAT_UNUSED_39 = 293,
UNIT_STAT_UNUSED_40 = 294,
UNIT_STAT_UNUSED_41 = 295,
UNIT_STAT_UNUSED_42 = 296,
UNIT_STAT_UNUSED_43 = 297,
UNIT_STAT_UNUSED_44 = 298,
UNIT_STAT_display_spirits = 299,
UNIT_STAT_display_souls_captured = 300,
UNIT_STAT_magharv = 301,
UNIT_STAT_dummy = 302,
UNIT_STAT_display_kills = 303,
UNIT_STAT_iforge = 304,
UNIT_STAT_item_pierce_cold = 305,
UNIT_STAT_item_pierce_fire = 306,
UNIT_STAT_item_pierce_ltng = 307,
UNIT_STAT_item_pierce_pois = 308,
UNIT_STAT_item_damage_vs_monster = 309,
UNIT_STAT_item_damage_percent_vs_monster = 310,
UNIT_STAT_item_tohit_vs_monster = 311,
UNIT_STAT_item_tohit_percent_vs_monster = 312,
UNIT_STAT_item_ac_vs_monster = 313,
UNIT_STAT_item_ac_percent_vs_monster = 314,
UNIT_STAT_firelength = 315,
UNIT_STAT_burningmin = 316,
UNIT_STAT_burningmax = 317,
UNIT_STAT_progressive_damage = 318,
UNIT_STAT_progressive_steal = 319,
UNIT_STAT_progressive_other = 320,
UNIT_STAT_progressive_fire = 321,
UNIT_STAT_progressive_cold = 322,
UNIT_STAT_progressive_lightning = 323,
UNIT_STAT_item_extra_charges = 324,
UNIT_STAT_progressive_tohit = 325,
UNIT_STAT_poison_count = 326,
UNIT_STAT_damage_framerate = 327,
UNIT_STAT_pierce_idx = 328,
UNIT_STAT_passive_fire_mastery = 329,
UNIT_STAT_passive_ltng_mastery = 330,
UNIT_STAT_passive_cold_mastery = 331,
UNIT_STAT_passive_pois_mastery = 332,
UNIT_STAT_passive_fire_pierce = 333,
UNIT_STAT_passive_ltng_pierce = 334,
UNIT_STAT_passive_cold_pierce = 335,
UNIT_STAT_passive_pois_pierce = 336,
UNIT_STAT_passive_critical_strike = 337,
UNIT_STAT_passive_dodge = 338,
UNIT_STAT_passive_avoid = 339,
UNIT_STAT_passive_evade = 340,
UNIT_STAT_passive_warmth = 341,
UNIT_STAT_passive_mastery_melee_th = 342,
UNIT_STAT_passive_mastery_melee_dmg = 343,
UNIT_STAT_passive_mastery_melee_crit = 344,
UNIT_STAT_passive_mastery_throw_th = 345,
UNIT_STAT_passive_mastery_throw_dmg = 346,
UNIT_STAT_passive_mastery_throw_crit = 347,
UNIT_STAT_passive_weaponblock = 348,
UNIT_STAT_passive_summon_resist = 349,
UNIT_STAT_modifierlist_skill = 350,
UNIT_STAT_modifierlist_level = 351,
UNIT_STAT_last_sent_hp_pct = 352,
UNIT_STAT_source_unit_type = 353,
UNIT_STAT_source_unit_id = 354,
UNIT_STAT_shortparam1 = 355,
UNIT_STAT_questitemdifficulty = 356,
UNIT_STAT_passive_mag_mastery = 357,
UNIT_STAT_passive_mag_pierce = 358,
UNIT_STAT_item_strength_percent = 359,
UNIT_STAT_item_dexterity_percent = 360,
UNIT_STAT_item_vitality_percent = 361,
UNIT_STAT_item_energy_percent = 362,
UNIT_STAT_item_strengthpercent_perlevel = 363,
UNIT_STAT_item_dexteritypercent_perlevel = 364,
UNIT_STAT_item_energypercent_perlevel = 365,
UNIT_STAT_item_vitalitypercent_perlevel = 366,
UNIT_STAT_item_attackergetsblind = 367,
UNIT_STAT_item_attackerflees = 368,
UNIT_STAT_item_attackertakesfiredamage = 369,
UNIT_STAT_item_attackertakescolddamage = 370,
UNIT_STAT_item_maxdamage_perstr = 371,
UNIT_STAT_item_maxdamage_perdex = 372,
UNIT_STAT_item_mindamage_perlvl = 373,
UNIT_STAT_item_mindamage_perstr = 374,
UNIT_STAT_item_mindamage_perdex = 375,
UNIT_STAT_item_maxdamage_percent_perstr = 376,
UNIT_STAT_item_maxdamage_percent_perdex = 377,
UNIT_STAT_item_openwounds_perdex = 378,
UNIT_STAT_item_openwounds_perstr = 379,
UNIT_STAT_item_deadlystrike_perdex = 380,
UNIT_STAT_item_deadlystrike_perstr = 381,
UNIT_STAT_item_armor_perstr = 382,
UNIT_STAT_item_armor_perdex = 383,
UNIT_STAT_item_tohit_perstr = 384,
UNIT_STAT_item_tohit_perDex = 385,
UNIT_STAT_item_hp_pervitality = 386,
UNIT_STAT_item_mana_perenr = 387,
UNIT_STAT_item_fastercastrate_perenr = 388,
UNIT_STAT_item_fasterblockrate_perdex = 389,
UNIT_STAT_item_fastermovevelocity_pervitality = 390,
UNIT_STAT_item_fasterswingvelocity_perstrength = 391,
UNIT_STAT_item_mindamage_percent_perstr = 392,
UNIT_STAT_item_mindamage_percent_perdex = 393,
UNIT_STAT_item_mindamage_percent_perlvl = 394,
UNIT_STAT_item_crushingblow_perstr = 395,
UNIT_STAT_item_crushingblow_perdex = 396,
UNIT_STAT_item_elemskillcold = 397,
UNIT_STAT_item_elemskilllight = 398,
UNIT_STAT_item_elemskillpoison = 399,
UNIT_STAT_item_elemskillmagic = 400,
UNIT_STAT_item_elemskillfire = 401,
UNIT_STAT_item_armorpercent_perstr = 402,
UNIT_STAT_item_armorpercent_perdex = 403,
UNIT_STAT_item_tohitpercent_perstr = 404,
UNIT_STAT_item_tohitpercent_perdex = 405,
UNIT_STAT_item_fasterswingvelocity_perdex = 406,
UNIT_STAT_item_fasterswingvelocity_perlvl = 407,
UNIT_STAT_item_fasterblockrate_perstr = 408,
UNIT_STAT_item_fasterblockrate_perlvl = 409,
UNIT_STAT_item_fastermovevelocity_perdex = 410,
UNIT_STAT_item_fastermovevelocity_perlvl = 411,
UNIT_STAT_item_fastercastrate_perlvl = 412,
UNIT_STAT_item_fasterhitrecovery_pervit = 413,
UNIT_STAT_item_fasterhitrecovery_perlvl = 414,
UNIT_STAT_item_increasedblock_perdex = 415,
UNIT_STAT_item_increasedblock_perlvl = 416,
UNIT_STAT_item_addexperience_perlvl = 417,
UNIT_STAT_item_addexperience_perenr = 418,
UNIT_STAT_item_reducedprices_perlvl = 419,
UNIT_STAT_item_pierce_perlvl = 420,
UNIT_STAT_item_pierce_perstr = 421,
UNIT_STAT_resmax_display_all_zero = 422,
UNIT_STAT_maxmagres_percent = 423,
UNIT_STAT_maxfireres_percent = 424,
UNIT_STAT_maxlightres_percent = 425,
UNIT_STAT_maxcoldres_percent = 426,
UNIT_STAT_maxpoisres_percent = 427,
UNIT_STAT_magicresist_hidden = 428,
UNIT_STAT_maxmagicresist_hidden = 429,
UNIT_STAT_fireresist_hidden = 430,
UNIT_STAT_maxfireresist_hidden = 431,
UNIT_STAT_lightresist_hidden = 432,
UNIT_STAT_maxlightresist_hidden = 433,
UNIT_STAT_coldresist_hidden = 434,
UNIT_STAT_maxcoldresist_hidden = 435,
UNIT_STAT_poisonresist_hidden = 436,
UNIT_STAT_maxpoisonresist_hidden = 437,
UNIT_STAT_hiddenresist_dummy = 438,
UNIT_STAT_item_slow_perlvl = 439,
UNIT_STAT_item_kick_damage_perstr = 440,
UNIT_STAT_item_kick_damage_perdex = 441,
UNIT_STAT_damageresist_perlvl = 442,
UNIT_STAT_damageresist_pervit = 443,
UNIT_STAT_magic_damage_reduction_perlvl = 444,
UNIT_STAT_magic_damage_reduction_perenr = 445,
UNIT_STAT_magicresist_perlvl = 446,
UNIT_STAT_magicresist_perenr = 447,
UNIT_STAT_item_stupidity_perlvl = 448,
UNIT_STAT_item_freeze_perlvl = 449,
UNIT_STAT_item_freeze_perenr = 450,
UNIT_STAT_item_poisonlengthresist_perlvl = 451,
UNIT_STAT_item_poisonlengthresist_pervit = 452,
UNIT_STAT_curse_resistance_perlvl = 453,
UNIT_STAT_curse_resistance_perenr = 454,
UNIT_STAT_curse_resistance_length = 455,
UNIT_STAT_item_manaafterkill_perlvl = 456,
UNIT_STAT_item_manaafterkill_perenr = 457,
UNIT_STAT_item_damagetomana_perlvl = 458,
UNIT_STAT_item_damagetomana_perenr = 459,
UNIT_STAT_item_damagetomana_permana = 460,
UNIT_STAT_UNUSED_45 = 461,
UNIT_STAT_UNUSED_46 = 462,
UNIT_STAT_UNUSED_47 = 463,
UNIT_STAT_UNUSED_48 = 464,
UNIT_STAT_UNUSED_49 = 465,
UNIT_STAT_UNUSED_50 = 466,
UNIT_STAT_UNUSED_51 = 467,
UNIT_STAT_UNUSED_52 = 468,
UNIT_STAT_UNUSED_53 = 469,
UNIT_STAT_UNUSED_54 = 470,
UNIT_STAT_UNUSED_55 = 471,
UNIT_STAT_UNUSED_56 = 472,
UNIT_STAT_UNUSED_57 = 473,
UNIT_STAT_UNUSED_58 = 474,
UNIT_STAT_UNUSED_59 = 475,
UNIT_STAT_UNUSED_60 = 476,
UNIT_STAT_UNUSED_61 = 477,
UNIT_STAT_UNUSED_62 = 478,
UNIT_STAT_UNUSED_63 = 479,
UNIT_STAT_UNUSED_64 = 480,
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_UNUSED_70 = 486,
UNIT_STAT_UNUSED_71 = 487,
UNIT_STAT_UNUSED_72 = 488,
UNIT_STAT_UNUSED_73 = 489,
UNIT_STAT_UNUSED_74 = 490,
UNIT_STAT_UNUSED_75 = 491,
UNIT_STAT_UNUSED_76 = 492,
UNIT_STAT_UNUSED_77 = 493,
UNIT_STAT_UNUSED_78 = 494,
UNIT_STAT_UNUSED_79 = 495,
UNIT_STAT_UNUSED_80 = 496,
UNIT_STAT_passive_sum_mastery = 497,
UNIT_STAT_item_socketmultiplier = 498,
UNIT_STAT_gembag_Ruby = 499,
UNIT_STAT_gembag_Amethyst = 500,
UNIT_STAT_gembag_Diamond = 501,
UNIT_STAT_gembag_Emerald = 502,
UNIT_STAT_gembag_Sapphire = 503,
UNIT_STAT_gembag_Topaz = 504,
UNIT_STAT_gembag_Skull = 505,
UNIT_STAT_runebag_RunesA = 506,
UNIT_STAT_runebag_RunesB = 507,
UNIT_STAT_runebag_RunesC = 508,
UNIT_STAT_UNUSED_83 = 509,
UNIT_STAT_item_aura_display = 510,
}; };
class d2_common { class d2_common {
public: public:
static char* get_base(); static char* get_base();
@ -452,5 +979,9 @@ namespace diablo2 {
static void diablo2::d2_common::refresh_unit_inventory(structures::unit* unit, bool set_update_flags); static void diablo2::d2_common::refresh_unit_inventory(structures::unit* unit, bool set_update_flags);
static void diablo2::d2_common::update_trade(structures::inventory* inventory, structures::unit* item); static void diablo2::d2_common::update_trade(structures::inventory* inventory, structures::unit* item);
//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::ITEMS_SetItemFlag(structures::unit* item, uint32_t dwFlag, BOOL bSet);
}; };
} }

View File

@ -22,6 +22,8 @@ namespace diablo2 {
struct statslistex; struct statslistex;
struct quest_record; struct quest_record;
struct npc_record; struct npc_record;
enum class unit_type_t : int32_t { enum class unit_type_t : int32_t {
UNIT_TYPE_PLAYER = 0, UNIT_TYPE_PLAYER = 0,
@ -74,6 +76,8 @@ namespace diablo2 {
ITEMFLAG_ITEM = 0x08000000 ITEMFLAG_ITEM = 0x08000000
}; };
struct unit { struct unit {
unit_type_t type; unit_type_t type;

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) {
@ -343,12 +350,34 @@ public:
float staminaPercentage = static_cast<float>(statStamina) / static_cast<float>(statMaxStamina); float staminaPercentage = static_cast<float>(statStamina) / static_cast<float>(statMaxStamina);
int sHeight = 768; int sHeight = 768;
int sWidth = 1280; int sWidth = 1280;
int sHCenter = sHeight / 2; int sHCenter = sHeight / 2;
int sWCenter = sWidth / 2; int sWCenter = sWidth / 2;
//spdlog::info("healthPercentage: {}", healthPercentage);
// Define default bar color
DWORD barColor = 0;
// Determine bar color based on health percentage
if (healthPercentage > .80) {
barColor = 118;
}
else if (healthPercentage > .50) {
barColor = 13;
}
else {
barColor = 5;
}
//spdlog::info("barColor: {}", barColor);
// Define the dimensions for the bars // Define the dimensions for the bars
int barWidth = 200; // Width of the bars int barWidth = 200; // Width of the bars
int barHeight = 16; // Height of the bars int barHeight = 16; // Height of the bars
@ -373,17 +402,23 @@ public:
int filledManaWidth = static_cast<int>(manaPercentage * barWidth); int filledManaWidth = static_cast<int>(manaPercentage * barWidth);
int filledStaminaWidth = static_cast<int>(staminaPercentage * barWidth); int filledStaminaWidth = static_cast<int>(staminaPercentage * barWidth);
// at 345 we need to minus the width of the text
int sWCenter = barX + 100 - (diablo2::d2_win::get_text_pixel_width(const_cast<wchar_t*>(mana.c_str())) / 2);
HWND diabloIIWnd = FindDiabloIIWindow(); HWND diabloIIWnd = FindDiabloIIWindow();
// Draw the filled HP bar // Draw the filled HP bar
diablo2::d2_gfx::draw_filled_rect(barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, 10, 255); diablo2::d2_gfx::draw_filled_rect(barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, barColor, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP //DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP
diablo2::d2_win::draw_text(const_cast<wchar_t*>(life.c_str()), sWCenter - (lifeWidth/2), barY_HP + 15, diablo2::ui_color_t::UI_COLOR_GOLD, 0);
diablo2::d2_win::draw_text(const_cast<wchar_t*>(life.c_str()), sWCenter, barY_HP + 15, stat.colorStatValue, 0);
// Draw the filled Mana bar // Draw the filled Mana bar
diablo2::d2_gfx::draw_filled_rect(barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, 156, 255); diablo2::d2_gfx::draw_filled_rect(barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, 140, 255);
//DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana //DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana
diablo2::d2_win::draw_text(const_cast<wchar_t*>(mana.c_str()), sWCenter - (lifeWidth / 2), barY_Mana + 15, diablo2::ui_color_t::UI_COLOR_DARK_WHITE, 0); diablo2::d2_win::draw_text(const_cast<wchar_t*>(mana.c_str()), sWCenter, barY_Mana + 15, stat.colorStatValue, 0);
/* /*
// Define the number of separators // Define the number of separators
@ -428,6 +463,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);
@ -235,6 +235,23 @@ static void draw_damage_labels() {
uint32_t textX = mx; uint32_t textX = mx;
uint32_t textY = my; uint32_t textY = my;
// Define default bar color
int barColor;
// Determine bar color based on health percentage
if (healthPercentage > .80) {
barColor = 132;
}
else if (healthPercentage > .50) {
barColor = 12;
}
else {
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);
@ -248,12 +265,16 @@ 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::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, textColor, 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, 9, 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;
// Draw damage label // Draw damage label
std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" "; std::wstring dmgText = L" " + std::to_wstring(label->damage) + L" ";
const wchar_t* dmgTextPtr = dmgText.c_str(); const wchar_t* dmgTextPtr = dmgText.c_str();

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

View File

@ -5,10 +5,8 @@
#include <common/hooking.h> #include <common/hooking.h>
#include <d2tweaks/common/protocol.h> #include <d2tweaks/common/protocol.h>
#include <d2tweaks/ui/menu.h> #include <d2tweaks/ui/menu.h>
#include <diablo2/d2win.h> #include <diablo2/d2win.h>
@ -19,6 +17,51 @@
#include <Windows.h> #include <Windows.h>
#include <d2tweaks/client/modules/autosort/autosort_client.h>
#include <d2tweaks/client/client.h>
#include <spdlog/spdlog.h>
#include <d2tweaks/common/common.h>
#include <d2tweaks/common/protocol.h>
#include <d2tweaks/common/asset_manager.h>
#include <d2tweaks/ui/menu.h>
#include <d2tweaks/ui/ui_manager.h>
#include <d2tweaks/ui/controls/control.h>
#include <d2tweaks/ui/controls/button.h>
#include <diablo2/d2common.h>
#include <diablo2/d2client.h>
#include <diablo2/d2win.h>
#include <diablo2/d2gfx.h>
#include <diablo2/d2cmp.h>
#include <diablo2/structures/unit.h>
#include <diablo2/structures/inventory.h>
#include <diablo2/structures/item_data.h>
#include <diablo2/structures/player_data.h>
#include <diablo2/structures/path.h>
#include <diablo2/structures/game.h>
#include <diablo2/structures/data/items_line.h>
#include <diablo2/structures/data/item_types_line.h>
#include <iostream>
#include <fstream>
#include <string>
#include <filesystem>
#include <unordered_map>
#include <time.h>
#include <cmath>
#include <random>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
diablo2::structures::unit* g_item1; diablo2::structures::unit* g_item1;
static LRESULT(__stdcall* g_wnd_proc_original)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT(__stdcall* g_wnd_proc_original)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
@ -95,7 +138,7 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
block = true; // block the game from processing this key block = true; // block the game from processing this key
} }
// Send item move packet // Send item move packet + transmute packet for certain codes
if (wParam == 'Z') { if (wParam == 'Z') {
// Call the item_click function using the function pointer // Call the item_click function using the function pointer
const auto g_hoverItem = (*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4)); const auto g_hoverItem = (*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4));
@ -121,51 +164,355 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
diablo2::d2_client::send_to_server(&packet, sizeof packet); diablo2::d2_client::send_to_server(&packet, sizeof packet);
(*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4)) = nullptr; (*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4)) = nullptr;
} }
if (g_hoverItem != 0) {
const auto record = diablo2::d2_common::get_item_record(g_hoverItem->data_record_index);
char* normCode = record->string_code;
if (strncmp(normCode, "gcv", 3) == 0 ||
strncmp(normCode, "gcw", 3) == 0 ||
strncmp(normCode, "gcg", 3) == 0 ||
strncmp(normCode, "gcr", 3) == 0 ||
strncmp(normCode, "gcb", 3) == 0 ||
strncmp(normCode, "skc", 3) == 0 ||
strncmp(normCode, "gcy", 3) == 0 ||
strncmp(normCode, "gfv", 3) == 0 ||
strncmp(normCode, "gfw", 3) == 0 ||
strncmp(normCode, "gfg", 3) == 0 ||
strncmp(normCode, "gfr", 3) == 0 ||
strncmp(normCode, "gfb", 3) == 0 ||
strncmp(normCode, "skf", 3) == 0 ||
strncmp(normCode, "gfy", 3) == 0 ||
strncmp(normCode, "gsv", 3) == 0 ||
strncmp(normCode, "gsw", 3) == 0 ||
strncmp(normCode, "gsg", 3) == 0 ||
strncmp(normCode, "gsr", 3) == 0 ||
strncmp(normCode, "gsb", 3) == 0 ||
strncmp(normCode, "sku", 3) == 0 ||
strncmp(normCode, "gsy", 3) == 0 ||
strncmp(normCode, "gzv", 3) == 0 ||
strncmp(normCode, "glw", 3) == 0 ||
strncmp(normCode, "glg", 3) == 0 ||
strncmp(normCode, "glr", 3) == 0 ||
strncmp(normCode, "glb", 3) == 0 ||
strncmp(normCode, "skl", 3) == 0 ||
strncmp(normCode, "gly", 3) == 0 ||
strncmp(normCode, "gpv", 3) == 0 ||
strncmp(normCode, "gpw", 3) == 0 ||
strncmp(normCode, "gpg", 3) == 0 ||
strncmp(normCode, "gpr", 3) == 0 ||
strncmp(normCode, "gpb", 3) == 0 ||
strncmp(normCode, "skz", 3) == 0 ||
strncmp(normCode, "gpy", 3) == 0 ||
strncmp(normCode, "ib1", 3) == 0 ||
// Runes
strncmp(normCode, "r01", 3) == 0 ||
strncmp(normCode, "r02", 3) == 0 ||
strncmp(normCode, "r03", 3) == 0 ||
strncmp(normCode, "r04", 3) == 0 ||
strncmp(normCode, "r05", 3) == 0 ||
strncmp(normCode, "r06", 3) == 0 ||
strncmp(normCode, "r07", 3) == 0 ||
strncmp(normCode, "r08", 3) == 0 ||
strncmp(normCode, "r09", 3) == 0 ||
strncmp(normCode, "r10", 3) == 0 ||
strncmp(normCode, "r11", 3) == 0 ||
strncmp(normCode, "r12", 3) == 0 ||
strncmp(normCode, "r13", 3) == 0 ||
strncmp(normCode, "r14", 3) == 0 ||
strncmp(normCode, "r15", 3) == 0 ||
strncmp(normCode, "r16", 3) == 0 ||
strncmp(normCode, "r17", 3) == 0 ||
strncmp(normCode, "r18", 3) == 0 ||
strncmp(normCode, "r19", 3) == 0 ||
strncmp(normCode, "r20", 3) == 0 ||
strncmp(normCode, "r21", 3) == 0 ||
strncmp(normCode, "r22", 3) == 0 ||
strncmp(normCode, "r23", 3) == 0 ||
strncmp(normCode, "r24", 3) == 0 ||
strncmp(normCode, "r25", 3) == 0 ||
strncmp(normCode, "r26", 3) == 0 ||
strncmp(normCode, "r27", 3) == 0 ||
strncmp(normCode, "r28", 3) == 0 ||
strncmp(normCode, "r29", 3) == 0 ||
strncmp(normCode, "r30", 3) == 0 ||
strncmp(normCode, "r31", 3) == 0 ||
strncmp(normCode, "r32", 3) == 0 ||
strncmp(normCode, "r33", 3) == 0 ||
strncmp(normCode, "ib2", 3) == 0
) {
char currentPage = diablo2::d2_common::get_item_page(g_hoverItem);
// Create the packet
static d2_tweaks::common::item_move_cs packet;
packet.item_guid = g_hoverItem->guid;
if (currentPage == 0) { //item is in inventory
if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_STASH))
packet.target_page = 4;
if (diablo2::d2_client::get_ui_window_state(diablo2::UI_WINDOW_CUBE))
packet.target_page = 3;
}
else {
packet.target_page = 0;
}
diablo2::d2_client::send_to_server(&packet, sizeof packet);
(*reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4)) = nullptr;
diablo2::d2_client::send_to_server_7(0x4F, 0x18, 0, 0);
}
}
block = true; // block the game from processing this key block = true; // block the game from processing this key
} }
if (wParam == 'G') {
const auto g_hoverItem = *reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4);
if (g_hoverItem != nullptr) {
const auto record = diablo2::d2_common::get_item_record(g_hoverItem->data_record_index);
char* normCode = record->string_code;
const auto player = diablo2::d2_client::get_local_player();
std::vector<diablo2::structures::unit*> items;
diablo2::structures::unit* gemBag{};
// get the gembag item
for (auto item = player->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);
if (record->type == 101) {
gemBag = item;
}
}
// 378 is ruby
// 379 is amathyst
// 380 is diamond
// 381 is emerald
// 382 is saphhire
// 383 is topaz
// 384 is skull
// 385 is El Runes
// 386 is Sol Runes
// 387 is Mal Runes
// properties.txt row number - 3
if (strncmp(normCode, "gcv", 3) == 0) { // Use strncmp for string comparison
int32_t stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Amethyst, NULL);
MessageBoxA(0, std::to_string(stat).c_str(), "stat", 0);
stat++;
D2PropertyStrc itemProperty = {};
itemProperty.nProperty = 382 - 3;
itemProperty.nLayer = 0;
itemProperty.nMin = 1;
itemProperty.nMax = 1;
//diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Amethyst, stat, 0);
diablo2::d2_common::add_property(gemBag, &itemProperty, 0);
int32_t stat1 = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Amethyst, NULL);
MessageBoxA(0, std::to_string(stat1).c_str(), "stat", 0);
}
// check to see if gembag is actually right
//const auto bagrecord = diablo2::d2_common::get_item_record(gemBag->data_record_index);
//char* bagcode = bagrecord->string_code;
//MessageBoxA(0, bagcode, "bag code", 0);
//if (normCode == "gcv") {
// int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Amethyst, NULL);
// diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Amethyst, stat + 1, 0);
// MessageBoxA(0, normCode, "normCode", 0);
//}
}
}
switch (msg) { switch (msg) {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
{ {
block = instance.process_left_mouse(false); block = instance.process_left_mouse(false);
break; break;
}
case WM_LBUTTONUP:
{
block = instance.process_left_mouse(true);
break;
}
case WM_RBUTTONDOWN:
{
int32_t gemBagGuid = 0;
const auto g_hoverItem = *reinterpret_cast<diablo2::structures::unit**>(diablo2::d2_client::get_base() + 0x1158F4);
if (g_hoverItem != nullptr) {
const auto record = diablo2::d2_common::get_item_record(g_hoverItem->data_record_index);
char* normCode = record->string_code;
const auto player = diablo2::d2_client::get_local_player();
auto pInventory = player->inventory;
std::vector<diablo2::structures::unit*> items;
diablo2::structures::unit* gemBag{};
// get the gembag item
for (auto item = player->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);
if (record->type == 101) {
gemBag = item;
gemBagGuid = gemBag->guid;
}
}
// Actual ID to use is 378 for Ruby, but actual row number is 381
// 378 is ruby
// 379 is amathyst
// 380 is diamond
// 381 is emerald
// 382 is saphhire
// 383 is topaz
// 384 is skull
// So remember, it's properties.txt row number - 3
// Define the structure D2PropertyStrc
struct GemType {
int chippedCount;
int rowID;
};
std::unordered_map<std::string, GemType> gemTypes = {
{"gcv", {1, 382}}, // Chipped Amethyst
{"gcw", {1, 383}}, // Chipped Diamond
{"gcg", {1, 384}}, // Chipped Emerald
{"gcr", {1, 381}}, // Chipped Ruby
{"gcb", {1, 385}}, // Chipped Sapphire
{"skc", {1, 387}}, // Chipped Skull
{"gcy", {1, 386}}, // Chipped Topaz
{"gfv", {3, 382}}, // Flawed Amethyst
{"gfw", {3, 383}}, // Flawed Diamond
{"gfg", {3, 384}}, // Flawed Emerald
{"gfr", {3, 381}}, // Flawed Ruby
{"gfb", {3, 385}}, // Flawed Sapphire
{"skf", {3, 387}}, // Flawed Skull
{"gfy", {3, 386}}, // Flawed Topaz
{"gsv", {9, 382}}, // Amethyst
{"gsw", {9, 383}}, // Diamond
{"gsg", {9, 384}}, // Emerald
{"gsr", {9, 381}}, // Ruby
{"gsb", {9, 385}}, // Sapphire
{"sku", {9, 387}}, // Skull
{"gsy", {9, 386}}, // Topaz
{"gzv", {27, 382}}, // Flawless Amethyst
{"glw", {27, 383}}, // Flawless Diamond
{"glg", {27, 384}}, // Flawless Emerald
{"glr", {27, 381}}, // Flawless Ruby
{"glb", {27, 385}}, // Flawless Sapphire
{"skl", {27, 387}}, // Flawless Skull
{"gly", {27, 386}}, // Flawless Topaz
{"gpv", {81, 382}}, // Perfect Amethyst
{"gpw", {81, 383}}, // Perfect Diamond
{"gpg", {81, 384}}, // Perfect Emerald
{"gpr", {81, 381}}, // Perfect Ruby
{"gpb", {81, 385}}, // Perfect Sapphire
{"skz", {81, 387}}, // Perfect Skull
{"gpy", {81, 386}}, // Perfect Topaz
{"r01", {1, 388}}, // El Rune
{"r02", {3, 388}}, // Eld Rune
{"r03", {9, 388}}, // Tir Rune
{"r04", {27, 388}}, // Nef Rune
{"r05", {81, 388}}, // Eth Rune
{"r06", {243, 388}}, // Ith Rune
{"r07", {1, 389}}, // Tal Rune
{"r08", {3, 389}}, // Ral Rune
{"r09", {9, 389}}, // Ort Rune
{"r10", {27, 389}}, // Thul Rune
{"r11", {81, 389}}, // Amn Rune
{"r12", {243, 389}}, // Sol Rune
{"r13", {1, 390}}, // Shael Rune
{"r14", {3, 390}}, // Dol Rune
{"r15", {9, 390}}, // Hel Rune
{"r16", {27, 390}}, // Io Rune
{"r17", {81, 390}}, // Lum Rune
{"r18", {243, 390}}, // Ko Rune
{"r19", {1, 391}}, // Fal Rune
{"r20", {3, 391}}, // Lem Rune
{"r21", {9, 391}}, // Pul Rune
{"r22", {27, 391}}, // Um Rune
{"r23", {81, 3901}}, // Mal Rune
{"r24", {243, 391}}, // Ist Rune
{"r25", {1, 392}}, // Gul Rune
{"r26", {3, 392}}, // Vex Rune
{"r27", {9, 392}}, // Ohm Rune
{"r28", {27, 392}}, // Lo Rune
{"r29", {81, 392}}, // Sur Rune
{"r30", {243, 392}}, // Ber Rune
{"r31", {1, 393}}, // Jah Rune
{"r32", {2, 393}}, // Cham Rune
{"r33", {4, 393}} // Zod Rune
};
auto currentPage = diablo2::d2_common::get_item_page(g_hoverItem);
if (currentPage == 0 || currentPage == 3 || currentPage == 4) {
for (const auto& gem : gemTypes) {
// Accessing key and value
const std::string& key = gem.first;
const GemType& value = gem.second;
if (strncmp(normCode, key.c_str(), 3) == 0) {
D2PropertyStrc itemProperty = {};
itemProperty.nProperty = value.rowID - 3;
itemProperty.nLayer = 0;
itemProperty.nMin = value.chippedCount;
itemProperty.nMax = value.chippedCount;
diablo2::d2_common::add_property(gemBag, &itemProperty, 0);
diablo2::d2_client::play_sound(record->drop_sound, nullptr, 0, 0, 0);
static d2_tweaks::common::item_move_cs packet;
packet.item_guid = g_hoverItem->guid;
packet.bag_guid = gemBagGuid;
packet.updateBag = 1;
packet.prop = itemProperty.nProperty;
packet.val = itemProperty.nMin;
packet.target_page = 99;
diablo2::d2_client::send_to_server(&packet, sizeof packet);
}
}
}
} }
case WM_LBUTTONUP: block = instance.process_right_mouse(false);
{ break;
block = instance.process_left_mouse(true); }
break;
}
case WM_RBUTTONDOWN: case WM_RBUTTONUP:
{ {
block = instance.process_right_mouse(false); block = instance.process_right_mouse(true);
break; break;
} }
case WM_RBUTTONUP: case WM_SYSKEYDOWN:
{ case WM_KEYDOWN:
block = instance.process_right_mouse(true); {
break; block = instance.process_key_event(wParam, false);
} break;
}
case WM_SYSKEYDOWN: case WM_SYSKEYUP:
case WM_KEYDOWN: case WM_KEYUP:
{ {
block = instance.process_key_event(wParam, false); block = instance.process_key_event(wParam, true);
break; break;
} }
case WM_SYSKEYUP: default: return g_wnd_proc_original(hWnd, msg, wParam, lParam);
case WM_KEYUP:
{
block = instance.process_key_event(wParam, true);
break;
}
default: return g_wnd_proc_original(hWnd, msg, wParam, lParam);
} }
if (block) if (block)
@ -182,7 +529,8 @@ void d2_tweaks::ui::ui_manager::process_inputs() {
process_left_mouse(false); process_left_mouse(false);
} }
} else if (m_was_down_before_left) { }
else if (m_was_down_before_left) {
m_was_down_before_left = false; m_was_down_before_left = false;
m_mouse_state_left = false; m_mouse_state_left = false;
@ -196,7 +544,8 @@ void d2_tweaks::ui::ui_manager::process_inputs() {
process_right_mouse(false); process_right_mouse(false);
} }
} else if (m_was_down_before_right) { }
else if (m_was_down_before_right) {
m_was_down_before_right = false; m_was_down_before_right = false;
m_mouse_state_right = false; m_mouse_state_right = false;
@ -241,4 +590,4 @@ bool d2_tweaks::ui::ui_manager::process_key_event(uint32_t key, bool up) {
} }
return block; return block;
} }

View File

@ -1,5 +1,6 @@
#include <diablo2/d2common.h> #include <diablo2/d2common.h>
#include <common/ptr_wrapper.h> #include <common/ptr_wrapper.h>
#include <d2tweaks/common/protocol.h>
char* diablo2::d2_common::get_base() { char* diablo2::d2_common::get_base() {
static auto base = reinterpret_cast<char*>(GetModuleHandle("d2common.dll")); static auto base = reinterpret_cast<char*>(GetModuleHandle("d2common.dll"));
@ -249,4 +250,14 @@ void diablo2::d2_common::update_trade(structures::inventory* inventory, structur
//void diablo2::d2_common::set_item_flags(structures::unit* item, diablo2::structures::itemflags_t dwFlag, bool bSet) { //void diablo2::d2_common::set_item_flags(structures::unit* item, diablo2::structures::itemflags_t dwFlag, bool bSet) {
// static wrap_func_std_import<void(structures::unit* item, structures::itemflags_t dwFlag, bool bSet)> set_item_flags(10708, get_base()); // static wrap_func_std_import<void(structures::unit* item, structures::itemflags_t dwFlag, bool bSet)> set_item_flags(10708, get_base());
// set_item_flags(item, dwFlag, bSet); // set_item_flags(item, dwFlag, bSet);
//} //}
void diablo2::d2_common::add_property(structures::unit* item, D2PropertyStrc* prop, int nUnused) {
static wrap_func_std_import<void(structures::unit* item, D2PropertyStrc* prop, int nUnused)> add_property(10868, get_base());
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);
}