summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-08-29 00:54:37 +0300
committerAndrei Karas <akaras@inbox.ru>2019-09-18 22:31:51 +0300
commit070256d031a01159c588fa62cd849624727e22ff (patch)
tree3b79fa9522b384c1ab69bb7084f22886ac297a63 /src/map
parent5fd9acf126af159d6a2fef4cccc8b2ed92bc2553 (diff)
downloadhercules-070256d031a01159c588fa62cd849624727e22ff.tar.gz
hercules-070256d031a01159c588fa62cd849624727e22ff.tar.bz2
hercules-070256d031a01159c588fa62cd849624727e22ff.tar.xz
hercules-070256d031a01159c588fa62cd849624727e22ff.zip
Convert packet ZC_TALKBOX_CHATCONTENTS into struct and add new packet version
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/mapdefines.h10
-rw-r--r--src/map/packets_struct.h7
3 files changed, 21 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 1c245ed43..e9d731224 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8689,14 +8689,14 @@ static void clif_emotion(struct block_list *bl, int type)
/// 0191 <id>.L <contents>.80B
static void clif_talkiebox(struct block_list *bl, const char *talkie)
{
- unsigned char buf[MESSAGE_SIZE+6];
nullpo_retv(bl);
nullpo_retv(talkie);
+ struct PACKET_ZC_TALKBOX_CHATCONTENTS p;
- WBUFW(buf,0) = 0x191;
- WBUFL(buf,2) = bl->id;
- safestrncpy(WBUFP(buf,6),talkie,MESSAGE_SIZE);
- clif->send(buf,packet_len(0x191),bl,AREA);
+ p.PacketType = HEADER_ZC_TALKBOX_CHATCONTENTS;
+ p.aid = bl->id;
+ safestrncpy(&p.message[0], talkie, TALKBOX_MESSAGE_SIZE);
+ clif->send(&p, sizeof(struct PACKET_ZC_TALKBOX_CHATCONTENTS), bl, AREA);
}
/// Displays wedding effect centered on an object (ZC_CONGRATULATION).
diff --git a/src/map/mapdefines.h b/src/map/mapdefines.h
index df9e9bccb..348ca98fd 100644
--- a/src/map/mapdefines.h
+++ b/src/map/mapdefines.h
@@ -21,6 +21,8 @@
#ifndef MAP_MAPDEFINES_H
#define MAP_MAPDEFINES_H
+#include "common/mmo.h" // packet versions
+
#define MAX_NPC_PER_MAP 512
#define AREA_SIZE (battle->bc->area_size)
#define CHAT_AREA_SIZE (battle->bc->chat_area_size)
@@ -57,8 +59,14 @@
#define MAPID_UPPERMASK 0x0fff
#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK)
-// Max size for inputs to Graffiti, Talkie Box and Vending text prompts
+// Max size for inputs to Vending text prompts
#define MESSAGE_SIZE (79 + 1)
+// Max size for inputs to Graffiti, Talkie Box text prompts
+#if PACKETVER_MAIN_NUM >= 20190904 || PACKETVER_RE_NUM >= 20190904 || PACKETVER_ZERO_NUM >= 20190828
+#define TALKBOX_MESSAGE_SIZE 21
+#else
+#define TALKBOX_MESSAGE_SIZE (79 + 1)
+#endif
// String length you can write in the 'talking box'
#define CHATBOX_SIZE (70 + 1)
// Chatroom-related string sizes
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index d12dc14d4..45254b5f8 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -3610,6 +3610,13 @@ struct PACKET_ZC_NPC_MARKET_PURCHASE_RESULT {
DEFINE_PACKET_HEADER(ZC_NPC_MARKET_PURCHASE_RESULT, 0x09d7);
#endif
+struct PACKET_ZC_TALKBOX_CHATCONTENTS {
+ int16 PacketType;
+ uint32 aid;
+ char message[TALKBOX_MESSAGE_SIZE];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_TALKBOX_CHATCONTENTS, 0x0191);
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris