1
0
mirror of https://gitlab.com/hashborgir/d2tweaks-rnd2k.git synced 2025-04-30 16:15:33 +00:00

Right click gem add to bag working

This commit is contained in:
Hash Borgir 2024-04-25 19:09:19 -06:00
parent f32b70b4bb
commit f915859023
37 changed files with 1093 additions and 29 deletions

Binary file not shown.

@ -3,34 +3,31 @@
autosort_client.cpp autosort_client.cpp
auto_gold_pickup_client.cpp auto_gold_pickup_client.cpp
auto_item_pickup_client.cpp auto_item_pickup_client.cpp
client_module.cpp
damage_display_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(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(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 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_drop_message_client.cpp
item_move_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 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_menu.cpp
loot_filter_settings_toggle_menu.cpp
small_patches.cpp
test.cpp test.cpp
trader_update_client.cpp trader_update_client.cpp
transmute_client.cpp transmute_client.cpp
asset_manager.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 trader_update_server.cpp
server.cpp transmute_server.cpp
button.cpp
checkbox.cpp
group.cpp
image.cpp
label.cpp
menu.cpp
ui_manager.cpp ui_manager.cpp
d2gfx.cpp d2common.cpp
d2win.cpp screen.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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

@ -23,6 +23,8 @@ namespace diablo2 {
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,
UNIT_TYPE_MONSTER = 1, UNIT_TYPE_MONSTER = 1,
@ -74,6 +76,8 @@ namespace diablo2 {
ITEMFLAG_ITEM = 0x08000000 ITEMFLAG_ITEM = 0x08000000
}; };
struct unit { struct unit {
unit_type_t type; unit_type_t type;

@ -342,6 +342,26 @@ public:
float manaPercentage = static_cast<float>(statMana) / static_cast<float>(statMaxMana); float manaPercentage = static_cast<float>(statMana) / static_cast<float>(statMaxMana);
float staminaPercentage = static_cast<float>(statStamina) / static_cast<float>(statMaxStamina); float staminaPercentage = static_cast<float>(statStamina) / static_cast<float>(statMaxStamina);
//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
@ -362,20 +382,21 @@ 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()), barX + 20, barY_HP + 15, stat.colorStatValue, 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()), barX + 20, barY_Mana + 15, stat.colorStatValue, 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

@ -235,6 +235,20 @@ 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
diablo2::ui_color_t barColor;
// Determine bar color based on health percentage
if (healthPercentage > .80) {
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GREEN;
}
else if (healthPercentage > .50) {
barColor = diablo2::ui_color_t::UI_COLOR_DARK_GOLD;
}
else {
barColor = diablo2::ui_color_t::UI_COLOR_RED;
}
// 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 +262,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::draw_text(const_cast<wchar_t*>(combinedText.c_str()), textX, textY, textColor, 0); diablo2::d2_win::set_current_font(diablo2::UI_FONT_6); // Set font to FONT16
diablo2::d2_gfx::draw_filled_rect(textX, textY, textX + healthPercentage * 60, textY + _barHeight, 9, 255); 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);
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();

@ -19,6 +19,53 @@
#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);
@ -84,6 +131,8 @@ struct D2InventoryGridInfoStrc
WORD pad0x16; //0x16 WORD pad0x16; //0x16
}; };
LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
static auto& instance = singleton<ui_manager>::instance(); static auto& instance = singleton<ui_manager>::instance();
@ -95,7 +144,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,9 +170,363 @@ 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);
//}
}
/*
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;
MessageBoxA(0, "Gem Bag Found", "Gem Bag Found", 0);
const auto record = diablo2::d2_common::get_item_record(item->data_record_index);
char* normCode = record->string_code;
MessageBoxA(0, normCode, "normCode", 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);
}
else if (normCode == "gcy") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, stat + 1, 0);
}
else if (normCode == "gcb") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, stat + 1, 0);
}
else if (normCode == "gcr") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, stat + 1, 0);
}
else if (normCode == "gcg") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, stat + 1, 0);
}
else if (normCode == "gcw") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, stat + 1, 0);
}
else if (normCode == "skc") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, stat + 1, 0);
}
if (normCode == "gfv") {
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 + 3, 0);
}
else if (normCode == "gfy") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, stat + 3, 0);
}
else if (normCode == "gfb") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, stat + 3, 0);
}
else if (normCode == "gfr") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, stat + 3, 0);
}
else if (normCode == "gfg") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, stat + 3, 0);
}
else if (normCode == "gfw") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, stat + 3, 0);
}
else if (normCode == "skf") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, stat + 3, 0);
}
if (normCode == "gsv") {
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 + 9, 0);
}
else if (normCode == "gsy") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, stat + 9, 0);
}
else if (normCode == "gsb") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, stat + 9, 0);
}
else if (normCode == "gsr") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, stat + 9, 0);
}
else if (normCode == "gsg") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, stat + 9, 0);
}
else if (normCode == "gsw") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, stat + 9, 0);
}
else if (normCode == "sku") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, stat + 9, 0);
}
if (normCode == "gzv") {
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 + 27, 0);
}
else if (normCode == "gly") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, stat + 27, 0);
}
else if (normCode == "glb") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, stat + 27, 0);
}
else if (normCode == "glr") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, stat + 27, 0);
}
else if (normCode == "glg") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, stat + 27, 0);
}
else if (normCode == "glw") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, stat + 27, 0);
}
else if (normCode == "skl") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, stat + 27, 0);
}
if (normCode == "gpv") {
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 + 81, 0);
}
else if (normCode == "gpy") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Topaz, stat + 81, 0);
}
else if (normCode == "gpb") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Sapphire, stat + 81, 0);
}
else if (normCode == "gpr") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Ruby, stat + 81, 0);
}
else if (normCode == "gpg") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Emerald, stat + 81, 0);
}
else if (normCode == "gpw") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Diamond, stat + 81, 0);
}
else if (normCode == "skz") {
int stat = diablo2::d2_common::get_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, NULL);
diablo2::d2_common::set_stat(gemBag, diablo2::unit_stats_t::UNIT_STAT_gembag_Skull, stat + 81, 0);
}
}
}
*/
}
switch (msg) { switch (msg) {
@ -141,6 +544,91 @@ LRESULT d2_tweaks::ui::ui_manager::wnd_proc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
{ {
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();
const 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;
}
}
// 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);
diablo2::d2_common::inv_remove_item(pInventory, g_hoverItem);
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);
//}
}
block = instance.process_right_mouse(false); block = instance.process_right_mouse(false);
break; break;
} }

@ -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"));
@ -250,3 +251,8 @@ void diablo2::d2_common::update_trade(structures::inventory* inventory, structur
// 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);
}