dUpdateUI(); //Update Dialogue UISprite
//FakeHDR(); //Update Fake HDR

//Bow Puzzles

pinv = player.getInventory()
redck = 4
var ppos = player.getPosition();
var px = Math.round(ppos.x);
var py = Math.round(ppos.y);
var pz = Math.round(ppos.z);

for each (var entity in player.getEntitiesWithinRange(50))
{
	if(entity.classType == "Arrow")
	{
		if(entity.isPlayersArrow && entity.inBlockID == 57)
		{
			blockCoord = entity.inBlockCoords
			world.setBlockID(blockCoord.x, blockCoord.y, blockCoord.z,89)
			entity.isPlayersArrow = false
				for (var i = blockCoord.x - redck; i < blockCoord.x + redck; i++)
						{
							for (var j = blockCoord.y - redck; j < blockCoord.y + redck; j++)
								{
									for (var k = blockCoord.z - redck; k < blockCoord.z + redck; k++)
										{
										var id = world.getBlockID(i,j,k);
										if (id == 167)	
										{
										world.triggerBlock(i,j,k);
										}
										}
								}
						}
			sound.playSound3D("sound.secret",ppos.x,ppos.y,ppos.z);
	}
}

}

//Money 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) {}

//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))
		}
	}
	
// Pickup Item, Rupee, and Sound UI \\

while (pinv.getSlotContainingItem(289) != -1) //Blue
	{
		pinv.consumeItem(289)
		pinv.addItem(Item(353,5))
		sound.playSoundUI("sound.tp_get_rupee_blue");
	}

while (pinv.getSlotContainingItem(348) != -1) //Yellow
	{
		pinv.consumeItem(348)
		pinv.addItem(Item(353,10))
		sound.playSoundUI("sound.tp_get_rupee_yellow");
	}
while (pinv.getSlotContainingItem(331) != -1)//Red
	{
		pinv.consumeItem(331)
		pinv.addItem(Item(353,20))
		sound.playSoundUI("sound.tp_get_rupee_yellow");
	}

while (pinv.getSlotContainingItem(341) != -1)//Purple
	{
		pinv.consumeItem(341)
		pinv.addItem(Item(353,50))
		sound.playSoundUI("sound.tp_get_rupee_first");
	}

	// 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");
}

