diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-29 13:32:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-29 13:32:06 +0300 |
commit | 33dd27e7025553d3635dc06200c1189901243ede (patch) | |
tree | faf8038ddcea8f5f634dfb5922141a66f4819e32 | |
parent | f7557fca587fac9d7bb410dba724e2c53f3c831a (diff) | |
download | evol-hercules-33dd27e7025553d3635dc06200c1189901243ede.tar.gz evol-hercules-33dd27e7025553d3635dc06200c1189901243ede.tar.bz2 evol-hercules-33dd27e7025553d3635dc06200c1189901243ede.tar.xz evol-hercules-33dd27e7025553d3635dc06200c1189901243ede.zip |
map: send monster info packet.
For now include monster attack range.
-rw-r--r-- | src/map/clif.c | 14 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/send.c | 19 | ||||
-rw-r--r-- | src/map/send.h | 1 |
5 files changed, 35 insertions, 2 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 5868c5e..f92a9f7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -200,13 +200,13 @@ int eclif_send_actual(int *fd, void *buf, int *len) if (*len >= 2) { const int packet = RBUFW (buf, 0); - if (packet == 0xb02) + if (packet == 0xb02 || packet == 0xb03) { struct SessionExt *data = session_get(*fd); if (!data) return 0; if (data->clientVersion < 3) - { // not sending 0xb02 to old clients + { // not sending new packets to old clients hookStop(); return 0; } @@ -214,3 +214,13 @@ int eclif_send_actual(int *fd, void *buf, int *len) } return 0; } + +void eclif_set_unit_idle_post(struct block_list* bl, struct map_session_data *tsd, + enum send_target *target) +{ + if (!bl || !tsd) + return; + + if (bl->type == BL_MOB && tsd) + send_mob_info(bl, tsd ? &tsd->bl : bl, *target); +} diff --git a/src/map/clif.h b/src/map/clif.h index 0699601..3b28390 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -17,5 +17,7 @@ int eclif_send_actual(int *fd, void *buf, int *len); void eclif_authok_post(struct map_session_data *sd); void eclif_changemap_post(struct map_session_data *sd, short *m, int *x, int *y); +void eclif_set_unit_idle_post(struct block_list* bl, struct map_session_data *tsd, + enum send_target *target); #endif // EVOL_MAP_CLIF diff --git a/src/map/init.c b/src/map/init.c index 27bf766..2034b4f 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -104,6 +104,7 @@ HPExport void plugin_init (void) addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post); addHookPost("clif->authok", eclif_authok_post); addHookPost("clif->changemap", eclif_changemap_post); + addHookPost("clif->set_unit_idle", eclif_set_unit_idle_post); addHookPost("status->set_viewdata", estatus_set_viewdata_post); langScriptId = script->add_str("Lang"); diff --git a/src/map/send.c b/src/map/send.c index f923dbb..59402ad 100644 --- a/src/map/send.c +++ b/src/map/send.c @@ -10,6 +10,7 @@ #include "../../../common/mmo.h" #include "../../../common/socket.h" #include "../../../common/strlib.h" +#include "../../../map/mob.h" #include "../../../map/pc.h" #include "map/send.h" @@ -100,3 +101,21 @@ void send_mapmask_brodcast(const int map, const int mask) WBUFL (buf, 6) = 0; clif->send(buf, 10, &bl, ALL_SAMEMAP); } + +void send_mob_info(struct block_list* bl1, struct block_list* bl2, + enum send_target target) +{ + char buf[12]; + + if (bl1->type != BL_MOB) + return; + + struct mob_data *md = (struct mob_data *)bl1; + + WBUFW (buf, 0) = 0xb03; + WBUFW (buf, 2) = 12; // len + WBUFL (buf, 4) = md->bl.id; + WBUFL (buf, 8) = md->status.rhw.range; + + clif->send(&buf, sizeof(buf), bl2, target); +} diff --git a/src/map/send.h b/src/map/send.h index d79765a..05b20f1 100644 --- a/src/map/send.h +++ b/src/map/send.h @@ -10,5 +10,6 @@ void send_local_message(int fd, struct block_list* bl, const char* msg); void send_changelook(int fd, int id, int type, int val); void send_mapmask(int fd, int mask); void send_mapmask_brodcast(const int map, const int mask); +void send_mob_info(struct block_list* bl1, struct block_list* bl2, enum send_target target); #endif // EVOL_MAP_PC |