Companions
On this page(25)
The companions module is the content of the SnCompanions plugin. Every stage of a zone gets its own egg, priced in your currencies. The companions it hatches boost a currency in /boosts. Use it to add a pet collection that scales with your zones.
| Needs | SnCompanions 1.16.0 or newer (API 1.1.0) |
| Files | modules/companions/config.yml, modules/companions/pools/ (one file per zone), modules/companions/guis/upgrades.yml |
| Player command | /egg (alias /eggs), /egg upgrades, /egg bulkdelete |
| Admin commands | /dungeons admin companions ... |
| Switch | enabled: (first key of modules/companions/config.yml) + /dungeons reload |
Without SnCompanions, the module stays off with one console warning. It is tried again on every /dungeons reload.
How it works
Who does what
| SnCompanions | SnDungeons |
|---|---|
| Keeps the companions, the slots and the storage. | Generates the catalogue: one egg per stage, 5 companions per egg. |
| Its menus: equip, Equip Best, Fuse All, delete, the egg filter. | Prices and rolls the eggs in its own currencies. |
| The egg menu with its open buttons, the hatch show and auto open. | Shows the egg block of each zone. |
| Draws the companions following the player. | Pays the booster of the currency the equipped companions boost. |
SnDungeons stores and draws nothing itself.
With the module off, /egg and the egg blocks go. SnCompanions shows the stored companions of SnDungeons as "unknown" until it is on again. Nothing is deleted.
Eggs
Every stage of every zone that has a pool has its egg, sndungeons:<zone>-<stage>. A pool is modules/companions/pools/<zone>.yml, named like the zone. Each egg holds the 5 companions of the pool, one per rarity.
An egg opens:
- with the egg block of its zone. Each player sees the block of the zone they stand at, with their own stage's text;
- with
/egg: the egg of the stage the player stands at; - with a menu button
[player] egg.
The eggs are not in /companions eggs of SnCompanions: only these ways open them.
A player can only open the egg of the stage they stand at (their stage of /zone). They must also be in that zone. "In the zone" means its mob area, or within egg.view-distance blocks of its egg block. Auto open stops when they leave.
The open buttons come from bundles:. Auto open (SnCompanions) also needs sncompanions.autoopen.
Values and prices
Every stage of every zone has a global index n: 0, 1, 2... It follows zones-order of the zones config, then the stage number. Zones without a pool count too.
| What | Formula |
|---|---|
| A companion's multiplier | value.base x value.growth ^ n x its rarity's ratio x its state's multiplier |
| One egg | price.base x price.growth ^ n, in price.currency |
A pool may set stages.<n>.value or stages.<n>.price instead of the formulas.
The booster
The value multiplies the currency the companion boosts (boost-currency, or the pool's). Every equipped companion adds its value to ONE booster of that currency in /boosts, named booster-name.
The booster is 1 + the sum of the multipliers: two x0.5 companions give x2. A rebirth ([reset-boosters]) keeps it.
States and fusion
Every egg hatches the first state of statuses: (Normal x1), unless a chance upgrade rolls a higher one. fuse identical companions make one of the next state. Identical means the same zone, stage, rarity and state.
With the shipped values, 5 Normal make 1 Rare, up to Mythic x4. Fuse All of SnCompanions does it, one layer per click.
Chance upgrades
/egg upgrades sells the chance upgrades, paid in upgrades.currency (souls):
| Upgrade id | Name | What one level does |
|---|---|---|
luck | Fortune | Moves per-level points of chance from the most common rarity to the others, in proportion to their chances. |
rare, epic, mythic | Rare/Epic/Mythic Chance | per-level percent that a hatched companion is born directly in that state. |
Fortune is not the Luck of luck.yml: it only moves egg rarity chances. A rebirth touches neither the companions nor the upgrades.
Ids are forever
The id of a companion is sndungeons:<zone>-<stage>-<rarity>-<state>.
Never rename a zone, a rarity or a state once players own companions. SnCompanions would show theirs as "unknown". They come back when the old id is back.
A zone whose ids would pass 64 characters is skipped with a warning.
Configuration
rarities
The rarities of every egg, in order: the first is the most common. Ids are 1 to 12 lowercase letters or digits. This block is # sn:extensible: its entries are yours.
| Key | Shipped values | What it does |
|---|---|---|
rarities.<id>.name | &7Common ... &b&lDivine | How the rarity shows. Its leading color is {rarity-color}. |
rarities.<id>.chance | 45, 30, 15, 7, 3 | The weight of the roll (any positive number, read as a share of their sum). |
rarities.<id>.ratio | 1.0, 1.5, 2.0, 3.0, 5.0 | The multiplier of the rarity against the first one. |
Shipped ids: common, uncommon, exotic, legendary, divine.
statuses
The fusion states, in order. Ids are 1 to 12 lowercase letters or digits. Also # sn:extensible.
| Key | Shipped values | What it does |
|---|---|---|
statuses.<id>.name | &fNormal ... &c&lMythic | How the state shows. |
statuses.<id>.multiplier | 1, 2, 3, 4 | The multiplier of the state (x the companion's value). |
statuses.<id>.fuse | 5 | Identical companions Fuse All turns into one of the next state (2 to 10000). The last state has none. |
Shipped ids: normal, rare, epic, mythic.
value and price
| Key | Default | What it does |
|---|---|---|
value.base | 0.5 | Multiplier of the first rarity, first state, at stage index 0. |
value.growth | 1.81 | Multiplied in once per stage index. |
price.base | 800 | Price of one egg at stage index 0. |
price.growth | 52 | Multiplied in once per stage index. |
price.currency | money | The currency eggs are paid in. |
Amounts accept the suffixes of currencies.number-format of config.yml (5M) or an exponent (2e40).
Booster and texts
| Key | Default | What it does |
|---|---|---|
boost-currency | money | The currency the companions boost. A pool may set another one for its zone. |
booster-name | '&aCompanions' | The name of the booster in /boosts. |
price-text | '{price} {currency}' | How a price shows in the egg menu and the chat lines of SnCompanions. |
companion.name | '{rarity-color}{animal} &8[{status}&8]' | How a companion is named in SnCompanions' menus. |
companion.lore | five lines | Its lore. |
The companion texts take {rarity}, {rarity-color}, {status}, {animal} (its pool name), {zone-name}, {stage}, {value} and {currency}.
bundles
The open buttons of the egg menu, drawn by SnCompanions. Each entry is an amount (1 to 10000, never twice the same) and a permission ('' = none).
| Amount | Permission |
|---|---|
1, 3, 10 | '' |
50 | sndungeons.companions.open.50 |
250 | sndungeons.companions.open.250 |
egg
| Key | Default | What it does |
|---|---|---|
egg.name | '&e{zone-name} {stage} Egg' | The name of the egg. |
egg.block | DRAGON_EGG | The block shown. An item material shows as an item. |
egg.view-distance | 48 | How far a player sees the block, and still counts as in its zone (4 to 128). |
egg.hitbox.width, egg.hitbox.height | 1.0 | The clickable box around the block, in blocks (0.1 to 8). |
egg.hologram-height | 1.4 | Height of the text above the base of the block (0 to 8). |
egg.hologram | five lines | The text over the block. {zone-name}, {stage}, {currency}, {price}, {price-currency}. |
A click on the block opens the egg menu of the player's stage.
upgrades
| Key | Default | What it does |
|---|---|---|
upgrades.currency | souls | The currency every upgrade is bought with. |
upgrades.<id>.name | &aFortune, &9Rare Chance... | The name shown. |
upgrades.<id>.max-level | 50 | The highest level. 0 turns the upgrade off. |
upgrades.<id>.price | 5M, 10M, 25M, 50M | The price of a level, the same for every level. |
upgrades.<id>.per-level | 0.1, 0.05, 0.04, 0.03 | What one level gives. |
upgrade-amounts | [1, 10, 'max'] | The amounts the upgrade buttons may buy. max = every level the balance covers. |
A state you add to statuses: gets its upgrade from a block named like it. To turn an upgrade off, set max-level: 0: a deleted block comes back on the merge.
bulk-delete and commands
| Key | Default | What it does |
|---|---|---|
bulk-delete.confirm-seconds | 10 | /egg bulkdelete deletes when typed again within this many seconds (1 to 300). |
commands.main.command | egg | Command name. '' = no /egg (the egg blocks and the API keep working). |
commands.main.aliases | [eggs] | Other names. |
commands.main.permission | '' | Permission for the command, the egg blocks and every upgrade button. '' = everyone. |
commands.upgrades.enable | true | false = no /egg upgrades. |
commands.upgrades.aliases | [] | Other names of the subcommand. |
commands.upgrades.permission | '' | Extra permission. '' = only the one of /egg. |
commands.upgrades.menu | upgrades | The menu (a file of modules/companions/guis/). |
commands.bulkdelete.enable | true | false = no /egg bulkdelete. |
commands.bulkdelete.aliases | [] | Other names of the subcommand. |
commands.bulkdelete.permission | '' | Extra permission. |
The display-name key ('&aCompanions') is the module's name in /dungeons admin modules.
Pool files
Each file of modules/companions/pools/ is the pool of one zone. The file name is the zone id (modules/zones/zones/barn.yml pairs with pools/barn.yml). A zone without a pool has no eggs.
The files are yours: SnLib never merges or re-creates them.
| Key | What it does |
|---|---|
companions.<rarity>.name | The companion of that rarity ({animal}). One per rarity of rarities:. |
companions.<rarity>.head | Its head: the Value of a minecraft-heads.com head (base64), a texture URL or a texture hash. '' = SnCompanions' default head. |
boost-currency | Optional: the currency this zone's companions boost. |
egg.location | Where the egg block stands, as 'world,x,y,z' (the block centre, x.5 and z.5). '' = no egg block. |
stages.'<n>'.value | Optional: the multiplier of that stage number, instead of the formula. |
stages.'<n>'.price | Optional: the price of one egg of that stage number. |
A missing rarity in companions: leaves the whole zone without eggs, with one console warning.
/dungeons admin companions setegg <zone> writes egg.location from the block you stand on. Without an egg block, the eggs still open with /egg.
The upgrades menu
modules/companions/guis/upgrades.yml (opened by /egg upgrades), 6 rows:
| Letter | Tile |
|---|---|
a, b, c, d | The four chance upgrades: luck, rare, epic, mythic. |
1 to 4 | Buy 1 level of the upgrade above. |
5 to 8 | Buy 10 levels. |
e to h | Buy every level the balance pays. |
C | Close. |
Each tile has states by %sndungeons_companions_upgrade_<id>_state%: maxed, missing (not enough currency) or buyable. The buttons run [companions] upgrade <id> <amount>, with an amount of upgrade-amounts. Each needs the permission of /egg.
Player settings
| Setting | What it hides (for that player only) |
|---|---|
companions.view-own | Your own companions following you. The others still see them. |
companions.view-others | Other players' companions. |
They add to /companions hide and /companions toggle of SnCompanions. In the isolated zone worlds, a player sees the companions of the players they see.
Commands
| Command | Permission | Description |
|---|---|---|
/egg | commands.main.permission ('' = everyone) | Opens the egg of the stage you stand at. |
/egg upgrades | The /egg permission + commands.upgrades.permission | Opens the chance upgrades menu. |
/egg bulkdelete <zone> <stage> | The /egg permission + commands.bulkdelete.permission | Deletes every stored companion of a stage. Type it again within bulk-delete.confirm-seconds to confirm. |
/dungeons admin companions setegg <zone> | sndungeons.admin.companions.setegg | Puts the egg block of a zone on the block you stand on (written to its pool). |
/dungeons admin companions info [player] | sndungeons.admin.companions.info | Shows the SnCompanions link, the catalogue and a player's upgrades and companion bonuses. |
/dungeons admin companions refresh | sndungeons.admin.companions.refresh | Builds the catalogue again and registers it with SnCompanions. |
/dungeons admin companions upgrade <player> <upgrade> <level> | sndungeons.admin.companions.upgrade | Sets a companion chance upgrade of a player, free (online or not). |
/dungeons admin companions give <player> <zone> <stage> <rarity> <status> [amount] | sndungeons.admin.companions.give | Gives an online player companions of SnDungeons. |
/egg bulkdelete never deletes the equipped companions. Full lists: Commands and Permissions.
Placeholders
The companions placeholders are listed in Placeholders:
| Placeholder | Value |
|---|---|
%sndungeons_companions_egg_name%, _egg_price, _egg_currency | The egg of the stage you stand at |
%sndungeons_companions_boost_<currency>% | Your companion booster total of a currency (1 without one) |
%sndungeons_companions_upgrade_<id>_level%, _max, _price, _currency, _name, _effect | A chance upgrade (luck, rare, epic, mythic) |
%sndungeons_companions_upgrade_<id>_state% | maxed, buyable or missing (_label for the word) |
Tips
- Run
/dungeons admin companions setegg <zone>standing where the block goes, for each zone with a pool. - After editing rarities, statuses or pools, run
/dungeons reload./dungeons admin companions refreshsends the catalogue again by hand. - Each stage multiplies the egg price by
price.growthand the value byvalue.growth. Tune both against your stage rewards. - A new rarity needs a companion in every pool: a pool without it loses all its eggs.
Default modules/companions/config.yml
enabled: true
# ============================================================
# SnDungeons - companions module
# Managed by SnLib: new keys are auto-merged on boot; your values and
# comments are preserved. Re-read on /dungeons reload.
# ============================================================
# Switch of the module (the key above): false turns the companions off on
# /dungeons reload; /egg disappears, the egg blocks go and SnCompanions shows
# the stored companions as "unknown" until the module is on again (nothing is
# deleted).
# The module stores and draws NOTHING: SnCompanions (1.16.0 or newer, API 1.1.0)
# keeps the companions, the slots, the storage, its menus (equip, fuse, delete,
# filter), the egg menu with open N, the hatch show and auto open, and draws
# the companions following the player. This module is its content: one egg per
# stage of every zone that has a pool (modules/companions/pools/<zone>.yml),
# with 5 companions (one per rarity) in every status, their values and prices,
# the roll and its chance upgrades, the egg block of each zone and the booster
# of the currency the equipped companions boost. Without SnCompanions the
# module stays off with one warning.
# The ids of the rarities and statuses below go into the id of every
# companion (sndungeons:<zone>-<stage>-<rarity>-<status>): NEVER rename one
# once players own companions, or SnCompanions shows theirs as "unknown"
# (they come back when the old id is back).
# Name of the module in /dungeons admin modules (color codes allowed).
display-name: '&aCompanions'
# The rarities of every egg, in order: the first is the most common. Ids: 1
# to 12 lowercase letters or digits. Each pool names one companion per rarity.
# name how the rarity shows (its leading color is {rarity-color})
# chance the weight of the roll (any positive number; they are read as
# shares of their sum)
# ratio the multiplier of the rarity against the first one
# sn:extensible
rarities:
common:
name: '&7Common'
chance: 45
ratio: 1.0
uncommon:
name: '&aUncommon'
chance: 30
ratio: 1.5
exotic:
name: '&dExotic'
chance: 15
ratio: 2.0
legendary:
name: '&6Legendary'
chance: 7
ratio: 3.0
divine:
name: '&b&lDivine'
chance: 3
ratio: 5.0
# The fusion states, in order: every egg hatches the first one (unless a chance
# upgrade rolls a higher one). Ids: 1 to 12 lowercase letters or digits.
# name how the state shows
# multiplier the multiplier of the state (x the value of the companion)
# fuse how many identical companions (same zone, stage, rarity and
# state) Fuse All of SnCompanions turns into one of the next
# state (2 to 10000); the last state has none
# sn:extensible
statuses:
normal:
name: '&fNormal'
multiplier: 1
fuse: 5
rare:
name: '&9Rare'
multiplier: 2
fuse: 5
epic:
name: '&5Epic'
multiplier: 3
fuse: 5
mythic:
name: '&c&lMythic'
multiplier: 4
# Every stage of every zone has a global index n: 0, 1, 2... in the order of
# zones-order (modules/zones/config.yml) and by stage number (zones without a
# pool count too). The multiplier of the first rarity in the first state of
# stage n is base x growth ^ n (a pool may set it per stage).
value:
base: 0.5
growth: 1.81
# The price of ONE egg of stage n: base x growth ^ n, in the currency below (a
# pool may set it per stage). Amounts accept the suffixes of
# currencies.number-format of config.yml (5M) or an exponent (2e40).
price:
base: 800
growth: 52
currency: money
# The currency the companions boost (a pool may set another one for its zone):
# the equipped companions that boost it add up into ONE booster of /boosts,
# 1 + the sum of their multipliers (two x0.5 companions = x2).
boost-currency: money
# The name of that booster in /boosts (color codes allowed).
booster-name: '&aCompanions'
# How a price shows in the egg menu and the chat lines of SnCompanions.
# {price}: the amount, {currency}: the name of its currency.
price-text: '{price} {currency}'
# The open buttons of the egg menu (SnCompanions draws them): how many eggs a
# click opens (1 to 10000, never twice the same) and the permission it needs
# ('' = none). Auto open (SnCompanions) also needs sncompanions.autoopen.
bundles:
- amount: 1
permission: ''
- amount: 3
permission: ''
- amount: 10
permission: ''
- amount: 50
permission: 'sndungeons.companions.open.50'
- amount: 250
permission: 'sndungeons.companions.open.250'
# How a companion looks in the menus of SnCompanions (written once per reload):
# {rarity} {rarity-color} {status} {animal} (its name in the pool)
# {zone-name} {stage} {value} (its multiplier) {currency} (what it boosts)
companion:
name: '{rarity-color}{animal} &8[{status}&8]'
lore:
- '&8ᴢᴏɴᴇ {zone-name} &8ꜱᴛᴀɢᴇ {stage}'
- ''
- ' &3┃ &fRarity: {rarity}'
- ' &3┃ &fStatus: {status}'
- ' &3┃ &fMultiplier: &b{value}x &3{currency}'
# The egg of each stage and the egg block of each zone (pools: egg.location;
# /dungeons admin companions setegg <zone> writes it). A player sees the block
# of the zone they stand at, with the text of their stage; a click opens the
# egg menu of that stage.
egg:
# The name of the egg. {zone-name} {stage}
name: '&e{zone-name} {stage} Egg'
# The block shown (a block material; an item shows as an item).
block: DRAGON_EGG
# How far from the egg block a player sees it, and still counts as standing
# in its zone away from the mob area (/egg, the open), blocks (4 to 128).
view-distance: 48
# The clickable box around the block, blocks (0.1 to 8).
hitbox:
width: 1.0
height: 1.0
# The height of the text above the base of the block, blocks (0 to 8).
hologram-height: 1.4
# The text over the block. {zone-name} {stage} {currency} (what the
# companions boost) {price} {price-currency} (the price of one egg)
hologram:
- '&e&l{zone-name} {stage} &r&eCompanion Egg'
- '&7Hatch companions that boost'
- '&7the {currency} you gain!'
- '&fCost: &a{price} {price-currency}'
- '&8Right click to view!'
# The chance upgrades, bought in /egg upgrades. The price of a level is the
# same for every level.
# luck: moves per-level points of chance (per level) from the first rarity
# (shown as Fortune: the Luck of luck.yml is another thing)
# to the others, in proportion to their chances
# one block per state after the first (rare, epic, mythic): the chance, in
# percent per level, that a hatched companion is born in that state
# A state you add to statuses: gets its upgrade from a block named like it;
# max-level: 0 turns an upgrade off (a deleted block comes back on the merge).
upgrades:
# The currency every upgrade is bought with.
currency: souls
luck:
name: '&aFortune'
max-level: 50
price: 5M
per-level: 0.1
rare:
name: '&9Rare Chance'
max-level: 50
price: 10M
per-level: 0.05
epic:
name: '&5Epic Chance'
max-level: 50
price: 25M
per-level: 0.04
mythic:
name: '&cMythic Chance'
max-level: 50
price: 50M
per-level: 0.03
# The amounts the upgrade buttons of /egg upgrades may buy ([companions]
# upgrade <id> <amount>); max = every level the balance covers.
upgrade-amounts: [1, 10, 'max']
bulk-delete:
# /egg bulkdelete <zone> <stage> deletes when it is typed again within this
# many seconds (1 to 300).
confirm-seconds: 10
commands:
# /egg opens the egg of the stage the player stands at (in its zone).
main:
# Command name; '' = no /egg command (the egg blocks and the API keep
# working).
command: egg
# Other names of the command.
aliases: [eggs]
# Permission needed to use the command, the egg blocks and every button of
# the upgrades menu. '' = everyone.
permission: ''
# /egg upgrades opens the chance upgrades menu.
upgrades:
# false = the subcommand does not exist.
enable: true
aliases: []
# Extra permission ('' = only the one of /egg).
permission: ''
# The menu: a file of modules/companions/guis/ without .yml.
menu: upgrades
# /egg bulkdelete <zone> <stage> deletes every STORED companion of that
# stage (never the equipped ones), like /companion bulkdelete of EMC.
bulkdelete:
enable: true
aliases: []
permission: ''Example pool: modules/companions/pools/barn.yml
# ============================================================
# SnDungeons - companions pool of the zone barn
# YOUR file: SnLib never merges or re-creates it. The file name is the id of
# its zone (modules/zones/zones/barn.yml); a zone without a pool has no eggs.
# Re-read on /dungeons reload.
# ============================================================
# The companions of the barn eggs: one per rarity of the module config
# (rarities:), the first rarity the most common. Every stage of the zone has
# its own egg with these 5 companions, in every state, worth what the stage is
# worth. A missing rarity leaves the whole zone without eggs (one warning).
# name: what {animal} shows
# head: the head the companion is drawn with: the Value of a head of
# minecraft-heads.com (base64), a texture URL or a texture hash;
# '' = the default head of SnCompanions
companions:
common:
name: 'Chicken'
head: ''
uncommon:
name: 'Cow'
head: ''
exotic:
name: 'Pig'
head: ''
legendary:
name: 'Horse'
head: ''
divine:
name: 'Zebra'
head: ''
# Optional: the currency the barn companions boost (else boost-currency of the
# module config).
# boost-currency: money
# Where the egg block of the zone stands, like the zone's spawn:
# 'world,x,y,z' (the centre of the block, x.5 and z.5). '' = no egg block (the
# eggs still open with /egg). /dungeons admin companions setegg barn writes the
# block you stand on.
egg:
location: 'world,3.5,64,0.5'
# Optional, per stage number: a multiplier (value: the first rarity in the
# first state) or a price (price: one egg) instead of the formulas of the
# module config. Amounts accept the suffixes of the number format (2.18M).
# stages:
# '3':
# value: 1.64
# price: 2.18M