@ -14,7 +14,7 @@
purpose="Notify to channel PK alert information."
purpose="Notify to channel PK alert information."
save_state="y"
save_state="y"
date_written="2018-10-29 13:37:21"
date_written="2018-10-29 13:37:21"
version="1.4 "
version="1.6 "
>
>
<description trim= "y" >
<description trim= "y" >
< ![CDATA[
< ![CDATA[
@ -24,7 +24,6 @@ Description Here
</plugin>
</plugin>
<!-- Get our standard constants -->
<!-- Get our standard constants -->
<include name= "constants.lua" />
<include name= "constants.lua" />
@ -32,17 +31,6 @@ Description Here
<!-- Triggers -->
<!-- Triggers -->
<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
<trigger
enabled="y"
enabled="y"
match="^(\w+) disappears!$"
match="^(\w+) disappears!$"
@ -53,21 +41,21 @@ Description Here
</trigger>
</trigger>
<trigger
<trigger
enabled="y"
enabled="y"
match="^You grab hold of (.* ?)\'s neck and choke \w+ to unconsciousness\!$"
match="^You grab hold of (.+ ?)\'s neck and choke \w+ to unconsciousness\!$"
regexp="y"
regexp="y"
sequence="100"
sequence="100"
script="sendStrangleAlert"
script="sendStrangleAlert"
>
>
</trigger>
</trigger>
<trigger
<trigger
enabled="y"
enabled="y"
match="^(.* ?) looks very uncomfortable\.$ "
match="^(?<target > \w[\w\s]+ ) looks very uncomfortable\."
regexp="y"
regexp="y"
sequence="100"
sequence="100"
script="sendCursedAlert"
script="sendCursedAlert"
>
>
</trigger>
</trigger>
<!-- You switch targets and direct your attacks at Ralyn. -->
<!-- You switch targets and direct your attacks at Ralyn. -->
<!-- ** You can take revenge on Yatzi for 15 minutes -->
<!-- ** You can take revenge on Yatzi for 15 minutes -->
<trigger
<trigger
@ -97,9 +85,14 @@ Description Here
>
>
</trigger>
</trigger>
<!--
The prefix characters '\' that YOU need to use are to be found in world properties -> scripts and then look at the top right for the characters in Script.
Room 10676 is in Kimr's Farm. safe room. test with
\Simulate("SuperBuff (Newbie member) tells the CLAN: 'PK Alert:Noddy in Farm [10676].'\n")
-->
<trigger
<trigger
enabled="y"
enabled="y"
match="^(?<clan > .+?)\s\(.+\)\s+tells the CLAN: 'PK Alert:(?<attacker > .+)\s+in\s+(?<area > .+?)\s+\[(?<roomid > \d+)\]'$"
match="^(?<clan > .+?)\s\(.+\)\s+tells the CLAN: 'PK Alert:\s+ (?<attacker > .+)\s+in\s+(?<area > .+?)\s+\[(?<roomid > \d+)\](?: I am level \d+ \(\d+ - \d+\))? '$"
regexp="y"
regexp="y"
sequence="100"
sequence="100"
script="outputHyperLink"
script="outputHyperLink"
@ -107,13 +100,9 @@ Description Here
keep_evaluating="y"
keep_evaluating="y"
>
>
</trigger>
</trigger>
</triggers>
</triggers>
<!-- Plugin help -->
<aliases >
<aliases >
<alias
<alias
enabled="y"
enabled="y"
match="pkc *"
match="pkc *"
@ -151,6 +140,18 @@ Description Here
script="COMMAND_PKAdmin"
script="COMMAND_PKAdmin"
>
>
</alias>
</alias>
<alias
enabled="y"
sequence="100"
ignore_case="y"
regexp="y"
keep_evaluating="n"
match="^\s*pk\s*go\s*$"
script="runto_PK_room"
>
</alias>
</aliases>
</aliases>
<script >
<script >
@ -163,6 +164,11 @@ PKASettings.volume = 100
PKASettings.alert = 1
PKASettings.alert = 1
PKASettings.sound = 1
PKASettings.sound = 1
PKASettings.enabled = 1
PKASettings.enabled = 1
PKASettings.playerlevel = 1
defLevelRange = 10
PKASettings.levelrange = defLevelRange
local runto_roomid = 0
function SaveSettings()
function SaveSettings()
SetVariable("PKSettings", serialize.save_simple(PKASettings))
SetVariable("PKSettings", serialize.save_simple(PKASettings))
@ -194,6 +200,7 @@ PKAdminCommands = {
COMMAND_PKAdmin_Sound = {"sound", "soun", "soun", "sou" },
COMMAND_PKAdmin_Sound = {"sound", "soun", "soun", "sou" },
COMMAND_PKAdmin_Status = {"status", "statu", "stat" },
COMMAND_PKAdmin_Status = {"status", "statu", "stat" },
COMMAND_PKAdmin_Volume = {"volume", "volum", "volu", "vol" },
COMMAND_PKAdmin_Volume = {"volume", "volum", "volu", "vol" },
COMMAND_PKAdmin_LevelRange = {"levelrange", "levelr", "level",},
COMMAND_PKAdmin_Reset = {"reset"}
COMMAND_PKAdmin_Reset = {"reset"}
}
}
@ -224,9 +231,13 @@ function COMMAND_PKAdmin_Help()
cnote(" @Gpkadmin alert <yes / n o > @w: @WTurns on/off channel alerts ")
cnote(" @Gpkadmin alert <yes / n o > @w: @WTurns on/off channel alerts ")
cnote(" @Gpkadmin sound <yes / n o > @w: @WTurns on/off sound alerts ")
cnote(" @Gpkadmin sound <yes / n o > @w: @WTurns on/off sound alerts ")
cnote(" @Gpkadmin volume <0-100 > @w: @WSets the play volume for sound")
cnote(" @Gpkadmin volume <0-100 > @w: @WSets the play volume for sound")
cnote(" @Gpkadmin levelrange <1-100 > @w: @WSet the range of levels displayed in the PK Alert")
cnote(" @Gpkadmin enable @w: @WEnables the script ")
cnote(" @Gpkadmin enable @w: @WEnables the script ")
cnote(" @Gpkadmin disable @w: @WDisables the script ")
cnote(" @Gpkadmin disable @w: @WDisables the script ")
Note()
Note()
cnote(" @Gpkgo @w: @W\"Runto\" help your clan mate out")
Note()
end
end
function COMMAND_PKAdmin_Enable()
function COMMAND_PKAdmin_Enable()
@ -322,6 +333,18 @@ function COMMAND_PKAdmin_Volume(args)
cnote(Prepend.."@wVolume is now set to @Y"..tonumber(args[1]).."@w.")
cnote(Prepend.."@wVolume is now set to @Y"..tonumber(args[1]).."@w.")
end
end
function COMMAND_PKAdmin_LevelRange(args)
if not tonumber(args[1]) or (tonumber(args[1]) < 0 ) t h e n
cnote(Prepend.."@RLevel Range@w requires a number greater than zero.")
Note()
return
end
PKASettings.levelrange = tonumber(args[1])
SaveSettings()
cnote(Prepend.."@wLevel range is now set to @Y+/-"..PKASettings.levelrange.."@w.")
end
function COMMAND_PKAdmin_Status()
function COMMAND_PKAdmin_Status()
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
cnote( " " .. Prepend .. " PKAnnouncer's current status is " .. (PKASettings.enabled == 1 and "@GOn" or "@ROff") .. "@w" )
cnote( " " .. Prepend .. " PKAnnouncer's current status is " .. (PKASettings.enabled == 1 and "@GOn" or "@ROff") .. "@w" )
@ -329,6 +352,7 @@ function COMMAND_PKAdmin_Status()
cnote( (" @x208Channel Alerts :@w %-30.30s " ):format( PKASettings.alert == 1 and "@GOn@w" or "@ROff@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 Alerts :@w %-30.30s " ):format( PKASettings.sound == 1 and "@GOn@w" or "@ROff@w"))
cnote( (" @x208Sound Volume :@w %-30.0d " ):format( PKASettings.volume ) )
cnote( (" @x208Sound Volume :@w %-30.0d " ):format( PKASettings.volume ) )
cnote( (" @x208Level Range :@w +/-%-30.0d " ):format( PKASettings.levelrange) )
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
cnote( "@R+@w-----------------------------------------------------------------------------------------@R+@w" )
Note()
Note()
end
end
@ -339,6 +363,8 @@ function COMMAND_PKAdmin_Reset()
PKASettings.alert = 1
PKASettings.alert = 1
PKASettings.sound = 1
PKASettings.sound = 1
PKASettings.enabled = 1
PKASettings.enabled = 1
PKASettings.levelrange = defLevelRange
PKASettings.playerlevel = tonumber(gmcp("char.status.level"))
cnote( Prepend.."PKASettings have been reset to defaults." )
cnote( Prepend.."PKASettings have been reset to defaults." )
SaveSettings()
SaveSettings()
end
end
@ -386,14 +412,15 @@ function isAlertEnabled()
else
else
return false
return false
end
end
end
end
function sendPkInfoClan(name, line, wildcards)
function sendPkInfoClan(name, line, wildcards)
if isEnabled() then
if isEnabled() then
getRoomInformation()
getRoomInformation()
if isAlertEnabled() then
if isAlertEnabled() then
SendNoEcho(string.format("cl @W%s@C ENGAGED @Win @x202%s @W[@x202%s@W]",wildcards[1], area, roomid))
local msg = string.format(" @W%s@C ENGAGED @Win @x202%s @W[@x202%s@W]",wildcards[1], area, roomid)
msg = addLevelRangeText(msg)
SendNoEcho("clan "..msg)
end
end
target = wildcards[1]
target = wildcards[1]
end
end
@ -401,12 +428,12 @@ end
function recalled(name, line, wildcards)
function recalled(name, line, wildcards)
if isEnabled() and isAlertEnabled() then
if isEnabled() and isAlertEnabled() then
if(wildcards[1] == target) then
if (ingroup == true) then
if (ingroup == true) then
chan = "gt "
chan = "gt "
else
else
chan = "clan "
chan = "clan "
end
end
if(wildcards[1] == target) then
SendNoEcho(string.format(chan .. "@W%s@C Recalled!",wildcards[1], area, roomid))
SendNoEcho(string.format(chan .. "@W%s@C Recalled!",wildcards[1], area, roomid))
end
end
end
end
@ -415,7 +442,10 @@ end
function sendPkInfoGroup(name, line, wildcards)
function sendPkInfoGroup(name, line, wildcards)
if isEnabled() and isAlertEnabled() then
if isEnabled() and isAlertEnabled() then
getRoomInformation()
getRoomInformation()
SendNoEcho(string.format("gt @W%s@C ENGAGED @Win @x202%s @W[@x202%s@W]",wildcards[1], area, roomid))
local msg = string.format(" @W%s@C ENGAGED @Win @x202%s @W[@x202%s@W]",wildcards[1], area, roomid)
msg = addLevelRangeText(msg)
SendNoEcho("gt "..msg)
target = wildcards[1]
target = wildcards[1]
end
end
end
end
@ -425,17 +455,13 @@ function sendPkAlert(name, line, wildcards)
if isAlertEnabled() then
if isAlertEnabled() then
getRoomInformation()
getRoomInformation()
if(wildcards[1] ~= nil) then
if wildcards[1] ~= nil then
if (ingroup == true) then
local msg = string.format(" @RPK Alert: @W%s @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid)
SendNoEcho(string.format("gt @RPK Alert: @W%s@C @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
msg = addLevelRangeText(msg)
SendNoEcho("clan "..msg)
if ingroup == true then
SendNoEcho("gt "..msg)
end
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]
target = wildcards[1]
end
end
end
end
@ -450,6 +476,8 @@ end
function outputHyperLink(name, line, wildcards)
function outputHyperLink(name, line, wildcards)
if wildcards.roomid ~= nil then
if wildcards.roomid ~= nil then
runto_roomid = wildcards.roomid
ColourTell("red", "", "RPK Alert: ", "goldenrod", "", "I'm getting attacked please help at ",
ColourTell("red", "", "RPK Alert: ", "goldenrod", "", "I'm getting attacked please help at ",
"white", "", "[")
"white", "", "[")
Hyperlink("mg "..wildcards.roomid, wildcards.roomid, "Click to run directly to then room Id"..roomid, "orangered", "", 0)
Hyperlink("mg "..wildcards.roomid, wildcards.roomid, "Click to run directly to then room Id"..roomid, "orangered", "", 0)
@ -457,21 +485,23 @@ function outputHyperLink(name, line, wildcards)
end
end
end
end
function runto_PK_room()
if runto_roomid ~= 0 then
Execute("mapper goto "..runto_roomid)
end
end
function sendStrangleAlert(name, line, wildcards)
function sendStrangleAlert(name, line, wildcards)
if isEnabled() and isAlertEnabled() then
if isEnabled() and isAlertEnabled() then
getRoomInformation()
getRoomInformation()
if (ingroup == true) then
chan = "gt "
else
chan = "clan "
end
if(wildcards[1] ~= nil) then
if(wildcards[1] ~= nil) then
Send(string.format(chan .. "@W%s@C STRANGLED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
local msg = string.format("@W%s@C STRANGLED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid)
target = wildcards[1]
msg = addLevelRangeText(msg)
else
SendNoEcho("clan "..msg)
Send(string.format(chan .. "@W%s@C STRANGLED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
if ingroup == true then
SendNoEcho("gt "..msg)
end
target = wildcards[1]
target = wildcards[1]
end
end
end
end
@ -485,17 +515,17 @@ function sendCursedAlert(name, line, wildcards)
chan = "clan "
chan = "clan "
end
end
getRoomInformation()
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))
if(wildcards.target ~= nil and wildcards.target ~= "") then
target = wildcards[1]
local msg = string.format("@W%s@C CURSED @Win @x202%s @W[@x202%s@W]", wildcards.target, area, roomid)
else
msg = addLevelRangeText(msg)
Send(string.format(chan .. "@W%s@C CURSED @Win @x202%s @W[@x202%s@W]", wildcards[1], area, roomid))
SendNoEcho("clan "..msg)
target = wildcards[1]
if ingroup == true then
SendNoEcho("gt "..msg)
end
end
target = wildcards.target
end
end
end
end
function respondAlert(name, line, wildcards)
end
end
function getRoomInformation()
function getRoomInformation()
@ -510,14 +540,30 @@ function getRoomInformation()
room = gmcproom.info.name
room = gmcproom.info.name
end
end
function addLevelRangeText(msg)
if PKASettings.playerlevel > 0 and PKASettings.levelrange > 0 then
local min = PKASettings.playerlevel - PKASettings.levelrange
if min < 1 t h e n min = 1 e n d
local max = PKASettings.playerlevel + PKASettings.levelrange
if max > 201 then max = 201 end
msg = msg.." I am level @x202"..PKASettings.playerlevel.." @W(@x202"..min.."@W - @x202"..max.."@W)"
end
return msg
end
function OnPluginBroadcast (msg, id, name, text)
function OnPluginBroadcast (msg, id, name, text)
if id == "3e7dedbe37e44942dd46d264" then
if id == GMCPPluginID then
if text == "group" then
if text == "group" then
local res, membercount = CallPlugin(GMCPPluginID, "gmcpval", "group.count")
local res, membercount = CallPlugin(GMCPPluginID, "gmcpval", "group.count")
if membercount == "" then membercount = 0 end
if membercount == "" then membercount = 0 end
if tonumber(membercount) >= 1 then
if tonumber(membercount) >= 1 then
ingroup = true
ingroup = true
end
end
elseif text == "char.status" then
PKASettings.playerlevel = tonumber(gmcp("char.status.level"))
end
end
end
end
end
end
@ -525,13 +571,17 @@ end
function OnPluginInstall()
function OnPluginInstall()
OnPluginEnable()
OnPluginEnable()
end
end
function OnPluginEnable()
function OnPluginEnable()
local settings = GetVariable("PKSettings")
local settings = GetVariable("PKSettings")
if settings and settings ~= "" then
if settings and settings ~= "" then
assert(loadstring("PKASettings = "..GetVariable("PKSettings"))) ()
assert(loadstring("PKASettings = "..GetVariable("PKSettings"))) ()
end
end
end
if PKASettings.levelrange == nil then PKASettings.levelrange = defLevelRange end
Send_GMCP_Packet("request char")
end
function OnHelp ()
function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))