Browse Source

- Removed the ->prev != NULL checks in skill_attack due to the fact that the code should check elsewhere how it should behave (eg: if traps are not cleared on death, stepping on one afterwards SHOULD cause damage)
- Removed use of packet 0x1c9 for skill_unit display, except for Graffiti (which is the only unit which requires the much larger packet)
- clif_getareachar_skillunit will sent the unit_id of UNT_ATTACK_SKILLS for traps (this is to prevent them from displaying on the client)


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

skotlex 19 năm trước cách đây
mục cha
commit
5b9305fe41
5 tập tin đã thay đổi với 59 bổ sung70 xóa
  1. 7 1
      Changelog-Trunk.txt
  2. 49 64
      src/map/clif.c
  3. 0 1
      src/map/clif.h
  4. 0 1
      src/map/pc.c
  5. 3 3
      src/map/skill.c

+ 7 - 1
Changelog-Trunk.txt

@@ -4,9 +4,15 @@ 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/15
+	* Updated skill_attack to allow characters not on a map to attack (enables
+	  traps and the like to work when they aren't cleared on the character's
+	  death) [Skotlex]
+	* Removed use of packet 0x1c9 for skill_unit display, except for Graffiti
+	  (which is the only unit which requires the much larger packet) [Skotlex]
+	* clif_getareachar_skillunit will send the unit_id of UNT_ATTACK_SKILLS for
+	  traps (this is to prevent them from displaying on the client) [Skotlex]
 	* Updated libs, Updated vc project files, And deleted uneeded DLLs.
 	  Credits to ALZ. [Zido]
-
 2006/04/14
 	* Updated sql-files/mob_db.sql to current. [Skotlex]
 	* Fixed being able to do all the stuff you shouldn't be able to during the

+ 49 - 64
src/map/clif.c

@@ -3800,14 +3800,28 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
  */
 int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *unit)
 {
-	int fd;
+	int fd, unit_id;
 	struct block_list *bl;
 
-	nullpo_retr(0, unit);
-
 	fd=sd->fd;
 	bl=map_id2bl(unit->group->src_id);
-#if PACKETVER < 3
+#if PACKETVER >= 3
+	if(unit->group->unit_id==UNT_GRAFFITI)	{ // Graffiti [Valaris]
+		WFIFOHEAD(fd,packet_len_table[0x1c9]);
+		memset(WFIFOP(fd,0),0,packet_len_table[0x1c9]);
+		WFIFOW(fd, 0)=0x1c9;
+		WFIFOL(fd, 2)=unit->bl.id;
+		WFIFOL(fd, 6)=unit->group->src_id;
+		WFIFOW(fd,10)=unit->bl.x;
+		WFIFOW(fd,12)=unit_id;
+		WFIFOB(fd,14)=unit->group->unit_id;
+		WFIFOB(fd,15)=1;
+		WFIFOB(fd,16)=1;
+		memcpy(WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE);
+		WFIFOSET(fd,packet_len_table[0x1c9]);
+		return 0;
+	}
+#endif
 	WFIFOHEAD(fd,packet_len_table[0x11f]);
 	memset(WFIFOP(fd,0),0,packet_len_table[0x11f]);
 	WFIFOW(fd, 0)=0x11f;
@@ -3815,17 +3829,22 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
 	WFIFOL(fd, 6)=unit->group->src_id;
 	WFIFOW(fd,10)=unit->bl.x;
 	WFIFOW(fd,12)=unit->bl.y;
-	WFIFOB(fd,14)=unit->group->unit_id;
+	//Use invisible unit id for traps.
+	WFIFOB(fd,14)=(skill_get_inf2(unit->group->skill_id)&INF2_TRAP?UNT_ATTACK_SKILLS:unit->group->unit_id);
 	WFIFOB(fd,15)=0;
 	WFIFOSET(fd,packet_len_table[0x11f]);
-#else
+
+	if(unit->group->skill_id == WZ_ICEWALL)
+		clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,5);
+	return 0;
+/* Previous implementation guess of packet 0x1c9, who can understand what all those fields are for? [Skotlex]
 	WFIFOHEAD(fd,packet_len_table[0x1c9]);
 	memset(WFIFOP(fd,0),0,packet_len_table[0x1c9]);
 	WFIFOW(fd, 0)=0x1c9;
 	WFIFOL(fd, 2)=unit->bl.id;
 	WFIFOL(fd, 6)=unit->group->src_id;
 	WFIFOW(fd,10)=unit->bl.x;
-	WFIFOW(fd,12)=unit->bl.y;
+	WFIFOW(fd,12)=unit_id;
 	WFIFOB(fd,14)=unit->group->unit_id;
 	WFIFOB(fd,15)=1;
 	if(unit->group->unit_id==UNT_GRAFFITI)	{ // Graffiti [Valaris]
@@ -3862,57 +3881,9 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
 		clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,5);
 
 	return 0;
+*/
 }
 
