Browse Source

Adds object type check to isStatusDisabled
* Check by object type rather than passing arbitrary integers to compare against.

aleos 1 năm trước cách đây
mục cha
commit
e9beffea50
3 tập tin đã thay đổi với 6 bổ sung5 xóa
  1. 3 2
      src/map/map.cpp
  2. 1 1
      src/map/map.hpp
  3. 2 2
      src/map/status.cpp

+ 3 - 2
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;

+ 1 - 1
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);
 };
 

+ 2 - 2
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);
 		}
 	}