Ver Fonte

- Added function clif_changetraplook to handle changing the appearance of traps as they are triggered (rather than using clif_changelook which is meant for view_data objects)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5852 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex há 19 anos atrás
pai
commit
d336815c66
4 ficheiros alterados com 40 adições e 6 exclusões
  1. 3 0
      Changelog-Trunk.txt
  2. 30 0
      src/map/clif.c
  3. 1 0
      src/map/clif.h
  4. 6 6
      src/map/skill.c

+ 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/04/01
+	* Added function clif_changetraplook to handle changing the appearance of
+	  traps as they are triggered. Fixes all the nullpos related to trap usage.
+	  [Skotlex]
 	* Fixed berserk not raising your HP to your new cap. [Skotlex]
 	* Fixed ground-skills not displaying damage done. [Skotlex]
 	* Fixed a few functions sending a negative ID for disguised characters

+ 30 - 0
src/map/clif.c

@@ -2715,6 +2715,36 @@ int clif_changelook(struct block_list *bl,int type,int val)
 	return 0;
 }
 
+//Sends a change-base-look packet required for traps as they are triggered.
+void clif_changetraplook(struct block_list *bl,int val)
+{
+	unsigned char buf[32];
+#if PACKETVER < 4
+	WBUFW(buf,0)=0xc3;
+	WBUFL(buf,2)=bl->id;
+	WBUFB(buf,6)=LOOK_BASE;
+	WBUFB(buf,7)=val;
+	clif_send(buf,packet_len_table[0xc3],bl,AREA);
+#else
+	if (val > 255)
+	{
+		WBUFW(buf,0)=0x1d7;
+		WBUFL(buf,2)=bl->id;
+		WBUFB(buf,6)=LOOK_BASE;
+		WBUFW(buf,7)=val;
+		WBUFW(buf,9)=0;
+		clif_send(buf,packet_len_table[0x1d7],bl,AREA);
+	} else {
+		WBUFW(buf,0)=0xc3;
+		WBUFL(buf,2)=bl->id;
+		WBUFB(buf,6)=LOOK_BASE;
+		WBUFB(buf,7)=val;
+		clif_send(buf,packet_len_table[0xc3],bl,AREA);
+	}
+#endif
+
+	
+}
 //For the stupid cloth-dye bug. Resends the given view data
 //to the area specified by bl.
 void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area)

+ 1 - 0
src/map/clif.h

@@ -77,6 +77,7 @@ int clif_changestatus(struct block_list*,int,int);	//area
 int clif_damage(struct block_list *,struct block_list *,unsigned int,int,int,int,int,int,int);	// area
 #define clif_takeitem(src,dst) clif_damage(src,dst,0,0,0,0,0,1,0)
 int clif_changelook(struct block_list *,int,int);	// area
+void clif_changetraplook(struct block_list *bl,int val); // area
 void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area); //area specified in 'area'
 int clif_arrowequip(struct map_session_data *sd,int val); //self
 int clif_arrow_fail(struct map_session_data *sd,int type); //self

+ 6 - 6
src/map/skill.c

@@ -5107,7 +5107,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 					case UNT_CLAYMORETRAP:
 					case UNT_TALKIEBOX:
 						su->group->unit_id = UNT_USED_TRAPS;
-						clif_changelook(bl,LOOK_BASE,su->group->unit_id);
+						clif_changetraplook(bl, UNT_USED_TRAPS);
 						su->group->limit=DIFF_TICK(tick+1500,su->group->tick);
 						su->limit=DIFF_TICK(tick+1500,su->group->tick);
 				}
@@ -6845,7 +6845,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
 		{
 			skill_blown(&src->bl,bl,skill_get_blewcount(sg->skill_id,sg->skill_lv)|0x10000);
 			sg->unit_id = UNT_USED_TRAPS;
-			clif_changelook(&src->bl,LOOK_BASE,sg->unit_id);
+			clif_changetraplook(&src->bl, UNT_USED_TRAPS);
 			sg->limit=DIFF_TICK(tick,sg->tick)+1500;
 			sg->val3 = BD_INTOABYSS; //Prevent Remove Trap from giving you the trap back. [Skotlex]
 		}
@@ -6882,7 +6882,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
 	case UNT_LANDMINE:
 		skill_attack(BF_MISC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
 		sg->unit_id = UNT_USED_TRAPS;
-		clif_changelook(&src->bl,LOOK_BASE,UNT_FIREPILLAR_ACTIVE);
+		clif_changetraplook(&src->bl, UNT_FIREPILLAR_ACTIVE);
 		sg->limit=DIFF_TICK(tick,sg->tick)+1500;
 		sg->val3 = BD_INTOABYSS; //Prevent Remove Trap from giving you the trap back. [Skotlex]
 		break;
@@ -6900,7 +6900,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
 			skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag,
 			&src->bl,tick,splash_count);
 		sg->unit_id = UNT_USED_TRAPS;
-		clif_changelook(&src->bl,LOOK_BASE,sg->unit_id);
+		clif_changetraplook(&src->bl, UNT_USED_TRAPS);
 		sg->limit=DIFF_TICK(tick,sg->tick)+1500;
 		sg->val3 = BD_INTOABYSS; //Prevent Remove Trap from giving you the trap back. [Skotlex]
 		break;
@@ -6911,7 +6911,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
 		if (sg->val2 == 0){
 			clif_talkiebox(&src->bl, sg->valstr);
 			sg->unit_id = UNT_USED_TRAPS;
-			clif_changelook(&src->bl, LOOK_BASE, sg->unit_id);
+			clif_changetraplook(&src->bl, UNT_USED_TRAPS);
 			sg->limit = DIFF_TICK(tick, sg->tick) + 5000;
 			sg->val2 = -1; //“¥‚ñ‚¾
 			sg->val3 = BD_INTOABYSS; //Prevent Remove Trap from giving you the trap back. [Skotlex]
@@ -9592,7 +9592,7 @@ int skill_unit_timer_sub( struct block_list *bl, va_list ap )
 		switch(group->unit_id){
 			case UNT_BLASTMINE:
 				group->unit_id = UNT_USED_TRAPS;
-				clif_changelook(bl,LOOK_BASE,group->unit_id);
+				clif_changetraplook(bl, UNT_USED_TRAPS);
 				group->limit=DIFF_TICK(tick+1500,group->tick);
 				unit->limit=DIFF_TICK(tick+1500,group->tick);
 				break;