mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 18:39:27 -05:00
Create simple_upgrade.js
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// A Simple Script to Upgrade Basic Items In Your Inventory
|
||||
var loops=0;
|
||||
|
||||
function locate_item(name)
|
||||
{
|
||||
for(var i=0;i<42;i++)
|
||||
{
|
||||
if(character.items[i] && character.items[i].name==name) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
setInterval(function(){
|
||||
loops+=1;
|
||||
if(!(loops%50)) // Every 50 loops, stock scrolls
|
||||
{
|
||||
if(locate_item("scroll0")==-1 || locate_item("scroll0").q<200) buy("scroll0",200);
|
||||
if(locate_item("scroll1")==-1 || locate_item("scroll1").q<100) buy("scroll1",100);
|
||||
}
|
||||
for(var i=0;i<42;i++)
|
||||
{
|
||||
if(!character.items[i]) continue;
|
||||
var item=character.items[i];
|
||||
var def=G.items[item.name];
|
||||
if(!def.upgrade) continue; // check whether the item is upgradeable
|
||||
if(item_grade(item)==2) continue; // rare item
|
||||
if(item_grade(item)==0) upgrade(i,locate_item("scroll0"));
|
||||
if(item_grade(item)==1) upgrade(i,locate_item("scroll1"));
|
||||
break;
|
||||
}
|
||||
},200);
|
||||
Reference in New Issue
Block a user