Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //OnUpdate
- //Rupee GUI
- h = ui.getHeight()
- pinv = player.getInventory()
- try
- {
- if (ui.getHeight() != scree)
- {var ne = ui.getHeight()
- screen.clear()
- ne = scree
- }
- if (pinv.getSlotContainingItem(353) == -1)
- {
- var rup = 0
- screen.clear()
- UISprite("gui/items.png",5,h-20,15,15,208,0)
- UILabel(rup,23,h-15)
- }
- else
- {
- try
- {
- rup = pinv.getItemInSlot(35).getQuantity()
- }
- catch(e)
- {
- }
- screen.clear()
- UISprite("gui/items.png",5,h-20,15,15,208,0)
- UILabel(rup,23,h-15)
- }
- }
- catch(e)
- {
- }
- //Crumbling Blocks
- var posX = Math.floor(player.getPosition().x)//.toFixed(2);
- var posY = Math.floor(player.getPosition().y)//.toFixed(2);
- var posZ = Math.floor(player.getPosition().z)//.toFixed(2);
- var d = new Date();
- function getCurTime() {
- return d.getMinutes()*60*1000+d.getSeconds()*1000+d.getMilliseconds();
- }
- //Adding Block to crumbleArr if it matches crumbleFrom ID
- if (world.getBlockID(posX,posY-2,posZ) == crumbleFrom) {
- if (hasCrumble(posX,posY-2,posZ) == 0) {
- chat.print("Adding:" +posX + " " + posY + " " + posZ);
- crumbleArrX.push(posX);
- crumbleArrY.push(posY-2);
- crumbleArrZ.push(posZ);
- if (pinv.getSlotContainingItem(crumbleProtect) != -1) {
- crumbleArrT.push(getCurTime()+crumbleTimeP);
- }else{
- crumbleArrT.push(getCurTime()+crumbleTime);
- }
- crumbleArrD.push(1);
- }
- }
- //Check entries in crumbleArr and perform actions based on values.
- var crumbleCount = 0;
- for (var i = 0; i < crumbleArrT.length; i++) {
- if (crumbleArrT[i]!=0) {
- if (crumbleArrT[i] < getCurTime() && crumbleArrD[i]==1) {
- //chat.print("[DEBUG] Crumbling:"+crumbleArrX[i]+" "+crumbleArrY[i]+" "+crumbleArrZ[i]);
- sound.playSound3D("sound.crumble", crumbleArrX[i],crumbleArrY[i],crumbleArrZ[i],0.1,1);
- world.setBlockID(crumbleArrX[i],crumbleArrY[i],crumbleArrZ[i],crumbleTo);
- crumbleArrD[i] = 0;
- crumbleArrT[i] = getCurTime()+crumbleTimeR
- }
- if (resetCrumble && crumbleArrT[i] < getCurTime() && crumbleArrD[i]==0) {
- //chat.print("[DEBUG] Reseting:"+crumbleArrX[i]+" "+crumbleArrY[i]+" "+crumbleArrZ[i]);
- world.setBlockID(crumbleArrX[i],crumbleArrY[i],crumbleArrZ[i],crumbleFrom);
- crumbleArrX[i] = null;
- crumbleArrY[i] = null;
- crumbleArrZ[i] = null;
- crumbleArrT[i] = 0;
- }
- crumbleCount = crumbleCount+1;
- }
- }
- //Recycle crumbleArr if crumbleCount is 0.
- if (crumbleCount == 0 && crumbleArrT.length>0) {
- //chat.print("[DEBUG] Array Recycled")
- crumbleArrX = [];
- crumbleArrY = [];
- crumbleArrZ = [];
- crumbleArrT = [];
- crumbleArrD = [];
- }
- //Rupee Forced Slot
- while (pinv.getSlotContainingItem(353) !=-1 && pinv.getSlotContainingItem(353) != 35)
- {
- pinv.consumeItem(353)
- if (pinv.getItemInSlot(35) != null)
- {
- if (pinv.getItemInSlot(35).getItemID() != 353)
- {
- var nosug = pinv.getItemInSlot(35).getItemID()
- var nosugqu = pinv.getItemInSlot(35).getQuantity()
- var nosugdm = pinv.getItemInSlot(35).getDamage()
- pinv.consumeItemAmount(nosug,nosugdm,nosugqu)
- pinv.addItem(Item(nosug,nosugqu,nosugdm))
- pinv.setSlot(35,Item(353,1,0))
- }
- else
- {
- var sugqu = pinv.getItemInSlot(35).getQuantity()
- if (sugqu == 100)
- {
- }
- else
- {
- pinv.setSlot(35,Item(353,sugqu +1,0))
- }
- }
- }
- else
- {
- pinv.setSlot(35,Item(353,1,0))
- }
- }
- //Tunic Character Skin Changes
- pinv = player.getInventory()
- if (pinv.getItemInSlot(38) == null)
- {
- effect.replaceTexture("/mob/char.png","/mob/char.png")
- }
- if (pinv.getSlotContainingItem(299) == 38)
- {
- effect.replaceTexture("/mob/char.png","/mob/goron.png")
- }
- if (pinv.getSlotContainingItem(303) == 38)
- {
- effect.replaceTexture("/mob/char.png","mob/zora.png")
- }
- if (pinv.getSlotContainingItem(315) == 38)
- {
- effect.replaceTexture("/mob/char.png","mob/shadow.png")
- }
- if (pinv.getSlotContainingItem(307) == 38)
- {
- effect.replaceTexture("/mob/char.png","mob/magic.png")
- }
- //Bow GUI
- var arrowAmount = 0;
- for(i=0;i<=35;i++)
- {
- if(pinv.getItemInSlot(i) != null)
- {
- var thisItem = pinv.getItemInSlot(i);
- if(thisItem.getItemID() == 262)
- {
- if(thisItem.getQuantity() > 0)
- {
- arrowAmount += thisItem.getQuantity();
- }
- }
- }
- }
- if(arrowAmount <= 0)
- {
- arrowAmount = 1;
- }
- if(pinv.getSlotContainingItem(261) != -1)
- {
- var bowSlotId = pinv.getSlotContainingItem(261);
- for(i=0;i<=35;i++)
- {
- if(pinv.getItemInSlot(i) != null)
- {
- if(pinv.getItemInSlot(i).getItemID() == 261)
- {
- pinv.emptySlot(i);
- }
- }
- }
- pinv.setSlot(bowSlotId, Item(261, arrowAmount));
- }
- //Goron Tunic
- var tunic = pinv.getItemInSlot(38);
- if (tunic == null || tunic.getItemID() != GORON_TUNIC)
- {
- var ppos = player.getPosition();
- var px = Math.round(ppos.x);
- var py = Math.round(ppos.y);
- var pz = Math.round(ppos.z);
- var heat = false;
- for (var i = px - HEAT_RANGE; i < px + HEAT_RANGE; i++)
- {
- for (var j = py - HEAT_RANGE; j < py + HEAT_RANGE; j++)
- {
- for (var k = pz - HEAT_RANGE; k < pz + HEAT_RANGE; k++)
- {
- if (world.getBlockID(i,j,k) == 11 || world.getBlockID(i,j,k) == 10) // 11 = Still Lava, 10 = Flowing Lava
- {
- heat = true;
- }
- }
- }
- }
- if (heat)
- {
- heatTime -= 1;
- if (heatTime <= 0)
- {
- var pv = player.getVelocity();
- player.attackEntityFrom(player, HEAT_DAMAGE);
- player.setVelocity(pv.x, pv.y, pv.z); // Prevents knockback - Remove this line if you want heat damage to have knockback
- heatTime = HEAT_DELAY;
- }
- }
- }
- else
- {
- heatTime = HEAT_DELAY;
- }
- //Zora Tunic
- if (player.isInsideOfWater() && pinv.getItemInSlot(38) != null && pinv.getItemInSlot(38).getItemID() == 303)
- {
- player.setAir(280);
- }
- // Pickup Item, Rupee, and Sound UI \\
- //Green Rupee Pickup
- while (pinv.getSlotContainingItem(344) != -1)
- {
- pinv.consumeItem(344)
- pinv.addItem(Item(353))
- sound.playSoundUI("sound.tp_get_rupee");
- }
- //Blue Rupee Pickup and Conversion
- while (pinv.getSlotContainingItem(471) != -1)
- {
- pinv.consumeItem(471)
- pinv.addItem(Item(353,5))
- sound.playSoundUI("sound.tp_get_rupee_blue");
- }
- //Yellow Rupee Pickup and Conversion
- while (pinv.getSlotContainingItem(472) != -1)
- {
- pinv.consumeItem(472)
- pinv.addItem(Item(353,10))
- sound.playSoundUI("sound.tp_get_rupee_yellow");
- }
- //Red Rupee Pickup and Conversion
- while (pinv.getSlotContainingItem(486) != -1)
- {
- pinv.consumeItem(486)
- pinv.addItem(Item(353,20))
- sound.playSoundUI("sound.tp_get_rupee_yellow");
- }
- //Purple Rupee Pickup and Conversion
- while (pinv.getSlotContainingItem(487) != -1)
- {
- pinv.consumeItem(487)
- pinv.addItem(Item(353,50))
- sound.playSoundUI("sound.tp_get_rupee_first");
- }
- //Arrow Pickup Sound and Item Conversion
- while (pinv.getSlotContainingItem(352) != -1)
- {
- pinv.consumeItem(352)
- pinv.getInventory().addItem(Item(262))
- sound.playSoundUI("sound.getitem");
- }
- // Fire and Ice Bows \\
- UpdateFireProjectiles();
- UpdateIceProjectiles();
- UpdateFrozenMobs();
Add Comment
Please, Sign In to add comment