<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MudletPackage>
<MudletPackage>
  <TriggerPackage />
  <TimerPackage />
  <AliasPackage />
  <ActionPackage />
  <ScriptPackage>
    <ScriptGroup isActive="yes" isFolder="yes">
      <name>Seamer CMUD Import (Chat)</name>
      <packageName>Seamer CMUD Import (Chat)</packageName>
      <script>MadROM = MadROM or {}
MadROM.CMUD = MadROM.CMUD or {}
MadROM.CMUD.buckets = MadROM.CMUD.buckets or {}

local bucket = "chat"
if MadROM.CMUD.buckets[bucket] then
  for _, id in ipairs(MadROM.CMUD.buckets[bucket].aliasIds or {}) do pcall(killAlias, id) end
  for _, id in ipairs(MadROM.CMUD.buckets[bucket].triggerIds or {}) do pcall(killTrigger, id) end
end

MadROM.CMUD.buckets[bucket] = { aliasIds = {}, triggerIds = {}, vars = {} }
local state = MadROM.CMUD.buckets[bucket]
local vars = state.vars
  vars["comms.activate_msg"] = "InformaBot is ready for action, find me and say !help"
  vars["comms.announce_method"] = "tribal"
  vars["comms.deactivate_msg"] = "RescueBot is now off."
  vars["comms.limit_msg"] = "InformaBot is now running in limited mode.  Only Vampire's can access this program.  Find me and say !help"
  vars["comms.off_title"] = ""
  vars["comms.on_title"] = "invites you into his parlour"
  vars["comms.rest_command"] = "rest"
  vars["comms.stand_command"] = "stand"
  vars["entertainment.void"] = "say RRR|oracle"
  vars["entertainment.whiner"] = "people|who|suck"
  vars["entertainment.phraseA"] = "Man|You|I|No man|Everyone|Only the gods|Death|Certain arseholes|Anyone|A man|A woman|No woman|Demons|A blade of grass|Certainly, you|It is a well-known fact that everyone|I have never heard of a man who|Many friends has the man who|All the clouds in the sky|Blessed are those who|Cursed are those who|Only a select few|I never thought that I would see one that|I have seen many a dragon who|The running river|Your hands|Thoughts|Even the likes of you|Everyone but the gods|A mere mortal|Friendly kittens|All tramps|No bitch|Apparently|Rumours say"
  vars["entertainment.phraseB"] = "can|should|must|may|will|could|may try to|should try to|will try to|can try to|ought to try to|ought to|can attempt to|should try to|could hope to|that you will"
  vars["entertainment.phraseC"] = "be serious|stand alone|annoy me|be truly faithful|kill me|see the bunny. That'd show 'em|kill everyone|kill you|pat a man on the head|be lonely|eat some cheese|solve problems|love you|speak truth|cause problems|instigate a rebellion|love a goblin|be real|be a friend|eat rocks|look attractive|defeat such a foe|speak eloquently|be kind|have feet|fly like a bird|be holy|be evil|overthrow even the gods|live in supreme filth|look like angels|steal the most riches|tip over a cow|dance merrily|breathe underwater|fling a worm very far|kick your arse"
  vars["entertainment.quote"] = "q1|q2|q3|q4|q5"
  vars["entertainment.thump"] = "hey|fuck|shit"
  vars["entertainment.favour"] = "nuzzle @victim|lick @victim|grope @victim|tell @victim you are one sexy bitch|hooters @victim"
  vars["people.test_friends"] = "Benny|Kalana|Yfandes|Berel|Seamer|Deirdre|Mim|Osuka|Sarien|Mushu|Aardvark|Moe|Tolina|Jordana|Kahlan|Ketricken"
  vars["people.limited_users"] = "Kalana|SuperPenguin|Berel|Relkin|Dough|Morgion|Neferiri|Glamdring|PurpleWisdom|Osuka|Aeolian|MW|Windlock|Elanna|Zoe|Cronax|Kain|Nel|Glodloch|Kode|Tolina|Jordana|Seamer"
  vars["people.friends"] = ""

