diff options
author | daegaladh <daegaladh@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-07-21 04:08:44 +0000 |
---|---|---|
committer | daegaladh <daegaladh@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-07-21 04:08:44 +0000 |
commit | 576b80efa1c556796c13f195467e0dd1cea5631b (patch) | |
tree | 38438982c5f54d1666eba94809c2fb6c60518224 /src/map/clif.c | |
parent | 1dea49c7f44dc9c33f8d204809a830be58a75ba2 (diff) | |
download | hercules-576b80efa1c556796c13f195467e0dd1cea5631b.tar.gz hercules-576b80efa1c556796c13f195467e0dd1cea5631b.tar.bz2 hercules-576b80efa1c556796c13f195467e0dd1cea5631b.tar.xz hercules-576b80efa1c556796c13f195467e0dd1cea5631b.zip |
Fixed an old bug in waitingroom where NPCs weren't appearing into their chatrooms.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16461 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 7b3e9e650..dcb74304c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -321,9 +321,16 @@ static int clif_send_sub(struct block_list *bl, va_list ap) break; case AREA_WOSC: { - struct map_session_data *ssd = (struct map_session_data *)src_bl; - if (ssd && (src_bl->type == BL_PC) && sd->chatID && (sd->chatID == ssd->chatID)) + if(src_bl->type == BL_PC){ + struct map_session_data *ssd = (struct map_session_data *)src_bl; + if (ssd && sd->chatID && (sd->chatID == ssd->chatID)) return 0; + } + else if(src_bl->type == BL_NPC) { + struct npc_data *nd = (struct npc_data *)src_bl; + if (nd && sd->chatID && (sd->chatID == nd->chat_id)) + return 0; + } } break; } @@ -3512,7 +3519,7 @@ void clif_dispchat(struct chat_data* cd, int fd) WBUFL(buf, 4) = cd->owner->id; WBUFL(buf, 8) = cd->bl.id; WBUFW(buf,12) = cd->limit; - WBUFW(buf,14) = cd->users; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; WBUFB(buf,16) = type; memcpy((char*)WBUFP(buf,17), cd->title, strlen(cd->title)); // not zero-terminated @@ -3550,7 +3557,7 @@ void clif_changechatstatus(struct chat_data* cd) WBUFL(buf, 4) = cd->owner->id; WBUFL(buf, 8) = cd->bl.id; WBUFW(buf,12) = cd->limit; - WBUFW(buf,14) = cd->users; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; WBUFB(buf,16) = type; memcpy((char*)WBUFP(buf,17), cd->title, strlen(cd->title)); // not zero-terminated @@ -3612,7 +3619,7 @@ void clif_joinchatfail(struct map_session_data *sd,int flag) void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) { int fd; - int i; + int i,t; nullpo_retv(sd); nullpo_retv(cd); @@ -3620,13 +3627,24 @@ void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) fd = sd->fd; if (!session_isActive(fd)) return; - WFIFOHEAD(fd, 8 + (28*cd->users)); + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); WFIFOW(fd, 0) = 0xdb; - WFIFOW(fd, 2) = 8 + (28*cd->users); + WFIFOW(fd, 2) = 8 + (28*(cd->users+t)); WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC){ + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), ((struct npc_data *)cd->owner)->name, NAME_LENGTH); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, NAME_LENGTH); + } + } else for (i = 0; i < cd->users; i++) { WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); - memcpy(WFIFOP(fd, 8+i*28+4), cd->usersd[i]->status.name, NAME_LENGTH); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, NAME_LENGTH); } WFIFOSET(fd, WFIFOW(fd, 2)); } |