summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/init.c1
-rw-r--r--src/map/parse.c23
-rw-r--r--src/map/parse.h1
-rw-r--r--src/map/send.c8
-rw-r--r--src/map/send.h1
5 files changed, 23 insertions, 11 deletions
diff --git a/src/map/init.c b/src/map/init.c
index c5ed8eb..1b1583a 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -115,6 +115,7 @@ HPExport void plugin_init (void)
addPacket(0xb11, 10, map_parse_pet_move, hpClif_Parse);
addPacket(0xb12, 9, map_parse_pet_dir, hpClif_Parse);
addPacket(0xb13, -1, map_parse_homun_say, hpClif_Parse);
+ addPacket(0xb14, 3, map_parse_homun_emote, hpClif_Parse);
addHookPre("pc->readparam", epc_readparam_pre);
addHookPre("pc->setregistry", epc_setregistry);
diff --git a/src/map/parse.c b/src/map/parse.c
index ba73516..cd33f23 100644
--- a/src/map/parse.c
+++ b/src/map/parse.c
@@ -125,7 +125,7 @@ void map_parse_pet_say(int fd)
void map_parse_pet_emote(int fd)
{
struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data;
- if (!sd)
+ if (!sd || !sd->pd)
return;
const time_t t = time(NULL);
if (sd->emotionlasttime + 1 >= t)
@@ -135,7 +135,7 @@ void map_parse_pet_emote(int fd)
}
sd->emotionlasttime = t;
- send_pet_emote(sd, RFIFOB(fd, 2));
+ clif->emotion(&sd->pd->bl, RFIFOB(fd, 2));
}
void map_parse_set_status(int fd)
@@ -186,3 +186,22 @@ void map_parse_homun_say(int fd)
else if (sd->hd && homun_alive(sd->hd))
send_slave_say(sd, &sd->hd->bl, sd->hd->homunculus.name, message);
}
+
+void map_parse_homun_emote(int fd)
+{
+ struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data;
+ if (!sd)
+ return;
+ const time_t t = time(NULL);
+ if (sd->emotionlasttime + 1 >= t)
+ { // not more than 1 per second
+ sd->emotionlasttime = t;
+ return;
+ }
+
+ sd->emotionlasttime = t;
+ if (sd->md && sd->md->db)
+ clif->emotion(&sd->md->bl, RFIFOB(fd, 2));
+ else if (sd->hd && homun_alive(sd->hd))
+ clif->emotion(&sd->hd->bl, RFIFOB(fd, 2));
+}
diff --git a/src/map/parse.h b/src/map/parse.h
index d59fd87..8bd5454 100644
--- a/src/map/parse.h
+++ b/src/map/parse.h
@@ -14,5 +14,6 @@ void map_parse_get_online_list(int fd);
void map_parse_pet_move(int fd);
void map_parse_pet_dir(int fd);
void map_parse_homun_say(int fd);
+void map_parse_homun_emote(int fd);
#endif // EVOL_MAP_PARSE
diff --git a/src/map/send.c b/src/map/send.c
index c2e79fc..0ba1089 100644
--- a/src/map/send.c
+++ b/src/map/send.c
@@ -276,14 +276,6 @@ void send_slave_say(struct map_session_data *sd,
aFree(buf);
}
-void send_pet_emote(struct map_session_data *sd, const int emote)
-{
- if (!sd || !sd->pd)
- return;
-
- clif->emotion(&sd->pd->bl, emote);
-}
-
void send_online_list(int fd, const char *buf, unsigned size)
{
if (!buf)
diff --git a/src/map/send.h b/src/map/send.h
index 0e18ff2..74f3e05 100644
--- a/src/map/send.h
+++ b/src/map/send.h
@@ -25,7 +25,6 @@ void send_slave_say(struct map_session_data *sd,
struct block_list *bl,
const char *const name,
const char *const message);
-void send_pet_emote(struct map_session_data *sd, const int emote);
void send_online_list(int fd, const char *buf, unsigned size);
#endif // EVOL_MAP_PC