summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-19 20:35:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-19 20:35:13 +0300
commita6c604b5228b023d638b1d595b80ed2e9ed29234 (patch)
tree019206664ae11603d8841b8fd35864acf00b8dbd /src
parentb495c9d144b75bbc7877aaf4efb19f09f47b0181 (diff)
downloadplugin-a6c604b5228b023d638b1d595b80ed2e9ed29234.tar.gz
plugin-a6c604b5228b023d638b1d595b80ed2e9ed29234.tar.bz2
plugin-a6c604b5228b023d638b1d595b80ed2e9ed29234.tar.xz
plugin-a6c604b5228b023d638b1d595b80ed2e9ed29234.zip
Send inf2 in skill info packet.
Diffstat (limited to 'src')
-rw-r--r--src/emap/clif.c43
-rw-r--r--src/emap/clif.h3
-rw-r--r--src/emap/init.c1
3 files changed, 47 insertions, 0 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index d0ab8bd..2faf394 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -1608,3 +1608,46 @@ void eclif_addskill_pre(struct map_session_data **sdPtr,
hookStop();
}
+
+void eclif_skillinfo_pre(struct map_session_data **sdPtr,
+ int *skill_idPtr,
+ int *infPtr)
+{
+ struct map_session_data *sd = *sdPtr;
+ nullpo_retv(sd);
+
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data)
+ return;
+ if (data->clientVersion < 18)
+ return;
+
+ int skill_id = *skill_idPtr;
+ int idx = skill->get_index(skill_id);
+ Assert_retv(idx >= 0 && idx < MAX_SKILL);
+ int inf = *infPtr;
+
+ const int fd = sd->fd;
+ int skill_lv = sd->status.skill[idx].lv;
+
+ const int sz = 21;
+ WFIFOHEAD(fd, sz);
+ WFIFOW(fd, 0) = 0xb20;
+ WFIFOW(fd, 2) = sz;
+ WFIFOW(fd, 4) = skill_id;
+ WFIFOL(fd, 6) = inf ? inf : skill->get_inf(skill_id);
+ WFIFOL(fd, 10) = skill->get_inf2(skill_id);
+ WFIFOW(fd, 14) = skill_lv;
+ if (skill_lv > 0) {
+ WFIFOW(fd, 16) = skill->get_sp(skill_id, skill_lv);
+ WFIFOW(fd, 18) = skill->get_range2(&sd->bl, skill_id, skill_lv);
+ } else {
+ WFIFOW(fd, 16) = 0;
+ WFIFOW(fd, 18) = 0;
+ }
+ if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT)
+ WFIFOB(fd, 20) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0;
+ else
+ WFIFOB(fd, 20) = 0;
+ WFIFOSET(fd, sz);
+}
diff --git a/src/emap/clif.h b/src/emap/clif.h
index 5f37b78..9605e7c 100644
--- a/src/emap/clif.h
+++ b/src/emap/clif.h
@@ -96,5 +96,8 @@ void eclif_useskill(struct block_list* bl,
void eclif_skillinfoblock_pre(struct map_session_data **sdPtr);
void eclif_addskill_pre(struct map_session_data **sdPtr,
int *idPtr);
+void eclif_skillinfo_pre(struct map_session_data **sdPtr,
+ int *skill_idPtr,
+ int *infPtr);
#endif // EVOL_MAP_CLIF
diff --git a/src/emap/init.c b/src/emap/init.c
index 7ce2a7b..9a1234b 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -230,6 +230,7 @@ HPExport void plugin_init (void)
addHookPre(clif, spawn_unit, eclif_spawn_unit_pre);
addHookPre(clif, skillinfoblock, eclif_skillinfoblock_pre);
addHookPre(clif, addskill, eclif_addskill_pre);
+ addHookPre(clif, skillinfo, eclif_skillinfo_pre);
addHookPre(itemdb, is_item_usable, eitemdb_is_item_usable_pre);
addHookPre(itemdb, readdb_additional_fields, eitemdb_readdb_additional_fields_pre);
addHookPre(itemdb, destroy_item_data, edestroy_item_data_pre);