Arguments:
* Integer - Inventory index of the item [0 to 41]
* Integer - Inventory index of the scroll [0 to 41]
* Integer - (Optional) Inventory index of the offering [0 to 41]
Returns:
* Promise
Example usages:
upgrade(0,1); // Item is in the first slot[0], scroll is in the second[1]
upgrade(0,1,2); // A primordial essence in the 3rd slot[2]
if(character.q.upgrade) log("Already upgrading something!");
upgrade(locate_item("coat"),locate_item("scroll0")).then(function(data){
if(data.success) game_log("I have a +"+data.level+" coat now!");
else game_log("Rip coat, you'll be missed.");
});
upgrade(locate_item("shoes"),locate_item("scroll0")).then(
function(data){
game_log("Upgrade call completed");
},
function(data){
game_log("Upgrade call failed with reason: "+data.reason);
},
);
Promise Reference:
"resolve"
{
success: true,
level: 7,
num: 37,
}
{
success: false, // Upgrade failed
level: 7,
num: 37,
}
{
success: true,
stat: true,
stat_type: "str",
num: 41,
}
"reject"
{
reason: "max_level", // Item reached it's max level
}
{
reason: "scroll", // Incompatible scroll
}
{
reason: "scroll_quantity", // Not enough scrolls
need: 100,
have: 24,
}
{
reason: "locked", // Item locked
}
{
reason: "no_item", // There's no item on that inventory index
}
{
reason: "no_scroll", // There's no scroll on that inventory index
}
{
reason: "not_upgradeable", // Item not upgradeable
}
{
// If you send 2+ upgrade calls simultaneously
// The consecutive ones will likely fail with this rejection
reason: "mismatch", // Item details don't match the upgrade call
}
{
reason: "offering", // Invalid offering
}
{
reason: "bank", // If operation isn't allowed inside
}
{
reason: "exception", // Possible server exception
}
"source"