Browse Source

- Added SCB_DYE which marks which status-changes need a forced cloth dye change to 0 due to sprite issues. Currently only NJ_BUNSINJYUTSU's status uses it.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8293 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 years ago
parent
commit
baee95996c
3 changed files with 24 additions and 13 deletions
  1. 3 0
      Changelog-Trunk.txt
  2. 18 12
      src/map/status.c
  3. 3 1
      src/map/status.h

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/08/15
+	* Added SCB_DYE which marks which status-changes need a forced cloth dye
+	  change to 0 due to sprite issues. Currently only NJ_BUNSINJYUTSU's status
+	  uses it. [Skotlex]
 	* Asura Strike now moves you to the target on fail always (unless the
 	  target does not exists or is in another map or there's a obstacle on the
 	  way) [Skotlex]

+ 18 - 12
src/map/status.c

@@ -357,7 +357,7 @@ void initChangeTables(void) {
 	add_sc(NJ_HYOUSYOURAKU, SC_FREEZE);
 	set_sc(NJ_NEN, SC_NEN, SI_NEN, SCB_STR|SCB_INT);
 	set_sc(NJ_UTSUSEMI, SC_UTSUSEMI, SI_UTSUSEMI,SCB_NONE);
-	set_sc(NJ_BUNSINJYUTSU, SC_BUNSINJYUTSU, SI_BUNSINJYUTSU, SCB_NONE);
+	set_sc(NJ_BUNSINJYUTSU, SC_BUNSINJYUTSU, SI_BUNSINJYUTSU, SCB_DYE);
 	set_sc(CR_SHRINK, SC_SHRINK, SI_SHRINK, SCB_NONE);
 	set_sc(RG_CLOSECONFINE, SC_CLOSECONFINE2, SI_CLOSECONFINE2, SCB_NONE);
 	set_sc(RG_CLOSECONFINE, SC_CLOSECONFINE, SI_CLOSECONFINE, SCB_FLEE);
@@ -4454,13 +4454,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 	}
 	//Before overlapping fail, one must check for status cured.
 	switch (type) {
-	case SC_BUNSINJYUTSU:	//[blackhole89]
-		if(sd)
-		{
-			val4=sd->status.clothes_color;
-			pc_changelook(sd,LOOK_CLOTHES_COLOR,0);
-		}
-		break;
 	case SC_BLESSING:
 		if ((!undead_flag && status->race!=RC_DEMON) || bl->type == BL_PC) {
 			if (sc->data[SC_CURSE].timer!=-1)
@@ -5590,6 +5583,16 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 	if(opt_flag)
 		clif_changeoption(bl);
 
+	if (calc_flag&SCB_DYE)
+	{	//Reset DYE color
+		if (vd && vd->cloth_color)
+		{
+			val4 = vd->cloth_color;
+			clif_changelook(bl,LOOK_CLOTHES_COLOR,0);
+		}
+		calc_flag&=~SCB_DYE;
+	}
+
 	if (vd && pcdb_checkid(vd->class_)) //Only for players sprites, client crashes if they receive this for a mob o.O [Skotlex]
 		clif_status_change(bl,StatusIconChangeTable[type],1);
 	else if (sd) //Send packet to self otherwise (disguised player?)
@@ -5729,10 +5732,6 @@ int status_change_end( struct block_list* bl , int type,int tid )
 	vd = status_get_viewdata(bl);
 	calc_flag = StatusChangeFlagTable[type];
 	switch(type){
-		case SC_BUNSINJYUTSU: //[blackhole89]
-			{
-				if(sd) pc_changelook(sd,LOOK_CLOTHES_COLOR,sc->data[type].val4);
-			}
 		case SC_WEDDING:
 		case SC_XMAS:
 			if (!vd) return 0;
@@ -6082,6 +6081,13 @@ int status_change_end( struct block_list* bl , int type,int tid )
 		opt_flag = 0;
 	}
 
+	if (calc_flag&SCB_DYE)
+	{	//Restore DYE color
+		if (vd && !vd->cloth_color && sc->data[type].val4)
+			clif_changelook(bl,LOOK_CLOTHES_COLOR,sc->data[type].val4);
+		calc_flag&=~SCB_DYE;
+	}
+
 	//On Aegis, when turning off a status change, first goes the sc packet, then the option packet.
 	if (vd && pcdb_checkid(vd->class_))
 		clif_status_change(bl,StatusIconChangeTable[type],0);

+ 3 - 1
src/map/status.h

@@ -514,8 +514,10 @@ enum {
 #define SCB_SIZE	0x04000000
 #define SCB_RACE	0x08000000
 #define SCB_RANGE	0x10000000
+//SCB_DYE means the sc should force cloth-dye change to 0 to avoid client crashes.
+#define SCB_DYE	0x40000000
 #define SCB_PC		0x80000000
-#define SCB_ALL	0x7FFFFFFF
+#define SCB_ALL	0x3FFFFFFF
 
 //Define to determine who gets HP/SP consumed on doing skills/etc. [Skotlex]
 #define BL_CONSUME (BL_PC|BL_HOM)