# GameData | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class GameData

- Defined in src/system/game-data.ts:335

##### Index

### Constructors

constructor

### Properties

achvUnlocks
dexData
eggPity
eggs
gameStats
gender
runHistory
secretId
starterData
trainerId
unlockPity
unlocks
voucherCounts
voucherUnlocks

### Methods

addStarterCandy
clearLocalData
consolidateDexData
convertSystemDataStr
deleteSession
getDexAttrLuck
getFormAttr
getFormIndex
getNaturesForAttr
getRunHistoryData
getSeenDialogues
getSession
getSessionSaveData
getSpeciesCount
getSpeciesDefaultDexAttr
getSpeciesDefaultNature
getSpeciesDefaultNatureAttr
getSpeciesDexAttrProps
getSpeciesStarterValue
getStarterCount
getStarterSpeciesDefaultAbilityIndex
getSystemSaveData
getTutorialFlags
importData
incrementRibbonCount
initSystem
isRootSpeciesUnlocked
isUnlocked
loadMappingConfigs
loadSession
loadSystem
migrateStarterAbilities
offlineNewClear
parseSessionData
parseSystemData
resetMappingToFactory
saveAll
saveControlSetting
saveMappingConfigs
saveRunHistory
saveSeenDialogue
saveSetting
saveSystem
saveTutorialFlag
setEggMoveUnlocked
setPokemonCaught
setPokemonSeen
setPokemonSpeciesCaught
tryClearSession
tryExportData
unlockSpeciesNature
updateSpeciesDexIvs
verify

## Constructors

### constructor

- new GameData(): GameData

  #### Returns GameData

  - Defined in src/system/game-data.ts:359

## Properties

### achvUnlocks

achvUnlocks: AchvUnlocks

- Defined in src/system/game-data.ts:351

### dexData

dexData: DexData

- Defined in src/system/game-data.ts:341

### eggPity

eggPity: number[]

- Defined in src/system/game-data.ts:356

### eggs

eggs: Egg []

- Defined in src/system/game-data.ts:355

### gameStats

gameStats: GameStats

- Defined in src/system/game-data.ts:346

### gender

gender: PlayerGender

- Defined in src/system/game-data.ts:339

### runHistory

runHistory: RunHistoryData

- Defined in src/system/game-data.ts:347

### secretId

secretId: number

- Defined in src/system/game-data.ts:337

### starterData

starterData: StarterData

- Defined in src/system/game-data.ts:344

### trainerId

trainerId: number

- Defined in src/system/game-data.ts:336

### unlockPity

unlockPity: number[]

- Defined in src/system/game-data.ts:357

### unlocks

unlocks: Unlocks

- Defined in src/system/game-data.ts:349

### voucherCounts

voucherCounts: VoucherCounts

- Defined in src/system/game-data.ts:354

### voucherUnlocks

voucherUnlocks: VoucherUnlocks

- Defined in src/system/game-data.ts:353

## Methods

### addStarterCandy

- addStarterCandy(species: default , count: number): void

  Adds a candy to the player's game data for a given `PokemonSpecies`. Will do nothing if the player does not have the Pokemon owned in their system save data.

  #### Parameters

  - species: default
  - count: number

  #### Returns void

  - Defined in src/system/game-data.ts:1960

### clearLocalData

- clearLocalData(): void

  #### Returns void

  - Defined in src/system/game-data.ts:763

### consolidateDexData

- consolidateDexData(dexData: DexData ): void

  #### Parameters

  - dexData: DexData

  #### Returns void

  - Defined in src/system/game-data.ts:2212

### convertSystemDataStr

- convertSystemDataStr(dataStr: string, shorten?: boolean): string

  #### Parameters

  - dataStr: string
  - shorten: boolean = false

  #### Returns string

  - Defined in src/system/game-data.ts:728

### deleteSession

- deleteSession(slotId: number): Promise<boolean>

  Delete the session data at the given slot when overwriting a save file For deleting the session of a finished run, use `tryClearSession`

  #### Parameters

  - slotId: number

    the slot to clear

  #### Returns Promise<boolean>

  Promise with result `true` if the session was deleted successfully, `false` otherwise

  - Defined in src/system/game-data.ts:1237

### getDexAttrLuck

- getDexAttrLuck(dexAttr: bigint): number

  #### Parameters

  - dexAttr: bigint

  #### Returns number

  - Defined in src/system/game-data.ts:2160

### getFormAttr

- getFormAttr(formIndex: number): bigint

  #### Parameters

  - formIndex: number

  #### Returns bigint

  - Defined in src/system/game-data.ts:2208

### getFormIndex

- getFormIndex(attr: bigint): number

  #### Parameters

  - attr: bigint

  #### Returns number

  - Defined in src/system/game-data.ts:2197

### getNaturesForAttr

- getNaturesForAttr(natureAttr?: number): Nature []

  #### Parameters

  - natureAttr: number = 0

  #### Returns Nature []

  - Defined in src/system/game-data.ts:2164

### getRunHistoryData

- getRunHistoryData(): Promise< RunHistoryData >

  Retrieves current run history data, organized by time stamp. At the moment, only retrievable from locale cache

  #### Returns Promise< RunHistoryData >

  - Defined in src/system/game-data.ts:619

### getSeenDialogues

- getSeenDialogues(): SeenDialogues

  #### Returns SeenDialogues

  - Defined in src/system/game-data.ts:992

### getSession

- getSession(slotId: number): Promise<null | SessionSaveData >

  #### Parameters

  - slotId: number

  #### Returns Promise<null | SessionSaveData >

  - Defined in src/system/game-data.ts:1037

### getSessionSaveData

- getSessionSaveData(): SessionSaveData

  #### Returns SessionSaveData

  - Defined in src/system/game-data.ts:1009

### getSpeciesCount

- getSpeciesCount(dexEntryPredicate: (entry: DexEntry ) => boolean): number

  #### Parameters

  - dexEntryPredicate: (entry: DexEntry ) => boolean

  #### Returns number

  - Defined in src/system/game-data.ts:2059

### getSpeciesDefaultDexAttr

- getSpeciesDefaultDexAttr(
  species: default ,
  _forSeen?: boolean,
  optimistic?: boolean,
  ): bigint

  #### Parameters

  - species: default
  - _forSeen: boolean = false
  - optimistic: boolean = false

  #### Returns bigint

  - Defined in src/system/game-data.ts:2082

### getSpeciesDefaultNature

- getSpeciesDefaultNature(species: default ): Nature

  #### Parameters

  - species: default

  #### Returns Nature

  - Defined in src/system/game-data.ts:2146

### getSpeciesDefaultNatureAttr

- getSpeciesDefaultNatureAttr(species: default ): number

  #### Parameters

  - species: default

  #### Returns number

  - Defined in src/system/game-data.ts:2156

### getSpeciesDexAttrProps

- getSpeciesDexAttrProps(_species: default , dexAttr: bigint): DexAttrProps

  #### Parameters

  - _species: default
  - dexAttr: bigint

  #### Returns DexAttrProps

  - Defined in src/system/game-data.ts:2120

### getSpeciesStarterValue

- getSpeciesStarterValue(speciesId: Species ): number

  #### Parameters

  - speciesId: Species

  #### Returns number

  - Defined in src/system/game-data.ts:2174

### getStarterCount

- getStarterCount(dexEntryPredicate: (entry: DexEntry ) => boolean): number

  #### Parameters

  - dexEntryPredicate: (entry: DexEntry ) => boolean

  #### Returns number

  - Defined in src/system/game-data.ts:2070

### getStarterSpeciesDefaultAbilityIndex

- getStarterSpeciesDefaultAbilityIndex(species: default ): number

  #### Parameters

  - species: default

  #### Returns number

  - Defined in src/system/game-data.ts:2141

### getSystemSaveData

- getSystemSaveData(): SystemSaveData

  #### Returns SystemSaveData

  - Defined in src/system/game-data.ts:389

### getTutorialFlags

- getTutorialFlags(): TutorialFlags

  #### Returns TutorialFlags

  - Defined in src/system/game-data.ts:961

### importData

- importData(dataType: GameDataType , slotId?: number): void

  #### Parameters

  - dataType: GameDataType
  - slotId: number = 0

  #### Returns void

  - Defined in src/system/game-data.ts:1533

### incrementRibbonCount

- incrementRibbonCount(species: default , forStarter?: boolean): number

  #### Parameters

  - species: default
  - forStarter: boolean = false

  #### Returns number

  - Defined in src/system/game-data.ts:1922

### initSystem

