<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="Inscribing">
    <alias name="startIns">
      <value>inscribeList = ""
inscribePause = 0
#call @pickIncribing()</value>
    </alias>
    <var name="inscribeList" type="Record">
      <json>{}</json>
    </var>
    <func name="pickIncribing">
      <value>#pick {p:Pick a card}
  {o:1}
  {Sun:card=Sun}
  {Emperor:card=Emperor}
  {Magician:card=Magician}
  {Priestess:card=Priestess}
  {Fool:card=Fool}
  {Chariot:card=Chariot}
  {Hermit:card=Hermit}
  {Empress:card=Empress}
  {Lovers:card=Lovers}
  {Hierophant:card=Hierophant}
  {Hangedman:card=Hangedman}
  {Tower:card=Tower}
  {Wheel:card=Wheel}
  {Creator:card=Creator}
  {Justice:card=Justice}
  {Star:card=Star}
  {Aeon:card=Aeon}
  {Lust:card=Lust}
  {Universe:card=Universe}
  {Devil:card=Devil}
  {Moon:card=Moon}
  {Death:card=Death}
#if (!%null(@card)) {
  #prompt inscribeQuantity "Enter the quantity you would like to inscribe"
  #addkey inscribeList @card @inscribeQuantity
  #yesno "Would you like to add another card?" {#call @pickIncribing()} {#call @startIncribing()}}</value>
    </func>
    <func name="startIncribing">
      <value>#sendraw "wield quill"
hmoff
inscribing = %item(%dbkeys(@inscribeList),1)
#sendraw "outd blank"
#sendraw "inscribe blank with "@inscribing</value>
    </func>
    <trigger name="Inscribe1" priority="870">
      <pattern>Wisely preparing yourself beforehand, you lay out the quill and various inks you will need to inscribe the sign of (%*) into your card.</pattern>
      <value>#substitute {&lt;color white purple&gt;Inking of @inscribing - Stage 1 of 5&lt;/color&gt;}</value>
    </trigger>
    <trigger name="inscribe2" priority="880">
      <pattern>Focusing your mind on the task ahead, you block out all extraneous thoughts.</pattern>
      <value>#substitute {&lt;color white purple&gt;Inking of @inscribing - Stage 2 of 5&lt;/color&gt;}</value>
    </trigger>
    <trigger name="inscribe4" priority="890">
      <pattern>Finishing the outline, you begin to colour (%*) properly, utilising just the right amount of hue here, the perfect amount of saturation there.</pattern>
      <value>#substitute {&lt;color white purple&gt;Inking of @inscribing - Stage 4 of 5&lt;/color&gt;}</value>
    </trigger>
    <trigger name="inscribe5" priority="900">
      <pattern>You have successfully inscribed the image of (%*) on your Tarot card.</pattern>
      <value><![CDATA[#substitute {<color white purple>Inking of @inscribing - Stage 5 of 5</color>}
#addkey inscribeList @inscribing (%db(@inscribeList, @inscribing) - 1)
tarotCards = ""
#call @updateInscribing()
#sendraw "ind "@inscribing
#if (!@inscribePause) {#if (@mana < (@manaMax - 400)) {dm}
#if (%item(@inscribelist,@inscribing) <= 0) {
  #delkey inscribelist @inscribing
  inscribing = %item(%dbkeys(@inscribeList), 1)
}
#if (@inscribing != "") {
inscribing = %item(%dbkeys(@inscribeList),1)
#sendraw "outd blank"
#sendraw "inscribe blank with "@inscribing;#echo %eval(%db(@inscribeList, @inscribing) - 1) remaining of @inscribing} {hmon;#print ""
    #print {<color lime><strong>All inscribing jobs complete!</strong></color>};#sendraw "unwield quill"}
    } {hmon;#sendraw "unwield quill"}
  ]]></value>
    </trigger>
    <trigger name="inscribe3" priority="910">
      <pattern>You take up the quill and begin to trace the outline of (%*) with careful precision. The slightest mistake will render the card useless.</pattern>
      <value>#substitute {&lt;color white purple&gt;Inking of @inscribing - Stage 3 of 5&lt;/color&gt;}</value>
    </trigger>
    <var name="inscribing"/>
    <var name="cardLeft"/>
    <var name="inscribePause">0</var>
    <alias name="pauseIns">
      <value>inscribePause = 1</value>
    </alias>
    <alias name="unpauseIns">
      <value>inscribePause = 0
#if (@mana &lt; (@manaMax - 400)) {#sendraw "drink mana"}
#if (%item(@inscribelist,@inscribing) &lt;= 0) {
  #delkey inscribelist @inscribing
  inscribing = %item(%dbkeys(@inscribeList), 1)
}
#if (@inscribing != "") {
#sendraw "wield quill"
hmoff
inscribing = %item(%dbkeys(@inscribeList),1)
#sendraw "outd blank"
#sendraw "inscribe blank with "@inscribing;#echo %eval(%db(@inscribeList, @inscribing) - 1) remaining of @inscribing}</value>
    </alias>
    <func name="updateInscribing">
      <value>#loopdb @inscribeList {tarotCards = %key%repeat("-",%eval(10-%len(%key)))@inscribeList.%key" "@tarotCards;#update @tarotCards
}</value>
    </func>
    <trigger priority="2050">
      <pattern>You cannot summon up the willpower to perform such a mentally exhausting task.</pattern>
      <value>pauseins
autoUniverse = 1
#sendraw "config timeout 0"
#sendraw "meditate"</value>
    </trigger>
    <trigger priority="2060">
      <pattern>You cease your meditation having achieved full will and mana.</pattern>
      <value>unpauseins
autoUniverse = 0
#sendraw "config timeout 10"</value>
    </trigger>
    <var name="autoUniverse">0</var>
    <trigger priority="2470">
      <pattern>You close your eyes, bow your head, and empty your mind of all thought.</pattern>
      <value>autoUniverse = 1</value>
    </trigger>
  </class>
</cmud>
