浏览代码

Fix disabled effects signage condition

aleos 7 月之前
父节点
当前提交
756c72e9f0
共有 5 个文件被更改,包括 16 次插入23 次删除
  1. 1 1
      src/map/clif.cpp
  2. 11 18
      src/map/map.cpp
  3. 2 2
      src/map/map.hpp
  4. 1 1
      src/map/skill.cpp
  5. 1 1
      src/map/status.cpp

+ 1 - 1
src/map/clif.cpp

@@ -10962,7 +10962,7 @@ void clif_parse_LoadEndAck(int fd,map_session_data *sd)
 		}
 
 		if (mapdata->zone != nullptr)
-			mapdata->zone->clear_all_disabled_status(sd->bl);
+			mapdata->zone->clear_all_disabled_status(*sd);
 		map_iwall_get(sd); // Updates Walls Info on this Map to Client
 		status_calc_pc(sd, sd->state.autotrade ? SCO_FIRST : SCO_NONE); // Some conditions are map-dependent so we must recalculate
 

+ 11 - 18
src/map/map.cpp

@@ -754,7 +754,7 @@ bool c_map_zone_data::isCommandDisabled(std::string name, map_session_data &sd)
 	if (cmd_lv == nullptr)
 		return false;
 
-	if (sd.group->level < *cmd_lv)
+	if (sd.group->level > *cmd_lv)
 		return false;
 
 	return true;
@@ -763,10 +763,10 @@ bool c_map_zone_data::isCommandDisabled(std::string name, map_session_data &sd)
 /**
  * Check if a skill is disabled on a map based on group level.
  * @param skill_id: Skill ID
- * @param bl: Block list data
+ * @param sd: Player data
  * @return True when skill is disabled or false otherwise
  */
-bool c_map_zone_data::isSkillDisabled(uint16 skill_id, block_list &bl) {
+bool c_map_zone_data::isSkillDisabled(uint16 skill_id, map_session_data &sd) {
 	if (this->disabled_skills.empty())
 		return false;
 
@@ -775,12 +775,7 @@ bool c_map_zone_data::isSkillDisabled(uint16 skill_id, block_list &bl) {
 	if (skill_lv == nullptr)
 		return false;
 
-	map_session_data *sd = BL_CAST(BL_PC, &bl);
-
-	if (sd == nullptr)
-		return false;
-
-	if (sd->group->level < skill_lv->second)
+	if (sd.group->level > skill_lv->second)
 		return false;
 
 	return true;
@@ -801,7 +796,7 @@ bool c_map_zone_data::isItemDisabled(t_itemid nameid, map_session_data &sd) {
 	if (item_lv == nullptr)
 		return false;
 
-	if (sd.group->level < *item_lv)
+	if (sd.group->level > *item_lv)
 		return false;
 
 	return true;
@@ -827,7 +822,7 @@ bool c_map_zone_data::isStatusDisabled(sc_type sc, block_list &bl) {
 	if (sd == nullptr)
 		return false;
 
-	if (sd->group->level < *status_lv)
+	if (sd->group->level > *status_lv)
 		return false;
 
 	return true;
@@ -848,7 +843,7 @@ bool c_map_zone_data::isJobRestricted(int32 job_id, uint16 group_lv) {
 	if (job_lv == nullptr)
 		return false;
 
-	if (group_lv < *job_lv)
+	if (group_lv > *job_lv)
 		return false;
 
 	return true;
@@ -856,17 +851,15 @@ bool c_map_zone_data::isJobRestricted(int32 job_id, uint16 group_lv) {
 
 /**
  * Clear all statuses that are disabled on a map.
- * @param bl: Block list data
+ * @param sd: Player data
  */
-void c_map_zone_data::clear_all_disabled_status(block_list &bl) {
+void c_map_zone_data::clear_all_disabled_status(map_session_data &sd) {
 	if (this->disabled_statuses.empty())
 		return;
 
-	map_session_data *sd = BL_CAST(BL_PC, &bl);
-
 	for (const auto &sc : this->disabled_statuses) {
-		if (sd == nullptr || sd->group->level < sc.second)
-			status_change_end(&bl, sc.first);
+		if (sd.group->level < sc.second)
+			status_change_end(&sd.bl, sc.first);
 	}
 }
 

+ 2 - 2
src/map/map.hpp

@@ -825,11 +825,11 @@ public:
 
 	e_map_type getMapZone(int16 map_id);
 	bool isCommandDisabled(std::string name, map_session_data &sd);
-	bool isSkillDisabled(uint16 skill_id, block_list &bl);
+	bool isSkillDisabled(uint16 skill_id, map_session_data &sd);
 	bool isItemDisabled(t_itemid nameid, map_session_data &sd);
 	bool isStatusDisabled(sc_type sc, block_list &bl);
 	bool isJobRestricted(int32 job_id, uint16 group_lv);
-	void clear_all_disabled_status(block_list &bl);
+	void clear_all_disabled_status(map_session_data &sd);
 };
 
 struct map_data {

+ 1 - 1
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)) {
+	if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, sd)) {
 		clif_msg(&sd, MSI_IMPOSSIBLE_SKILL_AREA); // This skill cannot be used within this area
 		return true;
 	}

+ 1 - 1
src/map/status.cpp

@@ -1979,7 +1979,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 = BL_CAST(BL_PC, src);
 
-		if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, sd->bl)) {
+		if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, *sd)) {
 			if (sd != nullptr)
 				clif_msg(sd, MSI_IMPOSSIBLE_SKILL_AREA); // This skill cannot be used within this area
 			return false;