From 35d7b2c7661bad6596a48c81f24a044a91fa346b Mon Sep 17 00:00:00 2001 From: Sara Date: Tue, 24 Mar 2009 01:56:16 +0000 Subject: * Added support for new status change packet, uses new setting display_status_timers in client.conf. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13613 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 11 ++++++----- src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/clif.c | 24 ++++++++++++++++++++---- src/map/clif.h | 2 +- src/map/pc.c | 2 +- src/map/status.c | 10 +++++----- src/map/status.h | 1 + src/map/unit.c | 14 ++++++++++---- 9 files changed, 46 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index f6928dcc0..1ed4f0701 100644 --- a/src/map/atcommand.c +++ b/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 )."); + if (!message || !*message || (i = sscanf(message, "%d %d %d", &type, &flag, &tick)) < 1) { + clif_displaymessage(fd, "Please, enter a status type/flag (usage: @displaystatus )."); 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; } diff --git a/src/map/battle.c b/src/map/battle.c index 66a70e8a7..bd9e49f5a 100644 --- a/src/map/battle.c +++ b/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, }, diff --git a/src/map/battle.h b/src/map/battle.h index 13d17cbb4..21c68b50b 100644 --- a/src/map/battle.h +++ b/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; diff --git a/src/map/clif.c b/src/map/clif.c index 063240899..c6fcb924b 100644 --- a/src/map/clif.c +++ b/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; } diff --git a/src/map/clif.h b/src/map/clif.h index 6356a0c89..7d866a801 100644 --- a/src/map/clif.h +++ b/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); diff --git a/src/map/pc.c b/src/map/pc.c index 9e0157041..9ee886984 100644 --- a/src/map/pc.c +++ b/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; diff --git a/src/map/status.c b/src/map/status.c index ae0da921f..05061ec5a 100644 --- a/src/map/status.c +++ b/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); diff --git a/src/map/status.h b/src/map/status.h index 0ac17016f..638783de1 100644 --- a/src/map/status.h +++ b/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, diff --git a/src/map/unit.c b/src/map/unit.c index 194145e58..faf6ec3e3 100644 --- a/src/map/unit.c +++ b/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; -- cgit v1.2.3-60-g2f50