local aliases = {
  {class="entertainment", name="void", pattern="^void(?:\\\\s+(.*))?$", run=function(matches)
    -- TODO CMUD directive not auto-converted: #IF {@afk == here} {
    send("%item( @void, %random( 1, %numitems( @void)))")
    return
    send("}")
    send("wake")
    send("cast para self")
    send("cast energy self")
    send("cast 'locate life' swizzlefuck")
    -- TODO CMUD directive not auto-converted: #if {@lethargy == undone} {cast leth self}
    send("rest")
  end},
  {class="entertainment", name="vsay", pattern="^vsay(?:\\\\s+(.*))?$", run=function(matches)
    send("emote says '~&amp;blood~&amp;~^~"^ ~&amp;white~&amp; %proper( "%-1")~ ~&amp;blood~&amp;^~"^~&amp;misc~&amp;'")
  end},
  {class="entertainment", name="saytime", pattern="^saytime(?:\\\\s+(.*))?$", run=function(matches)
    send("say %time")
  end},
  {class="entertainment", name="oracle", pattern="^oracle(?:\\\\s+(.*))?$", run=function(matches)
    send("say I proclaim, %concat( %item( @phraseA, %random( 1, %numitems( @phraseA))), " ", %item( @phraseB, %random( 1, %numitems( @phraseB))), " ", %item( @phraseC, %random( 1, %numitems( @phraseC))))")
  end},
  {class="entertainment", name="void1", pattern="^void1(?:\\\\s+(.*))?$", run=function(matches)
    send("%item( @void, %random( 1, %numitems( @void)))")
  end},
  {class="entertainment", name="testing", pattern="^testing(?:\\\\s+(.*))?$", run=function(matches)
    send("emote ~&amp;tribal~&amp;~&gt;~&gt; Vamps ~&lt;~&lt; " .. tostring(matches[1] or "") .. " calls '%-2''")
  end},
}

