Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.68 KB | None | 0 0
  1. package com.p3achb0t.scripts_private.Zulrah
  2.  
  3. import com.p3achb0t.api.Context
  4. import com.p3achb0t.api.wrappers.Tile
  5. import com.p3achb0t.api.wrappers.utils.Utils
  6. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.aliveCheck
  7. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.haskilled
  8. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.killTime
  9. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.kills
  10. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.pass
  11. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.phase
  12. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.phaseTimer
  13. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.rotation
  14. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.safeTile
  15. import com.p3achb0t.scripts_private.Zulrah.Combat.Companion.startingTile
  16.  
  17. fun zulrahPaintDebug(ctx: Context) {
  18.  
  19. fun nextPhase() {
  20. phase++
  21. phaseTimer.reset()
  22. phaseTimer.start()
  23. }
  24.  
  25. fun nextPass() {
  26. phase = 1
  27. pass++
  28. rotation = 0
  29. phaseTimer.reset()
  30. phaseTimer.start()
  31. }
  32.  
  33. fun setTile(tile: Tile) {
  34. if (safeTile.x != tile.x || safeTile.y != tile.y) {
  35. safeTile = tile
  36. }
  37. }
  38. while (true) {
  39.  
  40. // rotation and phase logic
  41. try {
  42. val localNpcs = ctx.client.getNpcs()
  43. localNpcs.forEachIndexed { index, npci ->
  44. if (npci != null) {
  45. if (npci.getType().getName().equals("Zulrah")) {
  46. if (npci.getSequence() == 5804) {
  47. if (phaseTimer.time > 0) {
  48. kills++
  49. haskilled = true
  50. }
  51. phaseTimer.reset()
  52. killTime.reset()
  53. aliveCheck.reset()
  54. phase = 1
  55. pass = 1
  56. rotation = 0
  57. }
  58. if (npci.getSequence() == 5071) {
  59. if (phaseTimer.time <= 0) startingTile = ctx.players.getLocal().getGlobalLocation()
  60. if (phaseTimer.time <= 0) phaseTimer.start()
  61. if (killTime.time <= 0) killTime.start()
  62. if (aliveCheck.time <= 0) aliveCheck.start()
  63. }
  64. if (phase == 1) {
  65. setTile(Tile(startingTile.x + 6, startingTile.y + 9, ctx = ctx))
  66. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) {
  67. nextPhase()
  68. }
  69. }
  70.  
  71. if (phase == 2) {
  72. if (npci.getType().getId() == 2042) {
  73. if (npci.getSequence() == 5073) rotation = 3
  74. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  75. }
  76. if (npci.getType().getId() == 2044) {
  77. if (Utils.getElapsedSeconds(phaseTimer.time) > 15) setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  78. if (Utils.getElapsedSeconds(phaseTimer.time) <= 15) setTile(Tile(startingTile.x + 6, startingTile.y + 9, ctx = ctx).getGlobalLocation())
  79. if (npci.getSequence() == 5073) rotation = 4
  80. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  81. }
  82. if (npci.getType().getId() == 2043) {
  83. if (npci.getSequence() == 5806) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  84. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  85. }
  86. }
  87. if (rotation != 3 && rotation != 4) {
  88. if (phase == 3) {
  89. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  90. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  91. }
  92. if (phase == 4) {
  93. setTile(Tile(startingTile.x - 4, startingTile.y + 4, ctx = ctx).getGlobalLocation())
  94. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  95. }
  96. if (phase == 5) {
  97. if (npci.getType().getId() == 2042 && pass > 1) setTile(Tile(startingTile.x - 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  98. if (npci.getType().getId() == 2043) rotation = 1
  99. if (npci.getType().getId() == 2044) rotation = 2
  100. }
  101. }
  102.  
  103. // rotation 1
  104. if (rotation == 1) {
  105. if (phase == 5) {
  106. setTile(Tile(startingTile.x - 4, startingTile.y + 4, ctx = ctx).getGlobalLocation())
  107. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  108. }
  109. if (phase == 6) {
  110. if (npci.getType().getId() != 2042) setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  111. if (pass == 2 && npci.getType().getId() == 2042) setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  112. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5 && npci.getType().getId() != 2042) nextPhase()
  113. }
  114. if (phase == 7) {
  115. setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  116. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  117. }
  118. if (phase == 8) {
  119. if (Utils.getElapsedSeconds(phaseTimer.time) < 11) setTile(Tile(startingTile.x + 4, startingTile.y + 5, ctx = ctx).getGlobalLocation())
  120. if (Utils.getElapsedSeconds(phaseTimer.time) > 10) setTile(Tile(startingTile.x - 4, startingTile.y + 5, ctx = ctx).getGlobalLocation())
  121. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  122. }
  123. if (phase == 9) {
  124. if (Utils.getElapsedSeconds(phaseTimer.time) > 19) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  125. if (Utils.getElapsedSeconds(phaseTimer.time) <= 19) setTile(Tile(startingTile.x - 4, startingTile.y + 5, ctx = ctx).getGlobalLocation())
  126. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  127. }
  128. if (phase == 10) {
  129. if (npci.getOrientation() != 1281) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  130. if (npci.getOrientation() == 1281) setTile(Tile(startingTile.x + 6, startingTile.y + 9, ctx = ctx).getGlobalLocation())
  131. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPass()
  132. }
  133. }
  134.  
  135. // rotation 2
  136. if (rotation == 2) {
  137. if (phase == 5) {
  138. if (Utils.getElapsedSeconds(phaseTimer.time) <= 8) setTile(Tile(startingTile.x - 4, startingTile.y + 6, ctx = ctx).getGlobalLocation())
  139. if (Utils.getElapsedSeconds(phaseTimer.time) > 8) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  140. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  141. }
  142. if (phase == 6) {
  143. if (npci.getOrientation() != 1281) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  144. if (npci.getOrientation() == 1281) setTile(Tile(startingTile.x + 6, startingTile.y + 9, ctx = ctx).getGlobalLocation())
  145. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  146. }
  147. if (phase == 7) {
  148. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  149. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  150. }
  151. if (phase == 8) {
  152. setTile(Tile(startingTile.x - 4, startingTile.y + 5, ctx = ctx).getGlobalLocation())
  153. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  154. }
  155. if (phase == 9) {
  156. if (Utils.getElapsedSeconds(phaseTimer.time) > 19) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  157. if (Utils.getElapsedSeconds(phaseTimer.time) <= 19) setTile(Tile(startingTile.x - 4, startingTile.y + 5, ctx = ctx).getGlobalLocation())
  158. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  159. }
  160. if (phase == 10) {
  161. if (npci.getOrientation() != 1281) setTile(Tile(startingTile.x + 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  162. if (npci.getOrientation() == 1281) setTile(Tile(startingTile.x + 6, startingTile.y + 9, ctx = ctx).getGlobalLocation())
  163. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPass()
  164. }
  165. }
  166.  
  167.  
  168. // rotation 3
  169. if (rotation == 3) {
  170. if (phase == 3) {
  171. if (npci.getOrientation() != 804) setTile(Tile(startingTile.x - 4, startingTile.y + 10, ctx = ctx).getGlobalLocation())
  172. if (npci.getOrientation() == 804) setTile(Tile(startingTile.x - 6, startingTile.y + 7, ctx = ctx).getGlobalLocation())
  173. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  174. }
  175. if (phase == 4) {
  176. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  177. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  178. }
  179. if (phase == 5) {
  180. setTile(Tile(startingTile.x, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  181. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  182. }
  183. if (phase == 6) {
  184. if (pass == 1) {
  185. setTile(Tile(startingTile.x - 5, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  186. }
  187. if (pass > 1) {
  188. if (npci.getX() < ctx.players.getLocal().x) setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  189. if (npci.getX() > ctx.players.getLocal().x) setTile(Tile(startingTile.x - 5, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  190. }
  191. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5 && pass == 1) nextPhase()
  192. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5 && pass > 1 && npci.getX() > ctx.players.getLocal().x) nextPhase()
  193. }
  194. if (phase == 7) {
  195. setTile(Tile(startingTile.x - 5, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  196. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  197. }
  198. if (phase == 8) {
  199. setTile(Tile(startingTile.x - 4, startingTile.y + 4, ctx = ctx).getGlobalLocation())
  200. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  201. }
  202. if (phase == 9) {
  203. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  204. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  205. }
  206. if (phase == 10) {
  207. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  208. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  209. }
  210. if (phase == 11) {
  211. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  212. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPass()
  213. }
  214. }
  215.  
  216. // rotation 4
  217. if (rotation == 4) {
  218. if (phase == 3) {
  219. setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  220. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  221. }
  222. if (phase == 4) {
  223. setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  224. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  225. }
  226. if (phase == 5) {
  227. if (npci.getType().getId() == 2044 && pass > 1 && Utils.getElapsedSeconds(phaseTimer.time) > 7) setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  228. if (npci.getType().getId() == 2043 && pass > 1 && Utils.getElapsedSeconds(phaseTimer.time) > 7) setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  229. if (pass == 1) setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  230. if (npci.getSequence() == 5072 && npci.getType().getId() != 2044 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  231. }
  232. if (phase == 6) {
  233. setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  234. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  235. }
  236. if (phase == 7) {
  237. setTile(Tile(startingTile.x - 4, startingTile.y + 4, ctx = ctx).getGlobalLocation())
  238. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  239. }
  240. if (phase == 8) {
  241. setTile(Tile(startingTile.x - 4, startingTile.y + 4, ctx = ctx).getGlobalLocation())
  242. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  243. }
  244. if (phase == 9) {
  245. setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  246. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  247. }
  248. if (phase == 10) {
  249. setTile(Tile(startingTile.x + 4, startingTile.y + 2, ctx = ctx).getGlobalLocation())
  250. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  251. }
  252. if (phase == 11) {
  253. setTile(Tile(startingTile.x + 4, startingTile.y + 3, ctx = ctx).getGlobalLocation())
  254. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPhase()
  255. }
  256. if (phase == 12) {
  257. setTile(Tile(startingTile.x + 6, startingTile.y + 9, ctx = ctx))
  258. if (npci.getSequence() == 5072 && Utils.getElapsedSeconds(phaseTimer.time) > 5) nextPass()
  259. }
  260. }
  261.  
  262. }
  263. }
  264. }
  265. Thread.sleep(200)
  266. } catch (e: Exception) {
  267. println("Error: NPC Paint " + e.message)
  268. e.stackTrace.iterator().forEach {
  269. println(it)
  270. }
  271. }
  272. }
  273.  
  274. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement