# Weights & Rarity

ExcellentCrates uses weight system to determine the probability (roll chance) of crate rewards.

You can edit reward's weight and rarity using the editor.

# Rarity

Use rarities to create more complex systems, where certain rewards becomes even more rare or common!

You can create, edit or remove rarities in the config.yml -> Rewards -> Rarities.

# Weights

Take a look at the following table:

This table represents crate rewards. There are 9 rewards with 3 rarities.

When choosing a reward, the plugin chooses a rarity first. Then a reward is choosen from all rewards with that rarity.

Rarity Probability is determined: <weight> / <total weight>

Total weight of rarities is 100, so their probabilities determined:

  • Common: 70 / 100 = 0.7 (70%)
  • Rare: 25 / 100 = 0.25 (25%)
  • Mythic: 5 / 100 = 0.05 (5%)

Since rewards choosen based on their rarity, to determine a reward probability, we need a total weight of all rewards with the same rarity.

Then Reward Probability is determined: <weight> / <total weight> * <rarity probability>

Total weight of common rewards is 100, the probability of common rarity is 0.7 so probability of each reward is determined:

  • Coal: 30 / 100 * 0.7 = 0.21 (21%)
  • Stick. 50 / 100 * 0.7 = 0.35 (35%)
  • Apple. 20 / 100 * 0.7 = 0.14 (14%)

The same applies to rare rewards:

  • Iron Ingot: 35 / 100 * 0.25 = 0.0875 (8.75%)
  • Gold Ingot. 25 / 100 * 0.25 = 0.0625 (6.25%)
  • Golden Apple. 40 / 100 * 0.25 = 0.1 (10%)

And mythic ones:

  • Emerald: 45 / 100 * 0.05 = 0.0225 (2.25%)
  • Diamond. 40 / 100 * 0.05 = 0.02 (2%)
  • Ender Pearl. 15 / 100 * 0.05 = 0.0075 (0.75%)

As you can see in the table above, total probability of all rewards of specific rarity is the same as rarity's probability. This means that the weight system works perfectly fine!

# Weights Simplified

If the example above is too difficult for you to understand, then let's make it simple!

This table represents crate rewards. There are 9 rewards with 1 rarity.

Since all rewards uses the same rarity, the rarity's probability is always 1 (100%). This means that rarity will not affect reward's probability.

Then Reward Probability is determined: <weight> / <total weight> * 1 = <weight> / <total weight>

Since total weight of rewards is 100, their probabilities (roll chances) will be the same as their weight values:

  • Coal: 15 / 100 = 0.15 (15%)
  • Stick: 20 / 100 = 0.2 (20%)
  • Apple: 15 / 100 = 0.15 (15%)
  • Iron Ingot: 10 / 100 = 0.1 (10%)
  • Gold Ingot: 8 / 100 = 0.08 (8%)
  • Diamond: 5 / 100 = 0.05 (5%)
  • Emerald: 3 / 100 = 0.03 (3%)
  • Redstone: 12 / 100 = 0.12 (12%)
  • Lapis Lazuli: 12 / 100 = 0.12 (12%)

Simple enough? :p