فهرست منبع

- Added preventing sending packet clif_clearchar_id when the character in question is invisible.
- Added packet 0x7c in clif_spawn which was supposed to be used for non-players.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5869 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 سال پیش
والد
کامیت
eb6eaff618
2فایلهای تغییر یافته به همراه43 افزوده شده و 17 حذف شده
  1. 5 0
      Changelog-Trunk.txt
  2. 38 17
      src/map/clif.c

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ 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/04/02
+	* Added preventing sending packet clif_clearchar_id when the character in
+	  question is invisible. [Skotlex]
+	* Added packet 0x7c in clif_spawn which was supposed to be used for
+	  non-players (this fixes pets/mobs/npcs spawning as if they just teleported
+	  into view) [Skotlex]
 	* Some cleanups to clif.c, removed some excess/broken packets/functions.
 	  [Skotlex]
 	* Merged Larry's fix of using a timer to get rid of the glow-issue when you

+ 38 - 17
src/map/clif.c

@@ -1235,26 +1235,45 @@ int clif_spawn(struct block_list *bl)
 	vd = status_get_viewdata(bl);
 	if (!vd || vd->class_ == INVISIBLE_CLASS)
 		return 0;
-	clif_set0078(bl, vd, buf);
 
+	if (pcdb_checkid(vd->class_))
+	{	//Player spawn packet.
+		clif_set0078(bl, vd, buf);
 #if PACKETVER > 3
-	if (WBUFW(buf,0)==0x78) {
-		WBUFW(buf, 0) = 0x79;
-		WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52
-		clif_send(buf, packet_len_table[0x79], bl, AREA_WOS);
-		if (disguised(bl))
-			clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x79], 0);
-	} else {
+		if (WBUFW(buf,0)==0x78) {
+			WBUFW(buf, 0) = 0x79;
+			WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52
+			clif_send(buf, packet_len_table[0x79], bl, AREA_WOS);
+			if (disguised(bl))
+				clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x79], 0);
+		} else {
 #endif
-		WBUFW(buf, 0) = 0x1d9;
-		WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52
-		clif_send(buf, packet_len_table[0x1d9], bl, AREA_WOS);
-		if (disguised(bl))
-			clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x1d9], 0);
+			WBUFW(buf, 0) = 0x1d9;
+			WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52
+			clif_send(buf, packet_len_table[0x1d9], bl, AREA_WOS);
+			if (disguised(bl))
+				clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x1d9], 0);
 #if PACKETVER > 3
-	}
+		}
 #endif
 
+	} else {	//Mob spawn packet.
+		struct status_change *sc = status_get_sc(bl);
+		WBUFW(buf,0)=0x7c;
+		WBUFL(buf,2)=bl->id;
+		WBUFW(buf,6)=status_get_speed(bl);
+		WBUFW(buf,8)=sc?sc->opt1:0;
+		WBUFW(buf,10)=sc?sc->opt2:0;
+		WBUFW(buf,12)=sc?sc->option:0;
+		WBUFW(buf,20)=vd->class_;
+		WBUFPOS(buf,36,bl->x,bl->y);
+		clif_send(buf,packet_len_table[0x7c],bl,AREA_WOS);
+		if (disguised(bl)) {
+			WBUFL(buf,2)=-bl->id;
+			clif_send(buf,packet_len_table[0x7c],bl,SELF);
+		}
+	}
+	
 	if (vd->cloth_color)
 		clif_refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS);
 		
@@ -3906,6 +3925,7 @@ int clif_01ac(struct block_list *bl)
 int clif_outsight(struct block_list *bl,va_list ap)
 {
 	struct block_list *tbl;
+	struct view_data *vd;
 	TBL_PC *sd, *tsd;
 	tbl=va_arg(ap,struct block_list*);
 	if(bl == tbl) return 0;
@@ -3916,7 +3936,8 @@ int clif_outsight(struct block_list *bl,va_list ap)
 	{	//tsd has lost sight of the bl object.
 		switch(bl->type){
 		case BL_PC:
-			clif_clearchar_id(bl->id,0,tsd->fd);
+			if (((TBL_PC*)bl)->vd.class_ != INVISIBLE_CLASS)
+				clif_clearchar_id(bl->id,0,tsd->fd);
 			if(sd->chatID){
 				struct chat_data *cd;
 				cd=(struct chat_data*)map_id2bl(sd->chatID);
@@ -3933,14 +3954,14 @@ int clif_outsight(struct block_list *bl,va_list ap)
 			clif_clearchar_skillunit((struct skill_unit *)bl,tsd->fd);
 			break;
 		default:
-			if (status_get_viewdata(bl))
+			if ((vd=status_get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS)
 				clif_clearchar_id(bl->id,0,tsd->fd);
 			break;
 		}
 	}
 	if (sd && sd->fd)
 	{	//sd is watching tbl go out of view.
-		if (status_get_viewdata(tbl))
+		if ((vd=status_get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS)
 			clif_clearchar_id(tbl->id,0,sd->fd);
 	}
 	return 0;