- initSystem(
  systemDataStr: string,
  cachedSystemDataStr?: string,
  ): Promise<boolean>

  #### Parameters

  - systemDataStr: string
  - `Optional` cachedSystemDataStr: string

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:497

### isRootSpeciesUnlocked

- isRootSpeciesUnlocked(species: default ): boolean

  Checks whether the root species of a given {@PokemonSpecies } has been unlocked in the dex

  #### Parameters

  - species: default

  #### Returns boolean

  - Defined in src/system/game-data.ts:2020

### isUnlocked

- isUnlocked(unlockable: Unlockables ): boolean

  Checks if an `Unlockable` has been unlocked.

  #### Parameters

  - unlockable: Unlockables

    The Unlockable to check

  #### Returns boolean

  `true` if the player has unlocked this `Unlockable` or an override has enabled it

  - Defined in src/system/game-data.ts:414

### loadMappingConfigs

- loadMappingConfigs(): boolean

  Loads the mapping configurations from localStorage and injects them into the input controller.

  #### Returns boolean

  `true` if the configurations are successfully loaded and injected; `false` if no configurations are found in localStorage.

  #### Remarks

  This method checks if the 'mappingConfigs' entry exists in localStorage. If it does not exist, the method returns `false`. If 'mappingConfigs' exists, it parses the configurations and injects each configuration into the input controller for the corresponding gamepad or device key. The method then returns `true` to indicate success.

  - Defined in src/system/game-data.ts:827

### loadSession

- loadSession(slotId: number, sessionData?: SessionSaveData ): Promise<boolean>

  #### Parameters

  - slotId: number
  - `Optional` sessionData: SessionSaveData

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:1077

### loadSystem

- loadSystem(): Promise<boolean>

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:454

### migrateStarterAbilities

- migrateStarterAbilities(
  systemData: SystemSaveData ,
  initialStarterData?: StarterData ,
  ): void

  #### Parameters

  - systemData: SystemSaveData
  - `Optional` initialStarterData: StarterData

  #### Returns void

  - Defined in src/system/game-data.ts:2224

### offlineNewClear

- offlineNewClear(): Promise<boolean>

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:1272

### parseSessionData

- parseSessionData(dataStr: string): SessionSaveData

  #### Parameters

  - dataStr: string

  #### Returns SessionSaveData

  - Defined in src/system/game-data.ts:1337

### parseSystemData

- parseSystemData(dataStr: string): SystemSaveData

  #### Parameters

  - dataStr: string

  #### Returns SystemSaveData

  - Defined in src/system/game-data.ts:708

### resetMappingToFactory

- resetMappingToFactory(): boolean

  #### Returns boolean

  - Defined in src/system/game-data.ts:843

### saveAll

- saveAll(
  skipVerification?: boolean,
  sync?: boolean,
  useCachedSession?: boolean,
  useCachedSystem?: boolean,
  ): Promise<boolean>

  #### Parameters

  - skipVerification: boolean = false
  - sync: boolean = false
  - useCachedSession: boolean = false
  - useCachedSystem: boolean = false

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:1407

### saveControlSetting

- saveControlSetting(
  device: Device ,
  localStoragePropertyName: string,
  setting: SettingGamepad | SettingKeyboard ,
  settingDefaults: any,
  valueIndex: number,
  ): boolean

  Saves a gamepad setting to localStorage.

  #### Parameters

  - device: Device
  - localStoragePropertyName: string
  - setting: SettingGamepad | SettingKeyboard

    The gamepad setting to save.

  - settingDefaults: any
  - valueIndex: number

    The index of the value to set for the gamepad setting.

  #### Returns boolean

  `true` if the setting is successfully saved.

  #### Remarks

  This method initializes an empty object for gamepad settings if none exist in localStorage. It then updates the setting in the current scene and iterates over the default gamepad settings to update the specified setting with the new value. Finally, it saves the updated settings back to localStorage and returns `true` to indicate success.

  - Defined in src/system/game-data.ts:866

### saveMappingConfigs

- saveMappingConfigs(deviceName: string, config: any): boolean

  Saves the mapping configurations for a specified device.

  #### Parameters

  - deviceName: string

    The name of the device for which the configurations are being saved.

  - config: any

    The configuration object containing custom mapping details.

  #### Returns boolean

  `true` if the configurations are successfully saved.

  - Defined in src/system/game-data.ts:802

### saveRunHistory

