FRjs/data

Data about Flight Rising's dragon traits and breeding mechanics, and utility functions to streamline working with that data.

Members

(static, constant) AGES :Array.<BasicTrait>

The two possible dragon ages in Flight Rising. Ordered as they are in-game.

Type:
  • Array.<BasicTrait>

(static, constant) BREEDS :Array.<Breed>

All available breeds in Flight Rising. Sorted by name (ascending). Data Source

Type:
  • Array.<Breed>

(static, constant) BreedType :string

Enum for breed types. This effects which genes are available on a breed, and which breed(s) it can be paired with.

Type:
  • string
Properties
NameTypeDescription
ANCIENTstring
MODERNstring

(static, constant) COLOURS :Array.<Colour>

All available colours in Flight Rising. Ordered as they are in-game. This should be treated as a circular array.

Type:
  • Array.<Colour>

(static, constant) ELEMENTS :Array.<BasicTrait>

All possible elements (flights) in Flight Rising. Ordered as they are in-game.

Type:
  • Array.<BasicTrait>

(static, constant) EYES :Array.<EyeType>

All possible eye types in Flight Rising. Sorted by probability (descending). Data Source (retrieved 2024-04-09 at 12:07 PM EST)

Type:
  • Array.<EyeType>

(static, constant) GENDERS :Array.<BasicTrait>

The two possible dragon genders in Flight Rising. Ordered as they are in-game.

Type:
  • Array.<BasicTrait>

(static, constant) GENES :Object

All available genes, organized into primary, secondary, and tertiary slots. Each slot is sorted by name (ascending). Data Source

This object has the following structure:

{
	primary: Gene[],
	secondary: Gene[],
	tertiary: Gene[]
}
Type:
  • Object
See

(static, constant) Rarity :string

Enum for rarities. Every breed and gene has a rarity which affects it's probability of occurring through breeding.

Type:
  • string
Properties
NameTypeDescription
PLENTIFULstring
COMMONstring
UNCOMMONstring
LIMITEDstring
RAREstring

Methods

(static) areBreedsCompatible(one, two) → {boolean|undefined}

Returns true if the two given breeds are compatible for breeding -- meaning either they're both modern breeds, or they're the same ancient breed -- and false if they aren't. If either parameter is not an index in BREEDS, returns undefined.

Parameters:
NameTypeDescription
onenumber

Index of the first breed.

twonumber

Index of the second breed.

Returns:
Type: 
boolean | undefined

(static) calcRarityProb(arr, one, two, target) → {number|undefined}

Compares two objects with rarities from the given array, and returns the probability of the given target outcome occurring. If the indexes aren't in the array, or the array members don't have rarities, returns undefined.

Parameters:
NameTypeDescription
arrArray.<{rarity: Rarity}>

Array of objects with a rarity property.

onenumber

Index in arr of the first possible outcome.

twonumber

Index in arr of the second possible outcome.

targetnumber

Index in arr of the target outcome. Should be identical to either one or two.

Returns:
Type: 
number | undefined

(static) colourRange(one, two) → {number}

Yields indices on COLOURS of all colours in the shortest range between the two given colours. If either parameter is not an index in COLOURS, yields nothing.

Parameters:
NameTypeDescription
onenumber

Index of the first colour in the range.

twonumber

Index of the last colour in the range.

Yields:
Type: 
number

(static) colourRangeLength(one, two) → {number|undefined}

Calculates the length of the shortest range between two colours. If either parameter is not an index in COLOURS, returns undefined.

Parameters:
NameTypeDescription
onenumber

Index of the first colour in the range.

twonumber

Index of the last colour in the range.

Returns:
Type: 
number | undefined

(static) genesForBreed(slot, breedopt) → {number}

Yields indices on GENES of all genes available to a breed in a specific slot. If no breed id or an invalid breed id is provided, ignores restrictions and yields all genes for this slot. If the slot is invalid, yields nothing.

Parameters:
NameTypeAttributesDescription
slot"primary" | "secondary" | "tertiary"

The slot to retrieve genes for.

breednumber<optional>

Index of the breed to retrieve genes for.

Yields:
Type: 
number

(static) isColourInRange(one, two, target) → {boolean|undefined}

Returns true if the target colour is in the shortest range between two given colours, and false if it isn't. If any parameter is not an index in COLOURS, returns undefined. Range includes both end colours.

Parameters:
NameTypeDescription
onenumber

Index of the first colour in the range.

twonumber

Index of the last colour in the range.

targetnumber

Index of the target colour.

Returns:
Type: 
boolean | undefined

(static) isColourSubrangeInRange(range1, range2, target1, target2) → {boolean|undefined}

Returns true if the colour range from target1 to target2 is a sub-range of the colour range from range1 to range2, and false if not. If any parameter is not an index in COLOURS, returns undefined. Both ranges include both their end colours.

Parameters:
NameTypeDescription
range1number

Index of the first colour in the parent range.

range2number

Index of the last colour in the parent range.

target1number

Index of the first colour in the target range.

target2number

Index of the last colour in the target range.

Returns:
Type: 
boolean | undefined

(static) nestSizesForBreeds(one, two) → {Array.<Nest>|undefined}

Returns an array containing possible nest sizes and their probabilities if dragons of the two given breeds are nested. If the given breeds are incompatible, or if either parameter is not an index in BREEDS, returns undefined.

Parameters:
NameTypeDescription
onenumber

Index of the first breed.

twonumber

Index of the second breed.

See
Returns:
Type: 
Array.<Nest> | undefined

(static) rarityTableLookup(rarity1, rarity2) → {Array.<number>|undefined}

Given two rarities to compare, returns an array containing, in order, the probability that rarity1 occurs and the probability that rarity2 occurs. If invalid rarities are given, returns undefined.

Parameters:
NameTypeDescription
rarity1Rarity
rarity2Rarity
Returns:
Type: 
Array.<number> | undefined

Type Definitions

BasicTrait

Type:
  • Object
Properties
NameTypeDescription
namestring
sidnumber

The trait's on-site ID.

Breed

Type:
  • Object
Properties
NameTypeDescription
namestring
sidnumber

The breed's on-site ID.

typeBreedType
rarityRarity

Colour

Type:
  • Object
Properties
NameTypeDescription
namestring
sidnumber

The colour's on-site ID.

hexstring

The colour's main hex code. NOT prefixed.

EyeType

Type:
  • Object
Properties
NameTypeDescription
namestring
sidnumber

The eye type's on-site ID.

probabilitynumber

The eye type's probability of showing up on a hatchling when breeding dragons.

Gene

Type:
  • Object
Properties
NameTypeDescription
namestring
rarityRarity
sidsObject

Map of all on-site IDs that this gene may have. The BreedType.MODERN (M) key, if present, corresponds to the site ID for the gene on modern breeds. All other keys, if present, are an index in BREEDS and correspond to the site ID for the gene on that ancient breed.

isModernboolean

Whether or not this gene is available on modern breeds.

ancientsArray.<number>

Array of indices in BREEDS for all ancient breeds this gene is available on.

sidForBreedfunction

Given the index of a breed in BREEDS, returns the site ID for this gene on that breed, if it's available.

Parameters:

NameTypeDescription
breednumberIndex of a breed in BREEDS

Returns:
Type: number | undefined

Nest

Type:
  • Object
Properties
NameTypeDescription
namestring
probabilitynumber

The nest's probability of occurring when breeding dragons.