Adds object type check to isStatusDisabled

* Check by object type rather than passing arbitrary integers to compare against.
This commit is contained in:
aleos 2024-01-16 14:19:58 -05:00
parent 772c6f33ff
commit e9beffea50
3 changed files with 6 additions and 5 deletions

View File

@ -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;

View File

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

View File

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