summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-11-18 20:08:29 +0100
committerGitHub <noreply@github.com>2017-11-18 20:08:29 +0100
commit901df02711777462bd9e4016c91b8166441d9353 (patch)
tree66078c91ed3cc6d99e406cad4dfc5f472f2878ee /src/map
parent65f7edf0d88ba7a879427ad2e99c91c20b8a599f (diff)
parentf48b5b3e5788105c54c90edf2ba0d3232de639bb (diff)
downloadhercules-901df02711777462bd9e4016c91b8166441d9353.tar.gz
hercules-901df02711777462bd9e4016c91b8166441d9353.tar.bz2
hercules-901df02711777462bd9e4016c91b8166441d9353.tar.xz
hercules-901df02711777462bd9e4016c91b8166441d9353.zip
Merge pull request #1903 from Asheraf/skill_scale
Implement skill scale packet for client versions >= 20151223.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c31
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h13
-rw-r--r--src/map/skill.c6
-rw-r--r--src/map/skill.h1
5 files changed, 52 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 4bf3cdf94..95a2d8f5d 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 1b7d40e83..d20178a34 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -20030,6 +20030,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 fa95a1a99..a0591de74 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -119,6 +119,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,
};