diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-19 20:13:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-19 20:13:46 +0300 |
commit | b495c9d144b75bbc7877aaf4efb19f09f47b0181 (patch) | |
tree | b674cfcdcf5574b7899db59717ac7337c64c1dfd /src | |
parent | e7f1290ab54d37ef72c97721cbb4f53a8ab56b86 (diff) | |
download | evol-hercules-b495c9d144b75bbc7877aaf4efb19f09f47b0181.tar.gz evol-hercules-b495c9d144b75bbc7877aaf4efb19f09f47b0181.tar.bz2 evol-hercules-b495c9d144b75bbc7877aaf4efb19f09f47b0181.tar.xz evol-hercules-b495c9d144b75bbc7877aaf4efb19f09f47b0181.zip |
Send inf2 in add skill packet.
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/clif.c | 58 | ||||
-rw-r--r-- | src/emap/clif.h | 2 | ||||
-rw-r--r-- | src/emap/init.c | 1 |
3 files changed, 61 insertions, 0 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c index 686cb08..d0ab8bd 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -1550,3 +1550,61 @@ void eclif_skillinfoblock_pre(struct map_session_data **sdPtr) } hookStop(); } + +void eclif_addskill_pre(struct map_session_data **sdPtr, + int *idPtr) +{ + struct map_session_data *sd = *sdPtr; + nullpo_retv(sd); + int id = *idPtr; + + struct SessionExt *data = session_get_bysd(sd); + if (!data) + return; + if (data->clientVersion < 18) + return; + + int fd = sd->fd; + if (!fd) + { + hookStop(); + return; + } + + const int idx = skill->get_index(id); + + if (sd->status.skill[idx].id <= 0) + { + hookStop(); + return; + } + + const int skill_lv = sd->status.skill[idx].lv; + const int sz = 45; + + WFIFOHEAD(fd, sz); + WFIFOW(fd, 0) = 0xb1f; + WFIFOW(fd, 2) = sz; + WFIFOW(fd, 4) = id; + WFIFOL(fd, 6) = skill->get_inf(id); + WFIFOL(fd, 10) = skill->get_inf2(id); + WFIFOW(fd, 14) = skill_lv; + if (skill_lv > 0) + { + WFIFOW(fd, 16) = skill->get_sp(id, skill_lv); + WFIFOW(fd, 18) = skill->get_range2(&sd->bl, id, skill_lv); + } + else + { + WFIFOW(fd, 16) = 0; + WFIFOW(fd, 18) = 0; + } + safestrncpy(WFIFOP(fd, 20), skill->get_name(id), NAME_LENGTH); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd, 44) = (skill_lv < skill->tree_get_max(id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd, 44) = 0; + WFIFOSET(fd, sz); + + hookStop(); +} diff --git a/src/emap/clif.h b/src/emap/clif.h index d1ce26f..5f37b78 100644 --- a/src/emap/clif.h +++ b/src/emap/clif.h @@ -94,5 +94,7 @@ void eclif_useskill(struct block_list* bl, uint16 skill_lv, int casttime); void eclif_skillinfoblock_pre(struct map_session_data **sdPtr); +void eclif_addskill_pre(struct map_session_data **sdPtr, + int *idPtr); #endif // EVOL_MAP_CLIF diff --git a/src/emap/init.c b/src/emap/init.c index ddb4c8e..7ce2a7b 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -229,6 +229,7 @@ HPExport void plugin_init (void) addHookPre(clif, pLoadEndAck, eclif_parse_LoadEndAck_pre); addHookPre(clif, spawn_unit, eclif_spawn_unit_pre); addHookPre(clif, skillinfoblock, eclif_skillinfoblock_pre); + addHookPre(clif, addskill, eclif_addskill_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); |