Skip to content

Instantly share code, notes, and snippets.

@Pwootage
Created July 10, 2011 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pwootage/1075053 to your computer and use it in GitHub Desktop.
Save Pwootage/1075053 to your computer and use it in GitHub Desktop.
//moneyLimit = 500
//Set that in the onload script!
if(pinv.getItemInSlot(35) != null)
{
if(pinv.getItemInSlot(35).getItemID() != 353)
{
for(i=0;i<35;i++)
{
if(pinv.getItemInSlot(i) == null)
{
var pitem = pinv.getItemInSlot(35).copy();
pinv.emptySlot(35);
pinv.setSlot(i, item);
}
}
}
}
if (pinv.getSlotContainingItem(353) != -1)
{
if (pinv.getSlotContainingItem(353) != 35)
{
try
{
var count = pinv.getItemInSlot(35).getQuantity();
}
catch(e) { var count = 0; }
var item = pinv.getItemInSlot(pinv.getSlotContainingItem(353)).copy();
pinv.emptySlot(pinv.getSlotContainingItem(353));
if (count < limit)
{
if (item.getQuantity() + count <= moneyLimit)
{
item.setQuantity(item.getQuantity() + count);
}
else
{
item.setQuantity(moneyLimit);
}
}
else
{
item.setQuantity(moneyLimit);
}
pinv.setSlot(35, item);
}
pinv.getItemInSlot(35).setDamage(pinv.getItemInSlot(35).getQuantity());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment