diff options
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 14 | ||||
-rw-r--r-- | src/map/script.h | 1 | ||||
-rw-r--r-- | src/map/send.c | 16 | ||||
-rw-r--r-- | src/map/send.h | 1 |
6 files changed, 34 insertions, 1 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 4e7f47b..e10b2f5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -201,7 +201,7 @@ int eclif_send_actual(int *fd, void *buf, int *len) if (*len >= 2) { const int packet = RBUFW (buf, 0); - if (packet >= 0xb02 && packet <= 0xb05) + if (packet >= 0xb02 && packet <= 0xb10) { struct SessionExt *data = session_get(*fd); if (!data) diff --git a/src/map/init.c b/src/map/init.c index 2794692..8b5d1fe 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -92,6 +92,7 @@ HPExport void plugin_init (void) addScriptCommand("setavatardir", "i", setAvatarDir); addScriptCommand("setavataraction", "i", setAvatarAction); addScriptCommand("clear", "", clear); + addScriptCommand("changemusic", "ss", changeMusic); do_init_langs(); diff --git a/src/map/script.c b/src/map/script.c index 9cb26c5..6d9a5d0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -801,3 +801,17 @@ BUILDIN(clear) send_npccommand(script->rid2sd (st), st->oid, 9); return true; } + +BUILDIN(changeMusic) +{ + const char *const mapName = script_getstr(st, 2); + const char *const music = script_getstr(st, 3); + if (!music || !mapName) + return 0; + const int m = map->mapname2mapid(mapName); + if (m < 0) + return false; + + send_changemusic_brodcast(m, music); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index 3a8ef8b..97b8f51 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -37,5 +37,6 @@ BUILDIN(showAvatar); BUILDIN(setAvatarDir); BUILDIN(setAvatarAction); BUILDIN(clear); +BUILDIN(changeMusic); #endif // EVOL_MAP_SCRIPT diff --git a/src/map/send.c b/src/map/send.c index b3ab051..be913e0 100644 --- a/src/map/send.c +++ b/src/map/send.c @@ -150,3 +150,19 @@ void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_targ clif->send(buf, i, tbl, target); aFree(buf); } + +void send_changemusic_brodcast(const int map, const char *music) +{ + if (!music) + return; + + struct block_list bl; + const int sz = strlen (music) + 5; + char buf[sz]; + + bl.m = map; + WBUFW (buf, 0) = 0xb05; + WBUFW (buf, 2) = sz; + strcpy ((char *)WBUFP (buf, 4), music); + clif->send (buf, sz, &bl, ALL_SAMEMAP); +} diff --git a/src/map/send.h b/src/map/send.h index d66bca0..438347a 100644 --- a/src/map/send.h +++ b/src/map/send.h @@ -12,5 +12,6 @@ void send_mapmask(int fd, int mask); 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); #endif // EVOL_MAP_PC |