Menu Tiles
On this page(9)
The enchant menus are fully declared: every tile is an item you write in a menu file. A new
enchant file does not add itself, so each new enchant needs its tiles. This page has copy-ready
templates: replace <id>, the material, the colors and the lore.
| Menu | File | Opened by |
|---|---|---|
| Enchants list, page 1 | modules/sword/guis/enchants.yml | /sword enchants, a right click with the sword, [sword-enchants] open 1 |
| Enchants list, page 2 | modules/sword/guis/enchants-2.yml | The Next button, [sword-enchants] open 2 |
| Upgrade menu (shared) | modules/sword/guis/upgrade.yml | A click on an enchant tile, [sword-enchants] upgrade <id> |
After an edit, run /dungeons reload. The items: of these menus are yours (# sn:extensible): a
tile you add or delete stays that way across updates.
How a tile shows its state
A tile is up to three items on the same cell (the same key: letter). The menu shows the
first item whose view-requirements pass, so the order matters:
<id>-maxed:%sndungeons_enchant_<id>_state% == maxed(at its max level).<id>-unbuyable:%sndungeons_enchant_<id>_state% == unbuyable(its currency is not loaded).<id>: no requirements (buyable, everything else).
The states read PlaceholderAPI placeholders. Without PlaceholderAPI the menus show every %...%
as written and the state items cannot work.
Step 1: a free cell
Each enchant takes one letter of the layout:. Page 1 is full as shipped (a to u). Page 2 uses
a to h:
layout:
- "#########"
- "#abcdefg#"
- "#h#######" # change to "#hi######" for a new enchant on letter i
- "#########"
- "#########"
- "P###C####"Use any free letter. Keep # (filler), C (close), P (previous) and N (next) as they are.
Step 2: the list tiles
modules/sword/guis/enchants-2.yml (under items:)
<id>-maxed:
material: DIAMOND_SWORD
glow: true
display-name: "&b&lMy Enchant &r&f&lEnchant"
lore:
- "&8ꜱᴡᴏʀᴅ ᴇɴᴄʜᴀɴᴛ"
- ""
- "&7What it does, in one or two lines."
- ""
- "&b&lInformation&r&b:"
- " &3┃ &r&bLevel: &r&a%sndungeons_enchant_<id>_level% &8(max)"
- " &3┃ &r&bChance: &r&f%sndungeons_enchant_<id>_chance%%"
- " &3┃ &r&bTrigger: &r%sndungeons_enchant_<id>_trigger%"
- " &3┃ &r&bCooldown: &r%sndungeons_enchant_<id>_cooldown%"
- ""
- "&a&lMAX LEVEL"
- ""
- "&b&lCLICK HERE"
- "&3Click here to open its upgrades."
key: i
view-requirements:
- "%sndungeons_enchant_<id>_state% == maxed"
click-actions:
- "[sword-enchants] upgrade <id>"
- "[sound] UI_BUTTON_CLICK"
<id>-unbuyable:
material: DIAMOND_SWORD
display-name: "&b&lMy Enchant &r&f&lEnchant"
lore:
- "&8ꜱᴡᴏʀᴅ ᴇɴᴄʜᴀɴᴛ"
- ""
- "&7What it does, in one or two lines."
- ""
- "&b&lInformation&r&b:"
- " &3┃ &r&bLevel: &r&f%sndungeons_enchant_<id>_level%&7/&f%sndungeons_enchant_<id>_max%"
- " &3┃ &r&bChance: &r&f%sndungeons_enchant_<id>_chance%%"
- ""
- "&c&lWARNING: &r&4It cannot be bought: its currency"
- "&4%sndungeons_enchant_<id>_currency% &4is not loaded."
key: i
view-requirements:
- "%sndungeons_enchant_<id>_state% == unbuyable"
click-actions:
- "[sword-enchants] upgrade <id>"
- "[sound] UI_BUTTON_CLICK"
<id>:
material: DIAMOND_SWORD
display-name: "&b&lMy Enchant &r&f&lEnchant"
lore:
- "&8ꜱᴡᴏʀᴅ ᴇɴᴄʜᴀɴᴛ"
- ""
- "&7What it does, in one or two lines."
- ""
- "&b&lInformation&r&b:"
- " &3┃ &r&bLevel: &r&f%sndungeons_enchant_<id>_level%&7/&f%sndungeons_enchant_<id>_max%"
- " &3┃ &r&bChance: &r&f%sndungeons_enchant_<id>_chance%% &8-> &f%sndungeons_enchant_<id>_next_chance%%"
- " &3┃ &r&bTrigger: &r%sndungeons_enchant_<id>_trigger%"
- " &3┃ &r&bCooldown: &r%sndungeons_enchant_<id>_cooldown%"
- " &3┃ &r&bNext Level: &r&f%sndungeons_enchant_<id>_cost% %sndungeons_enchant_<id>_currency%"
- " &3┃ &r&bYou Have: &r&f%sndungeons_enchant_<id>_balance% %sndungeons_enchant_<id>_currency%"
- ""
- "&b&lCLICK HERE"
- "&3Click here to upgrade this enchant."
key: i
click-actions:
- "[sword-enchants] upgrade <id>"
- "[sound] UI_BUTTON_CLICK"Step 3: the upgrade menu info tile
The upgrade menu is shared by every enchant. Its cell i shows the enchant you opened (the
"viewed" enchant), so each enchant adds two info items, filtered on %sndungeons_viewenchant_id%.
Without them, that cell stays empty for your enchant.
modules/sword/guis/upgrade.yml (under items:)
info-<id>-maxed:
material: DIAMOND_SWORD
glow: true
display-name: "&b&lMy Enchant &r&f&lEnchant"
lore:
- "&8ꜱᴡᴏʀᴅ ᴇɴᴄʜᴀɴᴛ"
- ""
- "&7What it does, in one or two lines."
- ""
- "&b&lInformation&r&b:"
- " &3┃ &r&bLevel: &r&a%sndungeons_viewenchant_level% &8(max)"
- " &3┃ &r&bChance: &r&f%sndungeons_viewenchant_chance%%"
- " &3┃ &r&bTrigger: &r%sndungeons_viewenchant_trigger%"
- " &3┃ &r&bCooldown: &r%sndungeons_viewenchant_cooldown%"
- ""
- "&a&lMAX LEVEL"
key: i
view-requirements:
- "%sndungeons_viewenchant_id% == <id>"
- "%sndungeons_viewenchant_state% == maxed"
info-<id>:
material: DIAMOND_SWORD
display-name: "&b&lMy Enchant &r&f&lEnchant"
lore:
- "&8ꜱᴡᴏʀᴅ ᴇɴᴄʜᴀɴᴛ"
- ""
- "&7What it does, in one or two lines."
- ""
- "&b&lInformation&r&b:"
- " &3┃ &r&bLevel: &r&f%sndungeons_viewenchant_level%&7/&f%sndungeons_viewenchant_max%"
- " &3┃ &r&bChance: &r&f%sndungeons_viewenchant_chance%% &8-> &f%sndungeons_viewenchant_next_chance%%"
- " &3┃ &r&bTrigger: &r%sndungeons_viewenchant_trigger%"
- " &3┃ &r&bCooldown: &r%sndungeons_viewenchant_cooldown%"
- " &3┃ &r&bYou Have: &r&f%sndungeons_viewenchant_balance% %sndungeons_viewenchant_currency%"
key: i
view-requirements:
- "%sndungeons_viewenchant_id% == <id>"You add nothing else to the upgrade menu: the level buttons, Max, Prestige, Back and Close serve every enchant.
The upgrade menu buttons
The layout has i (the viewed enchant) and a to g: one button per entry of enchants.upgrade-amounts (+1 to +1000 as shipped). Then come m (Max), p (Prestige), B (back to the list) and C (close).
| Button | States (placeholder) | Action |
|---|---|---|
| A level button | %sndungeons_viewenchant_amount_<n>_state%: ok, missing (the balance does not cover it), past-max, unbuyable | [sword-enchants] buy viewed <n> exact (the unbuyable state: [sword-enchants] unbuyable viewed) |
| Max | %sndungeons_viewenchant_max_state%: max or none | [sword-enchants] buy viewed max |
| Prestige | %sndungeons_viewenchant_prestige_state%: ready, leveling, maxed, none | [sword-enchants] prestige viewed |
A level button buys exactly its levels or nothing. Max buys every level the balance covers (at most 10000 at once), never past the max level.
The [sword-enchants] action
Use it in any menu or reward action list.
| Action | What it does |
|---|---|
[sword-enchants] open <page> | Opens a list page: 1 = enchants.yml, n = enchants-<n>.yml |
[sword-enchants] upgrade <id> | Opens the upgrade menu of that enchant (it becomes the viewed one) |
[sword-enchants] buy <id> <1|10|max> | Buys up to that many levels |
[sword-enchants] buy <id> <n> exact | Buys exactly n levels, or nothing |
[sword-enchants] prestige <id> | Prestiges the enchant when it is ready |
[sword-enchants] maxed <id> | Tells the player the enchant is at its max level |
[sword-enchants] unbuyable <id> | Tells the player the enchant's currency is not loaded |
Write viewed instead of an id for the enchant open in the upgrade menu. Every
[sword-enchants] action follows the enable and permission of commands.enchants in
modules/sword/config.yml, and the permission of /sword. A click the player may not make answers
enchants.not-allowed.
A third page
You can add list pages up to enchants-64.yml, numbered without gaps:
- Copy
enchants-2.ymltoenchants-3.ymland keep only its filler, close and previous items. - Change the previous button of page 3 to
[sword-enchants] open 2. - On page 2, add a next button with
[sword-enchants] open 3on a free cell. /dungeons reload.
Enchant placeholders
Every key below is %sndungeons_enchant_<id>_<field>%. The upgrade menu reads the same fields as
%sndungeons_viewenchant_<field>%.
| Field | Value |
|---|---|
state (and state_label) | maxed, buyable or unbuyable |
name, id, description, trigger | The enchant's texts |
level | Your level (the max label at the max) |
level_raw, max, left | Your level as a number, the max, and the levels left |
chance, next_chance | The chance now and after one more level |
boosted_chance | The chance times your enchant chance boosters (at most 100%) |
cost, cost_10, levels_10 | The next level's price, and the price and count of 10 levels |
max_levels, cost_max | The levels and price of a buy to the max |
currency, balance | The paying currency and your balance |
cooldown, cooldown_left | The cooldown, and the seconds until it may proc again (0 = ready) |
prestige, prestige_max, stars, prestige_label | Prestige stars, the max, the star symbols and a short label |
prestige_state (and _label) | none, maxed, ready or leveling |
prestige_power, prestige_next_power | The chance factor now and with one more star |
prestige_cost_multiplier, prestige_next_cost_multiplier | The level price factor now and with one more star |
prestige_price, remax_cost | The next prestige's price, and every level again with one more star |
The full list, momentum included: Placeholders.
The sword lore
The sword item lists every enchant above level 0 by itself, through the {enchants} line of
item.lore in modules/sword/config.yml. A new enchant needs nothing there. See
Sword.