# Class GameData

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

#####
Index

### Constructors

constructor

### Properties

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

### Methods

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

## Constructors

### constructor

- new GameData(scene): GameData

- #### Parameters

  - scene: default

  #### Returns GameData

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

## Properties

### achvUnlocks

achvUnlocks: AchvUnlocks

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

### `Private` defaultDexData

defaultDexData: DexData

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

### dexData

dexData: DexData

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

### eggPity

eggPity: number[]

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

### eggs

eggs: Egg []

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

### gameStats

gameStats: GameStats

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

### gender

gender: PlayerGender

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

### `Private` scene

scene: default

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

### secretId

secretId: number

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

### starterData

starterData: StarterData

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

### trainerId

trainerId: number

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

### unlockPity

unlockPity: number[]

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

### unlocks

unlocks: Unlocks

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

### voucherCounts

voucherCounts: VoucherCounts

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

### voucherUnlocks

voucherUnlocks: VoucherUnlocks

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

## Methods

### addStarterCandy

- addStarterCandy(species, count): void

- #### Parameters

  - species: default
  - count: number

  #### Returns void

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

### clearLocalData

- clearLocalData(): void

- #### Returns void

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

### consolidateDexData

- consolidateDexData(dexData): void

- #### Parameters

  - dexData: DexData

  #### Returns void

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

### convertSystemDataStr

- convertSystemDataStr(dataStr, shorten?): string

- #### Parameters

  - dataStr: string
  - shorten: boolean = false

  #### Returns string

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

### deleteSession

- deleteSession(slotId): Promise<boolean>

- #### Parameters

  - slotId: number

  #### Returns Promise<boolean>

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

### fixLegendaryStats

- fixLegendaryStats(systemData): void

- #### Parameters

  - systemData: SystemSaveData

  #### Returns void

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

### fixStarterData

- fixStarterData(systemData): void

- #### Parameters

  - systemData: SystemSaveData

  #### Returns void

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

### fixVariantData

- fixVariantData(systemData): void

- #### Parameters

  - systemData: SystemSaveData

  #### Returns void

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

### getDexAttrLuck

- getDexAttrLuck(dexAttr): number

- #### Parameters

  - dexAttr: bigint

  #### Returns number

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

### getFormAttr

- getFormAttr(formIndex): bigint

- #### Parameters

  - formIndex: number

  #### Returns bigint

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

### getFormIndex

- getFormIndex(attr): number

- #### Parameters

  - attr: bigint

  #### Returns number

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

### getNaturesForAttr

- getNaturesForAttr(natureAttr): Nature []

- #### Parameters

  - natureAttr: number

  #### Returns Nature []

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

### getSeenDialogues

- getSeenDialogues(): SeenDialogues

- #### Returns SeenDialogues

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

### getSession

- getSession(slotId): Promise< SessionSaveData >

- #### Parameters

  - slotId: number

  #### Returns Promise< SessionSaveData >

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

### `Private` getSessionSaveData

- getSessionSaveData(scene): SessionSaveData

- #### Parameters

  - scene: default

  #### Returns SessionSaveData

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

### getSpeciesCount

- getSpeciesCount(dexEntryPredicate): number

- #### Parameters

  - dexEntryPredicate: ((entry) => boolean)
    - - (entry): boolean

      - #### Parameters

        - entry: DexEntry

        #### Returns boolean

  #### Returns number

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

### getSpeciesDefaultDexAttr

- getSpeciesDefaultDexAttr(species, forSeen?, optimistic?): bigint

- #### Parameters

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

  #### Returns bigint

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

### getSpeciesDefaultNature

- getSpeciesDefaultNature(species): Nature

- #### Parameters

  - species: default

  #### Returns Nature

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

### getSpeciesDefaultNatureAttr

- getSpeciesDefaultNatureAttr(species): number

- #### Parameters

  - species: default

  #### Returns number

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

### getSpeciesDexAttrProps

- getSpeciesDexAttrProps(species, dexAttr): DexAttrProps

- #### Parameters

  - species: default
  - dexAttr: bigint

  #### Returns DexAttrProps

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

### getSpeciesStarterValue

- getSpeciesStarterValue(speciesId): number

- #### Parameters

  - speciesId: Species

  #### Returns number

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

### getStarterCount

- getStarterCount(dexEntryPredicate): number

- #### Parameters

  - dexEntryPredicate: ((entry) => boolean)
    - - (entry): boolean

      - #### Parameters

        - entry: DexEntry

        #### Returns boolean

  #### Returns number

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

