summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-09-12 00:16:56 +0000
committerFate <fate-tmw@googlemail.com>2009-09-12 00:16:56 +0000
commit6d6ee36ddea2465e34fcb67fc0fc8f37e9818df5 (patch)
tree77cefd6e2392085bf92abeca0af1ef4462e25941 /src/map/clif.c
parent80361c9a3b7fde14bbc094cc1dd241b52e33d9bc (diff)
downloadtmwa-6d6ee36ddea2465e34fcb67fc0fc8f37e9818df5.tar.gz
tmwa-6d6ee36ddea2465e34fcb67fc0fc8f37e9818df5.tar.bz2
tmwa-6d6ee36ddea2465e34fcb67fc0fc8f37e9818df5.tar.xz
tmwa-6d6ee36ddea2465e34fcb67fc0fc8f37e9818df5.zip
Implemented pDeaf property (70) which makes PCs ignore regular PC chat (except for GMs)
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 70311e9..b9dc90c 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -49,6 +49,7 @@
#endif
#define STATE_BLIND 0x10
+#define EMOTE_IGNORED 0x0e
static const int packet_len_table[0x220] = {
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -207,6 +208,18 @@ int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...)
return 0;
}
+static int
+is_deaf(struct block_list *bl)
+{
+ struct map_session_data *sd = (struct map_session_data *) bl;
+ if (!bl || bl->type != BL_PC)
+ return 0;
+ return sd->special_state.deaf;
+}
+
+static void clif_emotion_towards(struct block_list *bl, struct block_list *target, int type);
+
+
/*==========================================
* clif_send��AREA*�w�莞�p
*------------------------------------------
@@ -233,9 +246,17 @@ int clif_send_sub(struct block_list *bl, va_list ap)
if (bl && bl == src_bl)
return 0;
break;
+
+ case AREA_CHAT_WOC:
+ if (is_deaf (bl) && !(bl->type == BL_PC && pc_isGM((struct map_session_data *)src_bl))) {
+ clif_emotion_towards(src_bl, bl, EMOTE_IGNORED);
+ return 0;
+ }
+ /* fall through... */
case AREA_WOC:
if ((sd && sd->chatID) || (bl && bl == src_bl))
return 0;
+
break;
case AREA_WOSC:
if ((sd) && sd->chatID && sd->chatID == ((struct map_session_data*)src_bl)->chatID)
@@ -325,7 +346,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
map_foreachinarea(clif_send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_PC, buf, len, bl, type);
break;
case AREA_CHAT_WOC:
- map_foreachinarea(clif_send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC);
+ map_foreachinarea(clif_send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_CHAT_WOC);
break;
case CHAT:
case CHAT_WOS:
@@ -5878,6 +5899,26 @@ void clif_emotion(struct block_list *bl,int type)
clif_send(buf,packet_len_table[0xc0],bl,AREA);
}
+static void clif_emotion_towards(struct block_list *bl, struct block_list *target, int type)
+{
+ unsigned char buf[8];
+ int len = packet_len_table[0xc0];
+ struct map_session_data *sd = (struct map_session_data *) target;
+
+ nullpo_retv(bl);
+ nullpo_retv(target);
+
+ if (target->type != BL_PC)
+ return;
+
+ WBUFW(buf,0)=0xc0;
+ WBUFL(buf,2)=bl->id;
+ WBUFB(buf,6)=type;
+
+ memcpy(WFIFOP(sd->fd,0), buf, len);
+ WFIFOSET(sd->fd,len);
+}
+
/*==========================================
* �g�[�L�[�{�b�N�X
*------------------------------------------