summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-20 16:38:41 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-20 16:38:41 +0300
commit8cc96fc6a97376a020b31fbb16196e3476f79ec5 (patch)
tree71e4c8dc49db7642df43ba68bcf1732643c46c4e /src
parent428c65b5c8d000d1cf3b3540de5bd91124c76113 (diff)
downloadevol-hercules-8cc96fc6a97376a020b31fbb16196e3476f79ec5.tar.gz
evol-hercules-8cc96fc6a97376a020b31fbb16196e3476f79ec5.tar.bz2
evol-hercules-8cc96fc6a97376a020b31fbb16196e3476f79ec5.tar.xz
evol-hercules-8cc96fc6a97376a020b31fbb16196e3476f79ec5.zip
map: add support for sending npc activate distance to client
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c28
-rw-r--r--src/map/send.c22
-rw-r--r--src/map/send.h3
3 files changed, 49 insertions, 4 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 3c6675e..d0634bd 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -218,7 +218,31 @@ int eclif_send_actual(int *fd, void *buf, int *len)
return 0;
if (data->clientVersion < 3)
{ // not sending new packets to old clients
- ShowWarning("skip packet %d\n", packet);
+// ShowWarning("skip packet %d\n", packet);
+ hookStop();
+ return 0;
+ }
+ }
+ if (packet >= 0xb03 && packet <= 0xb0a)
+ {
+ struct SessionExt *data = session_get(*fd);
+ if (!data)
+ return 0;
+ if (data->clientVersion < 4)
+ { // not sending new packets to old clients
+// ShowWarning("skip packet %d\n", packet);
+ hookStop();
+ return 0;
+ }
+ }
+ if (packet == 0xb0b)
+ {
+ struct SessionExt *data = session_get(*fd);
+ if (!data)
+ return 0;
+ if (data->clientVersion < 5)
+ { // not sending new packets to old clients
+// ShowWarning("skip packet %d\n", packet);
hookStop();
return 0;
}
@@ -237,6 +261,8 @@ void eclif_set_unit_idle_post(struct block_list* bl, struct map_session_data *ts
send_mob_info(bl, &tsd->bl, *target);
else if (bl->type == BL_PC)
send_pc_info(bl, &tsd->bl, *target);
+ else if (bl->type == BL_NPC)
+ send_npc_info(bl, &tsd->bl, *target);
}
void eclif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
diff --git a/src/map/send.c b/src/map/send.c
index aa03de0..98772ff 100644
--- a/src/map/send.c
+++ b/src/map/send.c
@@ -11,6 +11,7 @@
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
#include "../../../map/mob.h"
+#include "../../../map/npc.h"
#include "../../../map/pc.h"
#include "../../../map/unit.h"
@@ -134,12 +135,9 @@ void send_pc_info(struct block_list* bl1,
return;
struct map_session_data *sd = (struct map_session_data *)bl1;
-
struct SessionExt *data = session_get_bysd(sd);
if (!data)
return;
- if (data->clientVersion < 4)
- return;
WBUFW (buf, 0) = 0xb0a;
WBUFW (buf, 2) = 12; // len
@@ -152,6 +150,24 @@ void send_pc_info(struct block_list* bl1,
clif->send(&buf, sizeof(buf), bl2, target);
}
+void send_npc_info(struct block_list* bl1,
+ struct block_list* bl2,
+ enum send_target target)
+{
+ if (!bl1 || bl1->type != BL_NPC)
+ return;
+
+ TBL_NPC *const nd = (TBL_NPC*)bl1;
+
+ char buf[12];
+ WBUFW (buf, 0) = 0xb0b;
+ WBUFW (buf, 2) = 12; // len
+ WBUFL (buf, 4) = nd->bl.id;
+ WBUFL (buf, 8) = nd->area_size;
+
+ clif->send(&buf, sizeof(buf), bl2, target);
+}
+
void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_target target)
{
if (!ud)
diff --git a/src/map/send.h b/src/map/send.h
index e7bdd2a..0c6bb9c 100644
--- a/src/map/send.h
+++ b/src/map/send.h
@@ -18,5 +18,8 @@ void send_join_ack(int fd, const char *const name, int flag);
void send_pc_info(struct block_list* bl1,
struct block_list* bl2,
enum send_target target);
+void send_npc_info(struct block_list* bl1,
+ struct block_list* bl2,
+ enum send_target target);
#endif // EVOL_MAP_PC