diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index a10e11a73c..7e81ba848f 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -11574,7 +11574,7 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t struct map_data *mapdata = map_getmapdata(sd->bl.m); - if (mapdata->zone->isCommandDisabled(info->command, pc_get_group_level(sd))) { + if (mapdata->zone->isCommandDisabled(info->command, *sd)) { clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 832), false, SELF); // This command is disabled on this map. return true; } diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index 35eeddbb79..c44ae463f6 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -4207,7 +4207,7 @@ bool itemdb_isNoEquip(map_session_data &sd, t_itemid nameid) { if (!mapdata) return true; - if (mapdata->zone->isItemDisabled(nameid, pc_get_group_level(&sd))) + if (mapdata->zone->isItemDisabled(nameid, sd)) return true; return false; } diff --git a/src/map/map.cpp b/src/map/map.cpp index 403a4768d3..4d9b4bd6cb 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -591,10 +591,10 @@ MapZoneDatabase map_zone_db; /** * Check if a command is disabled on a map based on group level. * @param name: Command name - * @param group_lv: Group level + * @param sd: Player session data * @return True when command is disabled or false otherwise */ -bool c_map_zone_data::isCommandDisabled(std::string name, uint16 group_lv) { +bool c_map_zone_data::isCommandDisabled(std::string name, map_session_data &sd) { if (this->disabled_commands.empty()) return false; @@ -603,7 +603,7 @@ bool c_map_zone_data::isCommandDisabled(std::string name, uint16 group_lv) { if (cmd_lv == nullptr) return false; - if (*cmd_lv < group_lv) + if (*cmd_lv < sd.group->level) return false; else return true; @@ -613,10 +613,10 @@ bool c_map_zone_data::isCommandDisabled(std::string name, uint16 group_lv) { * Check if a skill is disabled on a map based on group level. * @param skill_id: Skill ID * @param type: Object type - * @param group_lv: Group level + * @param sd: Player session data * @return True when skill is disabled or false otherwise */ -bool c_map_zone_data::isSkillDisabled(uint16 skill_id, uint16 type, uint16 group_lv) { +bool c_map_zone_data::isSkillDisabled(uint16 skill_id, uint16 type, map_session_data &sd) { if (this->disabled_skills.empty()) return false; @@ -625,7 +625,7 @@ bool c_map_zone_data::isSkillDisabled(uint16 skill_id, uint16 type, uint16 group if (skill_lv == nullptr) return false; - if ((!(type & BL_PC) && skill_lv->second > 0) || (skill_lv->second < group_lv)) + if ((!(type & BL_PC) && skill_lv->second > 0) || (skill_lv->second < sd.group->level)) return false; else return true; @@ -634,10 +634,10 @@ bool c_map_zone_data::isSkillDisabled(uint16 skill_id, uint16 type, uint16 group /** * Check if an item is disabled on a map based on group level. * @param nameid: Item ID - * @param group_lv: Group level + * @param sd: Player session data * @return True when item is disabled or false otherwise */ -bool c_map_zone_data::isItemDisabled(t_itemid nameid, uint16 group_lv) { +bool c_map_zone_data::isItemDisabled(t_itemid nameid, map_session_data &sd) { if (this->disabled_items.empty()) return false; @@ -646,7 +646,7 @@ bool c_map_zone_data::isItemDisabled(t_itemid nameid, uint16 group_lv) { if (item_lv == nullptr) return false; - if (*item_lv < group_lv) + if (*item_lv < sd.group->level) return false; else return true; @@ -656,10 +656,10 @@ bool c_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 + * @param sd: Player session data * @return True when status is disabled or false otherwise */ -bool c_map_zone_data::isStatusDisabled(sc_type sc, uint16 type, uint16 group_lv) { +bool c_map_zone_data::isStatusDisabled(sc_type sc, uint16 type, map_session_data &sd) { if (this->disabled_statuses.empty()) return false; @@ -668,7 +668,7 @@ bool c_map_zone_data::isStatusDisabled(sc_type sc, uint16 type, uint16 group_lv) if (status_lv == nullptr) return false; - if ((!(type & BL_PC) && *status_lv > 0) || (*status_lv < group_lv)) + if ((!(type & BL_PC) && *status_lv > 0) || (*status_lv < sd.group->level)) return false; else return true; diff --git a/src/map/map.hpp b/src/map/map.hpp index c45db72aa1..8407353ce6 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -817,10 +817,10 @@ public: std::unordered_map disabled_statuses; std::unordered_map restricted_jobs; - 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 type, uint16 group_lv); + bool isCommandDisabled(std::string name, map_session_data &sd); + bool isSkillDisabled(uint16 skill_id, uint16 type, map_session_data &sd); + bool isItemDisabled(t_itemid nameid, map_session_data &sd); + bool isStatusDisabled(sc_type sc, uint16 type, map_session_data &sd); bool isJobRestricted(int32 job_id, uint16 group_lv); }; diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 96e2953896..e08e57a84c 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -866,7 +866,7 @@ bool skill_isNotOk( uint16 skill_id, map_session_data& sd ){ uint32 skill_nocast = skill_get_nocast(skill_id); // Check skill restrictions [Celest] - if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, sd.bl.type, pc_get_group_level(&sd))) { + if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, BL_PC, sd)) { clif_msg(&sd, SKILL_CANT_USE_AREA); // This skill cannot be used within this area return true; } diff --git a/src/map/status.cpp b/src/map/status.cpp index 457c2d98a6..c7b3f1e9c3 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -1962,7 +1962,7 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui map_data *mapdata = map_getmapdata(src->m); map_session_data *sd = (TBL_PC *)src; - if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, src->type, (sd != nullptr) ? pc_get_group_level(sd) : 0 )) { + if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, src->type, *sd )) { if (sd != nullptr) clif_msg(sd, SKILL_CANT_USE_AREA); // This skill cannot be used within this area return false; @@ -9995,7 +9995,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, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0)) + if (mapdata != nullptr && mapdata->zone->isStatusDisabled(type, bl->type, *sd)) return 0; if (sc->getSCE(SC_GRAVITYCONTROL)) @@ -15409,7 +15409,7 @@ void status_change_clear_onChangeMap(block_list *bl) map_session_data *sd = (TBL_PC *)bl; - if (mapdata->zone->isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0)) + if (mapdata->zone->isStatusDisabled(type, bl->type, *sd)) status_change_end(bl, type); } }