Guest User

Untitled

a guest
Feb 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.55 KB | None | 0 0
  1. //OnUpdate
  2.  
  3. //Rupee GUI
  4.  
  5. h = ui.getHeight()
  6. pinv = player.getInventory()
  7. try
  8. {
  9. if (ui.getHeight() != scree)
  10. {var ne = ui.getHeight()
  11. screen.clear()
  12. ne = scree
  13. }
  14. if (pinv.getSlotContainingItem(353) == -1)
  15. {
  16. var rup = 0
  17. screen.clear()
  18. UISprite("gui/items.png",5,h-20,15,15,208,0)
  19. UILabel(rup,23,h-15)
  20. }
  21. else
  22. {
  23. try
  24. {
  25. rup = pinv.getItemInSlot(35).getQuantity()
  26. }
  27. catch(e)
  28. {
  29. }
  30. screen.clear()
  31. UISprite("gui/items.png",5,h-20,15,15,208,0)
  32. UILabel(rup,23,h-15)
  33. }
  34. }
  35. catch(e)
  36. {
  37. }
  38.  
  39. //Crumbling Blocks
  40.  
  41. var posX = Math.floor(player.getPosition().x)//.toFixed(2);
  42. var posY = Math.floor(player.getPosition().y)//.toFixed(2);
  43. var posZ = Math.floor(player.getPosition().z)//.toFixed(2);
  44. var d = new Date();
  45.  
  46. function getCurTime() {
  47. return d.getMinutes()*60*1000+d.getSeconds()*1000+d.getMilliseconds();
  48. }
  49.  
  50. //Adding Block to crumbleArr if it matches crumbleFrom ID
  51.  
  52. if (world.getBlockID(posX,posY-2,posZ) == crumbleFrom) {
  53. if (hasCrumble(posX,posY-2,posZ) == 0) {
  54. chat.print("Adding:" +posX + " " + posY + " " + posZ);
  55. crumbleArrX.push(posX);
  56. crumbleArrY.push(posY-2);
  57. crumbleArrZ.push(posZ);
  58. if (pinv.getSlotContainingItem(crumbleProtect) != -1) {
  59. crumbleArrT.push(getCurTime()+crumbleTimeP);
  60. }else{
  61. crumbleArrT.push(getCurTime()+crumbleTime);
  62. }
  63. crumbleArrD.push(1);
  64. }
  65. }
  66.  
  67. //Check entries in crumbleArr and perform actions based on values.
  68.  
  69. var crumbleCount = 0;
  70. for (var i = 0; i < crumbleArrT.length; i++) {
  71. if (crumbleArrT[i]!=0) {
  72. if (crumbleArrT[i] < getCurTime() && crumbleArrD[i]==1) {
  73. //chat.print("[DEBUG] Crumbling:"+crumbleArrX[i]+" "+crumbleArrY[i]+" "+crumbleArrZ[i]);
  74. sound.playSound3D("sound.crumble", crumbleArrX[i],crumbleArrY[i],crumbleArrZ[i],0.1,1);
  75. world.setBlockID(crumbleArrX[i],crumbleArrY[i],crumbleArrZ[i],crumbleTo);
  76. crumbleArrD[i] = 0;
  77. crumbleArrT[i] = getCurTime()+crumbleTimeR
  78. }
  79. if (resetCrumble && crumbleArrT[i] < getCurTime() && crumbleArrD[i]==0) {
  80. //chat.print("[DEBUG] Reseting:"+crumbleArrX[i]+" "+crumbleArrY[i]+" "+crumbleArrZ[i]);
  81. world.setBlockID(crumbleArrX[i],crumbleArrY[i],crumbleArrZ[i],crumbleFrom);
  82. crumbleArrX[i] = null;
  83. crumbleArrY[i] = null;
  84. crumbleArrZ[i] = null;
  85. crumbleArrT[i] = 0;
  86. }
  87. crumbleCount = crumbleCount+1;
  88. }
  89. }
  90.  
  91. //Recycle crumbleArr if crumbleCount is 0.
  92.  
  93. if (crumbleCount == 0 && crumbleArrT.length>0) {
  94. //chat.print("[DEBUG] Array Recycled")
  95. crumbleArrX = [];
  96. crumbleArrY = [];
  97. crumbleArrZ = [];
  98. crumbleArrT = [];
  99. crumbleArrD = [];
  100. }
  101.  
  102. //Rupee Forced Slot
  103.  
  104. while (pinv.getSlotContainingItem(353) !=-1 && pinv.getSlotContainingItem(353) != 35)
  105. {
  106. pinv.consumeItem(353)
  107. if (pinv.getItemInSlot(35) != null)
  108. {
  109. if (pinv.getItemInSlot(35).getItemID() != 353)
  110. {
  111. var nosug = pinv.getItemInSlot(35).getItemID()
  112. var nosugqu = pinv.getItemInSlot(35).getQuantity()
  113. var nosugdm = pinv.getItemInSlot(35).getDamage()
  114. pinv.consumeItemAmount(nosug,nosugdm,nosugqu)
  115. pinv.addItem(Item(nosug,nosugqu,nosugdm))
  116. pinv.setSlot(35,Item(353,1,0))
  117. }
  118. else
  119. {
  120. var sugqu = pinv.getItemInSlot(35).getQuantity()
  121. if (sugqu == 100)
  122. {
  123.  
  124. }
  125. else
  126. {
  127. pinv.setSlot(35,Item(353,sugqu +1,0))
  128. }
  129. }
  130. }
  131. else
  132. {
  133. pinv.setSlot(35,Item(353,1,0))
  134. }
  135. }
  136.  
  137. //Tunic Character Skin Changes
  138.  
  139. pinv = player.getInventory()
  140. if (pinv.getItemInSlot(38) == null)
  141. {
  142. effect.replaceTexture("/mob/char.png","/mob/char.png")
  143. }
  144. if (pinv.getSlotContainingItem(299) == 38)
  145. {
  146. effect.replaceTexture("/mob/char.png","/mob/goron.png")
  147. }
  148. if (pinv.getSlotContainingItem(303) == 38)
  149. {
  150. effect.replaceTexture("/mob/char.png","mob/zora.png")
  151. }
  152. if (pinv.getSlotContainingItem(315) == 38)
  153. {
  154. effect.replaceTexture("/mob/char.png","mob/shadow.png")
  155. }
  156. if (pinv.getSlotContainingItem(307) == 38)
  157. {
  158. effect.replaceTexture("/mob/char.png","mob/magic.png")
  159. }
  160.  
  161. //Bow GUI
  162.  
  163. var arrowAmount = 0;
  164.  
  165. for(i=0;i<=35;i++)
  166. {
  167. if(pinv.getItemInSlot(i) != null)
  168. {
  169. var thisItem = pinv.getItemInSlot(i);
  170. if(thisItem.getItemID() == 262)
  171. {
  172. if(thisItem.getQuantity() > 0)
  173. {
  174. arrowAmount += thisItem.getQuantity();
  175. }
  176. }
  177. }
  178. }
  179.  
  180. if(arrowAmount <= 0)
  181. {
  182. arrowAmount = 1;
  183. }
  184.  
  185. if(pinv.getSlotContainingItem(261) != -1)
  186. {
  187. var bowSlotId = pinv.getSlotContainingItem(261);
  188. for(i=0;i<=35;i++)
  189. {
  190. if(pinv.getItemInSlot(i) != null)
  191. {
  192. if(pinv.getItemInSlot(i).getItemID() == 261)
  193. {
  194. pinv.emptySlot(i);
  195. }
  196. }
  197. }
  198. pinv.setSlot(bowSlotId, Item(261, arrowAmount));
  199. }
  200.  
  201. //Goron Tunic
  202.  
  203. var tunic = pinv.getItemInSlot(38);
  204.  
  205. if (tunic == null || tunic.getItemID() != GORON_TUNIC)
  206. {
  207. var ppos = player.getPosition();
  208. var px = Math.round(ppos.x);
  209. var py = Math.round(ppos.y);
  210. var pz = Math.round(ppos.z);
  211. var heat = false;
  212.  
  213. for (var i = px - HEAT_RANGE; i < px + HEAT_RANGE; i++)
  214. {
  215. for (var j = py - HEAT_RANGE; j < py + HEAT_RANGE; j++)
  216. {
  217. for (var k = pz - HEAT_RANGE; k < pz + HEAT_RANGE; k++)
  218. {
  219. if (world.getBlockID(i,j,k) == 11 || world.getBlockID(i,j,k) == 10) // 11 = Still Lava, 10 = Flowing Lava
  220. {
  221. heat = true;
  222. }
  223. }
  224. }
  225. }
  226.  
  227. if (heat)
  228. {
  229. heatTime -= 1;
  230. if (heatTime <= 0)
  231. {
  232. var pv = player.getVelocity();
  233. player.attackEntityFrom(player, HEAT_DAMAGE);
  234. player.setVelocity(pv.x, pv.y, pv.z); // Prevents knockback - Remove this line if you want heat damage to have knockback
  235. heatTime = HEAT_DELAY;
  236. }
  237. }
  238. }
  239. else
  240. {
  241. heatTime = HEAT_DELAY;
  242. }
  243.  
  244. //Zora Tunic
  245.  
  246. if (player.isInsideOfWater() && pinv.getItemInSlot(38) != null && pinv.getItemInSlot(38).getItemID() == 303)
  247. {
  248. player.setAir(280);
  249. }
  250.  
  251. // Pickup Item, Rupee, and Sound UI \\
  252.  
  253. //Green Rupee Pickup
  254.  
  255. while (pinv.getSlotContainingItem(344) != -1)
  256. {
  257. pinv.consumeItem(344)
  258. pinv.addItem(Item(353))
  259. sound.playSoundUI("sound.tp_get_rupee");
  260. }
  261.  
  262. //Blue Rupee Pickup and Conversion
  263.  
  264. while (pinv.getSlotContainingItem(471) != -1)
  265. {
  266. pinv.consumeItem(471)
  267. pinv.addItem(Item(353,5))
  268. sound.playSoundUI("sound.tp_get_rupee_blue");
  269. }
  270.  
  271. //Yellow Rupee Pickup and Conversion
  272.  
  273. while (pinv.getSlotContainingItem(472) != -1)
  274. {
  275. pinv.consumeItem(472)
  276. pinv.addItem(Item(353,10))
  277. sound.playSoundUI("sound.tp_get_rupee_yellow");
  278. }
  279.  
  280. //Red Rupee Pickup and Conversion
  281.  
  282. while (pinv.getSlotContainingItem(486) != -1)
  283. {
  284. pinv.consumeItem(486)
  285. pinv.addItem(Item(353,20))
  286. sound.playSoundUI("sound.tp_get_rupee_yellow");
  287. }
  288.  
  289. //Purple Rupee Pickup and Conversion
  290.  
  291. while (pinv.getSlotContainingItem(487) != -1)
  292. {
  293. pinv.consumeItem(487)
  294. pinv.addItem(Item(353,50))
  295. sound.playSoundUI("sound.tp_get_rupee_first");
  296. }
  297.  
  298. //Arrow Pickup Sound and Item Conversion
  299.  
  300. while (pinv.getSlotContainingItem(352) != -1)
  301. {
  302. pinv.consumeItem(352)
  303. pinv.getInventory().addItem(Item(262))
  304. sound.playSoundUI("sound.getitem");
  305.  
  306. }
  307.  
  308. // Fire and Ice Bows \\
  309.  
  310. UpdateFireProjectiles();
  311. UpdateIceProjectiles();
  312. UpdateFrozenMobs();
Add Comment
Please, Sign In to add comment