From bb8d09dfca38f96bd7f02166e45fc3f94a95bd30 Mon Sep 17 00:00:00 2001 From: aleos Date: Thu, 25 Aug 2022 11:31:20 -0400 Subject: [PATCH] Fixes an issue with reloading the item database * Fixes an issue where players prior autobonuses were not properly recalculated when reloading the item database. --- src/map/itemdb.cpp | 2 +- src/map/status.cpp | 6 +++--- src/map/status.hpp | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index 7755f740b3..9ea9317b8d 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -3526,7 +3526,7 @@ void itemdb_reload(void) { pc_setinventorydata(sd); pc_check_available_item(sd, ITMCHK_ALL); // Check for invalid(ated) items. pc_load_combo(sd); // Check to see if new combos are available - status_calc_pc(sd, SCO_FORCE); // + status_calc_pc(sd, SCO_FORCE|SCO_ITEM_RELOAD); // } mapit_free(iter); } diff --git a/src/map/status.cpp b/src/map/status.cpp index c8ed5fb51e..03d5663a14 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -3619,9 +3619,9 @@ int status_calc_pc_sub(struct map_session_data* sd, uint8 opt) memset(&sd->bonus, 0, sizeof(sd->bonus)); // Autobonus - pc_delautobonus(*sd, sd->autobonus, true); - pc_delautobonus(*sd, sd->autobonus2, true); - pc_delautobonus(*sd, sd->autobonus3, true); + pc_delautobonus(*sd, sd->autobonus, (opt & SCO_ITEM_RELOAD) ? false : true); + pc_delautobonus(*sd, sd->autobonus2, (opt & SCO_ITEM_RELOAD) ? false : true); + pc_delautobonus(*sd, sd->autobonus3, (opt & SCO_ITEM_RELOAD) ? false : true); // Parse equipment for (i = 0; i < EQI_MAX; i++) { diff --git a/src/map/status.hpp b/src/map/status.hpp index 2d48745402..7793706568 100644 --- a/src/map/status.hpp +++ b/src/map/status.hpp @@ -2806,6 +2806,7 @@ enum e_status_calc_opt : uint8 { SCO_NONE = 0x0, SCO_FIRST = 0x1, ///< Trigger the calculations that should take place only onspawn/once, process base status initialization code SCO_FORCE = 0x2, ///< Only relevant to BL_PC types, ensures call bypasses the queue caused by delayed damage + SCO_ITEM_RELOAD = 0x4, ///< Triggered when the item database is reloaded to force autobonus types to reset }; /// Flags for status_change_start and status_get_sc_def