summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/init.c1
-rw-r--r--src/map/parse.c16
-rw-r--r--src/map/parse.h1
-rw-r--r--src/map/send.c8
-rw-r--r--src/map/send.h1
5 files changed, 27 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 0617c21..c00c884 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -108,6 +108,7 @@ HPExport void plugin_init (void)
addPacket(0xb07, 26, map_parse_join_channel, hpClif_Parse);
addPacket(0xb09, 26, map_parse_part_channel, hpClif_Parse);
addPacket(0xb0c, -1, map_parse_pet_say, hpClif_Parse);
+ addPacket(0xb0d, 3, map_parse_pet_emote, hpClif_Parse);
addHookPre("pc->readparam", epc_readparam_pre);
addHookPre("pc->setregistry", epc_setregistry);
addHookPre("pc->equipitem_pos", epc_equipitem_pos);
diff --git a/src/map/parse.c b/src/map/parse.c
index b2d66c0..bf3f296 100644
--- a/src/map/parse.c
+++ b/src/map/parse.c
@@ -108,3 +108,19 @@ void map_parse_pet_say(int fd)
safestrncpy(message, (char*)RFIFOP(fd, 4), len - 4);
send_pet_say(sd, message);
}
+
+void map_parse_pet_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;
+ send_pet_emote(sd, RFIFOB(fd, 2));
+}
diff --git a/src/map/parse.h b/src/map/parse.h
index 8badfc5..eaa3e37 100644
--- a/src/map/parse.h
+++ b/src/map/parse.h
@@ -8,5 +8,6 @@ void map_parse_version(int fd);
void map_parse_join_channel(int fd);
void map_parse_part_channel(int fd);
void map_parse_pet_say(int fd);
+void map_parse_pet_emote(int fd);
#endif // EVOL_MAP_PARSE
diff --git a/src/map/send.c b/src/map/send.c
index 097622a..7471c1f 100644
--- a/src/map/send.c
+++ b/src/map/send.c
@@ -274,3 +274,11 @@ void send_pet_say(struct map_session_data *sd, const char *const message)
buf[len - 1] = 0;
clif->GlobalMessage(&sd->pd->bl, buf);
}
+
+void send_pet_emote(struct map_session_data *sd, const int emote)
+{
+ if (!sd || !sd->pd)
+ return;
+
+ clif->emotion(&sd->pd->bl, emote);
+}
diff --git a/src/map/send.h b/src/map/send.h
index 04ba9aa..efb63e7 100644
--- a/src/map/send.h
+++ b/src/map/send.h
@@ -22,5 +22,6 @@ void send_npc_info(struct block_list* bl1,
struct block_list* bl2,
enum send_target target);
void send_pet_say(struct map_session_data *sd, const char *const message);
+void send_pet_emote(struct map_session_data *sd, const int emote);
#endif // EVOL_MAP_PC