Leveling Upgrades
On this page(15)
A leveling track can sell upgrades bought with points. Every level-up gives points, and the player spends them level by level in a menu on permanent boosters or on actions. As shipped, every rebirth gives one rebirth point, and /rebirth upgrades sells money, souls, damage, swings and enchant boosts.
| Files | the upgrades: block of levelings/<track>.yml, the menu guis/upgrades-<track>.yml |
| Player command | /<track> upgrades (/rebirth upgrades) |
| Admin commands | /dungeons admin upgrades list|set|reset |
| Menu actions | [leveling-upgrades] open <track>, [leveling-upgrades] buy <track> <upgrade> <amount|max> |
| Reward tag | [reset-upgrades] <track> [upgrade] |
| Switch | upgrades.enabled of the track file + /dungeons reload (on only for rebirth as shipped) |
How it works
- Points on level-up. Every level reached by a real level-up gives
per-levelpoints of the points currency. - The menu.
/<track> upgradesopens the upgrades menu of the track. - Buying. A click buys levels of an upgrade. Each level costs the same number of points.
- The effect. A
boosterupgrade adds to a booster target. Anactionsupgrade runs action lines once per level. - For good. There is no respec: what a player bought stays, until a reset tag or an admin clears it.
Why points are a currency. The points are a normal currency (currencies/rebirth-points.yml, /rebirthpoints). So [give-currency] rebirth-points <amount> can also give them from any reward, crate, shop or pouch.
Configuration
upgrades (in a track file)
levelings/rebirth.yml
upgrades:
enabled: true
points:
currency: rebirth-points
per-level: 1
commands:
upgrades:
enable: true
permission: ''| Key | Default | What it does |
|---|---|---|
upgrades.enabled | false (true for rebirth) | The switch of the track's upgrades. No block or no key means off. |
upgrades.points.currency | rebirth-points | The currency that is this track's points. Never the track's own cost currency. |
upgrades.points.per-level | 1 | Points for EACH level reached by a real level-up. A number or 1.5K. 0 means only through actions. |
commands.upgrades.enable | true | false removes /<track> upgrades. On for everyone when the block is missing. |
commands.upgrades.permission | '' | The permission of /<track> upgrades. |
Which level-ups give points. up, max, an automatic level-up, the auto-rebirth and the menu button. One gift per operation: a max of 5 levels gives 5 x per-level. The player reads messages.levelings.points-gained (&b+{amount} {currency}) right after the level-up line.
give, take, set, reset (admin or API) and [reset-leveling] never give points. They never touch the points or the upgrades either.
Mistakes. These keep the upgrades of the track off, with one console warning:
- an
enabledthat is not true or false; - a
points.currencythat is missing, not loaded, or the track's own cost currency.
A negative or unreadable per-level reads 1, with one warning.
To give /level its own upgrades, set upgrades.enabled: true in level.yml. Create a new currency for its points, to keep them apart from the rebirth points.
The upgrades menu
While the switch is on, the start (or /dungeons reload) creates guis/upgrades-<track>.yml from the plugin's template. <track> becomes the track id and <points> its points currency. The file is yours: SnDungeons never merges or rewrites it. Delete it and reload to get the template back.
The template layout (4 rows):
#########
# # # # #
#### ####
P###B###X| Cell | What it is |
|---|---|
| blank cells (10, 12, 14, 16, 22) | The upgrades, each on its slot:. |
P | Your points (%sndungeons_currency_<points>%). |
B | Back to the track menu ([leveling] open <track>). |
X | Close. |
templates.upgrade
The plugin draws each upgrade with the one upgrade template, which holds the clicks:
strict-clicks: true
templates:
upgrade:
click-actions: ["[leveling-upgrades] buy {track} {upgrade} 1"]
right-click-actions: ["[leveling-upgrades] buy {track} {upgrade} 10"]
shift-left-click-actions: ["[leveling-upgrades] buy {track} {upgrade} max"]
shift-right-click-actions: ["[leveling-upgrades] buy {track} {upgrade} max"][leveling-upgrades] buy <track> <upgrade> <amount|max> buys up to that many levels (as many as the points pay). max buys as many as the points pay, up to the max level. Put it on any click and on any button of items:.
Keep the template: a file without templates.upgrade draws no upgrade (one console warning per reload). A display-name there replaces the name of every upgrade. A lore there is added under the lore of each.
upgrades (in the menu file)
The upgrades: block at the end of guis/upgrades-<track>.yml says what is sold.
| Key | Default | What it does |
|---|---|---|
<upgrade> | The upgrade id: lowercase letters, digits and -, at most 64. | |
slot | required | A cell of the layout, not the slot of another upgrade. |
name | the id | Its name in messages, placeholders and /boosts. |
max-level | required | 1 to 10000 (above 10000 it is 10000). |
price | required | Points per level, the same for every level. A number or 1.5K. 0 means free. |
type | booster or actions. | |
target | booster only: damage, swings, enchants, enchant:<id> or a currency id. | |
per-level | booster only: the bonus per level, above 0. Level 3 of 0.1 is +0.3x. | |
actions | actions only: lines run once per level bought, as the player. | |
icon | required | The keys of a menu item: material, display-name, lore, glow, color, flags, custom-model-data... |
Icon tokens. In the name and the lore:
| Token | Value |
|---|---|
{name}, {upgrade}, {track} | The upgrade's name, its id, the track id |
{level}, {max} | Your level and the max level |
{price} | The price of the next level |
{per-level} | The bonus per level |
{value}, {next-value} | Your bonus now and after one more level (up to 4 decimals) |
{points}, {currency} | Your points and the points currency |
{status} | messages.leveling-upgrades.status.ready, missing or maxed |
Action tokens. {player}, {track}, {upgrade} and {level} (the level reached in that run).
guis/upgrades-rebirth.yml
upgrades:
souls:
slot: 10
name: '&bSouls Upgrade'
max-level: 100
price: 1
type: booster
target: souls
per-level: 0.1
icon:
material: MAGMA_CREAM
display-name: "{name}"
lore:
- " &3┃ &fLevel: &a{level} &8/ &c{max}"
- " &3┃ &fBonus: &b+{value}x &8-> &a+{next-value}x"
- " &3┃ &fPrice: &b{price} &3{currency}"
- "{status}"
pouch:
slot: 20
name: '&aSouls Pouch'
max-level: 10
price: 2
type: actions
actions:
- "[give-pouch] souls:t1 1"
icon:
material: BUNDLE
display-name: "{name}"The shipped template sells:
| Upgrade | Target | Per level | Max level | Price |
|---|---|---|---|---|
souls | souls | +0.1x | 100 | 1 point |
money | money | +0.1x | 100 | 1 point |
enchant-proc | enchants | +0.005x | 75 | 1 point |
damage | damage | +0.01x | 75 | 1 point |
swings | swings | +0.01x | 50 | 1 point |
The pouch example of type actions is commented. Slot 20 is a filler cell: make it blank in the layout first.
Mistakes in the file
Each refused value is one console warning naming the file and the key. These upgrades are not shown nor sold:
- a bad id, no
slot, a slot outside the menu or of another upgrade; - no readable
max-level(1 or more) orprice(0 or more); - an unknown
type; - a booster with an unknown
targetor aper-levelthat is not above 0.
An actions upgrade whose actions is not a list, or an empty one, is sold but runs nothing (one warning).
The boosters
A booster upgrade is a permanent ADDITIVE booster of per-level x level on its target. It shows in /boosts under the upgrade's name, with the id upgrade-<track>:<upgrade>.
- It is pushed again at the join, after a purchase, a reload and any level change. So
[reset-boosters]in the rebirth rewards never takes it away. - For
enchants, the bonus multiplies the proc chance: a 10% enchant with +0.005x is 10.05%, not 10.005%. - A target that exists but is off in
boosters.ymlloads with one warning and boosts nothing.
See Boosters for the math.
Example. Level 40 of damage (+0.01x per level) is a +0.4 additive booster. Alone, it makes the damage x1.4.
Buying
One purchase at a time per player.
- The price is the sum of the levels bought (after any API modifier, per level).
- The new level is saved first.
- The points are charged at once (one
COSTrow, causeleveling-upgrade:<track>:<upgrade>). - The booster is pushed, or the actions run once per level.
- The menu redraws.
Points that pay fewer levels than asked buy those. Points that pay none answer insufficient. Actions that ran are never undone, not even by a reset.
The Luck effect free-leveling-upgrade can waive the most expensive level of a purchase.
Messages are messages.leveling-upgrades.* of lang/messages_en.yml. The keys are purchased, insufficient, maxed, no-upgrades, busy, not-allowed and no-menu. unknown answers when the upgrade left the file while the menu was open.
Opening the menu
| Way | Gates |
|---|---|
/<track> upgrades | Players only. Hidden from tab and help while the track has no upgrades (it then answers no-upgrades). |
[leveling-upgrades] open <track> | The shipped rebirth menu has a button for it. One tick later it checks the track's root permission and its upgrades subcommand. |
ESC in the upgrades menu goes back to the menu you came from (menus.back-on-close of config.yml).
Resetting and removing
[reset-upgrades] <track> [upgrade](a reward tag) sets every upgrade of a track, or one, back to 0 and takes its booster away. No refund. Safe to run more than once./dungeons admin upgrades setandresetdo the same for one player, online or offline. An offline player gets the boosters at the next join.- Both take every loaded track, its upgrades on or off. Naming one upgrade needs the track's upgrades loaded now.
- The points are reset separately, with
[reset-currency] rebirth-points. - An upgrade you delete from the file keeps the levels players bought (they come back with it). Its booster goes at the next reload.
- A track switched off at a reload takes its upgrade boosters away.
Commands
| Command | Permission | Description |
|---|---|---|
/<track> upgrades | none (commands.upgrades.permission) | Opens the upgrades menu of the track. Shown only while the track has upgrades. |
/dungeons admin upgrades list <track> | sndungeons.admin.upgrades.list | The upgrades of a leveling track. |
/dungeons admin upgrades set <player> <track> <upgrade> <level> | sndungeons.admin.upgrades.set | Sets a player's level of an upgrade (offline too; no charge, no actions). |
/dungeons admin upgrades reset <player> <track> [upgrade] | sndungeons.admin.upgrades.reset | Sets a player's upgrades of a track (or one) back to 0 (offline too). |
Full list: Commands and Permissions.
Placeholders
Full list: Placeholders.
| Placeholder | Description |
|---|---|
%sndungeons_upgrade_<track>_points% | Your upgrade points in the track |
%sndungeons_upgrade_<track>_<upgrade>_level%, _max | Your level and the max level |
%sndungeons_upgrade_<track>_<upgrade>_price% | The price of your next level |
%sndungeons_upgrade_<track>_<upgrade>_value%, _next_value | Your bonus now and after one more level |
%sndungeons_upgrade_<track>_<upgrade>_state% and _label | ready, missing or maxed |
%sndungeons_level_<track>_points_per_level% | Upgrade points one level-up gives (empty without upgrades) |
Tips
- The stored levels live in the table
sndungeons_leveling_upgrades, one row per player, track and upgrade. - The debug category
upgradesprints every purchase, booster push and refusal./dungeons admin inspect playerhas anupgradessection. - Test with
/rebirthpoints give <you> 100, then open/rebirth upgrades. - An edited icon or title shows the next time the menu opens: the reload closes the open menus.
Default upgrades: block of the upgrades template
# What the track sells. Every upgrade has:
# slot: required. A cell of the layout.
# name: its name in messages, placeholders and /boosts (the id when absent).
# max-level: required. 1 to 10000.
# price: required. Points per level, the same for every level: a number or
# a text of the currency format (1.5K); 0 = free.
# type: booster or actions.
# booster: target (damage, swings, enchants, enchant:<id>, or a currency
# id such as souls) and per-level (the bonus per level, above 0). Each
# level adds per-level to that booster: +0.1 at level 3 is +0.3x. For
# enchants the bonus multiplies the proc chance: a 10% enchant with
# +0.005x proc is 10.05%.
# actions: run once for each level bought, as the player; {player},
# {track}, {upgrade}, {level} (the level reached). Actions that ran are
# never undone, not even by [reset-upgrades].
# icon: required. The keys of a menu item (material, display-name, lore,
# glow, color, flags, custom-model-data...). In its texts: {name},
# {level}, {max}, {price} (the next level), {per-level}, {value} (the
# bonus now), {next-value} (after one more level), {points} (your
# points), {currency}, {status} (status: of leveling-upgrades in the lang
# file), {track}, {upgrade}.
# An upgrade you delete keeps the levels players bought (they come back
# with it); its booster goes at the next reload.
upgrades:
souls:
slot: 10
name: '&bSouls Upgrade'
max-level: 100
price: 1
type: booster
target: souls
per-level: 0.1
icon:
material: MAGMA_CREAM
display-name: "{name}"
lore:
- "&8ᴍᴜʟᴛɪᴘʟɪᴇʀ ɪɴᴄʀᴇᴀsᴇ: &b+{per-level}x"
- ""
- " &3┃ &7This upgrade will make you gain"
- " &3┃ &7more souls while hitting mobs."
- " &3┃ &fType: &bBooster"
- ""
- " &3┃ &fLevel: &a{level} &8/ &c{max}"
- " &3┃ &fBonus: &b+{value}x &8-> &a+{next-value}x"
- " &3┃ &fPrice: &b{price} &3{currency}"
- ""
- "&8Left +1 &7┃ &8Right +10 &7┃ &8Shift max"
- "{status}"
money:
slot: 12
name: '&eMoney Upgrade'
max-level: 100
price: 1
type: booster
target: money
per-level: 0.1
icon:
material: GOLD_INGOT
display-name: "{name}"
lore:
- "&8ᴍᴜʟᴛɪᴘʟɪᴇʀ ɪɴᴄʀᴇᴀsᴇ: &b+{per-level}x"
- ""
- " &3┃ &7This upgrade will make you gain"
- " &3┃ &7more money while hitting mobs."
- " &3┃ &fType: &bBooster"
- ""
- " &3┃ &fLevel: &a{level} &8/ &c{max}"
- " &3┃ &fBonus: &b+{value}x &8-> &a+{next-value}x"
- " &3┃ &fPrice: &b{price} &3{currency}"
- ""
- "&8Left +1 &7┃ &8Right +10 &7┃ &8Shift max"
- "{status}"
enchant-proc:
slot: 14
name: '&dEnchant Proc Upgrade'
max-level: 75
price: 1
type: booster
target: enchants
per-level: 0.005
icon:
material: ENCHANTED_BOOK
glow: true
display-name: "{name}"
lore:
- "&8ᴍᴜʟᴛɪᴘʟɪᴇʀ ɪɴᴄʀᴇᴀsᴇ: &b+{per-level}x"
- ""
- " &3┃ &7This upgrade will make your sword"
- " &3┃ &7enchants proc more often."
- " &3┃ &fType: &bBooster"
- ""
- " &3┃ &fLevel: &a{level} &8/ &c{max}"
- " &3┃ &fBonus: &b+{value}x &8-> &a+{next-value}x"
- " &3┃ &fPrice: &b{price} &3{currency}"
- ""
- "&8Left +1 &7┃ &8Right +10 &7┃ &8Shift max"
- "{status}"
damage:
slot: 16
name: '&cDamage Upgrade'
max-level: 75
price: 1
type: booster
target: damage
per-level: 0.01
icon:
material: RED_DYE
display-name: "{name}"
lore:
- "&8ᴍᴜʟᴛɪᴘʟɪᴇʀ ɪɴᴄʀᴇᴀsᴇ: &b+{per-level}x"
- ""
- " &3┃ &7This upgrade will make every swing"
- " &3┃ &7of your sword deal more damage."
- " &3┃ &fType: &bBooster"
- ""
- " &3┃ &fLevel: &a{level} &8/ &c{max}"
- " &3┃ &fBonus: &b+{value}x &8-> &a+{next-value}x"
- " &3┃ &fPrice: &b{price} &3{currency}"
- ""
- "&8Left +1 &7┃ &8Right +10 &7┃ &8Shift max"
- "{status}"
swings:
slot: 22
name: '&fSwings Upgrade'
max-level: 50
price: 1
type: booster
target: swings
per-level: 0.01
icon:
material: FEATHER
display-name: "{name}"
lore:
- "&8ᴍᴜʟᴛɪᴘʟɪᴇʀ ɪɴᴄʀᴇᴀsᴇ: &b+{per-level}x"
- ""
- " &3┃ &7This upgrade will make you swing"
- " &3┃ &7faster on the zone mobs."
- " &3┃ &fType: &bBooster"
- ""
- " &3┃ &fLevel: &a{level} &8/ &c{max}"
- " &3┃ &fBonus: &b+{value}x &8-> &a+{next-value}x"
- " &3┃ &fPrice: &b{price} &3{currency}"
- ""
- "&8Left +1 &7┃ &8Right +10 &7┃ &8Shift max"
- "{status}"
# Example of the other type (remove the # to use it; slot 20 is a filler
# cell of the layout above: make it blank in the layout first).
# pouch:
# slot: 20
# name: '&aSouls Pouch'
# max-level: 10
# price: 2
# type: actions
# actions:
# - "[give-pouch] souls:t1 1"
# icon:
# material: BUNDLE
# display-name: "{name}"
# lore:
# - " &3┃ &7Gives a souls pouch for each level."
# - " &3┃ &fLevel: &a{level} &8/ &c{max}"
# - " &3┃ &fPrice: &b{price} &3{currency}"
# - ""
# - "{status}"