diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-17 20:45:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-17 20:45:00 +0300 |
commit | 834b4148b396a82962106db1c6c3c9d0c8636a99 (patch) | |
tree | df61f1c2d040193767e6a7d2173f89ed9b0ce0c0 | |
parent | 7d9be803ec4b90ff468365d6f843da9da74ac6e2 (diff) | |
download | plugin-834b4148b396a82962106db1c6c3c9d0c8636a99.tar.gz plugin-834b4148b396a82962106db1c6c3c9d0c8636a99.tar.bz2 plugin-834b4148b396a82962106db1c6c3c9d0c8636a99.tar.xz plugin-834b4148b396a82962106db1c6c3c9d0c8636a99.zip |
Add support for new casting packet 0xb1e.
In this packet added calculated skill range.
-rw-r--r-- | src/emap/clif.c | 83 | ||||
-rw-r--r-- | src/emap/clif.h | 8 | ||||
-rw-r--r-- | src/emap/init.c | 1 |
3 files changed, 92 insertions, 0 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c index 87a2adc..50ca4d9 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -594,6 +594,29 @@ int eclif_send_actual_pre(int *fd, return 0; } } + if (packet == 0xb1e) + { + struct SessionExt *data = session_get(*fd); + if (!data) + return 0; + if (data->clientVersion < 18) + { // not sending new packets to old clients +// ShowWarning("skip packet %d\n", packet); + hookStop(); + return 0; + } + } + if (packet == 0x7fb) + { + struct SessionExt *data = session_get(*fd); + if (!data) + return 0; + if (data->clientVersion >= 18) + { // not sending old packets to new clients + hookStop(); + return 0; + } + } } return 0; } @@ -1399,3 +1422,63 @@ void eclif_addcards2_post(unsigned short *cards, struct item *item) cards[3] = item->card[3]; } } + +void eclif_useskill(struct block_list* bl, + int src_id, + int dst_id, + int dst_x, + int dst_y, + uint16 skill_id, + uint16 skill_lv, + int casttime) +{ + const int cmd = 0x7fb; + unsigned char buf[50]; + int property = skill->get_ele(skill_id, skill_lv); + + // for client < 18 + WBUFW(buf, 0) = cmd; + WBUFL(buf, 2) = src_id; + WBUFL(buf, 6) = dst_id; + WBUFW(buf, 10) = dst_x; + WBUFW(buf, 12) = dst_y; + WBUFW(buf, 14) = skill_id; + WBUFL(buf, 16) = property < 0 ? 0 : property; //Avoid sending negatives as element [Skotlex] + WBUFL(buf, 20) = casttime; + WBUFB(buf, 24) = 0; // isDisposable + + if (clif->isdisguised(bl)) + { + clif->send(buf, 25, bl, AREA_WOS); + WBUFL(buf, 2) = -src_id; + clif->send(buf, 25, bl, SELF); + } + else + { + clif->send(buf, 25, bl, AREA); + } + + // for client >= 18 + const int len = 30; + WBUFW(buf, 0) = 0xb1e; + WBUFW(buf, 2) = len; + WBUFL(buf, 4) = src_id; + WBUFL(buf, 8) = dst_id; + WBUFW(buf, 12) = dst_x; + WBUFW(buf, 14) = dst_y; + WBUFW(buf, 16) = skill_id; + WBUFL(buf, 18) = property < 0 ? 0 : property; //Avoid sending negatives as element [Skotlex] + WBUFL(buf, 22) = casttime; + WBUFL(buf, 26) = skill->get_range2(bl, skill_id, skill_lv); + + if (clif->isdisguised(bl)) + { + clif->send(buf, len, bl, AREA_WOS); + WBUFL(buf, 2) = -src_id; + clif->send(buf, len, bl, SELF); + } + else + { + clif->send(buf, len, bl, AREA); + } +} diff --git a/src/emap/clif.h b/src/emap/clif.h index 046394f..9d4b774 100644 --- a/src/emap/clif.h +++ b/src/emap/clif.h @@ -85,5 +85,13 @@ void eclif_addcards_post(unsigned char *buf, struct item *item); void eclif_addcards2_post(unsigned short *cards, struct item *item); +void eclif_useskill(struct block_list* bl, + int src_id, + int dst_id, + int dst_x, + int dst_y, + uint16 skill_id, + uint16 skill_lv, + int casttime); #endif // EVOL_MAP_CLIF diff --git a/src/emap/init.c b/src/emap/init.c index a8a8ecd..3c57019 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -308,6 +308,7 @@ HPExport void plugin_init (void) skill->get_requirement_unknown = eskill_get_requirement_unknown; skill->castend_pos2_unknown = eskill_castend_pos2_unknown; skill->validate_additional_fields = eskill_validate_additional_fields; + clif->useskill = eclif_useskill; langScriptId = script->add_str("Lang"); mountScriptId = script->add_str("mount"); |