From 9aa109f1e404c60cf94832f95c82b7056916d14a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Nov 2014 11:43:12 +0300 Subject: map: show most slots to other players on warp or enter visible area. --- src/map/clif.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/map/clif.h | 1 + src/map/init.c | 2 ++ src/map/send.c | 11 +++++++++++ src/map/send.h | 1 + 5 files changed, 57 insertions(+) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 66a7312..0bcd990 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17,6 +17,7 @@ #include "map/clif.h" #include "map/lang.h" +#include "map/send.h" void eclif_quest_send_list(struct map_session_data *sd) { @@ -97,3 +98,44 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl) } } } + +#define equipPos(index, field) \ + equip = sd->equip_index[index]; \ + if (equip >= 0) \ + { \ + item = sd->inventory_data[equip]; \ + if (item && item->look) \ + send_changelook(fd, id, field, item->look); \ + } + +static void eclif_send_additional_slots(struct map_session_data* sd, struct map_session_data* sd2) +{ + int f; + const int id = sd->bl.id; + const int fd = sd2->fd; + + struct item_data *item; + short equip; + + equipPos(EQI_HEAD_LOW, LOOK_HEAD_BOTTOM); + equipPos(EQI_HEAD_TOP, LOOK_HEAD_TOP); + equipPos(EQI_HEAD_MID, LOOK_HEAD_MID); + equipPos(EQI_GARMENT, LOOK_ROBE); + //skip EQI_ARMOR + equipPos(EQI_SHOES, LOOK_SHOES); + equipPos(EQI_COSTUME_TOP, 13); + equipPos(EQI_COSTUME_MID, 14); + equipPos(EQI_COSTUME_LOW, 15); + equipPos(EQI_COSTUME_GARMENT, 16); + //skipping SHADOW slots +} + +void eclif_getareachar_unit_post(struct map_session_data* sd, struct block_list *bl) +{ + // need replace it to _post + if (bl->type == BL_PC) + { + eclif_send_additional_slots(sd, (struct map_session_data *)bl); + eclif_send_additional_slots((struct map_session_data *)bl, sd); + } +} diff --git a/src/map/clif.h b/src/map/clif.h index 5ad3a7b..4aaf033 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -7,5 +7,6 @@ void eclif_quest_send_list(struct map_session_data *sd); void eclif_quest_add(struct map_session_data *sd, struct quest *qd); void eclif_charnameack(int *fdPtr, struct block_list *bl); +void eclif_getareachar_unit_post(struct map_session_data* sd, struct block_list *bl); #endif // EVOL_MAP_CLIF diff --git a/src/map/init.c b/src/map/init.c index 7cf8b4e..eeb5785 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -92,6 +92,8 @@ HPExport void plugin_init (void) addHookPre("clif->quest_add", eclif_quest_add); addHookPre("clif->charnameack", eclif_charnameack); + addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post); + langScriptId = script->add_str("Lang"); } diff --git a/src/map/send.c b/src/map/send.c index 2739e7b..8e2f878 100644 --- a/src/map/send.c +++ b/src/map/send.c @@ -68,3 +68,14 @@ void send_local_message(int fd, struct block_list* bl, const char* msg) safestrncpy((char*)WFIFOP(fd, 8), msg, msg_len); WFIFOSET (fd, msg_len + 8); } + +void send_changelook(int fd, int id, int type, int val) +{ + WFIFOHEAD (fd, 11); + WFIFOW (fd, 0) = 0x1d7; + WFIFOL (fd, 2) = id; + WFIFOB (fd, 6) = type; + WFIFOW (fd, 7) = val; + WFIFOW (fd, 9) = 0; + WFIFOSET (fd, 11); +} diff --git a/src/map/send.h b/src/map/send.h index d9c6daa..afa0f3b 100644 --- a/src/map/send.h +++ b/src/map/send.h @@ -7,5 +7,6 @@ void send_npccommand (struct map_session_data *sd, int npcId, int cmd); void send_npccommand2 (struct map_session_data *sd, int npcId, int cmd, int id, int x, int y); void send_local_message(int fd, struct block_list* bl, const char* msg); +void send_changelook(int fd, int id, int type, int val); #endif // EVOL_MAP_PC -- cgit v1.2.3-70-g09d2