Files
Mush-Soundpack/cosmic rage/worlds/plugins/CosmicRage.xml
TheMinstrel96 b0a091e9da Update CosmicRage.xml
Updated xml version to 4 to match in game version.
2025-07-03 16:07:19 -05:00

301 lines
8.0 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, October 11, 2018, 7:12 PM -->
<!-- MuClient version 5.05 -->
<!-- Plugin "CosmicRage" generated by Plugin Wizard -->
<muclient>
<plugin
name="CosmicRage"
author="The Cosmic Rage hosting team"
id="57139deb42b490952946f9e4"
language="Lua"
purpose="Main plugin for Cosmic Rage, which holds the main triggers, keystrokes, and functions."
date_written="2004-08-26 19:06:10"
requires="4.82"
version="1.0"
sequence="10000"
>
</plugin>
<script>
<![CDATA[
for i = 1, 9 do
Accelerator("alt + " .. i, "@buffer " .. i)
end
Accelerator("alt + 0", "@buffer 10") -- 10 is a special case
Accelerator("alt + right", "@buffer forward")
Accelerator("alt + left", "@buffer backward")
Accelerator("alt + down", "@buffer down")
Accelerator("alt + up", "@buffer up")
Accelerator("alt + pagedown", "@buffer scrolldown")
Accelerator("alt + pageup", "@buffer scrollup")
Accelerator("alt + end", "@buffer bottom")
Accelerator("alt + home", "@buffer top")
Accelerator("alt+shift+delete", "@buffer clear")
Accelerator("alt+shift+right", "@buffer add")
Accelerator("alt+shift+left", "@buffer delete")
Accelerator("f4", "@sp-settings master volume")
Accelerator("f5", "@sp-settings General volume")
Accelerator("f6", "@sp-settings ambiance volume")
Accelerator("f7", "@sp-settings in and out of character communications volume")
Accelerator("f8", "@sp-settings planetary music volume")
Accelerator("ctrl+f5", "@sp-settings clocks volume")
Accelerator("ctrl+f6", "@sp-settings Combat music volume")
Accelerator("ctrl+f7", "@sp-settings IC social volume")
Accelerator("ctrl+f8", "@sp-settings OOC social volume")
Accelerator("alt+f5", "@sp-settings Ground Combat volume")
Accelerator("alt+f6", "@sp-settings harvesting activity volume")
Accelerator("alt+f7", "@sp-settings Salvage activity volume")
Accelerator("alt+f8", "@sp-settings volume for games such as Pilot's Parody")
Accelerator("shift+f5", "@sp-settings starship combat volume")
Accelerator("shift+f6", "@sp-settings ship volume")
Accelerator("shift+f7", "@sp-settings ship movement volume")
Accelerator("shift+f8", "@sp-settings vehicle volume")
Accelerator("f9", "@sp-settings IC social sounds")
Accelerator("f10", "@sp-settings OOC social sounds")
Accelerator("alt+f9", "@sp-settings panning of sounds")
Accelerator("alt+f10", "@sp-settings pitch-shifting sounds")
Accelerator("alt+f11", "@sp-settings ambiance")
Accelerator("ctrl+f9", "@sp-settings planetary music")
Accelerator("ctrl+f10", "@sp-settings space combat music")
Accelerator("ctrl+f11", "@sp-settings weather sounds")
Accelerator("alt+f12", "@sp-restart")
Accelerator("shift+alt+f9", "@sp-settings Interrupt OOC Social sounds when the next one plays")
Accelerator("f2", "@sp-settings")
Accelerator("shift+f1", "@sp-toggle")
Accelerator("Ctrl+shift+enter", "@sp-settings buffer sounds")
Accelerator("ctrl+shift+v", "@sp-version")
function RegisterMushClient(name, line, wildcards)
DoAfter(1, '@sp-register mush')
end
-- Define the latest soundpack version here
CURRENT_SP_VERSION = 4
function CheckSoundpackVersion(name, line, wildcards, styles)
local user_version = tonumber(wildcards.user_version)
if not user_version then
ColourNote("red", "", "Error: Could not read your soundpack version.")
return
end
Note("You are currently running version " .. tostring(CURRENT_SP_VERSION).." of the Cosmic Rage Mush Immersion.")
local version_diff = user_version - CURRENT_SP_VERSION
if version_diff > 0 then
ColourNote("yellow", "", "Warning: Your soundpack is " .. version_diff .. " version(s) out of date. We are now on version " .. user_version .. " of the soundpack.")
ColourNote("yellow", "", "Run Updater.bat to pull the latest version.")
else
ColourNote("green", "", "Your soundpack is up to date!")
end
end
function url_encode(str)
return (str:gsub("([^%w%-%_%.%~%/])", function(c)
return string.format("%%%02X", string.byte(c))
end))
end
]]>
dir=world.GetInfo(67)
require "socket.http"
require "ltn12"
PPI = require("ppi")
ppi = PPI.Load("aedf0cb0be5bf045860d54b7")
if not ppi then
error("Dependency plugin not installed!")
end
</script>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
group="hook"
keep_evaluating="y"
match = "Welcome to: Cosmic Rage!"
send_to="12"
sequence="100"
>
<send>
local intro = tonumber(GetVariable("intro") or "")
if not intro or ppi.isPlaying(intro) == 0 then
temp = ppi.play(dir.."sounds/ogg/music/IntroMusic/DefaultIntro.ogg", 1, 0, 40)
SetVariable("intro", temp)
end
</send>
</trigger>
<trigger
enabled="y"
group="hook"
keep_evaluating="y"
match = "synaptic signal verified. Sleep mode disengaged. Welcome back to Cosmic Rage!"
send_to="12"
sequence="100"
script="RegisterMushClient"
>
<send>
temp=GetVariable("intro")
ppi.stop(temp)
</send>
</trigger>
<trigger
enabled="y"
group="hook"
keep_evaluating="y"
match = "Your synaptic signal wavers for a moment, then returns with a snap!"
send_to="12"
sequence="100"
script="RegisterMushClient"
>
<send>
temp=GetVariable("intro")
ppi.stop(temp)
</send>
</trigger>
<trigger
enabled="y"
group="hook"
omit_from_output="y"
match="^\$soundpack mush last version: (?P<user_version>\d+)"
regexp="y"
script="CheckSoundpackVersion"
sequence="100"
/>
<trigger
enabled="y"
group="hook"
omit_from_output="y"
keep_evaluating="n"
match="^\$sphook\s+(?P<action>[\w]+):(?P<path>[\w./\\\s]+):(?P<volume>[\w]+):(?P<pitch>[\w-]+):(?P<pan>[\w-]+):(?P<id>[\w]+)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
action="%1"
path="%2"
volume="%3"
pitch="%4"
pan="%5"
id="%6"
volume=tonumber(volume)
if (path == "na") then
else
sound_path = dir .. "sounds/ogg/" .. path .. ".ogg"
directory_path = sound_path:match("(.*/)")
if directory_path then
test_file = io.open(directory_path .. "tester.txt", "w")
if test_file then
test_file:close()
os.remove(directory_path .. "checker.txt") -- Clean up
else
os.execute('mkdir "' .. directory_path .. '" 2>nul')
end
end
file = io.open(sound_path, "r")
if file then
file:close()
else
local encoded_path = url_encode(path)
local download_url = "http://nathantech.net:3000/CosmicRage/CosmicRageSounds/raw/branch/main/ogg/" .. encoded_path .. ".ogg"
body = {}
result, status_code, headers, status = socket.http.request{
url = download_url, sink = ltn12.sink.table(body)
}
if result and status_code == 200 then
save_file = io.open(sound_path, "wb")
if save_file then
save_file:write(table.concat(body))
save_file:close()
end
else
Note("Download of "..path.." failed with status code: " .. tostring(status_code))
end
end
end
if (pitch == "na") then
pitch = -10000
else
pitch = tonumber(pitch)
pitch = (pitch - 44100) / 98
end
if (pan == "na") then
pan = -10000
else
pan = tonumber(pan)
end
if (action == "play") then
temp = ppi.play(dir.."sounds/ogg/"..path..".ogg", 0, pan, volume)
if (pitch > -10000) then
ppi.setPitch(pitch, temp)
end
if (pan > -10000) then
ppi.setPan(pan, temp)
end
end
if (action=="playrec") then
temp=ppi.play(dir.."sounds/ogg/"..path..".ogg", 0, pan, volume)
SetVariable(id, temp)
if(pitch>-10000) then
ppi.setPitch(pitch,temp)
end
if(pan>-10000) then
ppi.setPan(pan,temp)
end
end
if (action=="loop") then
temp=ppi.play(dir.."sounds/ogg/"..path..".ogg", 1, pan, volume)
SetVariable(id, temp)
if(pitch>-10000) then
ppi.setPitch(pitch,temp)
end
if(pan>-10000) then
ppi.setPan(pan,temp)
end
end
if (action=="adjustsound") then
temp=GetVariable (id)
if(volume>-1) then
ppi.setVol(volume,temp)
end
if(pitch>-10000) then
ppi.setPitch(pitch,temp)
end
if(pan>-10000) then
ppi.setPan(pan,temp)
end
end
if (action=="stop") then
temp=GetVariable(id)
ppi.stop(temp)
end
</send>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
</aliases>
</muclient>