mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-23 12:23:04 +00:00
Added method to check what the current pokemon is
Useful if someone uses random, then wants to know what it was changed to.
This commit is contained in:
parent
1d579bae01
commit
13063b112b
3 changed files with 16 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
tell application "iTerm"
|
||||
tell current session of current window
|
||||
set background image to "/Users/Laki/GitHub/Pokemon-Terminal-Themes/Images/Generation IV - Sinnoh/478.png"
|
||||
set background image to "/Users/Laki/GitHub/Pokemon-Terminal-Themes/Images/Generation IV - Sinnoh/390.png"
|
||||
end tell
|
||||
end tell
|
11
extractor.py
11
extractor.py
|
@ -43,3 +43,14 @@ def pokemon_containing(word):
|
|||
if word in trimmed:
|
||||
result.append(printer.add_zeroes(pokemon))
|
||||
return result
|
||||
|
||||
|
||||
# Get the current Pokemon that is in the background.
|
||||
def current_pokemon():
|
||||
content = open(os.get_exec_path()[0] + "/Scripts/background.scpt", "r+").readlines()
|
||||
pokemon_id = content[2][len(content[2])-9:-6]
|
||||
all_pokemon = load_names()
|
||||
for pokemon in all_pokemon:
|
||||
if int(pokemon.split(' ')[0]) == int(pokemon_id):
|
||||
print(pokemon[:-1]) # Remove the new line at the end.
|
||||
break
|
||||
|
|
5
main.py
5
main.py
|
@ -4,6 +4,7 @@
|
|||
|
||||
from sys import argv
|
||||
import backchanger
|
||||
import extractor
|
||||
import printer
|
||||
import random
|
||||
import sys
|
||||
|
@ -27,7 +28,7 @@ if __name__ == "__main__":
|
|||
print("No command line arguments specified. Try typing in a Pokemon name or number.")
|
||||
elif len(argv) == 2:
|
||||
arg = argv[1].lower()
|
||||
if len(arg) == 1 and not arg.isdigit():
|
||||
if len(arg) == 1 and arg.isalpha():
|
||||
printer.print_pokemon_starting_with(arg)
|
||||
elif arg == "regions":
|
||||
printer.print_regions()
|
||||
|
@ -47,6 +48,8 @@ if __name__ == "__main__":
|
|||
debug()
|
||||
elif arg == "rand" or arg == "random":
|
||||
backchanger.change_background(random.randint(1, 494))
|
||||
elif arg == "?" or arg == "current":
|
||||
extractor.current_pokemon()
|
||||
else:
|
||||
backchanger.change_background(arg)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue