diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-10-16 20:19:43 +0000 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-10-16 20:19:43 +0000 |
commit | 83a913ba19dbbcabf4d00b27d436fa6b56504881 (patch) | |
tree | a847e99ebbb73f0cd73f1cc0bd569044a08bab05 /npc | |
parent | d4edbf92056973481c9937f20d9130e68f96e993 (diff) | |
download | serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.tar.gz serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.tar.bz2 serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.tar.xz serverdata-83a913ba19dbbcabf4d00b27d436fa6b56504881.zip |
Jukebox
This allows players to use @jukebox like @music anywhere
And it also adds a classy Jukebox in Hurnscald PUB.
First experiment with public functions, don't blame me if it breaks :p
Low priority, adding to MR list in order to met deadlines.
Diffstat (limited to 'npc')
-rw-r--r-- | npc/008-2-2/_import.txt | 1 | ||||
-rw-r--r-- | npc/008-2-2/jukebox.txt | 29 | ||||
-rw-r--r-- | npc/commands/music.txt | 17 | ||||
-rw-r--r-- | npc/functions/music.txt | 57 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
5 files changed, 103 insertions, 2 deletions
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", |