Advertisement
Anaristos

MoonServices Module (Cmud)

Jul 10th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.28 KB | None | 0 0
  1. <module name="MoonServices" global="true" id="362">
  2. <uid>{E411E3A3-03A2-4474-BC2B-BB748CD6CA9C}</uid>
  3. <packages>English Directions|English Keypad|GCMPServices|Aardwolf</packages>
  4. <alias name="moonbot" id="363">
  5. <value>$slist = "inactive|active"
  6. $switch = %lower( %1)
  7. ;;
  8. $mid = "MoonBot: "
  9. $msg1 = "Moon Tracker Activated"
  10. $msg2 = "Moon Tracker Deactivated"
  11. $msg3 = "Moon Tracker is "
  12. $msg4 = "Invalid Option"
  13. ;;
  14. #SWITCH ($switch = "on") {
  15. configtab.moons = 1
  16. #T+ MoonTriggers
  17. #T+ moontrig1
  18. #T+ moontrig2
  19. #T+ mButton
  20. #CALL @commbt.setStatus(True)
  21. #CALL @commbt.setColors(%json( @mbtcolors))
  22. #WINDOW @hWind {%crlf@oc$mid@cw$msg1%crlf}
  23. mbtmdisp
  24. } ($switch = "off") {
  25. configtab.moons = 0
  26. #T- mButton
  27. #T- moontrig1
  28. #T- moontrig2
  29. #T- MoonTriggers
  30. #CALL @commbt.setStatus(False)
  31. #WINDOW @hWind {%crlf@oc$mid@cw$msg2%crlf}
  32. mbtmdisp
  33. }
  34. ($switch = "") {#WINDOW @hWind {%crlf@oc$mid@cw$msg3@cy%item( $slist, @testconfig( moons) + 1)%crlf}}
  35. {#WINDOW @hWind {%crlf@oc$mid@cw$msg4%crlf}}</value>
  36. </alias>
  37. <alias name="resetmbt" id="364">
  38. <value>#IF (@testconfig( moons) = 1) {#CALL @commbt.setStatus(True)}</value>
  39. </alias>
  40. <alias name="moons" id="365">
  41. <value><![CDATA[$disp = ""
  42. ;;
  43. #IF (@testconfig( moons) = 1)
  44. {
  45. $data = %json( %comget( commbt, getMoons))
  46. $bd = %switch( $data.black > 0, (@cy + "|ON"), $data.black < 0, (@cr2 + "|OFF"), true, (@cd + "|Undefined"))
  47. $gd = %switch( $data.grey > 0, (@cy + "|ON"), $data.grey < 0, (@cr2 + "|OFF"), true, (@cd + "|Undefined"))
  48. $wd = %switch( $data.white > 0, (@cy + "|ON"), $data.white < 0, (@cr2 + "|OFF"), true, (@cd + "|Undefined"))
  49. $bt = %switch( %abs( $data.black) != 1, " ticks ", %abs( $data.black) = 1, " tick ", true, "")
  50. $gt = %switch( %abs( $data.grey) != 1, " ticks ", %abs( $data.grey) = 1, " tick ", true, "")
  51. $wt = %switch( %abs( $data.white) != 1, " ticks ", %abs( $data.white) = 1, " tick ", true, "")
  52. $disp = @oc"MoonBot: "@cm"White Moon -> "$wd.1$wd.2%if( $data.white != 0, @cw" for "@cy%abs( $data.white)@cw$wt, "")@cm" Grey Moon -> "$gd.1$gd.2%if( $data.grey != 0, @cw" for "@cy%abs( $data.grey)@cw$gt, "")@cm" Black Moon -> "$bd.1$bd.2%if( $data.black != 0, @cw" for "@cy%abs( $data.black)@cw$bt, "")@clw
  53. }
  54. {$disp = @oc"MoonBot: "@cw"Moon Tracker is "@cy"inactive"@clw}
  55. ;;
  56. #WINDOW @hWind {%crlf$disp%crlf}]]></value>
  57. </alias>
  58. <var name="mbstate" type="Integer" id="366">1</var>
  59. <alias name="setmoons" id="367">
  60. <value>#IF (@testconfig( moons) = 1)
  61. {
  62. BlackMoon = @commbt.BlackMoon
  63. GreyMoon = @commbt.GreyMoon
  64. WhiteMoon = @commbt.WhiteMoon
  65. #IF (%trigger( @gmcpwin) = 1) {mbtmdisp}
  66. }</value>
  67. </alias>
  68. <alias name="mbtclear" id="368">
  69. <value>#T- moontrig1
  70. ;;
  71. #T- moontrig2</value>
  72. </alias>
  73. <class name="MoonTriggers" id="369">
  74. <trigger name="moontrig3" priority="12540" enabled="false" id="370">
  75. <pattern>^You disappear into the void</pattern>
  76. <value>afk
  77. ;;
  78. afk
  79. ;;
  80. #CALL @commbt.MoonTick()</value>
  81. </trigger>
  82. <trigger name="moontrig1" priority="12550" regex="true" enabled="false" id="371">
  83. <pattern>^You notice the (\w+) moon falling to the (?:east|west)\.$</pattern>
  84. <value>#CALL @commbt.moonFalling(%1)
  85. ;;
  86. #IF (@commbt.moonsAreDefined()) {mbtclear}</value>
  87. </trigger>
  88. <trigger name="moontrig2" priority="12560" regex="true" enabled="false" id="372">
  89. <pattern>You see the (\w+) moon rising in the (?:east|west)\.$</pattern>
  90. <value>#CALL @commbt.moonRising(%1)
  91. ;;
  92. #IF (@commbt.moonsAreDefined()) {mbtclear}</value>
  93. </trigger>
  94. </class>
  95. <var name="BlackMoon" id="373">
  96. <value><![CDATA[<color red>OFF</color><color white> for </color><color yellow>22</color><color white> ticks</color>]]></value>
  97. <json>&lt;color gray&gt;Undefined&lt;/color&gt;</json>
  98. </var>
  99. <var name="GreyMoon" id="374">
  100. <value><![CDATA[<color red>OFF</color><color white> for </color><color yellow>22</color><color white> ticks</color>]]></value>
  101. <json>&lt;color gray&gt;Undefined&lt;/color&gt;</json>
  102. </var>
  103. <var name="WhiteMoon" id="375">
  104. <value><![CDATA[<color "0x00FF00">ON</color><color white> for </color><color yellow>4</color><color white> ticks</color>]]></value>
  105. <json>&lt;color gray&gt;Undefined&lt;/color&gt;</json>
  106. </var>
  107. <var name="mdata" type="Record" id="376">
  108. <value>grey=-22|black=-22|white=4</value>
  109. <json>{"white":4,"grey":-22,"black":-22}</json>
  110. </var>
  111. <var name="ldata" type="Record" id="377">
  112. <value>tickno=322|ticklen=7</value>
  113. <json>{"ticklen":7,"tickno":322}</json>
  114. </var>
  115. <var name="mbtcolors" type="Record" id="378">
  116. <value>white=yellow|grey=yellow|black=yellow</value>
  117. <json>{"white":"yellow","grey":"yellow","black":"yellow"}</json>
  118. </var>
  119. <alias name="mbtmdisp" id="379">
  120. <value><![CDATA[#LOCAL bd, gd, wd
  121. ;;
  122. #IF (%trigger( @gmcpwin) != 1) {#EXIT}
  123. ;;
  124. #IF (@mdata.black > 0) {$bd = @cg2} {$bd = @cr2}
  125. #IF (@mdata.grey > 0) {$gd = @cg2} {$gd = @cr2}
  126. #IF (@mdata.white > 0) {$wd = @cg2} {$wd = @cr2}
  127. ;;
  128. $bd = ($bd + %format( "&2d", %abs( @mdata.black)) + @rc)
  129. $gd = ($gd + %format( "&2d", %abs( @mdata.grey)) + @rc)
  130. $wd = ($wd + %format( "&2d", %abs( @mdata.white)) + @rc)
  131. ;;
  132. $x1 = 9
  133. $x2 = 19
  134. $x3 = 30
  135. $x4 = 18
  136. $x5 = 27
  137. $y1 = 36
  138. $y2 = 38
  139. ;;
  140. $disp = @rc@cup( $y1, $x1)$wd@cup( $y1, $x2)$gd@cup( $y1, $x3)$bd
  141. ;;
  142. #IF (@ldata.tickno != -1) {$disp = ($disp + @cup( $y2, $x4)@cw%format( "&3d", @ldata.tickno)@rc@cup( $y2, $x5)@cw%format( "&1d", @ldata.ticklen)@rc)} {$disp = ($disp + @cup( $y2, $x4)@cw%format( "&3d", 0)@rc@cup( $y2, $x5)@cw%format( "&1d", 0)@rc)}
  143. ;;
  144. ;;
  145. #WINDOW @gmcpwin {$disp}]]></value>
  146. </alias>
  147. <alias name="mbtdinit" id="380">
  148. <value>#WINDOW @gmcpwin {@cup( 36, 2)@eol@cw"WHITE:"@rc@cup( 36, 13)@cd"GREY:"@rc@cup( 36, 23)@cb"BLACK:"@rc}
  149. #WINDOW @gmcpwin {@cup( 38, 2)@eol@oc"CONJUNCTION IN:"@rc@cup( 38, 22)@oc"FOR:"@rc}
  150. ;;
  151. #CALL @commbt.setGMCP(True)</value>
  152. </alias>
  153. <alias name="mbtdreset" id="381">
  154. <value>#SECTION gmcpTimer {
  155. #ADDITEM gmcpupdt {mbtdinit}
  156. #ADDITEM gmcpupdt {mbtmdisp}
  157. }
  158. ;;
  159. #T+ gmcptimer</value>
  160. </alias>
  161. <alias name="lunes" id="382">
  162. <value>#LOCAL $disp
  163. ;;
  164. #IF (@testconfig( moons) = 1) {
  165. ldata = %json( %comget( commbt, Lunes))
  166. #IF (@ldata.tickno != -1 AND @ldata.ticklen != -1)
  167. {$disp = @oc"MoonBot: "@cw"The three-moon event will start in "@cy@ldata.tickno@cw" ticks and will last for "@cy@ldata.ticklen@cw" ticks."}
  168. {$disp = @oc"MoonBot: "@cr2"Moon tracking is not complete"}
  169. }
  170. ;;
  171. winwrite $disp</value>
  172. </alias>
  173. <var name="mbtacolors" type="Record" id="383">
  174. <value>white=&#27;[1;33m|grey=&#27;[1;33m|black=&#27;[1;33m</value>
  175. <json>{"white":"&#27;[1;33m","grey":"&#27;[1;33m","black":"&#27;[1;33m"}</json>
  176. </var>
  177. <alias name="mbtmdispn" enabled="false" id="384">
  178. <value><![CDATA[ldata = %json( %comget( commbt, Lunes))
  179. mdata = %json( %comget( commbt, getMoons))
  180. ;;
  181. #IF (%trigger( @gmcpwin) != 1) {#EXIT}
  182. ;;
  183. $bd = (%switch( (@mdata.black > 0), @cg2, true, @cr2) + %format( "&2d", %abs( @mdata.black)))
  184. $gd = (%switch( (@mdata.grey > 0), @cg2, true, @cr2) + %format( "&2d", %abs( @mdata.grey)))
  185. $wd = (%switch( (@mdata.white > 0), @cg2, true, @cr2) + %format( "&2d", %abs( @mdata.white)))
  186. #ECHO bd = $bd gd = $gd wd = $wd
  187. ;;
  188. $x1 = 9
  189. $x2 = 19
  190. $x3 = 30
  191. $x4 = 18
  192. $x5 = 27
  193. $y1 = 36
  194. $y2 = 38
  195. ;;
  196. #WINDOW @gmcpwin {@cup( $y1, $x1)$wd@cup( $y1, $x2)$gd@cup( $y1, $x3)$bd@clw}
  197. ;;
  198. #IF (@ldata.tickno != -1) {#WINDOW @gmcpwin {@cup( $y2, $x4)@cw%format( "&3d", @ldata.tickno)@clw@cup( $y2, $x5)@cw%format( "&1d", @ldata.ticklen)@rc}}
  199. {#WINDOW @gmcpwin {@cup( $y2, $x4)@cw%format( "&3d", 0)@cup( $y2, $x5)@cw%format( "&1d", 0)@clw}}]]></value>
  200. </alias>
  201. <alias name="moonsn" id="385">
  202. <value>$disp = ""
  203. ;;
  204. #IF (@testconfig( moons) = 1)
  205. {
  206. $data = %json( %comget( commbt, displayMoons))
  207. $disp = @oc + "MoonBot: " + @cm + "White Moon -&gt; " + $data.white + @cm + "Grey Moon -&gt; " + $data.grey + @cm + "Black Moon -&gt; " + $data.black +@rc
  208. }
  209. {$disp = @oc + "MoonBot: " + @cw + "Moon Tracker is " + @cy + "inactive" + @rc}
  210. ;;
  211. #IF (!%null( $disp)) {#WINDOW @hWind {%crlf$disp@rc%crlf}}</value>
  212. </alias>
  213. <alias name="mbtmreset" id="386">
  214. <value>mbtdinit
  215. ;;
  216. mbtmdisp</value>
  217. </alias>
  218. </module>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement