Jump to content

Question

5 answers to this question

Recommended Posts

Posted (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 by AnnieRuru
Posted (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 by Jonne
  • Upvote 1
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...