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

local bucket = "combat"
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["dameq.wristdam"] = "blood bracer"
  vars["dameq.aboutdam"] = "aura"
  vars["dameq.ringdam"] = "gloom"
  vars["dameq.helddam"] = "iron"
  vars["dameq.neckdam"] = "badge"
  vars["dameq.feetdam"] = "horseshoe"
  vars["dameq.handdam"] = "gauntlets"
  vars["dameq.shielddam"] = "wish"
  vars["dameq.waistdam"] = "'belt fire'"
  vars["dameq.legdam"] = "jeans"
  vars["dameq.headdam"] = "baseball"
  vars["dameq.armsdam"] = "bicep"
  vars["dameq.lightdam"] = "jaw"
  vars["fight.gore"] = "6"
  vars["fight.trip"] = "0"
  vars["fight.mood"] = "pissy"
  vars["fight.kick"] = "0"
  vars["fight.giant"] = "undone"
  vars["fight.haste"] = "undone"
  vars["fight.hp"] = ""
  vars["fight.maxhp"] = "30060"
  vars["fight.mana"] = "415"
  vars["fight.maxmana"] = "3572"
  vars["fight.gold"] = "50003236"
  vars["fight.afk"] = "here"
  vars["fight.counter"] = "0"
  vars["fight.eq"] = "-1"
  vars["fight.fightmode"] = "pissy"
  vars["fight.weap"] = "pit"
  vars["fight.damages"] = "misses|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|pulps|MUTILATES|FUBARS|CRIPPLES|MASSACRES|MANGLES|*** DEMOLISHES ***|*** EVISCERATES ***|=== OBLITERATES ===|&gt;&gt;&gt; ANNIHILATES &lt;&lt;&lt;|&lt;&lt;&lt; STOMPS &gt;&gt;&gt;|does UNSPEAKABLE"
  vars["fight.bodyparts"] = "head|left hand|right hand|face|chest|left forearm|right forearm|right thigh|left thigh|left shin|right shin|left bicep|right bicep|left knee|right knee|left calf|right calf|midriff|left shoulder|right shoulder|claws|fangs|tail|wings|scales|tongue|eye stalks|horn"
  vars["manaeq.aboutmana"] = "suspenders"
  vars["manaeq.headmana"] = "deere"
  vars["manaeq.ringmana"] = "sandy"
  vars["manaeq.wristmana"] = "angel"
  vars["manaeq.neckmana"] = "obsidian"
  vars["manaeq.legsmana"] = "baggy"
  vars["manaeq.legmana"] = "baggy"
  vars["manaeq.heldmana"] = "tome"
  vars["manaeq.shieldmana"] = "palette"
  vars["manaeq.feetmana"] = "slipper"
  vars["manaeq.waistmana"] = "faith"
  vars["manaeq.handsmana"] = "horseman"
  vars["manaeq.bodymana"] = "dragonscale"
  vars["manaeq.lightmana"] = "kosh"
  vars["manaeq.armsmana"] = "sleeve"

local aliases = {
  {class="fight", name="wield", pattern="^wield(?:\\\\s+(.*))?$", run=function(matches)
    send("wear " .. tostring(matches[1] or "") .. ";#var weap " .. tostring(matches[1] or "") .. "")
  end},
  {class="fight", name="target", pattern="^target(?:\\\\s+(.*))?$", run=function(matches)
    -- TODO CMUD directive not auto-converted: #var target %1
  end},
  {class="fight", name="gb", pattern="^gb(?:\\\\s+(.*))?$", run=function(matches)
    send("cast gas")
  end},
  {class="manaeq", name="seamermana", pattern="^seamermana(?:\\\\s+(.*))?$", run=function(matches)
    send("get all hole")
    send("wear @neckmana")
    send("rem @neckdam")
    send("wear @neckmana")
    send("put all.@neckdam hole")
    send("wear @headmana")
    send("put @headdam hole")
    send("wear @legsmana")
    send("put @legdam hole")
    send("wear @handsmana")
    send("put @handdam hole")
    send("wear @waistmana")
    send("put @waistdam hole")
    send("wear all")
    send("wear @heldmana")
    -- TODO CMUD directive not auto-converted: #if (@target == lich) {} {
    send("wear @shieldmana")
    send("put @shielddam hole")
    send("}")
    send("put @helddam hole")
    send("wear @aboutmana")
    send("put @aboutdam hole")
    -- TODO CMUD directive not auto-converted: #2 rem '@wristdam'
    -- TODO CMUD directive not auto-converted: #2 wear '@wristmana'
    -- TODO CMUD directive not auto-converted: #2 put '@wristdam' hole
    send("wear @armsmana")
    send("put @armsdam hole")
    send("wear @lightmana")
    send("put @lightdam hole")
    -- TODO CMUD directive not auto-converted: #VARIABLE eq {0}
    -- TODO CMUD directive not auto-converted: #VARIABLE mood {peaceful}
  end},
  {class="manaeq", name="next_step", pattern="^next_step(?:\\\\s+(.*))?$", run=function(matches)
    -- TODO CMUD directive not auto-converted: #if (@goldrun == "captain") {
    -- TODO CMUD directive not auto-converted: #var goldrun palgold
    -- TODO CMUD directive not auto-converted: #walk palgold
    send("}")
    -- TODO CMUD directive not auto-converted: #if (@goldrun == "palgold") {
    -- TODO CMUD directive not auto-converted: #var goldrun calico
    send("cast portal @goldrun")
    -- TODO CMUD directive not auto-converted: #temp {You wave your hands madly and create a portal!} {enter portal}
    -- TODO CMUD directive not auto-converted: #temp {You failed.} {cast portal @goldrun}
    send("}")
    -- TODO CMUD directive not auto-converted: #if (@goldrun == "calico") {
    -- TODO CMUD directive not auto-converted: #var goldrun grimdale
    send("cast portal @goldrun")
    -- TODO CMUD directive not auto-converted: #temp {You wave your hands madly and create a portal!} {enter portal}
    -- TODO CMUD directive not auto-converted: #temp {You failed.} {cast portal @goldrun}
    send("}")
    -- TODO CMUD directive not auto-converted: #if (@goldrun == "grimdale") {
    -- TODO CMUD directive not auto-converted: #var goldrun crotus
    send("cast portal @goldrun")
    -- TODO CMUD directive not auto-converted: #temp {You wave your hands madly and create a portal!} {enter portal}
    -- TODO CMUD directive not auto-converted: #temp {You failed.} {cast portal @goldrun}
    send("}")
    -- TODO CMUD directive not auto-converted: #if (@goldrun == "crotus") {
    -- TODO CMUD directive not auto-converted: #var goldrun cerberus
    send("cast portal @goldrun")
    -- TODO CMUD directive not auto-converted: #temp {You wave your hands madly and create a portal!} {enter portal}
    -- TODO CMUD directive not auto-converted: #temp {You failed.} {cast portal @goldrun}
    send("}")
    if cecho then cecho("should the script get here?\\n") else echo("should the script get here?\\n") end
  end},
  {class="portal", name="catchup", pattern="^catchup(?:\\\\s+(.*))?$", run=function(matches)
    -- TODO CMUD directive not auto-converted: #find;#alarm +3 {#exe %roomcom}
  end},
}

local triggers = {
  {class="fight", pattern="Your (.*) misses", run=function(matches)
    -- TODO CMUD directive not auto-converted: #if ("%1" == "kick") {#if (@kick &lt; 15) {#alarm "kick" +0.5 {kick};#add kick 1} {cast 'heal';#var kick 0;kick;#abort 1}};#if ("%1" == "gore") {#if (@gore &lt; 15) {#alarm "gore" +0.5 {gore};#add gore 1} {cast 'heal' shadow;#var gore 0;gore;#abort 1}};#if ("%1" == "bash") {#if (@bash &lt; 15) {#alarm "bash" +0.5 {bash};#add bash 1} {cast 'heal' shadow;#var bash 0;bash;#abort 1}}
  end},
  {class="fight", pattern="\*\*\*DISARMS\*\*\* you and sends your weapon flying!$", run=function(matches)
    send("get @weap")
    send("wear @weap")
  end},
  {class="fight", pattern="Ernie Ramirez is DEAD!! R.I.P.$You receive 0 experience points.$.*$You get a stooky gland from corpse of Ernie Ramirez.", run=function(matches)
    send("put stoo back")
    send("drop bat")
    send("drop key")
  end},
  {class="fight", pattern="(.+) axe SPLITS your a small wooden shield in two!", run=function(matches)
    send("wear wood")
    -- TODO CMUD directive not auto-converted: #MATH shields (@shields - 1)
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
  end},
  {class="fight", pattern="^You shiver and suffer.$Your poison scratches you.", run=function(matches)
    send("cast undo poison")
  end},
  {class="fight", pattern="^You receive (.+) experience points.", run=function(matches)
    -- TODO CMUD directive not auto-converted: #VARIABLE fightcounter 0
    -- TODO CMUD directive not auto-converted: #VARIABLE victim "Noone"
  end},
  {class="fight", pattern="Your ((.+)) {@damages} ((.+))'s {@bodyparts}(.*)", run=function(matches)
    -- TODO CMUD directive not auto-converted: #IF ( @fightcounter &gt;= @fight) {
    -- TODO CMUD directive not auto-converted: #IF (@HEALTH &lt; @HEALTH_MAX) {
    -- TODO CMUD directive not auto-converted: #VARIABLE fightcounter 0
    send("cast 'cure critical' self")
    send("} {")
    send("gore")
    -- TODO CMUD directive not auto-converted: #VARIABLE fightcounter 0
    send("}")
    send("}")
    -- TODO CMUD directive not auto-converted: #if (@MANA &gt; 100) {
    -- TODO CMUD directive not auto-converted: #IF (%1 == "blast of lightning") {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.75 {
    send("cast 'lightning breath'")
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("}")
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (%1 == "blast of acid") {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.75 {
    send("cast 'acid breath'")
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("}")
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (%1 == "blast of flame") {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.75 {
    send("cast 'fire breath'")
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("}")
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (%1 == "blast of frost") {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.75 {
    send("cast 'frost breath'")
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("}")
    return
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (%1 == "blast of gas") {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.75 {
    send("cast gas")
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("}")
    return
    send("}")
    send("}")
    -- TODO CMUD directive not auto-converted: #if (%1 == "divine power") {#abort 1}
    -- TODO CMUD directive not auto-converted: #if (%1 == "flaming bite") {#abort 1}
    -- TODO CMUD directive not auto-converted: #if (%1 == "kick") {
    -- TODO CMUD directive not auto-converted: #if (@fightcounter &lt; 15) {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.5 {kick}
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("}")
    send("}")
    -- TODO CMUD directive not auto-converted: #if (%1 == "gore") {
    -- TODO CMUD directive not auto-converted: #if (@gore &lt; 15) {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.5 {gore}
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("} {")
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("gore")
    return
    send("}")
    send("}")
    -- TODO CMUD directive not auto-converted: #if ("%1" == "bash") {
    -- TODO CMUD directive not auto-converted: #if (@bash &lt; 15) {
    -- TODO CMUD directive not auto-converted: #alarm "fightcounter" +0.5 {bash}
    -- TODO CMUD directive not auto-converted: #add fightcounter 1
    send("} {")
    -- TODO CMUD directive not auto-converted: #var fightcounter 0
    send("bash")
    return
    send("}")
    send("}")
  end},
  {class="fight", pattern="~&lt;((\\\\d+))/((\\\\d+))hp ((\\\\d+))m/((\\\\d+))m ((\\\\d+))g~&gt;~", run=function(matches)
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 750) AND (@eq == 0)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @helddam hole")
    send("wear @helddam")
    send("put @heldmana hole")
    -- TODO CMUD directive not auto-converted: #if (@target == lich) {
    send("wear wooden")
    send("put scale hole")
    send("} {")
    send("get @shielddam hole")
    send("wear @shielddam")
    send("put @shieldmana hole")
    send("}")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 700) AND (@eq == 1)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @neckdam hole")
    send("wear @neckdam")
    send("put @neckmana hole")
    send("get @lightdam hole")
    send("wear @lightdam")
    send("put @lightmana hole")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 650) AND (@eq == 2)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @waistdam hole")
    send("wear @waistdam")
    send("put @waistmana hole")
    send("wear all")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 600) AND (@eq == 3)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @legdam hole")
    send("wear @legdam")
    send("put @legmana hole")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 550) AND (@eq == 4)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @handdam hole")
    send("wear @handdam")
    send("put @handsmana hole")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 500) AND (@eq == 5)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    -- TODO CMUD directive not auto-converted: #2 get '@wristdam' hole
    -- TODO CMUD directive not auto-converted: #2 rem '@wristmana'
    -- TODO CMUD directive not auto-converted: #2 wear '@wristdam'
    -- TODO CMUD directive not auto-converted: #2 put '@wristmana' hole
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 450) AND (@eq == 6)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @headdam hole")
    send("wear @headdam")
    send("put @headmana hole")
    send("get @armsdam hole")
    send("wear @armsdam")
    send("put @armsmana hole")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF ((@mood == "pissy") AND (@mana &lt; 400) AND (@eq == 7)) {
    -- TODO CMUD directive not auto-converted: #ADD eq 1
    send("get @aboutdam hole")
    send("wear @aboutdam")
    send("put @aboutmana hole")
    send("get @neckdam hole")
    send("rem @neckmana")
    send("wear @neckdam")
    send("put @neckmana hole")
    -- TODO CMUD directive not auto-converted: #VARIABLE breath 0
    send("}")
    -- TODO CMUD directive not auto-converted: #IF (@eq == "") {#VARIABLE eq 0}
    -- TODO CMUD directive not auto-converted: #if (@eq &gt; 15) {#var eq 0}
    -- TODO CMUD directive not auto-converted: #if (%2 &lt; 100 AND @afk == afk) {
    send("wake")
    send("cast high self")
    send("}")
  end},
  {class="fight", pattern="You can't see a thing!", run=function(matches)
    -- TODO CMUD directive not auto-converted: #if (@eq &gt;= "8") {#abort 1} {
    -- TODO CMUD directive not auto-converted: #var blindeq @eq
    -- TODO CMUD directive not auto-converted: #var eq -1
    send("}")
  end},
  {class="fight", pattern="You rub the dirt out of your eyes.", run=function(matches)
    -- TODO CMUD directive not auto-converted: #math eq @blindeq-1
  end},
  {class="fight", pattern="You fail to disarm", run=function(matches)
    -- TODO CMUD directive not auto-converted: #alarm "disarm" +4 {disarm}
  end},
  {class="fight", pattern="You'll have to let (.+) get back up first.", run=function(matches)
    send("bash")
  end},
  {class="portal", pattern="You step through a gate and vanish.", run=function(matches)
    send("catchup")
  end},
  {class="portal", pattern="You flee from combat!  You lose 10 exps.", run=function(matches)
    send("catchup")
  end},
  {class="portal", pattern="^You peer closer at your foe and notice:", run=function(matches)
    -- TODO CMUD directive not auto-converted: #t+ consider
  end},
  {class="portal", pattern="You walk through a plane of energy and emerge into...", run=function(matches)
    send("catchup")
  end},
  {class="portal", pattern="Something has gone very wrong!!!!", run=function(matches)
    send("catchup")
  end},
  {class="portal", pattern="You are stretched like spaghetti from head to toe and sucked into a swirling portal!", run=function(matches)
    send("catchup")
  end},
  {class="portal", pattern="^I see no key here.$", run=function(matches)
    send("vsay what? No key! What a world, what a world...")
  end},
  {class="portal", pattern="You rest.", run=function(matches)
    -- TODO CMUD directive not auto-converted: #var awake rest
  end},
  {class="portal", pattern="You stand up.", run=function(matches)
    -- TODO CMUD directive not auto-converted: #var awake awake
  end},
  {class="portal", pattern="^Alas, you cannot go that way.$", run=function(matches)
    send("catchup")
  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 (Combat)", #aliases, #triggers))
end
</script>
    </ScriptGroup>
  </ScriptPackage>
  <KeyPackage />
  <HelpPackage />
</MudletPackage>
