From d33cdfb275c156e715567d41eb99a00da61352b0 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sun, 1 Jun 2025 14:16:16 -0700 Subject: [PATCH] Add more dex entries --- lib/Consts.dart | 2 +- lib/MainApp.dart | 29 ++++ lib/Session.dart | 27 ++++ lib/UpdateCheck.dart | 16 +++ lib/dexMisc.dart | 17 +++ lib/filters.dart | 16 +++ lib/generations/Gen1Data.dart | 261 ++++++++++++++++++++++++++++++++++ lib/pokemon.dart | 14 +- pubspec.yaml | 3 +- 9 files changed, 379 insertions(+), 6 deletions(-) diff --git a/lib/Consts.dart b/lib/Consts.dart index 925a60f..8ca80ef 100644 --- a/lib/Consts.dart +++ b/lib/Consts.dart @@ -1,5 +1,5 @@ class Constants { - static const VERSION = "1.0.060125+0216"; + static const VERSION = "1.0.060125+1415"; //static bool get isMobile => Platform.isAndroid || Platform.isIOS; } diff --git a/lib/MainApp.dart b/lib/MainApp.dart index 017e7dc..66d4fd4 100644 --- a/lib/MainApp.dart +++ b/lib/MainApp.dart @@ -21,6 +21,8 @@ class _MainAppState extends State { setState(() { SessionData.darkMode = !SessionData.darkMode; }); + + SessionData.finalize(); } @override @@ -48,6 +50,21 @@ class Home extends StatefulWidget { } class _HomeState extends State { + @override + void didChangeDependencies() { + SessionData.callbacks.mainPage = widget.toggleTheme; + SessionData.initialize(); + + super.didChangeDependencies(); + } + + @override + void dispose() { + SessionData.callbacks.mainPage = null; + + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -167,9 +184,21 @@ class _DexEntryState extends State { void didChangeDependencies() { int index = ModalRoute.of(context)!.settings.arguments as int; _pkmn = Pokemon.values[index]; + + SessionData.callbacks.dexDisplay = () async { + setState(() {}); + }; + super.didChangeDependencies(); } + @override + void dispose() { + SessionData.callbacks.dexDisplay = null; + + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/Session.dart b/lib/Session.dart index d09665f..6254706 100644 --- a/lib/Session.dart +++ b/lib/Session.dart @@ -1,8 +1,35 @@ import 'dart:math'; +import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart'; import 'package:pokedex/pokemon.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class Callbacks { + Function()? mainPage; + Function()? filtersPage; + Function()? dexDisplay; + Function()? updateCheckPage; + + Future dispatch() async { + if (mainPage != null) mainPage.call(); + if (filtersPage != null) filtersPage.call(); + if (dexDisplay != null) dexDisplay.call(); + if (updateCheckPage != null) updateCheckPage.call(); + } +} class SessionData { + static Future initialize() async { + SharedPreferencesAsync spa = SharedPreferencesAsync(); + darkMode = await spa.getBool("dark") ?? false; + } + + static Future finalize() async { + SharedPreferencesAsync spa = SharedPreferencesAsync(); + await spa.setBool("dark", darkMode); + } + + static Callbacks callbacks = Callbacks(); static bool isUpdateAvailable = false; static bool enableDescription = true; static bool darkMode = false; diff --git a/lib/UpdateCheck.dart b/lib/UpdateCheck.dart index f370f84..8a1eedc 100644 --- a/lib/UpdateCheck.dart +++ b/lib/UpdateCheck.dart @@ -39,6 +39,22 @@ class _UPDCheck extends State { super.initState(); } + @override + void didChangeDependencies() { + SessionData.callbacks.updateCheckPage = () async { + setState(() {}); + }; + + super.didChangeDependencies(); + } + + @override + void dispose() { + SessionData.callbacks.updateCheckPage = null; + + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/dexMisc.dart b/lib/dexMisc.dart index e97dce3..442cf43 100644 --- a/lib/dexMisc.dart +++ b/lib/dexMisc.dart @@ -100,6 +100,21 @@ enum GameRoute { MirageTower(commonName: "Mirage Tower"), UndergroundPath5_6(commonName: "Underground Path 5-6"), MtPyre(commonName: "Mt. Pyre"), + RockTunnel(commonName: "Rock Tunnel"), + SeafoamIslands(commonName: "Seafoam Islands"), + DarkCave(commonName: "Dark Cave"), + IcePath(commonName: "Ice Path"), + SlowpokeWell(commonName: "Slowpoke Well"), + WhirlIslands(commonName: "Whirl Islands"), + CaveOfOrigin(commonName: "Cave of Origin"), + GraniteCave(commonName: "Granite Cave"), + MeteorFalls(commonName: "Meteor Falls"), + SeafloorCavern(commonName: "Seafloor Cavern"), + ShoalCave(commonName: "Shoal Cave"), + AlteringCave(commonName: "Altering Cave"), + IcefallCave(commonName: "Icefall Cave"), + LostCave(commonName: "Lost Cave"), + SkyPillar(commonName: "Sky Pillar"), // The following mark the pokemon as not usually obtainable TradeOrMigrate(commonName: "Trade or Migrate from another game"), @@ -133,6 +148,8 @@ enum Game { FireRed(commonName: "Fire Red"), LeafGreen(commonName: "Leaf Green"), Emerald, + Colosseum, + XD(commonName: "XD Gale of Darkness"), Diamond, Pearl, Platinum, diff --git a/lib/filters.dart b/lib/filters.dart index 1173371..4934df0 100644 --- a/lib/filters.dart +++ b/lib/filters.dart @@ -12,6 +12,22 @@ class FilterPage extends StatefulWidget { } class _filterPage extends State { + @override + void didChangeDependencies() { + SessionData.callbacks.filtersPage = () async { + setState(() {}); + }; + + super.didChangeDependencies(); + } + + @override + void dispose() { + SessionData.callbacks.filtersPage = null; + + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/generations/Gen1Data.dart b/lib/generations/Gen1Data.dart index 713ec60..48d4fba 100644 --- a/lib/generations/Gen1Data.dart +++ b/lib/generations/Gen1Data.dart @@ -1682,6 +1682,161 @@ class Gen1Locations { ], ), ]; + static const List Zubat = [ + Location( + Game.Red, + [ + GameRoute.MtMoon, + GameRoute.RockTunnel, + GameRoute.SeafoamIslands, + GameRoute.VictoryRoad, + ], + Generation.One, + additionalGames: [Game.Blue, Game.Yellow], + ), + Location( + Game.Gold, + [ + GameRoute.RT3, + GameRoute.RT4, + GameRoute.RT32, + GameRoute.RT33, + GameRoute.RT42, + GameRoute.BurnedTower, + GameRoute.DarkCave, + GameRoute.IcePath, + GameRoute.IlexForest, + GameRoute.MtMoon, + GameRoute.MtMortar, + GameRoute.RockTunnel, + GameRoute.SlowpokeWell, + GameRoute.TohjoFalls, + GameRoute.UnionCave, + GameRoute.WhirlIslands, + ], + Generation.Two, + additionalGames: [Game.Silver], + ), + Location(Game.Crystal, [ + GameRoute.RT3, + GameRoute.RT4, + GameRoute.RT9, + GameRoute.RT10, + GameRoute.RT30, + GameRoute.RT31, + GameRoute.RT32, + GameRoute.RT33, + GameRoute.RT42, + GameRoute.BurnedTower, + GameRoute.DarkCave, + GameRoute.IcePath, + GameRoute.MtMoon, + GameRoute.MtMortar, + GameRoute.RockTunnel, + GameRoute.SlowpokeWell, + GameRoute.TohjoFalls, + GameRoute.UnionCave, + GameRoute.WhirlIslands, + ], Generation.Two), + Location( + Game.Ruby, + [ + GameRoute.CaveOfOrigin, + GameRoute.GraniteCave, + GameRoute.MeteorFalls, + GameRoute.SeafloorCavern, + GameRoute.ShoalCave, + GameRoute.VictoryRoad, + ], + Generation.Three, + additionalGames: [Game.Sapphire], + ), + Location(Game.Emerald, [ + GameRoute.AlteringCave, + GameRoute.CaveOfOrigin, + GameRoute.GraniteCave, + GameRoute.MeteorFalls, + GameRoute.SeafloorCavern, + GameRoute.ShoalCave, + GameRoute.VictoryRoad, + ], Generation.Three), + Location( + Game.FireRed, + [ + GameRoute.IcefallCave, + GameRoute.LostCave, + GameRoute.MtMoon, + GameRoute.RockTunnel, + GameRoute.SeafoamIslands, + GameRoute.VictoryRoad, + ], + Generation.Three, + additionalGames: [Game.LeafGreen], + ), + ]; + static const List Golbat = [ + Location( + Game.Red, + [GameRoute.CeruleanCave, GameRoute.SeafoamIslands, GameRoute.VictoryRoad], + Generation.One, + additionalGames: [Game.Blue, Game.Yellow], + ), + Location( + Game.Gold, + [ + GameRoute.DarkCave, + GameRoute.IcePath, + GameRoute.MtMortar, + GameRoute.MtSilver, + GameRoute.SlowpokeWell, + GameRoute.TohjoFalls, + GameRoute.UnionCave, + GameRoute.WhirlIslands, + GameRoute.VictoryRoad, + ], + Generation.Two, + additionalGames: [Game.Silver], + ), + Location(Game.Crystal, [ + GameRoute.RT28, + GameRoute.RT42, + GameRoute.DarkCave, + GameRoute.IcePath, + GameRoute.MtMortar, + GameRoute.MtSilver, + GameRoute.RockTunnel, + GameRoute.SlowpokeWell, + GameRoute.TohjoFalls, + GameRoute.UnionCave, + GameRoute.WhirlIslands, + GameRoute.VictoryRoad, + ], Generation.Two), + Location( + Game.Ruby, + [ + GameRoute.CaveOfOrigin, + GameRoute.MeteorFalls, + GameRoute.SeafloorCavern, + GameRoute.ShoalCave, + GameRoute.SkyPillar, + GameRoute.VictoryRoad, + ], + Generation.Three, + additionalGames: [Game.Sapphire, Game.Emerald], + ), + Location( + Game.FireRed, + [ + GameRoute.CeruleanCave, + GameRoute.IcefallCave, + GameRoute.LostCave, + GameRoute.SeafoamIslands, + GameRoute.VictoryRoad, + ], + Generation.Three, + additionalGames: [Game.LeafGreen], + ), + ]; } class Gen1DexData { @@ -3679,4 +3834,110 @@ class Gen1DexData { Generation.Three, ), ]; + static const List Zubat = [ + DexEntry( + Game.Red, + "Forms colonies in perpetually dark places. Uses ultrasonic waves to identify and approach targets.", + Generation.One, + additionalGames: [Game.Blue], + ), + DexEntry( + Game.Yellow, + "Emits ultrasonic cries while it flies. They act as a sonar used to check for objects in its way.", + Generation.One, + ), + DexEntry( + Game.Gold, + "While flying, it constantly emits ultrasonic waves from its mouth to check its surroundings.", + Generation.Two, + ), + DexEntry( + Game.Silver, + "Capable of flying safely in dark places, it emits ultrasonic cries to check for any obstacles.", + Generation.Two, + ), + DexEntry( + Game.Crystal, + "During the day, it gathers with others and hangs from the ceilings of old buildings and caves.", + Generation.Two, + ), + DexEntry( + Game.Ruby, + "ZUBAT remains quietly unmoving in a dark spot during the bright daylight hours. It does so because prolonged exposure to the sun causes its body to become slightly burned.", + Generation.Three, + ), + DexEntry( + Game.Sapphire, + "ZUBAT avoids sunlight because exposure causes it to become unhealthy. During the daytime, it stays in caves or under the eaves of old houses, sleeping while hanging upside down.", + Generation.Three, + ), + DexEntry( + Game.FireRed, + "It has no eyes. Instead, it relies on its ultrasonic cries for echo location to flit about in darkness.", + Generation.Three, + ), + DexEntry( + Game.LeafGreen, + "It forms colonies in perpetually dark places and uses ultrasonic waves to identify and approach targets.", + Generation.Three, + ), + DexEntry( + Game.Emerald, + "While living in pitch-black caverns, their eyes gradually grew shut and deprived them of vision. They use ultrasonic waves to detect obstacles.", + Generation.Three, + ), + ]; + static const List Golbat = [ + DexEntry( + Game.Red, + "Once it strikes, it will not stop draining energy from the victim even if it gets too heavy to fly.", + Generation.One, + additionalGames: [Game.Blue], + ), + DexEntry( + Game.Yellow, + "It attacks in a stealthy manner, without warning. Its sharp fangs are used to bite and suck blood.", + Generation.One, + ), + DexEntry( + Game.Gold, + "However hard its victim’s hide may be, it punctures with sharp fangs and gorges itself with blood.", + Generation.Two, + ), + DexEntry( + Game.Silver, + "It can drink more than 10 ounces of blood at once. If it has too much, it gets heavy and flies clumsily.", + Generation.Two, + ), + DexEntry( + Game.Crystal, + "When it plunges its fangs into its prey, it instantly draws and gulps down more than ten ounces of blood.", + Generation.Two, + ), + DexEntry( + Game.Ruby, + "GOLBAT loves to drink the blood of living things. It is particularly active in the pitch black of night. This POKéMON flits around in the night skies, seeking fresh blood.", + Generation.Three, + ), + DexEntry( + Game.Sapphire, + "GOLBAT bites down on prey with its four fangs and drinks the victim’s blood. It becomes active on inky dark moonless nights, flying around to attack people and POKéMON.", + Generation.Three, + ), + DexEntry( + Game.FireRed, + "It clamps down on its prey with needle-sharp fangs and drains over 10 ounces of blood in one gulp.", + Generation.Three, + ), + DexEntry( + Game.LeafGreen, + "Once it bites, it will not stop draining energy from the victim even if it gets too heavy to fly.", + Generation.Three, + ), + DexEntry( + Game.Emerald, + "Its fangs easily puncture even thick animal hide. It loves to feast on the blood of people and POKéMON. It flits about in darkness and strikes from behind.", + Generation.Three, + ), + ]; } diff --git a/lib/pokemon.dart b/lib/pokemon.dart index baa0468..c95bbf3 100644 --- a/lib/pokemon.dart +++ b/lib/pokemon.dart @@ -444,16 +444,22 @@ enum Pokemon { locations: Gen1Locations.Wigglytuff, dexEntries: Gen1DexData.Wigglytuff, ), - Zubat(41, Generation.One, [ - Type.Poison, - Type.Flying, - ], SingleEvolution(42, 22)), + Zubat( + 41, + Generation.One, + [Type.Poison, Type.Flying], + SingleEvolution(42, 22), + locations: Gen1Locations.Zubat, + dexEntries: Gen1DexData.Zubat, + ), Golbat( 42, Generation.One, [Type.Poison, Type.Flying], SingleEvolution(169, -1, condition: [EvolutionCondition.HighFriendship]), previousPokemon: 41, + locations: Gen1Locations.Golbat, + dexEntries: Gen1DexData.Golbat, ), Oddish(43, Generation.One, [ Type.Poison, diff --git a/pubspec.yaml b/pubspec.yaml index 92a6b88..b90a294 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.060125+0216 +version: 1.0.060125+1415 environment: sdk: ^3.7.0 @@ -43,6 +43,7 @@ dependencies: ota_update: ^7.0.1 dio: ^5.8.0+1 wakelock_plus: ^1.3.2 + shared_preferences: ^2.5.3 dev_dependencies: flutter_test: