Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RunEditorRefMut

The Run Editor allows modifying Runs while ensuring that all the different invariants of the Run objects are upheld no matter what kind of operations are being applied to the Run. It provides the current state of the editor as state objects that can be visualized by any kind of User Interface.

Hierarchy

Index

Constructors

constructor

Properties

ptr

ptr: number

Methods

activeParseAndSetBestSegmentTime

  • activeParseAndSetBestSegmentTime(time: string): boolean
  • Parses a best segment time from a string and sets it for the active segment with the chosen timing method.

    Parameters

    • time: string

    Returns boolean

activeParseAndSetComparisonTime

  • activeParseAndSetComparisonTime(comparison: string, time: string): boolean
  • Parses a comparison time for the provided comparison and sets it for the active active segment with the chosen timing method.

    Parameters

    • comparison: string
    • time: string

    Returns boolean

activeParseAndSetSegmentTime

  • activeParseAndSetSegmentTime(time: string): boolean
  • Parses a segment time from a string and sets it for the active segment with the chosen timing method.

    Parameters

    • time: string

    Returns boolean

activeParseAndSetSplitTime

  • activeParseAndSetSplitTime(time: string): boolean
  • Parses a split time from a string and sets it for the active segment with the chosen timing method.

    Parameters

    • time: string

    Returns boolean

activeRemoveIcon

  • activeRemoveIcon(): void
  • Removes the icon of the active segment.

    Returns void

activeSetIcon

  • activeSetIcon(data: number, length: number): void
  • Sets the icon of the active segment.

    Parameters

    • data: number
    • length: number

    Returns void

activeSetIconFromArray

  • activeSetIconFromArray(data: Int8Array): void
  • Parameters

    • data: Int8Array

    Returns void

activeSetName

  • activeSetName(name: string): void
  • Sets the name of the active segment.

    Parameters

    • name: string

    Returns void

addComparison

  • addComparison(comparison: string): boolean
  • Adds a new custom comparison. It can't be added if it starts with [Race] or already exists.

    Parameters

    • comparison: string

    Returns boolean

addCustomVariable

  • addCustomVariable(name: string): void
  • Adds a new permanent custom variable. If there's a temporary variable with the same name, it gets turned into a permanent variable and its value stays. If a permanent variable with the name already exists, nothing happens.

    Parameters

    • name: string

    Returns void

cleanSumOfBest

  • Creates a Sum of Best Cleaner which allows you to interactively remove potential issues in the segment history that lead to an inaccurate Sum of Best. If you skip a split, whenever you will do the next split, the combined segment time might be faster than the sum of the individual best segments. The Sum of Best Cleaner will point out all of these and allows you to delete them individually if any of them seem wrong.

    Returns SumOfBestCleaner

clearHistory

  • clearHistory(): void
  • Clears out the Attempt History and the Segment Histories of all the segments.

    Returns void

clearMetadata

  • clearMetadata(): void
  • Resets all the Metadata Information.

    Returns void

clearTimes

  • clearTimes(): void
  • Clears out the Attempt History, the Segment Histories, all the times, sets the Attempt Count to 0 and clears the speedrun.com run id association. All Custom Comparisons other than Personal Best are deleted as well.

    Returns void

importComparison

  • importComparison(run: RunRef, comparison: string): boolean
  • Imports the Personal Best from the provided run as a comparison. The comparison can't be added if its name starts with [Race] or it already exists.

    Parameters

    Returns boolean

insertSegmentAbove

  • insertSegmentAbove(): void
  • Inserts a new empty segment above the active segment and adjusts the Run's history information accordingly. The newly created segment is then the only selected segment and also the active segment.

    Returns void

insertSegmentBelow

  • insertSegmentBelow(): void
  • Inserts a new empty segment below the active segment and adjusts the Run's history information accordingly. The newly created segment is then the only selected segment and also the active segment.

    Returns void

moveComparison

  • moveComparison(srcIndex: number, dstIndex: number): boolean
  • Reorders the custom comparisons by moving the comparison with the source index specified to the destination index specified. Returns false if one of the indices is invalid. The indices are based on the comparison names of the Run Editor's state.

    Parameters

    • srcIndex: number
    • dstIndex: number

    Returns boolean

moveSegmentsDown

  • moveSegmentsDown(): void
  • Moves all the selected segments down, unless the last segment is selected. The run's information is automatically adjusted properly. The active segment stays the active segment.

    Returns void

moveSegmentsUp

  • moveSegmentsUp(): void
  • Moves all the selected segments up, unless the first segment is selected. The run's information is automatically adjusted properly. The active segment stays the active segment.

    Returns void

parseAndGenerateGoalComparison

  • parseAndGenerateGoalComparison(time: string): boolean
  • Parses a goal time and generates a custom goal comparison based on the parsed value. The comparison's times are automatically balanced based on the runner's history such that it roughly represents what split times for the goal time would roughly look like. Since it is populated by the runner's history, only goal times within the sum of the best segments and the sum of the worst segments are supported. Everything else is automatically capped by that range. The comparison is only populated for the selected timing method. The other timing method's comparison times are not modified by this, so you can call this again with the other timing method to generate the comparison times for both timing methods.

    Parameters

    • time: string

    Returns boolean

