Browse Source

* Added support for new status change packet, uses new setting display_status_timers in client.conf.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13613 54d463be-8e91-2dee-dedb-b68131a5f0ec
Sara 16 years ago
parent
commit
b3860fdc01
14 changed files with 65 additions and 20 deletions
  1. 2 0
      Changelog-Trunk.txt
  2. 2 0
      conf/Changelog.txt
  3. 3 0
      conf/battle/client.conf
  4. 1 0
      db/Changelog.txt
  5. 11 0
      db/packet_db.txt
  6. 6 5
      src/map/atcommand.c
  7. 1 0
      src/map/battle.c
  8. 1 0
      src/map/battle.h
  9. 20 4
      src/map/clif.c
  10. 1 1
      src/map/clif.h
  11. 1 1
      src/map/pc.c
  12. 5 5
      src/map/status.c
  13. 1 0
      src/map/status.h
  14. 10 4
      src/map/unit.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2009/03/23
+	* Added support for new status change packet, uses new setting display_status_timers in client.conf. [Sara]
 2009/03/18
 	* Updated item_db.sql with the perl script [Playtester]
 2009/03/08

+ 2 - 0
conf/Changelog.txt

@@ -1,4 +1,6 @@
 Date	Added
+2009/3/23
+	* Added setting display_status_timers to client.conf for new status change packet. [Sara]
 2009/1/26
 	* Rev. 13494 Changed guild_skill_relog_delay to yes. Relogging no longer resets delay on guild skills. [L0ne_W0lf]
 2009/1/12

+ 3 - 0
conf/battle/client.conf

@@ -113,3 +113,6 @@ display_version: yes
 // When affected with the "Hallucination" status effect, send the effect to client? (Note 1)
 // Note: Set to 'no' if the client lags due to the "Wavy" screen effect.
 display_hallucination: yes
+
+// Set this to 1 if your client is newer than 2009-01-14aSakexe and you want skill timers displayed
+display_status_timers: no

+ 1 - 0
db/Changelog.txt

@@ -45,6 +45,7 @@
 	- duration is a fixed 30s, except for stun 5s and bleeding 60s
 	- petrify/stone don't have a 5-second solidifying phase (instant stone)
 	- also lol @ DARKGRANDNESS
+	* Added new packets, included new status change packet. [Sara]
 2009/03/22
 	* Hopefully fixed NPC_DEFENDER not working [Playtester]
 	  (thanks to Brainstorm for the fix)

+ 11 - 0
db/packet_db.txt

@@ -1208,6 +1208,17 @@ packet_ver: 23
 0x0437,7,actionrequest,2:6
 0x0438,10,useskilltoid,2:4:6
 0x0439,8,useitem,2:4
+0x043d,8
+0x043e,-1
+0x043f,25
+0x0440,10
+0x0441,4
+0x0442,-1
+0x0443,8
+0x0444,-1
+0x0445,10
+0x0446,14
+0x0448,-1
 
 //Add new packets here
 //packet_ver: 24

+ 6 - 5
src/map/atcommand.c

