mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-23 05:11:26 -05:00
Open source
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<p>
|
||||
Arguments:
|
||||
<div> <b>*</b> Object - Character or Monster</div>
|
||||
</p>
|
||||
<p>
|
||||
Returns:
|
||||
<div> <b>*</b> Promise</div>
|
||||
</p>
|
||||
|
||||
<p>Example usages:</p>
|
||||
|
||||
<div class='code'>
|
||||
attack(target);
|
||||
attack(target).then(function(data){
|
||||
reduce_cooldown("attack",character.ping); // Try to increase your dps with ping correction
|
||||
});
|
||||
attack(target).then(
|
||||
function(data){
|
||||
game_log("yes!");
|
||||
},
|
||||
function(data){
|
||||
game_log("oh no, attack failed: "+data.reason);
|
||||
},
|
||||
);
|
||||
</div>
|
||||
|
||||
<p>Promise Reference:</p>
|
||||
|
||||
<span class='dlabel'>"resolve"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
source: "attack",
|
||||
actor: "CharacterName",
|
||||
target: "42", // Monster ID or Character ID
|
||||
damage: 1390,
|
||||
projectile: "momentum",
|
||||
eta: 50, // Arrival in milliseconds
|
||||
pid: "abcd1234", // Projectile ID
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 10px'></div>
|
||||
|
||||
<span class='dlabel'>"reject"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "not_found", // Target not found
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "too_far", // Target too far
|
||||
distance: 120,
|
||||
origin: "server", // or "client"
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "cooldown", // Target too far
|
||||
remaining: 20, // 20 milliseconds remaining
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "no_mp", // No MP
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "disabled", // Character disabled
|
||||
// If you are stunned, you can't attack
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "friendly", // PVP attacks in PVE servers
|
||||
// PVP attacks against friendly targets
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "failed", // Other reasons
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "miss", // Attack missed
|
||||
// Old response
|
||||
// Replaced by "too_far" and "cooldown"
|
||||
}
|
||||
</div>
|
||||
|
||||
<p></p>
|
||||
<span class='redlabel'>"source"</span>
|
||||
@@ -0,0 +1,79 @@
|
||||
<p>
|
||||
Arguments:
|
||||
<div> <b>*</b> String - An item key name from G.items</div>
|
||||
<div> <b>*</b> Integer - (Optional) Quantity</div>
|
||||
</p>
|
||||
<p>
|
||||
Returns:
|
||||
<div> <b>*</b> Promise</div>
|
||||
</p>
|
||||
|
||||
<p>List of available key names: <span class="xlabel" onclick="code_eval($(this).html())">show_json(Object.keys(G.items))</span></p>
|
||||
|
||||
<p>Example usages:</p>
|
||||
|
||||
<div class='code'>
|
||||
buy("shoes");
|
||||
|
||||
buy("hpot0",100);
|
||||
|
||||
buy("coat").then(function(data){
|
||||
game_log("Got a new coat at the "+data.num+"th inventory slot!");
|
||||
});
|
||||
|
||||
buy("shoes").then(
|
||||
function(data){
|
||||
game_log("New shoes!");
|
||||
},
|
||||
function(data){
|
||||
game_log("Can't buy shoes :(");
|
||||
},
|
||||
);
|
||||
</div>
|
||||
|
||||
<p>Promise Reference:</p>
|
||||
|
||||
<span class='dlabel'>"resolve"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
name: "coat",
|
||||
num: 0, // Inventory slot 0
|
||||
q: 1, // Quantity
|
||||
cost: 6000, // Gold spent
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 10px'></div>
|
||||
|
||||
<span class='dlabel'>"reject"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "distance", // Too far away from an NPC
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "not_buyable", // Can't buy this from an NPC
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "space", // No inventory space
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "cost", // Don't have enough gold
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "bank", // If operation isn't allowed inside
|
||||
}
|
||||
</div>
|
||||
|
||||
<p></p>
|
||||
<span class='redlabel'>"source"</span>
|
||||
@@ -0,0 +1,130 @@
|
||||
<p>
|
||||
Arguments:
|
||||
<div> <b>*</b> Integer - Inventory index of the first item [0 to 41]</div>
|
||||
<div> <b>*</b> Integer - Inventory index of the second item [0 to 41]</div>
|
||||
<div> <b>*</b> Integer - Inventory index of the third item [0 to 41]</div>
|
||||
<div> <b>*</b> Integer - Inventory index of the scroll [0 to 41]</div>
|
||||
<div> <b>*</b> Integer - (Optional) Inventory index of the offering [0 to 41]</div>
|
||||
</p>
|
||||
<p>
|
||||
Returns:
|
||||
<div> <b>*</b> Promise</div>
|
||||
</p>
|
||||
|
||||
<!-- <p>Current inventory with indexes: <br/><span class="xlabel" onclick="code_eval($(this).html())">show_json([Array(42).keys()].reduce(function(map,i){ map[i]=character.items[i]; return map; },{}))</span></p> -->
|
||||
|
||||
<p>Example usages:</p>
|
||||
|
||||
<div class='code'>
|
||||
compound(0,1,2,3); // Combines the first 3 items in your inventory [0,1,2] using the scroll in the 4th slot [3]
|
||||
|
||||
compound(0,1,2,3,4); // A primordial essence in the 5th slot[4]
|
||||
|
||||
if(character.q.compound) log("Already combining something!");
|
||||
|
||||
compound(0,1,2,locate_item("cscroll0")).then(function(data){
|
||||
if(data.success) game_log("I have a +"+data.level+" accessory now!");
|
||||
else game_log("Rip accessories, you'll be missed.");
|
||||
});
|
||||
|
||||
compound(0,1,2,locate_item("cscroll0")).then(
|
||||
function(data){
|
||||
game_log("Compound call completed");
|
||||
log(data);
|
||||
},
|
||||
function(data){
|
||||
game_log("Compound call failed with reason: "+data.reason);
|
||||
},
|
||||
);
|
||||
</div>
|
||||
|
||||
<p>Promise Reference:</p>
|
||||
|
||||
<span class='dlabel'>"resolve"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
success: true,
|
||||
level: 2,
|
||||
num: 16, // Inventory index
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
success: false, // Compound failed
|
||||
failed: true,
|
||||
level: 2,
|
||||
num: 16,
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 10px'></div>
|
||||
|
||||
<span class='dlabel'>"reject"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "max_level", // Item reached it's max level
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "scroll", // Incompatible scroll
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "locked", // Item locked
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "in_progress", // Another compound in progress
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "no_item", // Inventory index issues
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "no_scroll", // There's no scroll on that inventory index
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "not_combinable", // Items are not combinable
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "mismatch", // Items are not the same
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "offering", // Invalid offering
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "bank", // If operation isn't allowed inside
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "exception", // Possible server exception
|
||||
}
|
||||
</div>
|
||||
|
||||
<p></p>
|
||||
<span class='redlabel'>"source"</span>
|
||||
@@ -0,0 +1,139 @@
|
||||
<p>
|
||||
Arguments:
|
||||
<div> <b>*</b> Integer - Inventory index of the item [0 to 41]</div>
|
||||
<div> <b>*</b> Integer - Inventory index of the scroll [0 to 41]</div>
|
||||
<div> <b>*</b> Integer - (Optional) Inventory index of the offering [0 to 41]</div>
|
||||
</p>
|
||||
<p>
|
||||
Returns:
|
||||
<div> <b>*</b> Promise</div>
|
||||
</p>
|
||||
|
||||
<!-- <p>Current inventory with indexes: <br/><span class="xlabel" onclick="code_eval($(this).html())">show_json([Array(42).keys()].reduce(function(map,i){ map[i]=character.items[i]; return map; },{}))</span></p> -->
|
||||
|
||||
<p>Example usages:</p>
|
||||
|
||||
<div class='code'>
|
||||
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);
|
||||
},
|
||||
);
|
||||
</div>
|
||||
|
||||
<p>Promise Reference:</p>
|
||||
|
||||
<span class='dlabel'>"resolve"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
success: true,
|
||||
level: 7,
|
||||
num: 37,
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
success: false, // Upgrade failed
|
||||
level: 7,
|
||||
num: 37,
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
success: true,
|
||||
stat: true,
|
||||
stat_type: "str",
|
||||
num: 41,
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 10px'></div>
|
||||
|
||||
<span class='dlabel'>"reject"</span>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "max_level", // Item reached it's max level
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "scroll", // Incompatible scroll
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "scroll_quantity", // Not enough scrolls
|
||||
need: 100,
|
||||
have: 24,
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "locked", // Item locked
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "no_item", // There's no item on that inventory index
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "no_scroll", // There's no scroll on that inventory index
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "not_upgradeable", // Item not upgradeable
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
// 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
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "offering", // Invalid offering
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "bank", // If operation isn't allowed inside
|
||||
}
|
||||
</div>
|
||||
<div style='margin-bottom: 1px'></div>
|
||||
<div class='code'>
|
||||
{
|
||||
reason: "exception", // Possible server exception
|
||||
}
|
||||
</div>
|
||||
|
||||
<p></p>
|
||||
<span class='redlabel'>"source"</span>
|
||||
@@ -0,0 +1 @@
|
||||
<p>Work in progress, returned Promise's aren't resolved yet!</p>
|
||||
Reference in New Issue
Block a user