Browse Source

Removes waitingroom check for Maya Purple hackfix (#5269)

* Fixes #3102 and fixes #3645.
* Removes the waitingroom check for the Maya Purple card hackfix.
Thanks to @sader1992 and @Badarosk0!
Aleos 4 years ago
parent
commit
1c6270f96a
1 changed files with 26 additions and 12 deletions
  1. 26 12
      src/map/clif.cpp

+ 26 - 12
src/map/clif.cpp

@@ -1560,6 +1560,26 @@ void clif_weather(int16 m)
 	}
 	}
 	mapit_free(iter);
 	mapit_free(iter);
 }
 }
+
+/**
+ * Hide a NPC from the effects of Maya Purple card.
+ * @param bl: Block data
+ * @return True if NPC is disabled or false otherwise
+ */
+static inline bool clif_npc_mayapurple(block_list *bl) {
+	nullpo_retr(false, bl);
+
+	if (bl->type == BL_NPC) {
+		npc_data *nd = map_id2nd(bl->id);
+
+		// TODO: Confirm if waitingroom cause any special cases
+		if (/* nd->chat_id == 0 && */ nd->sc.option & OPTION_INVISIBLE)
+			return true;
+	}
+
+	return false;
+}
+
 /**
 /**
  * Main function to spawn a unit on the client (player/mob/pet/etc)
  * Main function to spawn a unit on the client (player/mob/pet/etc)
  **/
  **/
@@ -1570,10 +1590,8 @@ int clif_spawn( struct block_list *bl, bool walking ){
 	if( !vd || vd->class_ == JT_INVISIBLE )
 	if( !vd || vd->class_ == JT_INVISIBLE )
 		return 0;
 		return 0;
 
 
-	/**
-	* Hide NPC from maya purple card.
-	**/
-	if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE))
+	// Hide NPC from Maya Purple card
+	if (clif_npc_mayapurple(bl))
 		return 0;
 		return 0;
 
 
 	if( bl->type == BL_NPC && !vd->dead_sit ){
 	if( bl->type == BL_NPC && !vd->dead_sit ){
@@ -1916,10 +1934,8 @@ void clif_move(struct unit_data *ud)
 		return;
 		return;
 	}
 	}
 
 
-	/**
-	* Hide NPC from maya purple card.
-	**/
-	if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE))
+	// Hide NPC from Maya Purple card
+	if (clif_npc_mayapurple(bl))
 		return;
 		return;
 
 
 	if (ud->state.speed_changed) {
 	if (ud->state.speed_changed) {
@@ -4717,10 +4733,8 @@ void clif_getareachar_unit( struct map_session_data* sd,struct block_list *bl ){
 	if (!vd || vd->class_ == JT_INVISIBLE)
 	if (!vd || vd->class_ == JT_INVISIBLE)
 		return;
 		return;
 
 
-	/**
-	* Hide NPC from maya purple card.
-	**/
-	if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE))
+	// Hide NPC from Maya Purple card
+	if (clif_npc_mayapurple(bl))
 		return;
 		return;
 
 
 	ud = unit_bl2ud(bl);
 	ud = unit_bl2ud(bl);