summaryrefslogtreecommitdiff
path: root/src/emap/clif.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-17 20:45:00 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-17 20:45:00 +0300
commit834b4148b396a82962106db1c6c3c9d0c8636a99 (patch)
treedf61f1c2d040193767e6a7d2173f89ed9b0ce0c0 /src/emap/clif.c
parent7d9be803ec4b90ff468365d6f843da9da74ac6e2 (diff)
downloadplugin-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.
Diffstat (limited to 'src/emap/clif.c')
-rw-r--r--src/emap/clif.c83
1 files changed, 83 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);
+ }
+}