diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-04-09 13:33:57 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-04-09 13:33:57 -0300 |
commit | cf18ce071c79ae37e14ea38943e0b1d88da70a7b (patch) | |
tree | f9159c9b60b3018300dd22ffba0d797bc5e828e5 /npc/commands/music.txt | |
parent | 8a4bf716002a017de77fe7df301ef8e4aaf00a2e (diff) | |
download | serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.tar.gz serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.tar.bz2 serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.tar.xz serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.zip |
Override
Diffstat (limited to 'npc/commands/music.txt')
-rwxr-xr-x[-rw-r--r--] | npc/commands/music.txt | 88 |
1 files changed, 23 insertions, 65 deletions
diff --git a/npc/commands/music.txt b/npc/commands/music.txt index b817b949..5c62f008 100644..100755 --- a/npc/commands/music.txt +++ b/npc/commands/music.txt @@ -1,75 +1,33 @@ -// @music atcommand -// changes the music for all players on the map -// -// group lv: 2 -// group char lv: 99 -// log: True -// -// usage: -// @music <short name> -// -// example: -// @music fun - -- script @music 32767,{ +- script @music NPC32767,{ + callfunc "argv_splitter"; + if (GM < CMD_MUSIC && GM < G_SYSOP) goto L_GM; + if (@argv$[0] == "") goto L_Failed; + + gmlog "@music " + @args$; + .@find = array_search(@argv$[0], .find$); + if (.@find >= 0) + @argv$[0] = .replace$[max(.@find, 0)]; + .file$ = @argv$[0]; + areatimer 0, getmapname(), (POS_X - .range), (POS_Y - .range), (POS_X + .range), (POS_Y + .range), 0, strnpcinfo(0)+"::OnPC"; + message strcharinfo(0), "music : The music has ben temporarily changed."; end; -OnCall: - if (!is_evtc()) - { - end; - } - - // TODO: tmw-like argv splitter - .@map$ = getmap(); - - .@m$ = strtolower(.@atcmd_parameters$[0]); - - // GMs might not know and want a list of musics - if (.@m$ == "" || .@m$ == "list") { - .@r$="list"; - - freeloop(true); - .@size=getarraysize($MUSIC_ARRAY$); - for (.@i = 0; .@i < .@size; ++.@i) { - .@r$+=", "+$MUSIC_ARRAY$[.@i]; - } - freeloop(false); - - dispbottom("Music list: "+.@r$); - end; - } - - .@key = array_exists($MUSIC_ARRAY$, .@m$); - - if (!.@key) - { - //.@m$ = implode(.@atcmd_parameters$[0], " "); - message(getcharid(CHAR_ID_ACCOUNT), sprintf("Can't broadcast: %s.ogg", .@m$)); - } else { - message(getcharid(CHAR_ID_ACCOUNT), sprintf("Now broadcasting: %s", .@m$)); - changemusic .@map$, .@m$ + ".ogg"; - } +OnPC: + music .file$ + ".ogg"; end; -OnMyself: - .@m$ = strtolower(.@atcmd_parameters$[0]); - .@key = array_exists($MUSIC_ARRAY$, .@m$); - - // TODO: Check if you have the music unlocked? Bitmask? Array? +L_Failed: + message strcharinfo(0), "music : You must specify a music file."; + end; - if (!.@key) - { - //.@m$ = implode(.@atcmd_parameters$[0], " "); - message(getcharid(CHAR_ID_ACCOUNT), sprintf("Can't play: %s.ogg", .@m$)); - } else { - message(getcharid(CHAR_ID_ACCOUNT), sprintf("Now playing: %s", .@m$)); - changeplayermusic .@m$ + ".ogg"; - } +L_GM: + message strcharinfo(0), "music : GM command is level "+ CMD_MUSIC +", but you are level " + GM; end; OnInit: - bindatcmd "music", "@music::OnCall", 0, 99, 1; - bindatcmd "jukebox", "@music::OnMyself", 0, 50, 0; + setarray .find$, "this", "cave", "chilling", "clouds", "dimond", "explorers", "gy", "reid", "magick", "mystique", "night", "ride", "sail", "snow", "forest", "xmas"; + setarray .replace$, "this", "cavesong", "chilling-environment", "clouds-calling", "dimonds-cove", "explorers-melody", "graveyard", "inquisitive-inn", "magick-real", "mystique-forest", "night-is-calling", "ride-of-the-valkyries", "sail-away", "snow-village", "the-forest", "white-christmas"; + set .range, 14; // FIXME: make this a const + registercmd chr(ATCMD_SYMBOL) + "music", strnpcinfo(0); end; } |