@@ -2816,16 +2816,17 @@ int atcommand_gat(const int fd, struct map_session_data* sd, const char* command
  *------------------------------------------*/
 int atcommand_displaystatus(const int fd, struct map_session_data* sd, const char* command, const char* message)
 {
-	int i, type, flag;
+	int i, type, flag, tick;
 	nullpo_retr(-1, sd);
 	
-	if (!message || !*message || (i = sscanf(message, "%d %d", &type, &flag)) < 1) {
-		clif_displaymessage(fd, "Please, enter a status type/flag (usage: @displaystatus <status type> <flag>).");
+	if (!message || !*message || (i = sscanf(message, "%d %d %d", &type, &flag, &tick)) < 1) {
+		clif_displaymessage(fd, "Please, enter a status type/flag (usage: @displaystatus <status type> <flag> <tick>).");
 		return -1;
 	}
-	if (i == 1) flag = 1;
+	if (i < 2) flag = 1;
+	if (i < 3) tick = 0;
 
-	clif_status_change(&sd->bl, type, flag);
+	clif_status_change(&sd->bl, type, flag, tick);
 
 	return 0;
 }

+ 1 - 0
src/map/battle.c

@@ -3826,6 +3826,7 @@ static const struct _battle_data {
 	{ "auction_maximumprice",               &battle_config.auction_maximumprice,            500000000, 0,   MAX_ZENY,       },
 	{ "gm_viewequip_min_lv",                &battle_config.gm_viewequip_min_lv,             0,      0,      99,             },
 	{ "homunculus_auto_vapor",              &battle_config.homunculus_auto_vapor,           0,      0,      1,              },
+	{ "display_status_timers",              &battle_config.display_status_timers,           1,      0,      1,              },
 // BattleGround Settings
 	{ "bg_update_interval",                 &battle_config.bg_update_interval,              1000,   100,    INT_MAX,        },
 	{ "bg_guild_id1",                       &battle_config.bg_guild_id1,                    0,      0,      INT_MAX,        },

+ 1 - 0
src/map/battle.h

@@ -461,6 +461,7 @@ extern struct Battle_Config
 	int auction_maximumprice;
 	int gm_viewequip_min_lv;
 	int homunculus_auto_vapor; //Keep Homunculus from Vaporizing when master dies. [L0ne_W0lf]
+	int display_status_timers; //Show or hide skill buff/delay timers in recent clients [Sara]
 	// [BattleGround Settings]
 	int bg_update_interval;
 	int bg_guild_id1;

+ 20 - 4
src/map/clif.c

@@ -4531,20 +4531,36 @@ int clif_status_load(struct block_list *bl,int type, int flag)
 /*==========================================
  * 状態異常アイコン/メッセージ表示
  *------------------------------------------*/
-int clif_status_change(struct block_list *bl,int type,int flag)
+int clif_status_change(struct block_list *bl,int type,int flag,unsigned int tick)
 {
 	unsigned char buf[16];
 
 	if (type == SI_BLANK)  //It shows nothing on the client...
 		return 0;
-	
+
 	nullpo_retr(0, bl);
 
-	WBUFW(buf,0)=0x0196;
+	if (type == SI_BLANK || type == SI_MAXIMIZEPOWER || type == SI_RIDING ||
+		type == SI_FALCON || type == SI_TRICKDEAD || type == SI_BROKENARMOR ||
+		type == SI_BROKENWEAPON || type == SI_WEIGHT50 || type == SI_WEIGHT90 ||
+		type == SI_TENSIONRELAX || type == SI_LANDENDOW || type == SI_AUTOBERSERK ||
+		type == SI_BUMP || type == SI_READYSTORM || type == SI_READYDOWN ||
+		type == SI_READYTURN || type == SI_READYCOUNTER || type == SI_DODGE ||
+		type == SI_DEVIL || type == SI_NIGHT || type == SI_INTRAVISION)
+		tick=0;
+	if( battle_config.display_skill_timers && tick>0 )
+		WBUFW(buf,0)=0x043f;
+	else
+		WBUFW(buf,0)=0x0196;
 	WBUFW(buf,2)=type;
 	WBUFL(buf,4)=bl->id;
 	WBUFB(buf,8)=flag;
-	clif_send(buf,packet_len(0x196),bl,AREA);
+	if( battle_config.display_skill_timers && tick>0 )
+		clif_send(buf,packet_len(0x196),bl,AREA);
+	else {
+		WBUFL(buf,9)=tick;
+		clif_send(buf,packet_len(0x43f),bl,AREA);
+	}
 	return 0;
 }
 

+ 1 - 1
src/map/clif.h

@@ -248,7 +248,7 @@ void clif_bladestop(struct block_list* src, int dst_id, int active);
 void clif_changemapcell(int fd, int m, int x, int y, int type, enum send_target target);
 
 int clif_status_load(struct block_list *bl,int type, int flag);
-int clif_status_change(struct block_list *bl,int type,int flag);
+int clif_status_change(struct block_list *bl,int type,int flag,unsigned int tick);
 
 int clif_wis_message(int fd, const char* nick, const char* mes, int mes_len);
 int clif_wis_end(int fd,int flag);

+ 1 - 1
src/map/pc.c

@@ -4543,7 +4543,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
 	status_calc_pc(sd,0);
 	clif_misceffect(&sd->bl,1);
 	if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
-		clif_status_change(&sd->bl,SI_DEVIL, 1); //Permanent blind effect from SG_DEVIL.
+		clif_status_change(&sd->bl,SI_DEVIL, 1, 0); //Permanent blind effect from SG_DEVIL.
 
 	npc_script_event(sd, NPCE_JOBLVUP);
 	return 1;

+ 5 - 5
src/map/status.c

@@ -5370,7 +5370,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
 			//val3 : Brings the skilllv (merged into val1 here)
 			//val4 : Partner
 			if (val1 == CG_MOONLIT)
-				clif_status_change(bl,SI_MOONLIT,1);
+				clif_status_change(bl,SI_MOONLIT,1,tick);
 			val1|= (val3<<16);
 			val3 = tick/1000; //Tick duration
 			tick = 1000;
@@ -6226,9 +6226,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
 	}
 
 	if( vd && (pcdb_checkid(vd->class_) || bl->type == BL_MER ) ) //Only for players sprites, client crashes if they receive this for a mob o.O [Skotlex]
-		clif_status_change(bl,StatusIconChangeTable[type],1);
+		clif_status_change(bl,StatusIconChangeTable[type],1,tick);
 	else if( sd ) //Send packet to self otherwise (disguised player?)
-		clif_status_load(bl,StatusIconChangeTable[type],1);
+		clif_status_load(bl,StatusIconChangeTable[type],1,tick);
 
 	//Don't trust the previous sce assignment, in case the SC ended somewhere between there and here.
 	if((sce=sc->data[type]))
@@ -6538,7 +6538,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
 				}
 			}
 			if ((sce->val1&0xFFFF) == CG_MOONLIT)
