From a11db78940ba20570f11eda90b21028c09da03f2 Mon Sep 17 00:00:00 2001 From: Asheraf Date: Sun, 12 Nov 2017 23:56:11 +0000 Subject: Implement skill scale packet for client versions >= 20151223. --- db/pre-re/skill_db.conf | 1 + db/re/skill_db.conf | 1 + src/map/clif.c | 31 +++++++++++++++++++++++++++++++ src/map/clif.h | 1 + src/map/packets_struct.h | 13 +++++++++++++ src/map/skill.c | 6 ++++++ src/map/skill.h | 1 + 7 files changed, 54 insertions(+) diff --git a/db/pre-re/skill_db.conf b/db/pre-re/skill_db.conf index 80527b4f6..427cc96cb 100644 --- a/db/pre-re/skill_db.conf +++ b/db/pre-re/skill_db.conf @@ -73,6 +73,7 @@ Works like skill SA_FREECAST, allow move and attack with reduced speed. FreeCastNormal: true/false (boolean, defaults to false) Works like FreeCastReduced, but not reduce speed. + ShowSkillScale: true/false (boolean, defaults to false) } AttackType: "Attack Type" (string, defaults to "None") Types: "None", "Weapon", "Magic" or "Misc" diff --git a/db/re/skill_db.conf b/db/re/skill_db.conf index 2a59785fa..ced6e77c3 100644 --- a/db/re/skill_db.conf +++ b/db/re/skill_db.conf @@ -73,6 +73,7 @@ Works like skill SA_FREECAST, allow move and attack with reduced speed. FreeCastNormal: true/false (boolean, defaults to false) Works like FreeCastReduced, but not reduce speed. + ShowSkillScale: true/false (boolean, defaults to false) } AttackType: "Attack Type" (string, defaults to "None") Types: "None", "Weapon", "Magic" or "Misc" diff --git a/src/map/clif.c b/src/map/clif.c index 4dc36be6d..7fa05af05 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5068,6 +5068,10 @@ void clif_useskill(struct block_list* bl, int src_id, int dst_id, int dst_x, int } else { clif->send(buf,packet_len(cmd), bl, AREA); } +#if PACKETVER >= 20151223 + if ((skill->get_inf2(skill_id) & INF2_SHOW_SKILL_SCALE) != 0) + clif->skill_scale(bl, src_id, bl->x, bl->y, skill_id, skill_lv, casttime); +#endif } /// Notifies clients in area, that an object canceled casting (ZC_DISPEL). @@ -19860,6 +19864,32 @@ void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd) rodex->clean(sd, 1); } +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 + 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 (clif->isdisguised(bl)) { + clif->send(&p, sizeof(p), bl, AREA_WOS); + p.AID = -src_id; + clif->send(&p, sizeof(p), bl, SELF); + } else { + clif->send(&p, sizeof(p), bl, AREA); + } +#else + ShowWarning("clif_skill_scale: showing skill scale available only for clients >= 20151223."); + return; +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -20929,4 +20959,5 @@ void clif_defaults(void) { clif->rodex_request_items = clif_rodex_request_items; clif->rodex_icon = clif_rodex_icon; clif->rodex_send_mails_all = clif_rodex_send_mails_all; + clif->skill_scale = clif_skill_scale; } diff --git a/src/map/clif.h b/src/map/clif.h index 851c823ea..112db3dec 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1395,6 +1395,7 @@ struct clif_interface { void (*pRodexRequestItems) (int fd, struct map_session_data *sd); void (*rodex_request_items) (struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result); void (*rodex_icon) (int fd, bool show); + void (*skill_scale) (struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime); }; #ifdef HERCULES_CORE diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 03b555e2b..e1395e949 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -330,6 +330,9 @@ enum packet_headers { #else // PACKETVER >= 20160316 rodexcheckplayer = 0x0A51, #endif +#if PACKETVER >= 20151223 + skillscale = 0xA41, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -1478,6 +1481,16 @@ struct PACKET_ZC_ACK_ITEM_FROM_MAIL { int8 result; } __attribute__((packed)); +struct PACKET_ZC_SKILL_SCALE { + int16 PacketType; + uint32 AID; + int16 skill_id; + int16 skill_lv; + int16 x; + int16 y; + uint32 casttime; +} __attribute__((packed)); + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris diff --git a/src/map/skill.c b/src/map/skill.c index 726deaa9a..3b5c022ba 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -19651,6 +19651,12 @@ void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db * } else { sk->inf2 &= ~INF2_FREE_CAST_REDUCED; } + } else if (strcmpi(type, "ShowSkillScale") == 0) { + if (on) { + sk->inf2 |= INF2_SHOW_SKILL_SCALE; + } else { + sk->inf2 &= ~INF2_SHOW_SKILL_SCALE; + } } else if (strcmpi(type, "None") != 0) { skilldb_invalid_error(type, config_setting_name(t), sk->nameid); } diff --git a/src/map/skill.h b/src/map/skill.h index bba440107..8fc630716 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -120,6 +120,7 @@ enum e_skill_inf2 { INF2_CHORUS_SKILL = 0x04000, // Chorus skill INF2_FREE_CAST_NORMAL = 0x08000, INF2_FREE_CAST_REDUCED = 0x10000, + INF2_SHOW_SKILL_SCALE = 0x20000, }; -- cgit v1.2.3-70-g09d2 From f48b5b3e5788105c54c90edf2ba0d3232de639bb Mon Sep 17 00:00:00 2001 From: Asheraf Date: Thu, 16 Nov 2017 11:17:49 +0000 Subject: update skill db entries to support ShowSkillScale --- db/pre-re/skill_db.conf | 17 +++++++++++++++++ db/re/skill_db.conf | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/db/pre-re/skill_db.conf b/db/pre-re/skill_db.conf index 427cc96cb..06c06dd16 100644 --- a/db/pre-re/skill_db.conf +++ b/db/pre-re/skill_db.conf @@ -16552,6 +16552,7 @@ skill_db: ( SkillInfo: { NPC: true IgnoreLandProtector: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -16699,6 +16700,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16759,6 +16761,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -16778,6 +16781,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -16798,6 +16802,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16829,6 +16834,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16860,6 +16866,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16891,6 +16898,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16922,6 +16930,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16953,6 +16962,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -16984,6 +16994,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Magic" Element: "Ele_Fire" @@ -17007,6 +17018,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Magic" Element: "Ele_Dark" @@ -17070,6 +17082,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17175,6 +17188,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17206,6 +17220,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17237,6 +17252,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -17266,6 +17282,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true diff --git a/db/re/skill_db.conf b/db/re/skill_db.conf index ced6e77c3..815442fd9 100644 --- a/db/re/skill_db.conf +++ b/db/re/skill_db.conf @@ -17010,6 +17010,7 @@ skill_db: ( SkillInfo: { NPC: true IgnoreLandProtector: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -17157,6 +17158,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17217,6 +17219,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -17236,6 +17239,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -17256,6 +17260,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17287,6 +17292,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17318,6 +17324,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17349,6 +17356,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17380,6 +17388,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17411,6 +17420,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17442,6 +17452,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Magic" Element: "Ele_Fire" @@ -17465,6 +17476,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Magic" Element: "Ele_Dark" @@ -17528,6 +17540,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17633,6 +17646,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17664,6 +17678,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true @@ -17695,6 +17710,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } AttackType: "Weapon" DamageType: { @@ -17724,6 +17740,7 @@ skill_db: ( } SkillInfo: { NPC: true + ShowSkillScale: true } DamageType: { NoDamage: true -- cgit v1.2.3-70-g09d2