diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-30 18:50:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-30 18:50:08 +0300 |
commit | c3c009a7e2c3ad40048935de0d0538081cf613be (patch) | |
tree | 382fab456507ce0759d28b2ecd6dcd84737a4be0 /src/map | |
parent | 21ec9caab9010b3109050dd891228c191e2b0dd0 (diff) | |
download | plugin-c3c009a7e2c3ad40048935de0d0538081cf613be.tar.gz plugin-c3c009a7e2c3ad40048935de0d0538081cf613be.tar.bz2 plugin-c3c009a7e2c3ad40048935de0d0538081cf613be.tar.xz plugin-c3c009a7e2c3ad40048935de0d0538081cf613be.zip |
Add script command for change npc dialog title.
New script command: setnpcdialogtitle newtitle
Diffstat (limited to 'src/map')
-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 |