From e9beffea50bdd7c76878b7dd5800bebdc7fcf6f7 Mon Sep 17 00:00:00 2001 From: aleos Date: Tue, 16 Jan 2024 14:19:58 -0500 Subject: [PATCH] Adds object type check to isStatusDisabled * Check by object type rather than passing arbitrary integers to compare against. --- src/map/map.cpp | 5 +++-- src/map/map.hpp | 2 +- src/map/status.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/map/map.cpp b/src/map/map.cpp index 094811a977..eccf87750e 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -589,10 +589,11 @@ bool s_map_zone_data::isItemDisabled(t_itemid nameid, uint16 group_lv) { /** * Check if a status is disabled on a map based on group level. * @param sc: Status type + * @param type: Object type * @param group_lv: Group level * @return True when status is disabled or false otherwise */ -bool s_map_zone_data::isStatusDisabled(sc_type sc, uint16 group_lv) { +bool s_map_zone_data::isStatusDisabled(sc_type sc, uint16 type, uint16 group_lv) { if (this->disabled_statuses.empty()) return false; @@ -601,7 +602,7 @@ bool s_map_zone_data::isStatusDisabled(sc_type sc, uint16 group_lv) { if (status_lv == nullptr) return false; - if ((group_lv == 101 && *status_lv > 0) || (*status_lv < group_lv)) + if ((!(type & BL_PC) && *status_lv > 0) || (*status_lv < group_lv)) return false; else return true; diff --git a/src/map/map.hpp b/src/map/map.hpp index 258d82dd2d..4f0624dad8 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -818,7 +818,7 @@ struct s_map_zone_data { bool isCommandDisabled(std::string name, uint16 group_lv); bool isSkillDisabled(uint16 skill_id, uint16 type, uint16 group_lv); bool isItemDisabled(t_itemid nameid, uint16 group_lv); - bool isStatusDisabled(sc_type sc, uint16 group_lv); + bool isStatusDisabled(sc_type sc, uint16 type, uint16 group_lv); bool isJobRestricted(int32 job_id, uint16 group_lv); }; diff --git a/src/map/status.cpp b/src/map/status.cpp index bf0120fa8c..81b9ee9f75 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -9981,7 +9981,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty map_data *mapdata = map_getmapdata(bl->m); map_session_data *sd = BL_CAST(BL_PC, bl); - if (mapdata != nullptr && mapdata->zone.isStatusDisabled(type, (sd != nullptr) ? pc_get_group_level(sd) : 101)) + if (mapdata != nullptr && mapdata->zone.isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0)) return 0; if (sc->getSCE(SC_GRAVITYCONTROL)) @@ -15372,7 +15372,7 @@ void status_change_clear_onChangeMap(block_list *bl) map_session_data *sd = (TBL_PC *)bl; - if (mapdata->zone.isStatusDisabled(type, (sd != nullptr) ? pc_get_group_level(sd) : 101)) + if (mapdata->zone.isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0)) status_change_end(bl, type); } }