Serial Mutation  Engine
Skip to main content API Docs

/api

Handles POST requests to process serials.

Parameters

Name
Type
Description
request
Request
- The incoming request object.

Body

Name
Type
Description
-
Operation | Operation[]
A single operation or an array of operations.

Responses

Type
Description
Response<object|object[]>
result of the operation(s).

Throws

Type
Description
400
the request body is invalid.
500
an unexpected error occurs.

Examples

// Single operation { "functionName": "parseSerial", "args": ["@UgbV{rFme!KI4sa#RG}W#sX3@xsFnx"] }

// Batch of operations [ { "functionName": "parseSerial", "args": ["@UgbV{rFme!KI4sa#RG}W#sX3@xsFnx"] }, { "functionName": "encodeSerial", "args": [[{ "token": 4, "value": 1 }]] } ]

serialToCustomFormat

Parameters

Name
Type
Description
serial
string
- The Base85 encoded serial string.

Returns

Type
Description
Promise<string>
promise that resolves to the deserialized custom format string.

customFormatToSerial

Parameters

Name
Type
Description
custom
string
- The custom format string.
passives
Record<string, { id: number; name?: string }>
- Optional map of passive names to their IDs.

Returns

Type
Description
Promise<string>
promise that resolves to the Base85 encoded serial string.

writeVarint

Parameters

Name
Type
Description
stream
BitstreamWriter
- The bitstream writer.
value
number
- The integer value to write.

Returns

Type
Description
Promise<void>

writeVarbit

Parameters

Name
Type
Description
stream
BitstreamWriter
- The bitstream writer.
value
number
- The integer value to write.

Returns

Type
Description
Promise<void>

encodeSerial

Parameters

Name
Type
Description
serial
Serial
- The serial object.

Returns

Type
Description
Promise<string>
promise that resolves to the Base85 encoded serial string.

getInitialState

Parameters

Name
Type
Description

Returns

Type
Description
State
initial state.

appendRandomAsset

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

injectRepeatingPart

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

scrambleAndAppendFromRepo

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Promise<Serial>
promise that resolves to the mutated serial.

injectRepeatingPartFull

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

injectRandomAsset

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

reverseRandomSegments

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

injectHighValuePart

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Promise<Serial>
promise that resolves to the mutated serial.

crossoverWithRepository

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Promise<Serial>
promise that resolves to the mutated serial.

shuffleAssets

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

randomizeAssets

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

repeatHighValuePart

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

appendHighValuePart

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

appendSelectedAssetMutation

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

repeatSelectedAssetMutation

Parameters

Name
Type
Description
serial
Serial
- The serial to mutate.
state
State
- The current state.

Returns

Type
Description
Serial
mutated serial.

mergeSerial

Parameters

Name
Type
Description
yaml
string
- The YAML string to merge into.
serialToInsert
string
- The serial to insert.

Returns

Type
Description
{newYaml: string, message: string}
object containing the new YAML string and a message.

mergeSerials

Parameters

Name
Type
Description
yaml
string
- The YAML string to merge into.
serialsToInsert
string[]
- The serials to insert.

Returns

Type
Description
{newYaml: string, message: string}
object containing the new YAML string and a message.

parseBytes

Parameters

Name
Type
Description
bytes
Uint8Array
- The byte array to parse.
no_header
boolean
- Whether to skip the header check.

Returns

Type
Description
Promise<Serial>
promise that resolves to the serial object.

parseSerial

Parameters

Name
Type
Description
serial
string
- The Base85 encoded serial string.

Returns

Type
Description
Promise<Serial>
promise that resolves to the serial object.

Part

Properties

Name
Type
Description
subType
SubType
index
number
value
number
values
{ type: number; value: number }[]
code
string

PartInfo

Properties

Name
Type
Description
name
string
fileName
string
code
string
subType
SubType
index
number
value
number
values
{ type: number; value: number }[]

Block

Properties

Name
Type
Description
token
number
value
number
valueStr
string
part
Part

Serial

Properties

Name
Type
Description

RawPart

Properties

Name
Type
Description
name
string
universalPart
string
fileName
string

Counts

Properties

Name
Type
Description
appendRandomAsset
number
injectRepeatingPart
number
injectRepeatingPartFull
number
scrambleAndAppendFromRepo
number
injectRandomAsset
number
reverseRandomSegments
number
injectHighValuePart
number
crossoverWithRepository
number
shuffleAssets
number
randomizeAssets
number
repeatHighValuePart
number
appendHighValuePart
number
appendMutation
number
stackedPartMutationV1
number
stackedPartMutationV2
number
evolvingMutation
number
characterFlipMutation
number
segmentReversalMutation
number
partManipulationMutation
number
repositoryCrossoverMutation
number
shuffleAssetsMutation
number
randomizeAssetsMutation
number
repeatHighValuePartMutation
number
appendHighValuePartMutation
number

Rules

Properties

Name
Type
Description
targetOffset
number
minChunk
number
maxChunk
number
minPart
number
maxPart
number
legendaryChance
number
difficultyIncrement
number
mutableStart
number
mutableEnd
number
targetChunk
number

Difficulties

Properties

Name
Type
Description
appendRandomAsset
number
injectRepeatingPart
number
injectRepeatingPartFull
number
scrambleAndAppendFromRepo
number
injectRandomAsset
number
reverseRandomSegments
number
injectHighValuePart
number
crossoverWithRepository
number
shuffleAssets
number
randomizeAssets
number
repeatHighValuePart
number
appendHighValuePart
number

State

Properties

Name
Type
Description
repository
string
seed
string
counts
Counts
rules
Rules
difficulties
Difficulties
generateStats
boolean
debugMode
boolean
selectedAsset
number
baseYaml
string

Operation

Properties

Name
Type
Description
functionName
string
- The name of the function to call from the API.
args
any[]
- An array of arguments to pass to the function.
debug
boolean
- Enable debug mode to get execution time.