Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DrRetro2033 committed Mar 30, 2022
2 parents d07a391 + 4803164 commit 86b518e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ View, organize, and manage your Pokémon.

What is Pokémon Manager?
-
As the 3ds and Wii U's e-shop draws to a close, all online only services will be lost to time. One of the most consering is Pokémon Bank, as soon your pokémon from the 3DS games, and consequently DS games, and GBA games will be trapped on your console. Thankfully, the 3ds homebrewing and the Pokémon community has already made software to transfer help transfer Pokémon to the switch. The most important software for this process is [PKHeX](https://github.com/kwsch/PKHeX), as it allows users to copy pokémon from one save file to another. [PKHeX](https://github.com/kwsch/PKHeX) is an amazing piece of software, but in my option, the only problem I have with it is the pk database. The pk database is only designed to store copies of Pokémon, but I feel that it could be expanded to be a easier way to store pokémon on your computer. So I created Pokémon Manager with the main goal of being an alternative to Pokémon Bank and Pokémon Home. Pokémon Manager will start out as a Windows exclusive program; but I am planning, after I get the foundation built, to make a linux version too. As I do not have a Mac machine lying around my house, I am not planning to make a Mac version, but because Pokémon Manager is made on the godot engine and open-source, someone could compile it to Mac and test it.
Pokémon Manager is alternative to Pokémon Bank and Pokémon Home for computers.

