diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 13 | ||||
-rw-r--r-- | src/map/script.h | 1 | ||||
-rw-r--r-- | src/map/send.c | 17 | ||||
-rw-r--r-- | src/map/send.h | 1 |
5 files changed, 33 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c index 8b5d1fe..a67ddba 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -93,6 +93,7 @@ HPExport void plugin_init (void) addScriptCommand("setavataraction", "i", setAvatarAction); addScriptCommand("clear", "", clear); addScriptCommand("changemusic", "ss", changeMusic); + addScriptCommand("setnpcdialogtitle", "s", setNpcDialogTitle); do_init_langs(); diff --git a/src/map/script.c b/src/map/script.c index 6d9a5d0..da63a29 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -815,3 +815,16 @@ BUILDIN(changeMusic) send_changemusic_brodcast(m, music); return true; } + +BUILDIN(setNpcDialogTitle) +{ + const char *const name = script_getstr(st, 2); + if (!name) + return false; + struct map_session_data *sd = script->rid2sd (st); + if (!sd) + return false; + + send_changenpc_title(sd, st->oid, name); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index 97b8f51..b238e92 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -38,5 +38,6 @@ BUILDIN(setAvatarDir); BUILDIN(setAvatarAction); BUILDIN(clear); BUILDIN(changeMusic); +BUILDIN(setNpcDialogTitle); #endif // EVOL_MAP_SCRIPT diff --git a/src/map/send.c b/src/map/send.c index be913e0..029df93 100644 --- a/src/map/send.c +++ b/src/map/send.c @@ -166,3 +166,20 @@ void send_changemusic_brodcast(const int map, const char *music) strcpy ((char *)WBUFP (buf, 4), music); clif->send (buf, sz, &bl, ALL_SAMEMAP); } + +void send_changenpc_title (struct map_session_data *sd, const int npcId, const char *name) +{ + if (!sd || !name) + return; + + const int fd = sd->fd; + const int len = strlen (name); + const int sz = len + 5 + 4 + 2; + WFIFOHEAD (fd, sz); + WFIFOW (fd, 0) = 0xb06; + WFIFOW (fd, 2) = sz; + WFIFOL (fd, 4) = npcId; + WFIFOW (fd, 8) = len; + strcpy (WFIFOP (fd, 10), name); + WFIFOSET (fd, sz); +} diff --git a/src/map/send.h b/src/map/send.h index 438347a..0993624 100644 --- a/src/map/send.h +++ b/src/map/send.h @@ -13,5 +13,6 @@ void send_mapmask_brodcast(const int map, const int mask); void send_mob_info(struct block_list* bl1, struct block_list* bl2, enum send_target target); void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_target target); void send_changemusic_brodcast(const int map, const char *music); +void send_changenpc_title (struct map_session_data *sd, const int npcId, const char *name); #endif // EVOL_MAP_PC |