From b35860a736d42d0320e9a7afbf9d56b7b95214f9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Feb 2015 13:40:10 +0300 Subject: Add packet for homunculus/mercenary talk. --- src/map/parse.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/map/parse.c') diff --git a/src/map/parse.c b/src/map/parse.c index 97aac6f..ba73516 100644 --- a/src/map/parse.c +++ b/src/map/parse.c @@ -12,6 +12,8 @@ #include "../../../common/strlib.h" #include "../../../map/channel.h" #include "../../../map/clif.h" +#include "../../../map/homunculus.h" +#include "../../../map/mercenary.h" #include "../../../map/pc.h" #include "../../../map/pet.h" #include "../../../map/unit.h" @@ -110,11 +112,14 @@ void map_parse_pet_say(int fd) char message[500]; struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data; + if (!sd || !sd->pd) + return; + const int len = RFIFOW(fd, 2); if (len > 500 || len < 6) return; safestrncpy(message, (char*)RFIFOP(fd, 4), len - 4); - send_pet_say(sd, message); + send_slave_say(sd, &sd->pd->bl, sd->pd->pet.name, message); } void map_parse_pet_emote(int fd) @@ -166,3 +171,18 @@ void map_parse_pet_dir(int fd) return; unit->setdir(&sd->pd->bl, RFIFOB(fd, 8)); } + +void map_parse_homun_say(int fd) +{ + char message[500]; + + struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data; + const int len = RFIFOW(fd, 2); + if (len > 500 || len < 6) + return; + safestrncpy(message, (char*)RFIFOP(fd, 4), len - 4); + if (sd->md && sd->md->db) + send_slave_say(sd, &sd->md->bl, sd->md->db->name, message); + else if (sd->hd && homun_alive(sd->hd)) + send_slave_say(sd, &sd->hd->bl, sd->hd->homunculus.name, message); +} -- cgit v1.2.3-70-g09d2