From d87ac219862dcacc7c5ade32e752cd401a6ea5d5 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Thu, 4 Jun 2020 19:53:19 +0200 Subject: [PATCH] Added support for skill scale display (#5041) Fixes #4530 Thanks to @Balferian --- conf/battle/client.conf | 4 ++++ db/pre-re/skill_db.yml | 25 +++++++++++++++++++++++++ db/re/skill_db.yml | 25 +++++++++++++++++++++++++ doc/skill_db.txt | 3 ++- src/map/battle.cpp | 1 + src/map/battle.hpp | 1 + src/map/clif.cpp | 31 ++++++++++++++++++++++++++++++- src/map/clif.hpp | 2 +- src/map/script_constants.hpp | 1 + src/map/skill.hpp | 1 + src/map/unit.cpp | 4 ++-- 11 files changed, 93 insertions(+), 5 deletions(-) diff --git a/conf/battle/client.conf b/conf/battle/client.conf index c429287279b..50d437769f6 100644 --- a/conf/battle/client.conf +++ b/conf/battle/client.conf @@ -145,3 +145,7 @@ ping_timer_inverval: 30 // Send packets timeout in seconds before ping packet can be sent. ping_time: 20 + +// Show skill scale for clients 2015-12-23 and newer? (Note 1) +// Official: yes +show_skill_scale: yes diff --git a/db/pre-re/skill_db.yml b/db/pre-re/skill_db.yml index 22f97f1eed4..6a22c72cb8b 100644 --- a/db/pre-re/skill_db.yml +++ b/db/pre-re/skill_db.yml @@ -15309,6 +15309,7 @@ Body: Flags: IsNpc: true TargetTrap: true + ShowScale: true Hit: Multi_Hit HitCount: 1 SplashArea: @@ -15414,6 +15415,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15460,6 +15462,7 @@ Body: Flags: IsNpc: true TargetTrap: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: 7 @@ -15475,6 +15478,7 @@ Body: Flags: IsNpc: true TargetTrap: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: 14 @@ -15489,6 +15493,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15513,6 +15518,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15537,6 +15543,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15561,6 +15568,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15585,6 +15593,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15609,6 +15618,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15634,6 +15644,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 Element: Fire @@ -15652,6 +15663,7 @@ Body: IgnoreDefCard: true Flags: IsNpc: true + ShowScale: true Range: 7 Hit: Single HitCount: 1 @@ -15748,6 +15760,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15864,6 +15877,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15888,6 +15902,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15912,6 +15927,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15945,6 +15961,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16224,6 +16241,7 @@ Body: Flags: IsNpc: true IgnoreLandProtector: true + ShowScale: true Hit: Single HitCount: 1 Element: Poison @@ -16240,6 +16258,8 @@ Body: Name: NPC_COMET Description: Comet 2 MaxLevel: 1 + Flags: + ShowScale: true - Id: 716 Name: NPC_MAXPAIN Description: Max Pain @@ -16271,6 +16291,8 @@ Body: Name: NPC_JACKFROST Description: Jack Frost 2 MaxLevel: 1 + Flags: + ShowScale: true - Id: 725 Name: NPC_REVERBERATION Description: Reverberation 2 @@ -16283,6 +16305,7 @@ Body: IsNpc: true IsTrap: true DisableNearNpc: true + ShowScale: true Range: 1 Hit: Single HitCount: 1 @@ -16323,6 +16346,8 @@ Body: Name: NPC_LEX_AETERNA Description: Lex Aeterna 2 MaxLevel: 1 + Flags: + ShowScale: true - Id: 728 Name: NPC_ARROWSTORM Description: NPC Arrow Storm diff --git a/db/re/skill_db.yml b/db/re/skill_db.yml index 735bda12661..05bd39f59e7 100644 --- a/db/re/skill_db.yml +++ b/db/re/skill_db.yml @@ -15722,6 +15722,7 @@ Body: Flags: IsNpc: true TargetTrap: true + ShowScale: true Hit: Multi_Hit HitCount: 1 SplashArea: @@ -15829,6 +15830,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15877,6 +15879,7 @@ Body: Flags: IsNpc: true TargetTrap: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: 7 @@ -15892,6 +15895,7 @@ Body: Flags: IsNpc: true TargetTrap: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: 14 @@ -15907,6 +15911,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15932,6 +15937,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15957,6 +15963,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -15982,6 +15989,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16007,6 +16015,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16032,6 +16041,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16058,6 +16068,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 Element: Fire @@ -16077,6 +16088,7 @@ Body: IgnoreDefCard: true Flags: IsNpc: true + ShowScale: true Range: 7 Hit: Single HitCount: 1 @@ -16175,6 +16187,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16295,6 +16308,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16320,6 +16334,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16345,6 +16360,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16378,6 +16394,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 SplashArea: @@ -16676,6 +16693,7 @@ Body: Flags: IsNpc: true IgnoreLandProtector: true + ShowScale: true Hit: Single HitCount: 1 Element: Poison @@ -16699,6 +16717,7 @@ Body: Splash: true Flags: AlterRangeRadius: true + ShowScale: true Range: 11 Hit: Multi_Hit HitCount: -20 @@ -16724,6 +16743,7 @@ Body: IgnoreDefCard: true Flags: IsNpc: true + ShowScale: true Hit: Single HitCount: 1 Duration1: 10000 @@ -16748,6 +16768,7 @@ Body: Flags: IsNpc: true IgnoreLandProtector: true + ShowScale: true Hit: Single HitCount: 1 Knockback: 2 @@ -16826,6 +16847,8 @@ Body: TargetType: Self DamageFlags: Splash: true + Flags: + ShowScale: true Hit: Multi_Hit HitCount: -5 Element: Water @@ -16864,6 +16887,7 @@ Body: IsNpc: true IsTrap: true DisableNearNpc: true + ShowScale: true Range: 1 Hit: Single HitCount: 1 @@ -16912,6 +16936,7 @@ Body: Splash: true Flags: IsNpc: true + ShowScale: true Range: 9 Hit: Single SplashArea: diff --git a/doc/skill_db.txt b/doc/skill_db.txt index 7f2582e560d..5b8cfe4889a 100644 --- a/doc/skill_db.txt +++ b/doc/skill_db.txt @@ -99,8 +99,9 @@ TargetManHole - Target enemy with SC__MANHOLE. TargetHidden - Target enemy with OPTION_HIDE. IncreaseDanceWithWugDamage - Increase SC_DANCEWITHWUG damage. IgnoreWugBite - Ignore RA_WUGBITE. -IgnoreAutoGuard - Not blocked by SC_AUTOGUARD (When TargetType is Weapon only). +IgnoreAutoGuard - Not blocked by SC_AUTOGUARD (When TargetType is Weapon only). IgnoreCicada - Not blocked by SC_UTSUSEMI or SC_BUNSINJYUTSU (When TargetType is Weapon only). +ShowScale - Shows AoE area while casting --------------------------------------- diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 892f22c3ad3..1378e0ca9ed 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -8956,6 +8956,7 @@ static const struct _battle_data { { "rental_item_novalue", &battle_config.rental_item_novalue, 1, 0, 1, }, { "ping_timer_inverval", &battle_config.ping_timer_interval, 30, 0, 99999999, }, { "ping_time", &battle_config.ping_time, 20, 0, 99999999, }, + { "show_skill_scale", &battle_config.show_skill_scale, 1, 0, 1, }, #include "../custom/battle_config_init.inc" }; diff --git a/src/map/battle.hpp b/src/map/battle.hpp index 15767c13b95..4097bf19e5c 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -680,6 +680,7 @@ struct Battle_Config int rental_item_novalue; int ping_timer_interval; int ping_time; + int show_skill_scale; #include "../custom/battle_config_struct.inc" }; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index d7dff73c64b..78c94651f85 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -5425,6 +5425,31 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) WFIFOSET(fd,packet_len(0x7e1)); } +void clif_skill_scale( struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime ){ +#if PACKETVER >= 20151223 + if( !battle_config.show_skill_scale ){ + return; + } + + struct PACKET_ZC_SKILL_SCALE p; + + p.PacketType = skillscale; + p.AID = src_id; + p.skill_id = skill_id; + p.skill_lv = skill_lv; + p.x = x; + p.y = y; + p.casttime = casttime; + + if( disguised( bl ) ){ + clif_send( &p, sizeof( p ), bl, AREA_WOS ); + p.AID = disguised_bl_id( bl->id ); + clif_send( &p, sizeof( p ), bl, SELF ); + }else{ + clif_send( &p, sizeof( p ), bl, AREA ); + } +#endif +} /// Notifies clients in area, that an object is about to use a skill. /// 013e .L .L .W .W .W .L .L (ZC_USESKILL_ACK) @@ -5441,7 +5466,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) /// is disposable: /// 0 = yellow chat text "[src name] will use skill [skill name]." /// 1 = no text -void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int property, int casttime) { #if PACKETVER < 20091124 const int cmd = 0x13e; @@ -5468,6 +5493,10 @@ void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, clif_send(buf,packet_len(cmd), bl, SELF); } else clif_send(buf,packet_len(cmd), bl, AREA); + + if( skill_get_inf2( skill_id, INF2_SHOWSCALE ) ){ + clif_skill_scale( bl, src_id, bl->x, bl->y, skill_id, skill_lv, casttime ); + } } diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 2dbdf0fd086..4a74a2ee617 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -694,7 +694,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf); void clif_addskill(struct map_session_data *sd, int skill_id); void clif_deleteskill(struct map_session_data *sd, int skill_id); -void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime); +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int property, int casttime); void clif_skillcastcancel(struct block_list* bl); void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype, int itemId = 0); void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, t_tick tick); diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp index a75f75ff4e2..79662ab9116 100644 --- a/src/map/script_constants.hpp +++ b/src/map/script_constants.hpp @@ -7527,6 +7527,7 @@ export_constant(INF2_IGNOREWUGBITE); export_constant(INF2_IGNOREAUTOGUARD); export_constant(INF2_IGNORECICADA); + export_constant(INF2_SHOWSCALE); /* skill no near npc flags */ export_constant(SKILL_NONEAR_WARPPORTAL); diff --git a/src/map/skill.hpp b/src/map/skill.hpp index 7f20a9998c3..5031bea9a3d 100644 --- a/src/map/skill.hpp +++ b/src/map/skill.hpp @@ -105,6 +105,7 @@ enum e_skill_inf2 : uint8 { INF2_IGNOREWUGBITE, // Skill blocked by RA_WUGBITE INF2_IGNOREAUTOGUARD , // Skill is not blocked by SC_AUTOGUARD (physical-skill only) INF2_IGNORECICADA, // Skill is not blocked by SC_UTSUSEMI or SC_BUNSINJYUTSU (physical-skill only) + INF2_SHOWSCALE, // Skill shows AoE area while casting INF2_MAX, }; diff --git a/src/map/unit.cpp b/src/map/unit.cpp index 2d0a74cbff9..dcae524a650 100644 --- a/src/map/unit.cpp +++ b/src/map/unit.cpp @@ -1890,7 +1890,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui skill_toggle_magicpower(src, skill_id); // In official this is triggered even if no cast time. - clif_skillcasting(src, src->id, target_id, 0,0, skill_id, skill_get_ele(skill_id, skill_lv), casttime); + clif_skillcasting(src, src->id, target_id, 0,0, skill_id, skill_lv, skill_get_ele(skill_id, skill_lv), casttime); if (sd && target->type == BL_MOB) { TBL_MOB *md = (TBL_MOB*)target; @@ -2149,7 +2149,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui skill_toggle_magicpower(src, skill_id); // In official this is triggered even if no cast time. - clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill_get_ele(skill_id, skill_lv), casttime); + clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill_lv, skill_get_ele(skill_id, skill_lv), casttime); if( casttime > 0 ) { ud->skilltimer = add_timer( tick+casttime, skill_castend_pos, src->id, 0 );