parent
a63cdc5ad0
commit
af54651f8a
@ -0,0 +1,542 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE muclient>
|
||||
<!-- Saved on Monday, October 29, 2018, 1:39 PM -->
|
||||
<!-- MuClient version 5.06-pre -->
|
||||
|
||||
<!-- Plugin "PK Alert Script" generated by Plugin Wizard -->
|
||||
|
||||
<muclient>
|
||||
<plugin
|
||||
name="PK_Alert"
|
||||
author="Cytan_Method"
|
||||
id="dc7103896128e00c34b21951"
|
||||
language="Lua"
|
||||
purpose="Notify to channel PK alert information."
|
||||
save_state="y"
|
||||
date_written="2018-10-29 13:37:21"
|
||||
version="1.4"
|
||||
>
|
||||
<description trim="y">
|
||||
<![CDATA[
|
||||
Description Here
|
||||
]]>
|
||||
</description>
|
||||
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- Get our standard constants -->
|
||||
|
||||
<include name="constants.lua"/>
|
||||
|
||||
<!-- Triggers -->
|
||||
|
||||
<triggers>
|
||||
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^@\w\(@\wGroup@\w\) @\w(?<saveme>.+): '@\w(?<target>\w+).* @\win @x202(?<area>\w+) @\w\[@x202(?<roomnum>\d+)@\w\]'$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="respondAlert"
|
||||
omit_from_output="n"
|
||||
>
|
||||
</trigger>
|
||||
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^(\w+) disappears!$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="recalled"
|
||||
>
|
||||
</trigger>
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^You grab hold of (.*?)\'s neck and choke \w+ to unconsciousness\!$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="sendStrangleAlert"
|
||||
>
|
||||
</trigger>
|
||||
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^(.*?) looks very uncomfortable\.$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="sendCursedAlert"
|
||||
>
|
||||
</trigger>
|
||||
<!--You switch targets and direct your attacks at Ralyn.-->
|
||||
<!--** You can take revenge on Yatzi for 15 minutes-->
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^\*\* For \w+ interference, you can take revenge on (.*?) for 15 minutes\.$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="sendPkAlert"
|
||||
>
|
||||
</trigger>
|
||||
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^\*\* You can take revenge on (.*?) for 15 minutes\.$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="sendPkAlert"
|
||||
>
|
||||
</trigger>
|
||||
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^\*\* (.*?) can now take revenge on you for 15 minutes\.$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="sendPkAlert"
|
||||
>
|
||||
</trigger>
|
||||
|
||||
<trigger
|
||||
enabled="y"
|
||||
match="^(?<clan>.+?)\s\(.+\)\s+tells the CLAN: 'PK Alert:(?<attacker>.+)\s+in\s+(?<area>.+?)\s+\[(?<roomid>\d+)\]'$"
|
||||
regexp="y"
|
||||
sequence="100"
|
||||
script="outputHyperLink"
|
||||
ignore_case="y"
|
||||
keep_evaluating="y"
|
||||
>
|
||||
</trigger>
|
||||
|
||||
</triggers>
|
||||
|
||||
<!-- Plugin help -->
|
||||
|
||||
<aliases>
|
||||
|
||||
<alias
|
||||
enabled="y"
|
||||
match="pkc *"
|
||||
script="sendPkInfoClan"
|
||||
sequence="100"
|
||||
>
|
||||
</alias>
|
||||
|
||||
<alias
|
||||
enabled="y"
|
||||
match="pkg *"
|
||||
script="sendPkInfoGroup"
|
||||
sequence="100"
|
||||
>
|
||||
</alias>
|
||||
|
||||
<alias
|
||||
enabled="y"
|
||||
sequence="100"
|
||||
ignore_case="y"
|
||||
regexp="y"
|
||||
keep_evaluating="n"
|
||||
match="^\s*(?:pkadmin|pkadmi|pkadm)\s+(?<Args>.+)?$"
|
||||
script="COMMAND_PKAdmin"
|
||||
>
|
||||
</alias>
|
||||
|
||||
<alias
|
||||
enabled="y"
|
||||
sequence="100"
|
||||
ignore_case="y"
|
||||
regexp="y"
|
||||
keep_evaluating="n"
|
||||
match="^\s*(?:pkadmin|pkadmi|pkadm(?<Args>))$"
|
||||
script="COMMAND_PKAdmin"
|
||||
>
|
||||
</alias>
|
||||
</aliases>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
-- Settings Management
|
||||
require 'serialize'
|
||||
|
||||
PKASettings = {}
|
||||
PKASettings.volume = 100
|
||||
PKASettings.alert = 1
|
||||
PKASettings.sound = 1
|
||||
PKASettings.enabled = 1
|
||||
|
||||
function SaveSettings()
|
||||
SetVariable("PKSettings", serialize.save_simple(PKASettings))
|
||||
end
|
||||
|
||||
function LoadSettings()
|
||||
assert(loadstring("PKASettings = "..GetVariable("PKSettings"))) ()
|
||||
end
|
||||
]]></script>
|
||||
<script>
|
||||
<![CDATA[
|
||||
-- PKAdmin Commands
|
||||
dofile (GetInfo(60) .. "aardwolf_colors.lua")
|
||||
|
||||
Prepend = "@GPKAdmin: @W"
|
||||
|
||||
function cnote(str)
|
||||
AnsiNote(stylesToANSI(ColoursToStyles(str)))
|
||||
end
|
||||
|
||||
-- Turn on the option to have Mushclient Play Sounds while minimized/background
|
||||
SetOption ("play_sounds_in_background", 1)
|
||||
|
||||
PKAdminCommands = {
|
||||
COMMAND_PKAdmin_Help = {"help", "hel", "he", "h"},
|
||||
COMMAND_PKAdmin_Alert = {"alert", "aler", "ale" },
|
||||
COMMAND_PKAdmin_Enable = {"enable", "enabl", "enab", "ena", "on"},
|
||||
COMMAND_PKAdmin_Disable = {"disable", "disabl", "disab", "disa", "off"},
|
||||
COMMAND_PKAdmin_Sound = {"sound", "soun", "soun", "sou" },
|
||||
COMMAND_PKAdmin_Status = {"status", "statu", "stat" },
|
||||
COMMAND_PKAdmin_Volume = {"volume", "volum", "volu", "vol" },
|
||||
COMMAND_PKAdmin_Reset = {"reset"}
|
||||
}
|
||||
|
||||
function COMMAND_PKAdmin(name, lines, wildcards)
|
||||
local args, command = {}, nil
|
||||
--split args, set first to "command", default to 'help'
|
||||
for word in string.gmatch(wildcards.Args, "%w+") do table.insert(args, word) end
|
||||
command = args[1]
|
||||
if command then table.remove(args,1) else command = "help" end
|
||||
|
||||
--parse command
|
||||
command = string.lower(command)
|
||||
for func, list in pairs(PKAdminCommands) do
|
||||
for _, item in ipairs(list) do
|
||||
if command == item then
|
||||
return _G[func](args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
OUTPUT_UnrecognizedCommand()
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Help()
|
||||
cnote("@GPKAdmin")
|
||||
cnote("@WUsage:")
|
||||
cnote(" @Gpkadmin help @w: @WThis menu")
|
||||
cnote(" @Gpkadmin alert <yes/no> @w: @WTurns on/off channel alerts ")
|
||||
cnote(" @Gpkadmin sound <yes/no> @w: @WTurns on/off sound alerts ")
|
||||
cnote(" @Gpkadmin volume <0-100> @w: @WSets the play volume for sound ")
|
||||
cnote(" @Gpkadmin enable @w: @WEnables the script ")
|
||||
cnote(" @Gpkadmin disable @w: @WDisables the script ")
|
||||
Note()
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Enable()
|
||||
cnote(Prepend.."PKAnnouncer is now @Genabled@W.")
|
||||
PKASettings.enabled = 1
|
||||
SaveSettings()
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Disable()
|
||||
cnote(Prepend.."PKAnnouncer is now @Rdisabled@W.")
|
||||
PKASettings.enabled = 0
|
||||
SaveSettings()
|
||||
end
|
||||
|
||||
OnOffCommands = {
|
||||
True = {"true", "t", "yes", "y"},
|
||||
False = {"false", "f", "no", "n"}
|
||||
}
|
||||
|
||||
function COMMAND_PKAdmin_Alert(args)
|
||||
local enabled, ch = nil
|
||||
if args and args[1] then
|
||||
ch = string.lower(args[1])
|
||||
for enabl, list in pairs(OnOffCommands) do
|
||||
for _, trunc in ipairs(list) do
|
||||
if trunc == ch then
|
||||
enabled = enabl
|
||||
break
|
||||
end
|
||||
end
|
||||
if enabled then break end
|
||||
end
|
||||
|
||||
if not enabled then --didn't understand arg
|
||||
cnote(Prepend.."@R"..args[1].." is not a valid option.")
|
||||
Note()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if enabled == "True" then
|
||||
PKASettings.alert = 1
|
||||
cnote(Prepend.."@wAlerts to clan channel are now @GEnabled@w.")
|
||||
SaveSettings()
|
||||
elseif enabled == "False" then
|
||||
PKASettings.alert = 0
|
||||
cnote(Prepend.."@wAlerts to clan channel are now @RDisabled@w.")
|
||||
SaveSettings()
|
||||
end
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Sound(args)
|
||||
local enabled, ch = nil
|
||||
if args and args[1] then
|
||||
ch = string.lower(args[1])
|
||||
for enabl, list in pairs(OnOffCommands) do
|
||||
for _, trunc in ipairs(list) do
|
||||
if trunc == ch then
|
||||
enabled = enabl
|
||||
break
|
||||
end
|
||||
end
|
||||
if enabled then break end
|
||||
end
|
||||
|
||||
if not enabled then --didn't understand arg
|
||||
cnote(Prepend.."@R"..args[1].." is not a valid option.")
|
||||
Note()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if enabled == "True" then
|
||||
PKASettings.sound = 1
|
||||
cnote(Prepend.."@wSound alerts are now @GEnabled@w.")
|
||||
SaveSettings()
|
||||
elseif enabled == "False" then
|
||||
PKASettings.sound = 0
|
||||
cnote(Prepend.."@wSound alerts are now @RDisabled@w.")
|
||||
SaveSettings()
|
||||
end
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Volume(args)
|
||||
if not tonumber(args[1]) or (tonumber(args[1]) < 0) or (tonumber(args[1]) > 100) then
|
||||
cnote(Prepend.."@RVolume@w requires a number from 0-100." )
|
||||
Note()
|
||||
return
|
||||
end
|
||||
|
||||
PKASettings.volume = tonumber(args[1])
|
||||
SaveSettings()
|
||||
cnote(Prepend.."@wVolume is now set to @Y"..tonumber(args[1]).."@w.")
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Status()
|
||||
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
|
||||
cnote( " " .. Prepend .. " PKAnnouncer's current status is " .. (PKASettings.enabled == 1 and "@GOn" or "@ROff") .. "@w" )
|
||||
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
|
||||
cnote( (" @x208Channel Alerts :@w %-30.30s " ):format( PKASettings.alert == 1 and "@GOn@w" or "@ROff@w"))
|
||||
cnote( (" @x208Sound Alerts :@w %-30.30s " ):format( PKASettings.sound == 1 and "@GOn@w" or "@ROff@w"))
|
||||
cnote( (" @x208Sound Volume :@w %-30.0d " ):format( PKASettings.volume ) )
|
||||
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
|
||||
Note()
|
||||
end
|
||||
|
||||
function COMMAND_PKAdmin_Reset()
|
||||
PKASettings = {}
|
||||
PKASettings.volume = 100
|
||||
PKASettings.alert = 1
|
||||
PKASettings.sound = 1
|
||||
PKASettings.enabled = 1
|
||||
cnote( Prepend.."PKASettings have been reset to defaults." )
|
||||
SaveSettings()
|
||||
end
|
||||
|
||||
function OUTPUT_UnrecognizedCommand()
|
||||
cnote(Prepend.."Unrecognized command. Try @Ggadmin help@W for help.")
|
||||
Note()
|
||||
end
|
||||
|
||||
]]></script>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
require "gmcphelper"
|
||||
|
||||
local area = ""
|
||||
local roomid = ""
|
||||
local room = ""
|
||||
local target = ""
|
||||
local ingroup = false
|
||||
local chan = "clan "
|
||||
local varSoundFile = GetInfo(74) .. "redalert.wav"
|
||||
|
||||
GMCPPluginID = "3e7dedbe37e44942dd46d264"
|
||||
|
||||
function isEnabled()
|
||||
if PKASettings.enabled == 1 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function isSoundEnabled()
|
||||
if PKASettings.sound == 1 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function isAlertEnabled()
|
||||
if PKASettings.alert == 1 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function sendPkInfoClan(name, line, wildcards)
|
||||
if isEnabled() then
|
||||
getRoomInformation()
|
||||
if isAlertEnabled() then
|
||||
SendNoEcho(string.format("cl @W%s@C ENGAGED @Win @x202%s @W[@x202%s@W]",wildcards[1], area, roomid))
|
||||
end
|
||||
target = wildcards[1]
|
||||
end
|
||||
end
|
||||
|
||||
function recalled(name, line, wildcards)
|
||||
if isEnabled() and isAlertEnabled() then
|
||||
if (ingroup == true) then
|
||||
chan = "gt "
|
||||
else
|
||||
chan = "clan "
|
||||
end
|
||||
if(wildcards[1] == target) then
|
||||
SendNoEcho(string.format(chan .. "@W%s@C Recalled!",wildcards[1], area, roomid))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function sendPkInfoGroup(name, line, wildcards)
|
||||
if isEnabled() and isAlertEnabled() then
|
||||
getRoomInformation()
|
||||
SendNoEcho(string.format("gt @W%s@C ENGAGED @Win @x202%s @W[@x202%s@W]",wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
end
|
||||
end
|
||||
|
||||
function sendPkAlert(name, line, wildcards)
|
||||
if isEnabled() then
|
||||
if isAlertEnabled() then
|
||||
getRoomInformation()
|
||||
|
||||
if(wildcards[1] ~= nil) then
|
||||
if (ingroup == true) then
|
||||
SendNoEcho(string.format("gt @RPK Alert: @W%s@C @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
end
|
||||
SendNoEcho(string.format("cla @RPK Alert: @W%s@C @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
else
|
||||
if (ingroup == true) then
|
||||
SendNoEcho(string.format("gt @RPK Alert: @W%s@C @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
end
|
||||
SendNoEcho(string.format("cla @RPK Alert: @W%s@C @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
end
|
||||
end
|
||||
|
||||
--- Give the audio indicator
|
||||
-- Sound( varSoundFile )
|
||||
if isSoundEnabled() then
|
||||
PlaySound( 9, varSoundFile, false, (0-(100-PKASettings.volume)), 0 )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function outputHyperLink(name, line, wildcards)
|
||||
if wildcards.roomid ~= nil then
|
||||
ColourTell("red", "", "RPK Alert: ", "goldenrod", "", "I'm getting attacked please help at ",
|
||||
"white", "", "[")
|
||||
Hyperlink("mg "..wildcards.roomid, wildcards.roomid, "Click to run directly to then room Id"..roomid, "orangered", "", 0)
|
||||
ColourNote("White", "", "]!")
|
||||
end
|
||||
end
|
||||
|
||||
function sendStrangleAlert(name, line, wildcards)
|
||||
if isEnabled() and isAlertEnabled() then
|
||||
getRoomInformation()
|
||||
|
||||
if (ingroup == true) then
|
||||
chan = "gt "
|
||||
else
|
||||
chan = "clan "
|
||||
end
|
||||
|
||||
if(wildcards[1] ~= nil) then
|
||||
Send(string.format(chan .. "@W%s@C STRANGLED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
else
|
||||
Send(string.format(chan .. "@W%s@C STRANGLED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function sendCursedAlert(name, line, wildcards)
|
||||
if isEnabled() and isAlertEnabled() then
|
||||
if (ingroup == true) then
|
||||
chan = "gt "
|
||||
else
|
||||
chan = "clan "
|
||||
end
|
||||
getRoomInformation()
|
||||
if(wildcards[1] ~= nil) then
|
||||
SendNoEcho(string.format(chan .. "@W%s@C CURSED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
else
|
||||
Send(string.format(chan .. "@W%s@C CURSED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
|
||||
target = wildcards[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function respondAlert(name, line, wildcards)
|
||||
end
|
||||
|
||||
function getRoomInformation()
|
||||
if IsConnected() then
|
||||
Send_GMCP_Packet("request room")
|
||||
end
|
||||
|
||||
-- get updated room information
|
||||
gmcproom = gmcp("room")
|
||||
area = gmcproom.info.zone
|
||||
roomid = gmcproom.info.num
|
||||
room = gmcproom.info.name
|
||||
end
|
||||
|
||||
function OnPluginBroadcast (msg, id, name, text)
|
||||
if id == "3e7dedbe37e44942dd46d264" then
|
||||
if text == "group" then
|
||||
local res, membercount = CallPlugin(GMCPPluginID, "gmcpval", "group.count")
|
||||
if membercount == "" then membercount = 0 end
|
||||
if tonumber(membercount) >= 1 then
|
||||
ingroup = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OnPluginInstall()
|
||||
OnPluginEnable()
|
||||
end
|
||||
function OnPluginEnable()
|
||||
local settings = GetVariable("PKSettings")
|
||||
if settings and settings ~= "" then
|
||||
assert(loadstring("PKASettings = "..GetVariable("PKSettings"))) ()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function OnHelp ()
|
||||
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
|
||||
end
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</muclient>
|
Binary file not shown.
Loading…
Reference in new issue