- saveRunHistory(runEntry: SessionSaveData , isVictory: boolean): Promise<boolean>

  Saves a new entry to Run History

  #### Parameters

  - runEntry: SessionSaveData
  - isVictory: boolean

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:669

### saveSeenDialogue

- saveSeenDialogue(dialogue: string): boolean

  #### Parameters

  - dialogue: string

  #### Returns boolean

  - Defined in src/system/game-data.ts:981

### saveSetting

- saveSetting(setting: string, valueIndex: number): boolean

  Saves a setting to localStorage

  #### Parameters

  - setting: string

    string ideally of SettingKeys

  - valueIndex: number

    index of the setting's option

  #### Returns boolean

  true

  - Defined in src/system/game-data.ts:779

### saveSystem

- saveSystem(): Promise<boolean>

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:421

### saveTutorialFlag

- saveTutorialFlag(tutorial: Tutorial , flag: boolean): boolean

  #### Parameters

  - tutorial: Tutorial
  - flag: boolean

  #### Returns boolean

  - Defined in src/system/game-data.ts:938

### setEggMoveUnlocked

- setEggMoveUnlocked(
  species: default ,
  eggMoveIndex: number,
  showMessage?: boolean,
  prependSpeciesToMessage?: boolean,
  ): Promise<boolean>

  #### Parameters

  - species: default
  - eggMoveIndex: number
  - showMessage: boolean = true

    Default true. If true, will display message for unlocked egg move

  - prependSpeciesToMessage: boolean = false

    Default false. If true, will change message from "X Egg Move Unlocked!" to "Bulbasaur X Egg Move Unlocked!"

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:1976

### setPokemonCaught

- setPokemonCaught(
  pokemon: default ,
  incrementCount?: boolean,
  fromEgg?: boolean,
  showMessage?: boolean,
  ): Promise<boolean>

  #### Parameters

  - pokemon: default
  - incrementCount: boolean = true
  - fromEgg: boolean = false
  - showMessage: boolean = true

  #### Returns Promise<boolean>

  `true` if Pokemon catch unlocked a new starter, `false` if Pokemon catch did not unlock a starter

  - Defined in src/system/game-data.ts:1766

### setPokemonSeen

- setPokemonSeen(
  pokemon: default ,
  incrementCount?: boolean,
  trainer?: boolean,
  ): void

  #### Parameters

  - pokemon: default
  - incrementCount: boolean = true
  - trainer: boolean = false

  #### Returns void

  - Defined in src/system/game-data.ts:1732

### setPokemonSpeciesCaught

- setPokemonSpeciesCaught(
  pokemon: default ,
  species: default ,
  incrementCount?: boolean,
  fromEgg?: boolean,
  showMessage?: boolean,
  ): Promise<boolean>

  #### Parameters

  - pokemon: default
  - species: default
  - incrementCount: boolean = true
  - fromEgg: boolean = false
  - showMessage: boolean = true

  #### Returns Promise<boolean>

  `true` if Pokemon catch unlocked a new starter, `false` if Pokemon catch did not unlock a starter

  - Defined in src/system/game-data.ts:1785

### tryClearSession

- tryClearSession(slotId: number): Promise<[success: boolean, newClear: boolean]>

  Attempt to clear session data after the end of a run After session data is removed, attempt to update user info so the menu updates To delete an unfinished run instead, use `deleteSession`

  #### Parameters

  - slotId: number

  #### Returns Promise<[success: boolean, newClear: boolean]>

  - Defined in src/system/game-data.ts:1301

### tryExportData

- tryExportData(dataType: GameDataType , slotId?: number): Promise<boolean>

  #### Parameters

  - dataType: GameDataType
  - slotId: number = 0

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:1482

### unlockSpeciesNature

- unlockSpeciesNature(species: default , nature: Nature ): void

  Unlocks the given `Nature` for a `PokemonSpecies` and its prevolutions. Will fail silently if root species has not been unlocked

  #### Parameters

  - species: default
  - nature: Nature

  #### Returns void

  - Defined in src/system/game-data.ts:2028

### updateSpeciesDexIvs

- updateSpeciesDexIvs(speciesId: Species , ivs: number[]): void

  #### Parameters

  - speciesId: Species
  - ivs: number[]

  #### Returns void

  - Defined in src/system/game-data.ts:2043

### verify

- verify(): Promise<boolean>

  #### Returns Promise<boolean>

  - Defined in src/system/game-data.ts:744