parseAndSetAttemptCount

  • parseAndSetAttemptCount(attempts: string): boolean
  • Parses and sets the attempt count from the string provided. Changing this has no affect on the attempt history or the segment history. This number is mostly just a visual number for the runner.

    Parameters

    • attempts: string

    Returns boolean

parseAndSetOffset

  • parseAndSetOffset(offset: string): boolean
  • Parses and sets the timer offset from the string provided. The timer offset specifies the time, the timer starts at when starting a new attempt.

    Parameters

    • offset: string

    Returns boolean

removeComparison

  • removeComparison(comparison: string): void
  • Removes the chosen custom comparison. You can't remove a Comparison Generator's Comparison or the Personal Best.

    Parameters

    • comparison: string

    Returns void

removeCustomVariable

  • removeCustomVariable(name: string): void
  • Removes the custom variable with the name specified. If the custom variable does not exist, or is not a permanent variable, nothing happens.

    Parameters

    • name: string

    Returns void

removeGameIcon

  • removeGameIcon(): void
  • Removes the game's icon.

    Returns void

removeSegments

  • removeSegments(): void
  • Removes all the selected segments, unless all of them are selected. The run's information is automatically adjusted properly. The next not-to-be-removed segment after the active segment becomes the new active segment. If there's none, then the next not-to-be-removed segment before the active segment, becomes the new active segment.

    Returns void

removeSpeedrunComVariable

  • removeSpeedrunComVariable(name: string): void
  • Removes the speedrun.com variable with the name specified.

    Parameters

    • name: string

    Returns void

renameComparison

  • renameComparison(oldName: string, newName: string): boolean
  • Renames a comparison. The comparison can't be renamed if the new name of the comparison starts with [Race] or it already exists.

    Parameters

    • oldName: string
    • newName: string

    Returns boolean

selectAdditionally

  • selectAdditionally(index: number): void
  • In addition to the segments that are already selected, the segment with the given index is being selected. The segment chosen also becomes the active segment.

    This panics if the index of the segment provided is out of bounds.

    Parameters

    • index: number

    Returns void

selectOnly

  • selectOnly(index: number): void
  • Selects the segment with the given index. All other segments are unselected. The segment chosen also becomes the active segment.

    This panics if the index of the segment provided is out of bounds.

    Parameters

    • index: number

    Returns void

selectTimingMethod

  • selectTimingMethod(method: number): void
  • Selects a different timing method for being modified.

    Parameters

    • method: number

    Returns void

setCategoryName

  • setCategoryName(category: string): void
  • Sets the name of the category.

    Parameters

    • category: string

    Returns void

setCustomVariable

  • setCustomVariable(name: string, value: string): void
  • Sets the value of a custom variable with the name specified. If the custom variable does not exist, or is not a permanent variable, nothing happens.

    Parameters

    • name: string
    • value: string

    Returns void

setEmulatorUsage

  • setEmulatorUsage(usesEmulator: boolean): void
  • Specifies whether this speedrun is done on an emulator. Keep in mind that false may also mean that this information is simply not known.

    Parameters

    • usesEmulator: boolean

    Returns void

setGameIcon

  • setGameIcon(data: number, length: number): void
  • Sets the game's icon.

    Parameters

    • data: number
    • length: number

    Returns void

setGameIconFromArray

  • setGameIconFromArray(data: Int8Array): void
  • Parameters

    • data: Int8Array

    Returns void

setGameName

  • setGameName(game: string): void
  • Sets the name of the game.

    Parameters

    • game: string

    Returns void

setPlatformName

  • setPlatformName(name: string): void
  • Sets the name of the platform this game is run on. This may be empty if it's not specified.

    Parameters

    • name: string

    Returns void

setRegionName

  • setRegionName(name: string): void
  • Sets the name of the region this game is from. This may be empty if it's not specified.

    Parameters

    • name: string

    Returns void

setRunId

  • setRunId(name: string): void
  • Sets the speedrun.com Run ID of the run. You need to ensure that the record on speedrun.com matches up with the Personal Best of this run. This may be empty if there's no association.

    Parameters

    • name: string

    Returns void

setSpeedrunComVariable

  • setSpeedrunComVariable(name: string, value: string): void
  • Sets the speedrun.com variable with the name specified to the value specified. A variable is an arbitrary key value pair storing additional information about the category. An example of this may be whether Amiibos are used in this category. If the variable doesn't exist yet, it is being inserted.

    Parameters

    • name: string
    • value: string

    Returns void

stateAsJson

  • stateAsJson(): any
  • Calculates the Run Editor's state and encodes it as JSON in order to visualize it.

    Returns any

unselect

  • unselect(index: number): void
  • Unselects the segment with the given index. If it's not selected or the index is out of bounds, nothing happens. The segment is not unselected, when it is the only segment that is selected. If the active segment is unselected, the most recently selected segment remaining becomes the active segment.

    Parameters

    • index: number

    Returns void

Generated using TypeDoc