IMPORTANT:
-
Expand Down Expand Up @@ -32,8 +32,9 @@ Features:
- By my understanding of the Godot Engine, you could theoretically keep Pokémon Manager, [PKHeX](https://github.com/kwsch/PKHeX), and your pokémon on a usb stick and plug it into a brand new computer and it should work. Although [PKHeX](https://github.com/kwsch/PKHeX) will not work unless you install .NET Core onto the computer
- Level of Pokémon is displayed next to the gender of the pokemon.
- Ability to make multiple parties.
- Compatibility with alternate forms (Currently, there are no PokéDex entries for alternate Pokémon in PokéAPI so alternate forms will show the first form's entry nad not the correct form's entry. This will be fixed in a future update)
- Compatibility with alternate forms (Currently, there are no PokéDex entries for alternate Pokémon in PokéAPI so alternate forms will show the first form's entry and not the correct form's entry. This will be fixed in a future update)
- Make a personalized profile.
- Copy parties and boxes to your clipboard and paste them into Pokémon Showdown.

In progress/Planned:
-
Expand Down
53 changes: 28 additions & 25 deletions scripts/pkm.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ var data_translate = load("res://scripts/Pokemon_Database.gd").new()
var pk5 = load("res://scripts/pk5.gd").new()
var pk6 = load("res://scripts/pk6.gd").new()
var pk7 = load("res://scripts/pk7.gd").new()
var walking_pokemon = load("res://WalkingPokemon.tscn")
var info : Dictionary
var moves : Dictionary
var flavor_text : String
var form : int
var growth : String
var walking_pokemon = load("res://WalkingPokemon.tscn") #this is the scene that contains the animations and sprite of the pokemon walking into the bank
var info : Dictionary #basic info for the pokemon
var moves : Dictionary #hold all known moves a pokemon has
var flavor_text : String #the first pokedex entry that a pokemon has
var form : int #what alt form the pokemon is
var growth : String #the speed at which pokemon level up at (needed for converting exp to levels)
var pokemon_url : String
func _ready():
print(BinaryTranslator.bin_to_int(BinaryTranslator.int_to_bin(2254250705)))
var dir = Directory.new()
print(BinaryTranslator.bin_to_int(BinaryTranslator.int_to_bin(2254250705))) #this is for testing the binary translator by having it convert this number to binary and back
var dir = Directory.new() #instances a new directory object
var path : String = OS.get_executable_path().get_base_dir()+"/pkmdb"
$"Loading Screen".switch("reading")
var user_pokemon
if path == "C:/Program Files (x86)/Steam/steamapps/common/Godot Engine/pkmdb":
if path == "C:/Program Files (x86)/Steam/steamapps/common/Godot Engine/pkmdb": #this is only for testing purposes as I keep the pkmdb folder in this directory
user_pokemon = list_files_in_directory(pokemon_path) #lists all of the pk files in pkmdb folder
else:
user_pokemon = list_files_in_directory(path)
Expand All @@ -31,7 +31,7 @@ func _ready():
Trainer.trainer_picture = existing_pokemon.trainer_picture
Trainer.first_time_setup = false
$ProfilePic/Pic.texture = existing_pokemon.trainer_picture
#this chunk of code jod is to get all of the pokemon that already exists in the bank and remove null/empty slots
#this chunk of code's job is to get all of the pokemon that already exists in the bank and remove null/empty slots
var without_null = []
if existing_pokemon.data != {}:
for x in existing_pokemon.data:
Expand All @@ -54,34 +54,33 @@ func get_info(user_pokemon, existing_pokemon):
var id = 0 #this is for giving the pokemon unqie keys
var pokemon = {}
var order = []
$"Loading Screen/ProgressBar".max_value = user_pokemon.size()
if existing_pokemon != null and not existing_pokemon.data.empty():
$"Loading Screen/ProgressBar".max_value = user_pokemon.size() #sets the progress bar's max value to the amount of pokemon the user has
if existing_pokemon != null and not existing_pokemon.data.empty(): #checks to see if there is any existing pokemon in the bank file and if there is then add them to the database
pokemon = existing_pokemon.data
order = existing_pokemon.order
while user_pokemon.size() > 0:
var array #tempory array for personal data about the pokemon
var file = user_pokemon.front()
user_pokemon.remove(0)
match file.get_extension(): #switches the correct pk script to read the pk file
user_pokemon.remove(0) #removes the pokemon so that godot does not read it again and get stuck in a loop
match file.get_extension(): #switches to the correct pk script to read the pk file
"pk5":
array = pk5.readpk(file)
"pk6":
array = pk6.readpk(file)
"pk7":
array = pk7.readpk(file)
#asks PokeAPI for infomation about the pokemons species and moves
if existing_pokemon != null and not existing_pokemon.data.empty() and pokemon.has(array["id"]):
if existing_pokemon != null and not existing_pokemon.data.empty() and pokemon.has(array["id"]): #if the pokemon is already in the database, skip it
print(array)
id += 1
continue
else:
else: #asks PokeAPI for infomation about the pokemons species and known moves
$"Loading Screen".switch("api") #changes loading screen text
form = array["form"] #tells the species request which form the pokemon is
$SpeciesRequest.request(url+"pokemon-species/"+str(int(array["species"])))
yield($SpeciesRequest, "request_completed")
$PokemonRequest.request(pokemon_url)
yield($PokemonRequest, "request_completed")
var move_names = ["move1","move2","move3","move4"]
var move_names = ["move1","move2","move3","move4"]
for x in move_names:
if array[x] > 0:
$MoveRequest.request(url+"move/"+str(int(array[x])))
Expand All @@ -101,11 +100,11 @@ func get_info(user_pokemon, existing_pokemon):
array[x]["pp"] = 0
array[x]["power"] = 0
array[x]["accuracy"] = 0
array["level"] = Pokemon.level(array["exp"],growth)
array["level"] = Pokemon.level(array["exp"],growth) #converts the pokemon total exp and converts it the pokemon's level
array["species"] = info["species"]
array["sprite"] = info["sprite"]
array["sprite"] = info["sprite"]
array["species-name"] = info["species-name"]
if array["nickname"] == "":
if array["nickname"] == "": #if the nickname is blank then that means that the pokemon's name is just it's species name
array["nickname"] = info["species-name"].capitalize()
array["type1"] = info["type1"]
array["type2"] = info["type2"]
Expand All @@ -116,7 +115,8 @@ func get_info(user_pokemon, existing_pokemon):
array["spd"] = info["spd"]
array["spe"] = info["spe"]
array["text"] = flavor_text
if existing_pokemon != null and existing_pokemon.data.has(array["id"]):
#this should be removed in the future
if existing_pokemon != null and existing_pokemon.data.has(array["id"]):
id += 1
moves.clear()
info.clear()
Expand All @@ -125,12 +125,15 @@ func get_info(user_pokemon, existing_pokemon):
growth = ""
continue
else:
#
pokemon[array["id"]] = {}
pokemon[array["id"]] = array
order.push_back(array["id"])
#this part creates and starts the walking pokemon
var walk = walking_pokemon.instance()
$"Loading Screen".add_child(walk)
walk.start(array)
#
print(array)
moves.clear()
info.clear()
Expand All @@ -140,7 +143,7 @@ func get_info(user_pokemon, existing_pokemon):
$"Loading Screen/ProgressBar".value += 1
id += 1
#
Pokemon.set_data(pokemon)
Pokemon.set_data(pokemon) #makes a copy of the temporary dictionary and gives it to the object Pokemon for public access
$"Loading Screen".switch("layout")
$TabContainer.addPokemon(order)

Expand Down Expand Up @@ -215,7 +218,7 @@ func _on_SpeciesRequest_request_completed(result, response_code, headers, body):
var data = json.result
var text = data.flavor_text_entries
for x in text:
var characters = "abcdefghijklmnopqrstuvwxyz.,'`é?!1234567890-’"
var characters = "abcdefghijklmnopqrstuvwxyz.,'`é?!1234567890-’" #will be removed
if x.language.name == "en":
flavor_text = x.flavor_text
flavor_text = removeEscapechars(flavor_text)
Expand All @@ -240,7 +243,7 @@ func _process(delta):
$PopupMenu.popup()
$PopupMenu.set_global_position(get_viewport().get_mouse_position())

func removeEscapechars(text):
func removeEscapechars(text): #removes all escape charaters that messes up the pokedex entries
var ascii_text = Array(flavor_text.to_utf8())
while ascii_text.has(12):
var pos = ascii_text.find(12)
Expand Down

0 comments on commit 86b518e

Please sign in to comment.