-int clif_reveal_skillunit(struct skill_unit *unit) {
-	struct block_list *bl;
-	unsigned char buf[97];
-	bl=map_id2bl(unit->group->src_id);
-#if PACKETVER < 3
-	memset(buf,0,packet_len_table[0x11f]);
-	WBUFW(buf, 0)=0x11f;
-	WBUFL(buf, 2)=unit->bl.id;
-	WBUFL(buf, 6)=unit->group->src_id;
-	WBUFW(buf,10)=unit->bl.x;
-	WBUFW(buf,12)=unit->bl.y;
-	WBUFB(buf,14)=unit->group->unit_id;
-	WBUFB(buf,15)=0;
-	clif_send(buf,packet_len_table[0x11f],&unit->bl,AREA);
-#else
-	memset(buf,0,packet_len_table[0x1c9]);
-	WBUFW(buf, 0)=0x1c9;
-	WBUFL(buf, 2)=unit->bl.id;
-	WBUFL(buf, 6)=unit->group->src_id;
-	WBUFW(buf,10)=unit->bl.x;
-	WBUFW(buf,12)=unit->bl.y;
-	WBUFB(buf,14)=unit->group->unit_id;
-	WBUFB(buf,15)=1;
-	WBUFL(buf,15+1)=0;
-	WBUFL(buf,15+5)=0;
-
-	WBUFL(buf,15+13)=unit->bl.y - 0x12;
-	WBUFL(buf,15+17)=0x004f37dd;
-	WBUFL(buf,15+21)=0x0012f674;
-	WBUFL(buf,15+25)=0x0012f664;
-	WBUFL(buf,15+29)=0x0012f654;
-	WBUFL(buf,15+33)=0x77527bbc;
-
-	WBUFB(buf,15+40)=0x2d;
-	WBUFL(buf,15+41)=0;
-	WBUFL(buf,15+45)=0;
-	WBUFL(buf,15+49)=0;
-	WBUFL(buf,15+53)=0x0048d919;
-	WBUFL(buf,15+57)=0x0000003e;
-	WBUFL(buf,15+61)=0x0012f66c;
-
-	if(bl) WBUFL(buf,15+73)=bl->y;
-	WBUFL(buf,15+77)=unit->bl.m;
-	WBUFB(buf,15+81)=0xaa;
-
-	clif_send(buf,packet_len_table[0x1c9],&unit->bl,AREA);
-#endif
-	return 0;
-}
 /*==========================================
  * 場所スキルエフェクトが視界から消える
  *------------------------------------------
@@ -3969,9 +3940,7 @@ int clif_01ac(struct block_list *bl)
 		clif_getareachar_item(sd,(struct flooritem_data*) bl);
 		break;
 	case BL_SKILL:
-		//Only reveal non-traps. [Skotlex]
-		if (!skill_get_inf2(((TBL_SKILL*)bl)->group->skill_id)&INF2_TRAP)
-			clif_getareachar_skillunit(sd,(TBL_SKILL*)bl);
+		clif_getareachar_skillunit(sd,(TBL_SKILL*)bl);
 		break;
 	default:
 		if(&sd->bl == bl)
@@ -4053,9 +4022,7 @@ int clif_insight(struct block_list *bl,va_list ap)
 			clif_getareachar_item(tsd,(struct flooritem_data*)bl);
 			break;
 		case BL_SKILL:
-			//Only reveal non-traps. [Skotlex]
-			if (!skill_get_inf2(((TBL_SKILL*)bl)->group->skill_id)&INF2_TRAP)
-				clif_getareachar_skillunit(tsd,(TBL_SKILL*)bl);
+			clif_getareachar_skillunit(tsd,(TBL_SKILL*)bl);
 			break;
 		default:
 			clif_getareachar_char(tsd,bl);
@@ -4465,7 +4432,22 @@ int clif_skill_setunit(struct skill_unit *unit)
 //	if (unit->group->unit_id == UNT_ATTACK_SKILLS)
 //		return 0;
 		
-#if PACKETVER < 3
+#if PACKETVER >= 3
+	if(unit->group->unit_id==UNT_GRAFFITI)	{ // Graffiti [Valaris]
+		memset(WBUFP(buf, 0),0,packet_len_table[0x1c9]);
+		WBUFW(buf, 0)=0x1c9;
+		WBUFL(buf, 2)=unit->bl.id;
+		WBUFL(buf, 6)=unit->group->src_id;
+		WBUFW(buf,10)=unit->bl.x;
+		WBUFW(buf,12)=unit->bl.y;
+		WBUFB(buf,14)=unit->group->unit_id;
+		WBUFB(buf,15)=1;
+		WBUFB(buf,16)=1;
+		memcpy(WBUFP(buf,17),unit->group->valstr,MESSAGE_SIZE);
+		clif_send(buf,packet_len_table[0x1c9],&unit->bl,AREA);
+		return 0;
+	}
+#endif
 	memset(WBUFP(buf, 0),0,packet_len_table[0x11f]);
 	WBUFW(buf, 0)=0x11f;
 	WBUFL(buf, 2)=unit->bl.id;
@@ -4475,7 +4457,9 @@ int clif_skill_setunit(struct skill_unit *unit)
 	WBUFB(buf,14)=unit->group->unit_id;
 	WBUFB(buf,15)=0;
 	clif_send(buf,packet_len_table[0x11f],&unit->bl,AREA);
-#else
+	return 0;
+	
+/* Previous mysterious implementation noone really understands. [Skotlex]
 		memset(WBUFP(buf, 0),0,packet_len_table[0x1c9]);
 		WBUFW(buf, 0)=0x1c9;
 		WBUFL(buf, 2)=unit->bl.id;
@@ -4514,6 +4498,7 @@ int clif_skill_setunit(struct skill_unit *unit)
 		clif_send(buf,packet_len_table[0x1c9],&unit->bl,AREA);
 #endif
 	return 0;
+*/
 }
 /*==========================================
  * 場所スキルエフェクト削除

+ 0 - 1
src/map/clif.h

@@ -100,7 +100,6 @@ int clif_clearchat(struct chat_data*,int);	// area or fd
 int clif_leavechat(struct chat_data*,struct map_session_data*);	// chat
 int clif_changechatstatus(struct chat_data*);	// chat
 int clif_refresh(struct map_session_data*);	// self
-int clif_reveal_skillunit(struct skill_unit *unit); //Area
 
 int clif_fame_blacksmith(struct map_session_data *, int);
 int clif_fame_alchemist(struct map_session_data *, int);

+ 0 - 1
src/map/pc.c

@@ -2532,7 +2532,6 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
 			}
 		}
 	}
-	first_sd = NULL; //First_sd will store who picked up the item.
 	//This function takes care of giving the item to whoever should have it
 	//considering party-share options.
 	if ((flag = party_share_loot(p,sd,&fitem->item_data))) {

+ 3 - 3
src/map/skill.c

@@ -1695,8 +1695,8 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
 	nullpo_retr(0, dsrc); //dsrc is the actual originator of the damage, can be the same as src, or a skill casted by src.
 	nullpo_retr(0, bl); //Target to be attacked.
 
-	if(src->prev == NULL || dsrc->prev == NULL || bl->prev == NULL)
-		return 0;
+//	if(src->prev == NULL || dsrc->prev == NULL || bl->prev == NULL)
+//		return 0;
 	if (src != dsrc) {
 		//When caster is not the src of attack, this is a ground skill, and as such, do the relevant target checking. [Skotlex]
 		if (!status_check_skilluse(battle_config.skill_caster_check?src:NULL, bl, skillid, 2))
@@ -2454,7 +2454,7 @@ static int skill_reveal_trap( struct block_list *bl,va_list ap )
 	TBL_SKILL *su = (TBL_SKILL*)bl;
 	if (su->alive && su->group && skill_get_inf2(su->group->skill_id)&INF2_TRAP)
 	{	//Reveal trap.
-		clif_reveal_skillunit(su);
+		clif_changetraplook(bl, su->group->unit_id);
 		return 1;
 	}
 	return 0;