<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, April 24, 2007, 7:53 PM -->
<!-- MuClient version 4.05 -->

<!-- Plugin "Wardens" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Wardens"
   author="Edoren"
   id="378112bf3ba9e1bc2c606a94"
   language="Lua"
   purpose="React to House commands"
   save_state="y"
   date_written="2007-04-24 19:52:44"
   requires="4.05"
   version="1.0"
   >

<description trim="y">
<![CDATA[

METEOR COMMANDS:
 /m (on|off)			- turn meteor responses on or off
 /m (bow|rune)			- use a bow or the thurisaz rune on command
 /m (inv|pack|kitbag)	- use meteor arrows from your pack kitbag or inventory


BOW COMMANDS:
 /b (on|off)			- turn bow responses on or off
 /b (noaim|aim)			- aim or don't aim when told to shoot
 /rb					- removes bow and wields it
 /sd					- unwield bow and wear it


FALCONRY COMMANDS:
 /f (on|off)			- turn falconry responses on or off
 /f (follow|track)		- use the track or follow command

]]>
</description>

</plugin>

<!--  Get our standard constants -->

<include name="constants.lua"/>

<!--  Triggers  -->

<triggers>
 <trigger
  group="meteors"
  enabled="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;Runewardens?\,? (T|t)hurisaz (?P&lt;target&gt;.*)(\.| now\.)&quot;$"
  regexp="y"
  sequence="100"
  script="meteors_thurisaz"
 >
 </trigger>

 <trigger
  group="bows"
  enabled="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;(P|p)repare your bow\.&quot;$"
  regexp="y"
  sequence="100"
  script="bows_ready"
 >
 </trigger>

 <trigger
  group="bows"
  enabled="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;(S|s)tand down\.&quot;$"
  regexp="y"
  sequence="100"
  script="bows_standdown"
 >
 </trigger>

 <trigger
  group="bows"
  enabled="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;(S|s)hoot (?P&lt;target&gt;.*) (?P&lt;direction&gt;\w+)\.&quot;$"
  regexp="y"
  sequence="100"
  script="bows_shoot"
 >
 </trigger>

 <trigger
  group="falcons"
  enabled="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;(F|f)alcons?\,? recall\.&quot;$"
  regexp="y"
  sequence="100"
 ><send>falcon recall</send>
 </trigger>

 <trigger
  group="falcons"
  enabled="y"
  expand_variables="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;(F|f)alcons?\,? slay (?P&lt;target&gt;.*)(\.| now\.)&quot;$"
  regexp="y"
  sequence="100"
 ><send>falcon slay %&lt;target&gt;</send>
 </trigger>

 <trigger
  group="falcons"
  enabled="y"
  expand_variables="y"
  match="^\(Wardens\): (?P&lt;commander&gt;\w+) says?\, &quot;(F|f)alcons?\,? track (?P&lt;target&gt;.*)(\.| now\.)&quot;$"
  regexp="y"
  sequence="100"
  script="falcons_track"
 >
 </trigger>

</triggers>

<!-- Aliases -->
<aliases>
 <alias
  enabled="y"
  match="^/f (?P&lt;command&gt;\w+)$"
  regexp="y"
  script="falcon_command"
  sequence="100"
 >
 </alias>

 <alias
  enabled="y"
  match="^/m (?P&lt;command&gt;\w+)$"
  regexp="y"
  script="meteor_command"
  sequence="100"
 >
 </alias>

 <alias
  enabled="y"
  match="^/b (?P&lt;command&gt;\w+)$"
  regexp="y"
  script="bow_command"
  sequence="100"
 >
 </alias>

 <alias
  enabled="y"
  match="^/rb$"
  regexp="y"
  script="ready_bow"
  sequence="100"
 >
 </alias>

 <alias
  enabled="y"
  match="^/sd$"
  regexp="y"
  script="bows_standdown"
  sequence="100"
 >
 </alias>
 </aliases>

<!-- Scripts -->