### getStarterSpeciesDefaultAbilityIndex

- getStarterSpeciesDefaultAbilityIndex(species): number

- #### Parameters

  - species: default

  #### Returns number

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

### getSystemSaveData

- getSystemSaveData(): SystemSaveData

- #### Returns SystemSaveData

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

### getTutorialFlags

- getTutorialFlags(): TutorialFlags

- #### Returns TutorialFlags

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

### importData

- importData(dataType, slotId?): void

- #### Parameters

  - dataType: GameDataType
  - slotId: number = 0

  #### Returns void

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

### incrementRibbonCount

- incrementRibbonCount(species, forStarter?): number

- #### Parameters

  - species: default
  - forStarter: boolean = false

  #### Returns number

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

### `Private` initDexData

- initDexData(): void

- #### Returns void

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

### `Private` initStarterData

- initStarterData(): void

- #### Returns void

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

### initSystem

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

- #### Parameters

  - systemDataStr: string
  - `Optional` cachedSystemDataStr: string

  #### Returns Promise<boolean>

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

### `Private` loadGamepadSettings

- loadGamepadSettings(): boolean

- #### Returns boolean

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

### 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:611

### loadSession

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

- #### Parameters

  - scene: default
  - slotId: number
  - `Optional` sessionData: SessionSaveData

  #### Returns Promise<boolean>

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

### `Private` loadSettings

- loadSettings(): boolean

- Loads Settings from local storage if available

  #### Returns boolean

  true if succesful, false if not

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

### loadSystem

- loadSystem(): Promise<boolean>

- #### Returns Promise<boolean>

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

### migrateStarterAbilities

- migrateStarterAbilities(systemData, initialStarterData?): void

- #### Parameters

  - systemData: SystemSaveData
  - `Optional` initialStarterData: StarterData

  #### Returns void

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

### offlineNewClear

- offlineNewClear(scene): Promise<boolean>

- #### Parameters

  - scene: default

  #### Returns Promise<boolean>

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

### parseSessionData

- parseSessionData(dataStr): SessionSaveData

- #### Parameters

  - dataStr: string

  #### Returns SessionSaveData

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

### parseSystemData

- parseSystemData(dataStr): SystemSaveData

- #### Parameters

  - dataStr: string

  #### Returns SystemSaveData

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

### resetMappingToFactory

- resetMappingToFactory(): boolean

- #### Returns boolean

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

### saveAll

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

- #### Parameters

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

  #### Returns Promise<boolean>

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

### saveControlSetting

- saveControlSetting(device, localStoragePropertyName, setting, settingDefaults, valueIndex): 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:646

### saveMappingConfigs

- saveMappingConfigs(deviceName, config): 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:587

### saveSeenDialogue

- saveSeenDialogue(dialogue): boolean

- #### Parameters

  - dialogue: string

  #### Returns boolean

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

### saveSetting

- saveSetting(setting, valueIndex): 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:565

### saveSystem

- saveSystem(): Promise<boolean>

- #### Returns Promise<boolean>

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

### saveTutorialFlag

- saveTutorialFlag(tutorial, flag): boolean

- #### Parameters

  - tutorial: Tutorial
  - flag: boolean

  #### Returns boolean

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

### setEggMoveUnlocked

- setEggMoveUnlocked(species, eggMoveIndex): Promise<boolean>

- #### Parameters

  - species: default
  - eggMoveIndex: number

  #### Returns Promise<boolean>

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

### setPokemonCaught

- setPokemonCaught(pokemon, incrementCount?, fromEgg?): Promise<void>

- #### Parameters

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

  #### Returns Promise<void>

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

### setPokemonSeen

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

- #### Parameters

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

  #### Returns void

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

### setPokemonSpeciesCaught

- setPokemonSpeciesCaught(pokemon, species, incrementCount?, fromEgg?): Promise<void>

- #### Parameters

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

  #### Returns Promise<void>

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

### tryClearSession

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

- #### Parameters

  - scene: default
  - slotId: number

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

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

### tryExportData

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

- #### Parameters

  - dataType: GameDataType
  - slotId: number = 0

  #### Returns Promise<boolean>

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

### updateSpeciesDexIvs

- updateSpeciesDexIvs(speciesId, ivs): void

- #### Parameters

  - speciesId: Species
  - ivs: number[]

  #### Returns void

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

### verify

- verify(): Promise<boolean>

- #### Returns Promise<boolean>

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