From e0a520c8ea88b5d1b14d3e2a1d02eed4371a8949 Mon Sep 17 00:00:00 2001 From: Khiem Ton Date: Fri, 24 Mar 2023 15:39:29 +0700 Subject: [PATCH] refactor: import --- ispoof/lists/__init__.py | 3 ++ main.py | 76 +++++++++++++++++++++++++++------------- 2 files changed, 55 insertions(+), 24 deletions(-) diff --git a/ispoof/lists/__init__.py b/ispoof/lists/__init__.py index e69de29..54e6e7a 100644 --- a/ispoof/lists/__init__.py +++ b/ispoof/lists/__init__.py @@ -0,0 +1,3 @@ +from .pokemonlist import PokemonList +from .raidlist import RaidList +from .playerhistory import PlayerHistory \ No newline at end of file diff --git a/main.py b/main.py index 49141d6..459f8b5 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,8 @@ from ispoof.objects.player import Player from ispoof.spoofer.scraper import Scraper from ispoof.spoofer.device import Device -from ispoof.lists.pokemonlist import PokemonList +from ispoof.lists import PokemonList, RaidList + from ispoof.data import Database if __name__ == "__main__": @@ -17,31 +18,58 @@ if __name__ == "__main__": scraper = Scraper() pokemon_lst = PokemonList(engine=engine) + raid_lst = RaidList(engine=engine) while True: - pokemons = scraper.get_hundos() - pokemon_lst.insert_to_database(pokemons) - print("1. Sort by name") - print("2. Sort by level") - print("3. Sort by CP") - print("4. Sort by distance") - print("5. Search name") - choice = int(input("Your choice: ")) - if choice == 1: - pokemons = pokemon_lst.sort_by_name() - elif choice == 2: - pokemons = pokemon_lst.sort_by_level() - elif choice == 3: - pokemons = pokemon_lst.sort_by_cp() - elif choice == 4: - pokemons = pokemon_lst.sort_by_distance(player.location) + print("1. Raid") + print("2. Pokemon") + raid_or_mon = int(input("Choose 1: ")) + if raid_or_mon == 1: + raids = scraper.get_raids() + raid_lst.insert_to_database(raids) + print("1. Sort by name") + print("2. Sort by level") + print("3. Sort by distance") + print("4. Search name") + choice = int(input("Your choice: ")) + if choice == 1: + raids = raid_lst.sort_by_name() + elif choice == 2: + raids = raid_lst.sort_by_level() + elif choice == 3: + raids = raid_lst.sort_by_distance(player.location) + else: + raids = raid_lst.search_by_name(input("Enter query: ")) + print("Raid List:") + for i, raid in enumerate(raids): + print(i, raid) + i = int(input("Choose raid: ")) + pokemon = raids[i] + location = raid.location else: - pokemons = pokemon_lst.search_by_name(input("Enter query: ")) - print("Pokemon List:") - for i, pokemon in enumerate(pokemons): - print(i, pokemon) - i = int(input("Choose pokemon: ")) - pokemon = pokemons[i] - location = pokemon.location + pokemons = scraper.get_hundos() + pokemon_lst.insert_to_database(pokemons) + print("1. Sort by name") + print("2. Sort by level") + print("3. Sort by CP") + print("4. Sort by distance") + print("5. Search name") + choice = int(input("Your choice: ")) + if choice == 1: + pokemons = pokemon_lst.sort_by_name() + elif choice == 2: + pokemons = pokemon_lst.sort_by_level() + elif choice == 3: + pokemons = pokemon_lst.sort_by_cp() + elif choice == 4: + pokemons = pokemon_lst.sort_by_distance(player.location) + else: + pokemons = pokemon_lst.search_by_name(input("Enter query: ")) + print("Pokemon List:") + for i, pokemon in enumerate(pokemons): + print(i, pokemon) + i = int(input("Choose pokemon: ")) + pokemon = pokemons[i] + location = pokemon.location device.spoof_gps(location) did_activity = None print("Spoof to")