Skip to content

Releases: bpierre/loot-rarity

Loot Rarity 5.0.0

08 Sep 20:29
Compare
Choose a tag to compare

This version adds a way to calculate the rarity of a Loot bag without relying on the lootId. It also adds a new option to the image generation functions to display this level as a badge inside the image.

Check out the updated demo website to see these new features in action.

Calculation of the Loot Level

The rarity level of a Loot is calculated in this way:

  • The levels of every item in a bag are summed (which can theoratically go from 8*1 to 8*6).
  • A series of thresholds (0, 17, 20, 23, 26, 29) allows to split these levels in 6 brackets.

The distribution looks like this:

 Bag levels distribution:

 Common:     score above  0   26.4%  (2112 bags)
 Uncommon:   score above 17   23.1%  (1848 bags)
 Rare:       score above 20  22.85%  (1828 bags)
 Epic:       score above 23     15%  (1200 bags)
 Legendary:  score above 26   8.51%   (681 bags)
 Mythic:     score above 29   4.14%   (331 bags)

lootRarity()

A new function has been added to the API: lootRarity().

lootRarity(items: string[]): RarityLevel

It works with arrays of 8 items and return the rarity level of a Loot (bag). See README.md for more info.

Loot Level Badge

The Loot rarity badge is disabled by default. It can be enabled by setting the displayLootLevel option to true in the rarityImage() and rarityImageFromItems() functions. See README.md for more info.

Loot Level Badge

Other Changes

The displayLevels option of the rarityImage() and rarityImageFromItems() functions is deprecated and will be removed in a future version. Please use displayItemLevels instead.