summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-10-16 20:19:43 +0000
committerJesusaves <cpntb1@ymail.com>2020-10-16 20:19:43 +0000
commitde2e70e8a28f9cec3c4490bf828d175ce608b6dc (patch)
treea847e99ebbb73f0cd73f1cc0bd569044a08bab05
parentd4edbf92056973481c9937f20d9130e68f96e993 (diff)
parent83a913ba19dbbcabf4d00b27d436fa6b56504881 (diff)
downloadserverdata-de2e70e8a28f9cec3c4490bf828d175ce608b6dc.tar.gz
serverdata-de2e70e8a28f9cec3c4490bf828d175ce608b6dc.tar.bz2
serverdata-de2e70e8a28f9cec3c4490bf828d175ce608b6dc.tar.xz
serverdata-de2e70e8a28f9cec3c4490bf828d175ce608b6dc.zip
Merge branch 'jesusalva/jukebox' into 'master'
Jukebox See merge request evol/serverdata!268
-rw-r--r--db/constants.conf1
-rw-r--r--npc/008-2-2/_import.txt1
-rw-r--r--npc/008-2-2/jukebox.txt29
-rw-r--r--npc/commands/music.txt17
-rw-r--r--npc/functions/music.txt57
-rw-r--r--npc/scripts.conf1
6 files changed, 104 insertions, 2 deletions
diff --git a/db/constants.conf b/db/constants.conf
index 551da2c3..51a00953 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -4968,6 +4968,7 @@ more than one separator can be used in a row (so 12_3___456 is illegal).
NPC_ANWAR: 225
NPC_REBECCA: 226
NPC_PAULINE: 227
+ NPC_JUKEBOX: 228
NPC_CONFUSED_TREE: 400
NPC_ALIGE: 401
diff --git a/npc/008-2-2/_import.txt b/npc/008-2-2/_import.txt
index 34d628f7..92597add 100644
--- a/npc/008-2-2/_import.txt
+++ b/npc/008-2-2/_import.txt
@@ -2,6 +2,7 @@
// This file is generated automatically. All manually added changes will be removed when running the Converter.
"npc/008-2-2/_warps.txt",
"npc/008-2-2/barron.txt",
+"npc/008-2-2/jukebox.txt",
"npc/008-2-2/kfahr.txt",
"npc/008-2-2/ledmitz.txt",
"npc/008-2-2/mapflags.txt",
diff --git a/npc/008-2-2/jukebox.txt b/npc/008-2-2/jukebox.txt
new file mode 100644
index 00000000..6e592c8f
--- /dev/null
+++ b/npc/008-2-2/jukebox.txt
@@ -0,0 +1,29 @@
+// The Mana World Script
+// Author:
+// Jesusalva
+// Hocus Pocus Fidibus
+// Description:
+// Music box for a classy AFKing experience
+// GMs can play on whole map but default to player only
+
+008-2-2,39,27,0 script #JukeboxHurns NPC_JUKEBOX,{
+ mesc l("Select a music");
+ .@track="jukebox"::HurnscaldPrompt();
+ .@global=ASK_NO;
+ if (is_evtc()) {
+ mes "Play music globally?";
+ mes "* Selecting \"No\" will play only to yourself (default behavior)";
+ .@global=askyesno();
+ }
+ if (.@global == ASK_YES)
+ "jukebox"::BroadcastMusic(getmap(), .@track);
+ else
+ "jukebox"::JukeboxMusic(.@track);
+ close;
+
+OnInit:
+ .distance = 3;
+ end;
+}
+
+
diff --git a/npc/commands/music.txt b/npc/commands/music.txt
index e794060f..d2578d1a 100644
--- a/npc/commands/music.txt
+++ b/npc/commands/music.txt
@@ -21,9 +21,9 @@ OnCall:
}
// TODO: tmw-like argv splitter
- getmapxy .@map$, .@void, .@void, UNITTYPE_PC; // get map
+ .@map$ = getmap();
- .@key$ = .@atcmd_parameters$[0];
+ .@key$ = strtolower(.@atcmd_parameters$[0]);
.@m$ = htget(.hash, .@key$, "Not found");
if (.@m$ == "Not found")
@@ -34,8 +34,21 @@ OnCall:
changemusic .@map$, .@m$ + ".ogg";
end;
+OnMyself:
+ .@key$ = strtolower(.@atcmd_parameters$[0]);
+ .@m$ = htget(.hash, .@key$, "Not found");
+
+ if (.@m$ == "Not found")
+ {
+ .@m$ = implode(.@atcmd_parameters$[0], " ");
+ }
+
+ changeplayermusic .@m$ + ".ogg";
+ end;
+
OnInit:
bindatcmd "music", "@music::OnCall", 0, 99, 1;
+ bindatcmd "jukebox", "@music::OnMyself", 0, 50, 0;
.hash = htnew; // create hashtable
htput(.hash, "forest", "bartk - in the forest of the birches");
diff --git a/npc/functions/music.txt b/npc/functions/music.txt
new file mode 100644
index 00000000..c8937583
--- /dev/null
+++ b/npc/functions/music.txt
@@ -0,0 +1,57 @@
+// The Mana World Script
+// Author:
+// Jesusalva
+// Gumi
+// Description:
+// Music functions
+//
+// NOTE: This NPC uses the new public/private function call system to avoid
+// the use of doevent.
+// Syntax:
+// "jukebox"::HurnscaldPrompt(); → Makes a menuint for selecting hurns tracks
+// "jukebox"::JukeboxMusic(ID); → Changes music based on prompted ID
+// "jukebox"::BroadcastMusic(MAP, ID); → Changes music based on prompted ID
+
+- script jukebox 32767,{
+ end;
+
+// Helpers
+public function JukeboxMusic {
+ changeplayermusic .MUSIC_ARRAY[getarg(0)];
+ return;
+}
+
+public function BroadcastMusic {
+ changemusic getarg(0), .MUSIC_ARRAY[getarg(1)];
+ return;
+}
+
+// public function listing
+// * Hurnscald
+
+public function HurnscaldPrompt {
+ menuint
+ "Cancel", -1,
+ "Forest of Birches", 0,
+ "Adventure Begins", 1,
+ "Magick Real", 5;
+ mes "";
+ if (@menuret == -1)
+ close;
+ return @menuret;
+}
+
+// Initialize stuff which will be needed
+OnInit:
+ .MUSIC_ARRAY[0] = "bartk - in the forest of the birches.ogg";
+ .MUSIC_ARRAY[1] = "bartk - the adventure begins.ogg";
+ .MUSIC_ARRAY[2] = "eric matyas - ghoulish fun.ogg";
+ .MUSIC_ARRAY[3] = "eric matyas - surreal place.ogg";
+ .MUSIC_ARRAY[4] = "ezili - ocean sounds.ogg";
+ .MUSIC_ARRAY[5] = "magick - real.ogg";
+ end;
+}
+
+
+
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 1ce33c7e..6f275056 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -65,6 +65,7 @@
"npc/functions/lockpicks.txt",
"npc/functions/crafting.txt",
"npc/functions/referral.txt",
+"npc/functions/music.txt",
// quest debug
"npc/functions/quest-debug/functions.txt",