<script>
<![CDATA[
require "serialize"

function falcon_command(name, line, wildcards)
 if wildcards.command == "on" then
  EnableTriggerGroup ("falcons", true)
  Note ("Falconry Triggers are on now")
 elseif wildcards.command == "off" then
  EnableTriggerGroup ("falcons", false)
  Note ("Falconry Triggers are now off")
 elseif wildcards.command == "track" then
  command.falcons="track"
  Note ("You have set your falcons to track when ordered")
 elseif wildcards.command == "follow" then
  command.falcons="follow"
  Note ("You have set your falcons to follow when ordered")
 else
  Note ("Sorry i don't understand what you want with the falconry command")
 end
end

function meteor_command(name, line, wildcards)
 if wildcards.command == "on" then
  EnableTriggerGroup ("meteors", true)
  Note ("Meteor Triggers are on now")
 elseif wildcards.command == "off" then
  EnableTriggerGroup ("meteors", false)
  Note ("Meteor Triggers are now off")
 elseif wildcards.command == "bow" then
  command.meteors="bow"
  Note ("You will now use your bow when ordered to Thurisaz")
 elseif wildcards.command == "rune" then
  command.meteors="rune"
  Note ("You will now use the rune when ordered to Thurisaz")
 elseif wildcards.command == "pack" then
  command.arrow="pack"
  Note ("You will now use meteor arrows in your pack")
 elseif wildcards.command == "kitbag" then
  command.arrow="kitbag"
  Note ("You will now use meteor arrows in your kitbag")
 elseif wildcards.command == "inv" then
  command.arrow="inv"
  Note ("You will now use meteor arrows in your inventory")
 else
  Note ("Sorry i don't understand what you want with the meteor command")
 end
end

function bow_command(name, line, wildcards)
 if wildcards.command == "on" then
  EnableTriggerGroup ("bows", true)
  Note ("Bow Triggers are on now")
 elseif wildcards.command == "off" then
  EnableTriggerGroup ("bows", false)
  Note ("Bow Triggers are now off")
 elseif wildcards.command == "aim" then
  command.bows="aim"
  Note ("You will now aim when ordered to fire")
 elseif wildcards.command == "noaim" then
  command.bows="noaim"
  Note ("You will not aim when ordered to fire")
 else
  Note ("Sorry i don't understand what you want with the bow command")
 end
end

function meteors_thurisaz(name, line, wildcards)
 if command.meteors == "rune" then
  Send ("outr red ink")
  Send ("outr blue ink")
  Send ("sketch thurisaz on ground for " .. wildcards.target)
 elseif command.meteors == "bow" then
  if bow == false then
   world.Execute ("/rb")
  end
  if (command.arrow == "pack" or command.arrow == "kitbag") then
   SendNoEcho ("get meteor from " .. command.arrow)
  end
  Send ("shoot " .. wildcards.target .. " with meteor")
 end
end

function ready_bow()
 if bow == false then
  Send ("stand")
  Send ("unwield left")
  Send ("unwield right")
  Send ("remove bow")
  Send ("wield bow")
  Send ("grip")
  bow=true
 elseif bow == true then
  Note ("Your bow is already ready")
 end
end

function bows_standdown()
 if bow == true then
  Send ("unwield bow")
  Send ("wear bow")
  bow=false
 elseif bow == false then
  Note ("Your bow is already put away")
 end
end

function bows_ready()
 world.Execute ("/rb")
end --ready_bow

function bows_shoot(name, line, wildcards)
 if command.bows == "noaim" then
  if bow == false then
   world.Execute ("/rb")
   bow=true
  end
  Send ("shoot " .. wildcards.target .. " " .. wildcards.direction)
 elseif command.bows == "aim" then
  if bow == false then
   world.Execute ("/rb")
   bow=true
  end
  Send ("aim " .. wildcards.target .. " " .. wildcards.direction)
  Send ("shoot " .. wildcards.target .. " " .. wildcards.direction)
 end
end

function falcons_track(name, line, wildcards)
 if command.falcons == "follow" then
  Send ("falcon follow " .. wildcards.target)
 elseif command.falcons == "track" then
  Send ("falcon track " .. wildcards.target)
 end
end

function OnPluginInstall()
 assert (loadstring (GetVariable ("command") or "")) ()
 command = command or {}  -- ensure table exists
 if not(command.bows) then
  command.bows="noaim"
 end
 if not(command.meteors) then
  command.meteors="bow"
 end
 if not(command.falcons) then
  command.falcons="follow"
 end
 if not(command.arrow) then
  command.arrow="inv"
 end
 bow=false
end

function OnPluginSaveState()
 SetVariable ("command", serialize.save ("command"))
end

]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="Wardens:help"
   enabled="y"
   ignore_case="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
function OnHelp (name, line, wildcards)
 world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
]]>
</script> 

</muclient>
