diff --git a/assets/db/characters.json b/assets/db/characters.json index 737749888..b6cf3cb15 100644 --- a/assets/db/characters.json +++ b/assets/db/characters.json @@ -7720,6 +7720,25 @@ "pyroDmgBonusPercentage", "critRatePercentage" ] + }, + { + "multiples": [ + { + "quantity": 2, + "image": "crimson_witch_of_flames_4.png" + }, + { + "quantity": 2, + "image": "noblesse_oblige_4.png" + } + ], + "stats": [ + "hp", + "atk", + "hpPercentage", + "pyroDmgBonusPercentage", + "critRatePercentage" + ] } ], "subStatsToFocus": [ diff --git a/assets/db/game_codes.json b/assets/db/game_codes.json new file mode 100644 index 000000000..a3f530533 --- /dev/null +++ b/assets/db/game_codes.json @@ -0,0 +1,399 @@ +{ + "gameCodes": [ + { + "dateAdded": "03/06/2021", + "isExpired": false, + "code": "PSNTC8FEQK4D", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 50000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": "03/06/2021", + "isExpired": false, + "code": "KTNSCQWW922M", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10, + "materialType": "expWeapon", + "image": "mystic_enchancement_ore.png" + } + ] + }, + { + "dateAdded": "03/06/2021", + "isExpired": false, + "code": "ET7ADQFF8KJR", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "heros_wit.png" + } + ] + }, + { + "dateAdded": "01/22/2021", + "isExpired": true, + "code": "jsSK8n23jzr", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10, + "materialType": "expWeapon", + "image": "mystic_enchancement_ore.png" + } + ] + }, + { + "dateAdded": "01/22/2021", + "isExpired": true, + "code": "du2mhjQL1ZT", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 50000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": "01/22/2021", + "isExpired": true, + "code": "nBEm3myAL2b", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "adventurers_experience.png" + } + ] + }, + { + "dateAdded": "01/12/2021", + "isExpired": false, + "code": "153YuSaenh", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "adventurers_experience.png" + } + ] + }, + { + "dateAdded": "01/12/2021", + "isExpired": true, + "code": "Cuupmbjsvd", + "rewards": [ + { + "quantity": 50, + "materialType": "currency", + "image": "primogem.png" + } + ] + }, + { + "dateAdded": "12/24/2020", + "isExpired": false, + "code": "GSIMPTq125", + "rewards": [ + { + "quantity": 60, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": "12/11/2020", + "isExpired": true, + "code": "5KVeIbSxDUU", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10, + "materialType": "expWeapon", + "image": "mystic_enchancement_ore.png" + } + ] + }, + { + "dateAdded": "12/11/2020", + "isExpired": true, + "code": "G3tQq6TOqmE", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "heros_wit.png" + } + ] + }, + { + "dateAdded": "12/11/2020", + "isExpired": true, + "code": "eATDgIXLD56", + "rewards": [ + { + "quantity": 100, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 50000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": "11/10/2020", + "isExpired": false, + "code": "GENSHINGIFT", + "rewards": [ + { + "quantity": 50, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 3, + "materialType": "expCharacter", + "image": "heros_wit.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GOLNXLAKC58", + "rewards": [ + { + "quantity": 50, + "materialType": "currency", + "image": "primogem.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN1111", + "rewards": [ + { + "quantity": 60, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHINZHB30", + "rewards": [ + { + "quantity": 160, + "materialType": "currency", + "image": "primogem.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHINMHY0O", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHINMHY0M", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHINMHY0I", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN1006U", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "adventurers_experience.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN1006A", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "adventurers_experience.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN1006S", + "rewards": [ + { + "quantity": 30, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 5, + "materialType": "expCharacter", + "image": "adventurers_experience.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN0928E", + "rewards": [ + { + "quantity": 60, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN0928N", + "rewards": [ + { + "quantity": 60, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10000, + "materialType": "currency", + "image": "mora.png" + } + ] + }, + { + "dateAdded": null, + "isExpired": true, + "code": "GENSHIN0928A", + "rewards": [ + { + "quantity": 60, + "materialType": "currency", + "image": "primogem.png" + }, + { + "quantity": 10000, + "materialType": "currency", + "image": "mora.png" + } + ] + } + ] +} \ No newline at end of file diff --git a/lib/domain/assets.dart b/lib/domain/assets.dart index 45242110b..5aa2776c3 100644 --- a/lib/domain/assets.dart +++ b/lib/domain/assets.dart @@ -8,6 +8,7 @@ class Assets { static String artifactsDbPath = '$dbPath/artifacts.json'; static String materialsDbPath = '$dbPath/materials.json'; static String elementsDbPath = '$dbPath/elements.json'; + static String gameCodesDbPath = '$dbPath/game_codes.json'; static String translationsBasePath = 'assets/i18n'; //General diff --git a/lib/domain/models/db/game_codes/game_codes_file.dart b/lib/domain/models/db/game_codes/game_codes_file.dart new file mode 100644 index 000000000..e95e47fbd --- /dev/null +++ b/lib/domain/models/db/game_codes/game_codes_file.dart @@ -0,0 +1,31 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../models.dart'; + +part 'game_codes_file.freezed.dart'; +part 'game_codes_file.g.dart'; + +@freezed +abstract class GameCodesFile implements _$GameCodesFile { + factory GameCodesFile({ + @required List gameCodes, + }) = _GameCodesFile; + + GameCodesFile._(); + + factory GameCodesFile.fromJson(Map json) => _$GameCodesFileFromJson(json); +} + +@freezed +abstract class GameCodeFileModel implements _$GameCodeFileModel { + factory GameCodeFileModel({ + String dateAdded, + @required bool isExpired, + @required String code, + @required List rewards, + }) = _GameCodeFileModel; + + GameCodeFileModel._(); + + factory GameCodeFileModel.fromJson(Map json) => _$GameCodeFileModelFromJson(json); +} diff --git a/lib/domain/models/models.dart b/lib/domain/models/models.dart index 3271bb22a..8b135caf7 100644 --- a/lib/domain/models/models.dart +++ b/lib/domain/models/models.dart @@ -16,6 +16,7 @@ export 'db/characters/characters_file.dart'; export 'db/elements/element_debuff_file_model.dart'; export 'db/elements/element_reaction_file_model.dart'; export 'db/elements/elements_file.dart'; +export 'db/game_codes/game_codes_file.dart'; export 'db/materials/material_file_model.dart'; export 'db/materials/materials_file.dart'; export 'db/translations/translation_artifact_file.dart'; diff --git a/lib/domain/services/genshin_service.dart b/lib/domain/services/genshin_service.dart index 18db24593..1b995edf0 100644 --- a/lib/domain/services/genshin_service.dart +++ b/lib/domain/services/genshin_service.dart @@ -8,6 +8,7 @@ abstract class GenshinService { Future initArtifacts(); Future initMaterials(); Future initElements(); + Future initGameCodes(); Future initTranslations(AppLanguageType languageType); List getCharactersForCard(); @@ -42,4 +43,6 @@ abstract class GenshinService { List getMaterials(MaterialType type); int getServerDay(AppServerResetTimeType type); + + List getAllGameCodes(); } diff --git a/lib/infrastructure/genshin_service.dart b/lib/infrastructure/genshin_service.dart index 48d219bae..66a005f56 100644 --- a/lib/infrastructure/genshin_service.dart +++ b/lib/infrastructure/genshin_service.dart @@ -17,6 +17,7 @@ class GenshinServiceImpl implements GenshinService { ArtifactsFile _artifactsFile; MaterialsFile _materialsFile; ElementsFile _elementsFile; + GameCodesFile _gameCodesFile; GenshinServiceImpl(this._localeService); @@ -28,6 +29,7 @@ class GenshinServiceImpl implements GenshinService { initArtifacts(), initMaterials(), initElements(), + initGameCodes(), initTranslations(languageType), ]); } @@ -67,6 +69,13 @@ class GenshinServiceImpl implements GenshinService { _elementsFile = ElementsFile.fromJson(json); } + @override + Future initGameCodes() async { + final jsonStr = await rootBundle.loadString(Assets.gameCodesDbPath); + final json = jsonDecode(jsonStr) as Map; + _gameCodesFile = GameCodesFile.fromJson(json); + } + @override Future initTranslations(AppLanguageType languageType) async { final transJsonStr = await rootBundle.loadString(Assets.getTranslationPath(languageType)); @@ -480,4 +489,7 @@ class GenshinServiceImpl implements GenshinService { return server.weekday - 1; } + + @override + List getAllGameCodes() => _gameCodesFile.gameCodes; }