local triggers = {
  {class="comms", pattern="((\\\\w+)) tells the group '((.+))'.", run=function(matches)
    -- TODO CMUD directive not auto-converted: #cap group
    -- TODO CMUD directive not auto-converted: #if ("%2" == "crotus") {
    send("wake")
    -- TODO CMUD directive not auto-converted: #if (@detect_hidden == "undone") {cast 'detect hidden'}
    -- TODO CMUD directive not auto-converted: #if (@detect_invis == "undone") {cast 'detect invis'}
    send("cast portal crotus")
    send("rest")
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #if ("%2" == "where") {gt room: %roomname area: %zonename}
  end},
  {class="comms", pattern="((\\\\w+)) tells you '(.+)'", run=function(matches)
    -- TODO CMUD directive not auto-converted: #if ("%1" == "Lia" &amp; "%2" == "spellup") {
    send("cast cancel lia")
    send("spellplayer lia")
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (@idle == "on") {reply I'm currrently idle, but your tell has been recorded!} {}
    -- TODO CMUD directive not auto-converted: #IF (!%ismember( %1, @test_friends)) {
    if cecho then cecho("%1 told you '%2' at %time\\n") else echo("%1 told you '%2' at %time\\n") end
    -- TODO CMUD directive not auto-converted: #cap nonfriends
    if deleteLine then deleteLine() end
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (%ismember( %1, @test_friends)) {
    if cecho then cecho("%ansi( brown, bold)%1 %ansi( white, bold)sent a tell saying '%ansi( green, bold)%2%ansi( white, bold)' at %ansi( red, bold)%time%ansi( white)\\n") else echo("%ansi( brown, bold)%1 %ansi( white, bold)sent a tell saying '%ansi( green, bold)%2%ansi( white, bold)' at %ansi( red, bold)%time%ansi( white)\\n") end
    -- TODO CMUD directive not auto-converted: #cap friends
    if deleteLine then deleteLine() end
    send("}")
    return
  end},
  {class="comms", pattern="You tell ((\\\\w+)) '(.+)'", run=function(matches)
    -- TODO CMUD directive not auto-converted: #if (!%ismember( %1, @test_friends)) {
    if cecho then cecho("You sent a tell to %1 saying '%2' at %time\\n") else echo("You sent a tell to %1 saying '%2' at %time\\n") end
    -- TODO CMUD directive not auto-converted: #cap nonfriends
    if deleteLine then deleteLine() end
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #if (%ismember( %1, @test_friends)) {
    if cecho then cecho("%ansi( white, bold)You sent a tell to %ansi( brown, bold)%1 %ansi( white, bold)saying '%ansi( green, bold)%2%ansi( white, bold)' at %ansi( blue, bold)%time%ansi( white)\\n") else echo("%ansi( white, bold)You sent a tell to %ansi( brown, bold)%1 %ansi( white, bold)saying '%ansi( green, bold)%2%ansi( white, bold)' at %ansi( blue, bold)%time%ansi( white)\\n") end
    -- TODO CMUD directive not auto-converted: #cap friends
    if deleteLine then deleteLine() end
    send("}")
    return
  end},
  {class="comms", pattern="~&gt;~&gt; Vamps ~&lt;~&lt; (.+) calls '(.+)'", run=function(matches)
    -- TODO CMUD directive not auto-converted: #if (!%ismember( %1, @test_friends)) {#say %1 said '%2' to the vamps at %time;#cap tribal;#gag;#abort 1};#if (%ismember( %1, @test_friends)) {#say %ansi( brown, bold) %1 %ansi( white, bold)said '%ansi( green, bold)%2%ansi( white, bold)' to the tribe at %ansi( blue, bold)%time%ansi( white);#cap tribal;#gag};#abort 1
  end},
  {class="comms", pattern="You call to your Tribe '(.+)'", run=function(matches)
    -- TODO CMUD directive not auto-converted: #window tribal You said '%1' to the tribe at %time
    if deleteLine then deleteLine() end
  end},
  {class="comms", pattern="hormones rage: ~}~}", run=function(matches)
    -- TODO CMUD directive not auto-converted: #cap hormone
  end},
  {class="entertainment", pattern="(\\\\w+) says '!oracle'", run=function(matches)
    send("oracle")
  end},
  {class="entertainment", pattern="valley elf", run=function(matches)
    -- TODO CMUD directive not auto-converted: #sub "valley girl"
  end},
  {class="entertainment", pattern="((\\\\w+)) looks at you.$", run=function(matches)
    -- TODO CMUD directive not auto-converted: #var victim %1
    -- TODO CMUD directive not auto-converted: #IF (%ismember( %1, @whiner)) {#ABORT 1}
    -- TODO CMUD directive not auto-converted: #IF (%ismember( %1, @favoured)) {#alarm +2 {%item( @favour, %random( 1, %numitems( @favour)))}}
    -- TODO CMUD directive not auto-converted: #IF ("%1" == "someone") {
    send("emote nudges and winks at someone, snickering with a dirty grin.")
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (%ismember( %1, @hated)) {
    send("say take a picture bitch, it'll be the only way you can look at me without me feeling sick")
    return
    send("}")
  end},
}

for _, spec in ipairs(aliases) do
  local id = tempAlias(spec.pattern, function(matches)
    spec.run(matches)
  end)
  table.insert(state.aliasIds, id)
end

for _, spec in ipairs(triggers) do
  local id = tempRegexTrigger(spec.pattern, function(matches)
    spec.run(matches)
  end)
  table.insert(state.triggerIds, id)
end

if cecho then
  cecho(string.format("&amp;lt;green&amp;gt;[%s]&amp;lt;reset&amp;gt; loaded %d aliases / %d triggers\n", "Seamer CMUD Import (Chat)", #aliases, #triggers))
end
</script>
    </ScriptGroup>
  </ScriptPackage>
  <KeyPackage />
  <HelpPackage />
</MudletPackage>