-				clif_status_change(bl,SI_MOONLIT,0);
+				clif_status_change(bl,SI_MOONLIT,0,0);
 
 			status_change_end(bl,SC_LONGING,-1);
 			break;
@@ -6815,7 +6815,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
 
 	//On Aegis, when turning off a status change, first goes the sc packet, then the option packet.
 	if( vd && (pcdb_checkid(vd->class_) || bl->type == BL_MER ) )
-		clif_status_change(bl,StatusIconChangeTable[type],0);
+		clif_status_change(bl,StatusIconChangeTable[type],0,0);
 	else if (sd)
 		clif_status_load(bl,StatusIconChangeTable[type],0);
 

+ 1 - 0
src/map/status.h

@@ -360,6 +360,7 @@ enum si_type {
 	//40: Again Aspd Potion
 	SI_SPEEDPOTION1		= 41,
 	SI_SPEEDPOTION2		= 42,
+	SI_ACTIONDELAY		= 46,
 	SI_STRIPWEAPON		= 50,
 	SI_STRIPSHIELD		= 51,
 	SI_STRIPARMOR		= 52,

+ 10 - 4
src/map/unit.c

@@ -435,7 +435,7 @@ int unit_run(struct block_list *bl)
 
 	if(to_x == bl->x && to_y == bl->y) {
 		//If you can't run forward, you must be next to a wall, so bounce back. [Skotlex]
-		clif_status_change(bl, SI_BUMP, 1);
+		clif_status_change(bl, SI_BUMP, 1, 0);
 
 		//Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin]
 		unit_bl2ud(bl)->state.running = 0;
@@ -443,7 +443,7 @@ int unit_run(struct block_list *bl)
 
 		skill_blown(bl,bl,skill_get_blewcount(TK_RUN,lv),unit_getdir(bl),0);
 		clif_fixpos(bl); //Why is a clif_slide (skill_blown) AND a fixpos needed? Ask Aegis.
-		clif_status_change(bl, SI_BUMP, 0);
+		clif_status_change(bl, SI_BUMP, 0, 0);
 		return 0;
 	}
 	if (unit_walktoxy(bl, to_x, to_y, 1))
@@ -455,7 +455,7 @@ int unit_run(struct block_list *bl)
 	} while (--i > 0 && !unit_walktoxy(bl, to_x, to_y, 1));
 	if (i==0) {
 		// copy-paste from above
-		clif_status_change(bl, SI_BUMP, 1);
+		clif_status_change(bl, SI_BUMP, 1, 0);
 
 		//Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin]
 		unit_bl2ud(bl)->state.running = 0;
@@ -463,7 +463,7 @@ int unit_run(struct block_list *bl)
 
 		skill_blown(bl,bl,skill_get_blewcount(TK_RUN,lv),unit_getdir(bl),0);
 		clif_fixpos(bl);
-		clif_status_change(bl, SI_BUMP, 0);
+		clif_status_change(bl, SI_BUMP, 0, 0);
 		return 0;
 	}
 	return 1;
@@ -1070,6 +1070,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
 		ud->state.skillcastcancel = 0;
 
 	ud->canact_tick  = tick + casttime + 100;
+	if ( sd )
+		clif_status_change(bl, SI_ACTIONDELAY, 1, ud->canact_tick);
 	ud->skilltarget  = target_id;
 	ud->skillx       = 0;
 	ud->skilly       = 0;
@@ -1175,6 +1177,8 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
 		ud->state.skillcastcancel=0;
 
 	ud->canact_tick  = tick + casttime + 100;
+	if ( sd )
+		clif_status_change(bl, SI_ACTIONDELAY, 1, ud->canact_tick);
 	ud->skillid      = skill_num;
 	ud->skilllv      = skill_lv;
 	ud->skillx       = skill_x;
@@ -1591,6 +1595,8 @@ int unit_skillcastcancel(struct block_list *bl,int type)
 	}
 	
 	ud->canact_tick = tick;
+	if ( sd )
+		clif_status_change(bl, SI_ACTIONDELAY, 1, ud->canact_tick);
 
 	if(type&1 && sd)
 		skill = sd->skillid_old;