summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorYommy <Yommy@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-06-09 19:57:53 +0000
committerYommy <Yommy@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-06-09 19:57:53 +0000
commit3afe53b2e0037df26ade1057f4e6064b90376f74 (patch)
tree002b0013a5aa8c3084622bad14b0c7368ef9f02f /src/map/script.c
parent21495a40514791bf0c6c1e375f66bb9d49a96529 (diff)
downloadhercules-3afe53b2e0037df26ade1057f4e6064b90376f74.tar.gz
hercules-3afe53b2e0037df26ade1057f4e6064b90376f74.tar.bz2
hercules-3afe53b2e0037df26ade1057f4e6064b90376f74.tar.xz
hercules-3afe53b2e0037df26ade1057f4e6064b90376f74.zip
* Added support for packet 0x7fe which changes the bgm temporarily for a single player.
* Added 2 script commands, playBGM and playBGMall, documented use in doc/script_commands.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14335 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index f6b41331f..c3ad39a8e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10636,6 +10636,71 @@ BUILDIN_FUNC(misceffect)
return 0;
}
/*==========================================
+ * Play a BGM on a single client [Rikter/Yommy]
+ *------------------------------------------*/
+BUILDIN_FUNC(playBGM)
+{
+ TBL_PC* sd = script_rid2sd(st);
+ const char* name = script_getstr(st,2);
+
+ if(sd)
+ {
+ if(!st->rid)
+ clif_playBGM(sd,map_id2bl(st->oid),name);
+ else
+ clif_playBGM(sd,&sd->bl,name);
+ }
+
+ return 0;
+}
+
+int playBGM_sub(struct block_list* bl,va_list ap)
+{
+ char* name = va_arg(ap,char*);
+
+ clif_playBGM((TBL_PC *)bl, bl, name);
+
+ return 0;
+}
+
+/*==========================================
+ * Play a BGM on multiple client [Rikter/Yommy]
+ *------------------------------------------*/
+BUILDIN_FUNC(playBGMall)
+{
+ struct block_list* bl;
+ const char* name;
+
+ bl = (st->rid) ? &(script_rid2sd(st)->bl) : map_id2bl(st->oid);
+ if (!bl)
+ return 0;
+
+ name = script_getstr(st,2);
+
+ if(script_hasdata(st,7))
+ { // specified part of map
+ const char* map = script_getstr(st,3);
+ int x0 = script_getnum(st,4);
+ int y0 = script_getnum(st,5);
+ int x1 = script_getnum(st,6);
+ int y1 = script_getnum(st,7);
+ map_foreachinarea(playBGM_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name);
+ }
+ else
+ if(!script_hasdata(st,7))
+ { // entire map
+ const char* map = script_getstr(st,3);
+ map_foreachinmap(playBGM_sub, map_mapname2mapid(map), BL_PC, name);
+ }
+ else
+ {
+ ShowError("buildin_playBGMall: insufficient arguments for specific area broadcast.\n");
+ }
+
+ return 0;
+}
+
+/*==========================================
* サウンドエフェクト
*------------------------------------------*/
BUILDIN_FUNC(soundeffect)
@@ -14504,6 +14569,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(clearitem,""),
BUILDIN_DEF(classchange,"ii"),
BUILDIN_DEF(misceffect,"i"),
+ BUILDIN_DEF(playBGM,"s"),
+ BUILDIN_DEF(playBGMall,"s*"),
BUILDIN_DEF(soundeffect,"si"),
BUILDIN_DEF(soundeffectall,"si*"), // SoundEffectAll [Codemaster]
BUILDIN_DEF(strmobinfo,"ii"), // display mob data [Valaris]