ryusama2007 Posted December 20, 2013 Posted December 20, 2013 How do is hidden the name of the NPC after the # in the chat. screen: must be some means via src, since all my events have event name. Quote
AnnieRuru Posted December 20, 2013 Posted December 20, 2013 (edited) yeah this is source related ... should belongs to scouce support it must have something to do with clif_getareachar_unit inside clif.c ... case BL_NPC: { TBL_NPC* nd = (TBL_NPC*)bl; if( nd->chat_id ) clif_dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd); if( nd->size == SZ_BIG ) clif_specialeffect_single(bl,423,sd->fd); else if( nd->size == SZ_MEDIUM ) clif_specialeffect_single(bl,421,sd->fd); } break;change the nd ... npc name over here ...forgot the exact command at the moment ... my source coding still rusty ok I give up, this doesn't work doesn't work case BL_NPC: { TBL_NPC* nd = (TBL_NPC*)bl; char aaa[100]; char bbb[100]; sprintf( aaa, "%s" , nd->name ); sprintf( bbb, "adasdasdasd" ); clif_displaymessage( sd->fd, aaa ); memcpy(bbb, nd->name, 23); if( nd->chat_id ) clif_dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd); if( nd->size == SZ_BIG ) clif_specialeffect_single(bl,423,sd->fd); else if( nd->size == SZ_MEDIUM ) clif_specialeffect_single(bl,421,sd->fd); } break; Edited December 20, 2013 by AnnieRuru Quote
ryusama2007 Posted December 20, 2013 Author Posted December 20, 2013 this not working right, have patience. Quote
Jonne Posted December 21, 2013 Posted December 21, 2013 (edited) Isn't this rather in clif_joinchatok ? /// Notifies the client about entering a chatroom (ZC_ENTER_ROOM). /// 00db <packet len>.W <chat id>.L { <role>.L <name>.24B }* /// role: /// 0 = owner (menu) /// 1 = normal void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) { int fd; int i,t; nullpo_retv(sd); nullpo_retv(cd); fd = sd->fd; if (!session_isActive(fd)) return; 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+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+t)*28+4), cd->usersd[i]->status.name, NAME_LENGTH); } WFIFOSET(fd, WFIFOW(fd, 2)); } Try this maybe: /// Notifies the client about entering a chatroom (ZC_ENTER_ROOM). /// 00db <packet len>.W <chat id>.L { <role>.L <name>.24B }* /// role: /// 0 = owner (menu) /// 1 = normal void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) { int fd; int i,t; nullpo_retv(sd); nullpo_retv(cd); fd = sd->fd; if (!session_isActive(fd)) return; 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+t)); WFIFOL(fd, 4) = cd->bl.id; if(cd->owner->type == BL_NPC){ char name[NAME_LENGTH+1]; char *pos; strcpy(name, ((struct npc_data *)cd->owner)->name); pos = strchr(name, '#'); if (pos != NULL) { *pos = '\0'; } WFIFOL(fd, 30) = 1; WFIFOL(fd, 8) = 0; memcpy(WFIFOP(fd, 12), 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+t)*28+4), cd->usersd[i]->status.name, NAME_LENGTH); } WFIFOSET(fd, WFIFOW(fd, 2)); } Edited December 21, 2013 by Jonne 1 Quote
AnnieRuru Posted December 22, 2013 Posted December 22, 2013 omg ... x.x I looked into changing the npc name <.< you are right yes your fix is correct one src/map/clif.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/map/clif.c b/src/map/clif.c index d45c05f..68fe5e0 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3763,9 +3763,15 @@ void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) WFIFOL(fd, 4) = cd->bl.id; if(cd->owner->type == BL_NPC){ + char name[NAME_LENGTH+1]; + char *pos; + strcpy(name, ((struct npc_data *)cd->owner)->name); + pos = strchr(name, '#'); + if ( pos != NULL ) + *pos = '\0'; WFIFOL(fd, 30) = 1; WFIFOL(fd, 8) = 0; - memcpy(WFIFOP(fd, 12), ((struct npc_data *)cd->owner)->name, NAME_LENGTH); + memcpy(WFIFOP(fd, 12), 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); tested and worked Quote
ryusama2007 Posted December 23, 2013 Author Posted December 23, 2013 Perfect, thank you. I think you should have already applied this as the default emulator. Quote
Question
ryusama2007
How do is hidden the name of the NPC after the # in the chat.
screen:
must be some means via src, since all my events have event name.
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.