mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-02-16 09:41:41 +00:00
Updated buyable documentation and added buyablesOwned
This commit is contained in:
parent
e9105e9865
commit
61788c6bdd
4 changed files with 16 additions and 5 deletions
|
@ -6,7 +6,8 @@ Tmp does not need to be manually updated.
|
|||
Almost every value in layer data can be a function or a constant value!
|
||||
You don't have to have the same amount of upgrades in every row (and challs and buyables)
|
||||
Unl is optional for all Big Components (defaults to true).
|
||||
effectDisplay in Challenges and Upgrades no longer takes an argument
|
||||
effectDisplay in Challenges and Upgrades no longer takes an argument, as well as buyable effect.
|
||||
Buyable cost can take an argument for amount of buyables, but if one is not supplied it should do the cost of the next buyable.
|
||||
|
||||
##v1.3.5
|
||||
- Completely automated convertToDecimal, now you never have to worry about it again.
|
||||
|
|
|
@ -5,6 +5,7 @@ the player can reset the purchases to get their currency back.
|
|||
|
||||
However, if you're creative, you can use them for basically anything. "canAfford()" is effectively "canClick()" and "buy()" is effectively "onClick()".
|
||||
|
||||
The amount of a buyable owned is a Decimal, and can be accessed with buyablesOwned(layer, id).
|
||||
You can use buyableEffect(layer, id) to get the current effects of a buyable.
|
||||
|
||||
Buyables should be formatted like this:
|
||||
|
@ -29,10 +30,11 @@ Features:
|
|||
- title: **optional**, displayed at the top in a larger font
|
||||
It can also be a function that returns updating text.
|
||||
|
||||
- cost(): cost for buying xth buyable, can be an object if there are multiple currencies
|
||||
- cost(): cost for buying the next buyable. Can have an optional argument "x" to calculate the cost of the x+1th object,
|
||||
but needs to use "current amount" as a default value for x. Can return an object if there are multiple currencies.
|
||||
|
||||
- effect(): **optional**, A function that calculates and returns the current values of bonuses
|
||||
for having x of this buyable. Can return a value or an object containing multiple values.
|
||||
of this buyable. Can return a value or an object containing multiple values.
|
||||
|
||||
- display(): A function returning everything that should be displayed on the rebuyable after the title, likely
|
||||
including the description, amount bought, cost, and current effect. Can use basic HTML.
|
||||
|
|
|
@ -252,6 +252,14 @@ function hasChall(layer, id){
|
|||
return (player[layer].challs.includes(toNumber(id)) || player[layer].challs.includes(id.toString()))
|
||||
}
|
||||
|
||||
function buyablesOwned(layer, id){
|
||||
return (player[layer].buyables[id])
|
||||
}
|
||||
|
||||
function clickableState(layer, id){
|
||||
return (player[layer].clickables[id])
|
||||
}
|
||||
|
||||
function upgEffect(layer, id){
|
||||
return (tmp[layer].upgrades[id].effect)
|
||||
}
|
||||
|
|
4
js/v.js
4
js/v.js
|
@ -140,9 +140,9 @@ function loadVue() {
|
|||
template: `
|
||||
<div v-if="layers[layer].milestones">
|
||||
<table>
|
||||
<tr v-for="id in Object.keys(tmp[layer].milestones)">
|
||||
<tr v-for="id in Object.keys(tmp[layer].milestones)"><div v-if="layers[layer].milestones[id]!== undefined && tmp[layer].milestones[id].unl"
|
||||
<milestone :layer = "layer" :data = "id" v-bind:style="tmp[layer].componentStyles.milestone"></milestone>
|
||||
</tr>
|
||||
</tr></div>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue