-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
__init__.py
5998 lines (5371 loc) · 297 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
# Ankimon
# Copyright (C) 2024 Unlucky-Life
# This program is free software: you can redistribute it and/or modify
# by the Free Software Foundation
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Important - If you redistribute it and/or modify this addon - must give contribution in Title and Code
# aswell as ask for permission to modify / redistribute this addon or the code itself
import os, sys
from aqt.utils import *
from typing import Optional
from aqt.qt import *
import anki
import threading
from anki.hooks import addHook, wrap
from aqt.reviewer import Reviewer
from aqt import mw, editor, gui_hooks
from aqt.qt import QDialog, QGridLayout, QLabel, QPixmap, QPainter, QFont, Qt, QVBoxLayout, QWidget, QAction
import random
import csv
from aqt.qt import *
import requests
import json
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from PyQt6.QtCore import *
from PyQt6.QtWebEngineWidgets import *
#from PyQt6.QtWidgets import QAction
from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton, QDialog, QVBoxLayout, QLabel, QWidget
from PyQt6.QtMultimedia import QMediaPlayer
from PyQt6.QtMultimediaWidgets import QVideoWidget
#from PyQt6.QtCore import QUrl
import base64
from aqt import utils
from PyQt6.QtGui import QSurfaceFormat
import aqt
import pathlib
from pathlib import Path
from typing import List, Union
import shutil
import distutils.dir_util
from anki.collection import Collection
import csv
import time, wave
import platform
#from .download_pokeapi_db import create_pokeapidb
config = mw.addonManager.getConfig(__name__)
#show config .json file
# Find current directory
addon_dir = Path(__file__).parents[0]
currdirname = addon_dir
def check_folders_exist(parent_directory, folder):
folder_path = os.path.join(parent_directory, folder)
if not os.path.isdir(folder_path):
return False
else:
return True
def check_file_exists(folder, filename):
file_path = os.path.join(folder, filename)
if os.path.isfile(file_path):
return True
else:
return False
#safe route for updates
user_path = addon_dir / "user_files"
user_path_data = addon_dir / "user_files" / "data_files"
user_path_sprites = addon_dir / "user_files" / "sprites"
# Assign Pokemon Image folder directory name
pkmnimgfolder = addon_dir / "user_files" / "sprites"
backdefault = addon_dir / "user_files" / "sprites" / "back_default"
frontdefault = addon_dir / "user_files" / "sprites" / "front_default"
#Assign saved Pokemon Directory
mypokemon_path = addon_dir / "user_files" / "mypokemon.json"
mainpokemon_path = addon_dir / "user_files" / "mainpokemon.json"
battlescene_path = addon_dir / "addon_sprites" / "battle_scenes"
battlescene_path_without_dialog = addon_dir / "addon_sprites" / "battle_scenes_without_dialog"
battle_ui_path = addon_dir / "pkmnbattlescene - UI_transp"
type_style_file = addon_dir / "addon_files" / "types.json"
next_lvl_file_path = addon_dir / "addon_files" / "ExpPokemonAddon.csv"
berries_path = addon_dir / "user_files" / "sprites" / "berries"
background_dialog_image_path = addon_dir / "background_dialog_image.png"
pokedex_image_path = addon_dir / "addon_sprites" / "pokedex_template.jpg"
evolve_image_path = addon_dir / "addon_sprites" / "evo_temp.jpg"
learnset_path = addon_dir / "user_files" / "data_files" / "learnsets.json"
pokedex_path = addon_dir / "user_files" / "data_files" / "pokedex.json"
moves_file_path = addon_dir / "user_files" / "data_files" / "moves.json"
items_path = addon_dir / "user_files" / "sprites" / "items"
badges_path = addon_dir / "user_files" / "sprites" / "badges"
itembag_path = addon_dir / "user_files" / "items.json"
badgebag_path = addon_dir / "user_files" / "badges.json"
pokenames_lang_path = addon_dir / "user_files" / "data_files" / "pokemon_species_names.csv"
pokedesc_lang_path = addon_dir / "user_files" / "data_files" / "pokemon_species_flavor_text.csv"
pokeapi_db_path = user_path_data / "pokeapi_db.json"
starters_path = addon_dir / "addon_files" / "starters.json"
eff_chart_html_path = addon_dir / "addon_files" / "eff_chart_html.html"
effectiveness_chart_file_path = addon_dir / "addon_files" / "eff_chart.json"
table_gen_id_html_path = addon_dir / "addon_files" / "table_gen_id.html"
#pokemon species id files
pokemon_species_normal_path = addon_dir / "user_files" / "pkmn_data" / "normal.json"
pokemon_species_legendary_path = addon_dir / "user_files" / "pkmn_data" / "legendary.json"
pokemon_species_ultra_path = addon_dir / "user_files" / "pkmn_data" / "ultra.json"
pokemon_species_mythical_path = addon_dir / "user_files" / "pkmn_data" / "mythical.json"
pokemon_species_baby_path = addon_dir / "user_files" / "pkmn_data" / "baby.json"
# Get the profile folder
profilename = mw.pm.name
#profilefolder = Path(mw.pm.profileFolder())
#mediafolder = Path(mw.col.media.dir())
font_name = "Axolotl"
font_file = "Axolotl.ttf"
font_path = addon_dir / "addon_files" / font_file
mainpkmn = 0
mainpokemon_hp = 100
#test mainpokemon
#battlescene_file = "pkmnbattlescene.png"
pokemon_encounter = 0
# check for sprites, data
sound_files = check_folders_exist(pkmnimgfolder, "sounds")
back_sprites = check_folders_exist(pkmnimgfolder, "back_default")
back_default_gif = check_folders_exist(pkmnimgfolder, "back_default_gif")
front_sprites = check_folders_exist(pkmnimgfolder, "front_default")
front_default_gif = check_folders_exist(pkmnimgfolder, "front_default_gif")
item_sprites = check_folders_exist(pkmnimgfolder, "items")
badges_sprites = check_folders_exist(pkmnimgfolder, "badges")
berries_sprites = check_folders_exist(addon_dir, "berries")
poke_api_data = check_file_exists(user_path_data, "pokeapi_db.json")
pokedex_data = check_file_exists(user_path_data, "pokedex.json")
learnsets_data = check_file_exists(user_path_data, "learnsets.json")
poke_api_data = check_file_exists(user_path_data, "pokeapi_db.json")
pokedex_data = check_file_exists(user_path_data, "pokedex.json")
moves_data = check_file_exists(user_path_data, "moves.json")
if pokedex_data and learnsets_data and moves_data and back_sprites and front_sprites and front_default_gif and back_default_gif and item_sprites and badges_sprites == True:
database_complete = True
else:
database_complete = False
class CheckFiles(QDialog):
def __init__(self):
super().__init__()
check_files_message = "Ankimon Files:"
if database_complete != True:
check_files_message += " \n Resource Files incomplete. \n Please go to Ankimon => 'Download Resources' to download the needed files"
check_files_message += "\n Once all files have been downloaded: Restart Anki"
# Set the window title for the dialog
self.setWindowTitle("Ankimon Files Checker")
# Create a QLabel instance
self.label = QLabel(f"{check_files_message}", self)
# Create a QVBoxLayout instance
self.layout = QVBoxLayout()
# Add the QLabel to the layout
self.layout.addWidget(self.label)
# Set the dialog's layout
self.setLayout(self.layout)
dialog = CheckFiles()
if database_complete != True:
dialog.show()
window = None
gender = None
card_counter = -1
item_receive_value = random.randint(30, 120)
system_name = platform.system()
if system_name == "Windows" or system_name == "Linux":
system = "win_lin"
elif system_name == "Darwin":
# Open file explorer at the specified path in macOS
system = "mac"
#only_online_sprites = config["only_use_online_sprites"]
#text_box_in_reviewer = config["text_box"]
cards_per_round = config["cards_per_round"]
reviewer_image_gif = config["reviewer_image_gif"]
sounds = config["sounds"]
battle_sounds = config["battle_sounds"]
language = config["language"]
ankimon_key = config["key_for_opening_closing_ankimon"]
def test_online_connectivity(url='http://www.google.com', timeout=5):
try:
# Attempt to get the URL
response = requests.get(url, timeout=timeout)
# Check if the response status code is 200 (OK)
if response.status_code == 200:
return True
except requests.ConnectionError:
# Connection error means no internet connectivity
return False
online_connectivity = test_online_connectivity()
# Function to check if the content of the two files is the same
def compare_files(local_content, github_content):
return local_content == github_content
# Function to read the content of the local file
def read_local_file(file_path):
try:
with open(file_path, 'r', encoding='utf-8') as file:
return file.read()
except FileNotFoundError:
return None
# Function to write content to a local file
def write_local_file(file_path, content):
with open(file_path, 'w', encoding='utf-8') as file:
file.write(content)
# Function to check if the file exists on GitHub and read its content
def read_github_file(url):
response = requests.get(url)
if response.status_code == 200:
# File exists, parse the Markdown content
content = response.text
html_content = markdown.markdown(content)
return content, html_content
else:
return None, None
if online_connectivity != False:
import markdown
# Custom Dialog class
class UpdateNotificationWindow(QDialog):
def __init__(self, content):
super().__init__()
self.setWindowTitle("Ankimon Notifications")
self.setGeometry(100, 100, 600, 400)
layout = QVBoxLayout()
self.text_edit = QTextEdit()
self.text_edit.setReadOnly(True)
self.text_edit.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
self.text_edit.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) # For horizontal scrollbar, if you want it off
self.text_edit.setHtml(content)
layout.addWidget(self.text_edit)
self.setLayout(layout)
# URL of the file on GitHub
github_url = "https://raw.githubusercontent.com/Unlucky-Life/ankimon/main/update_txt.md"
# Path to the local file
local_file_path = addon_dir / "updateinfos.md"
# Read content from GitHub
github_content, github_html_content = read_github_file(github_url)
# Read content from the local file
local_content = read_local_file(local_file_path)
# If local content exists and is the same as GitHub content, do not open dialog
if local_content is not None and compare_files(local_content, github_content):
pass
else:
# Download new content from GitHub
if github_content is not None:
# Write new content to the local file
write_local_file(local_file_path, github_content)
dialog = UpdateNotificationWindow(github_html_content)
dialog.exec()
else:
showWarning("Failed to retrieve Ankimon content from GitHub.")
##HelpGuide
class HelpWindow(QDialog):
def __init__(self):
super().__init__()
html_content = " "
if online_connectivity != False:
# URL of the file on GitHub
help_github_url = "https://raw.githubusercontent.com/Unlucky-Life/ankimon/main/src/Ankimon/HelpInfos.html"
# Path to the local file
help_local_file_path = addon_dir / "HelpInfos.html"
local_content = read_local_file(help_local_file_path)
# Read content from GitHub
github_content, github_html_content = read_github_file(help_github_url)
if local_content is not None and compare_files(local_content, github_content):
html_content = github_html_content
else:
# Download new content from GitHub
if github_content is not None:
# Write new content to the local file
write_local_file(help_local_file_path, github_content)
html_content = github_html_content
else:
local_content = read_local_file(help_local_file_path)
html_content = local_content
self.setWindowTitle("Ankimon HelpGuide")
self.setGeometry(100, 100, 600, 400)
layout = QVBoxLayout()
self.text_edit = QTextEdit()
self.text_edit.setReadOnly(True)
self.text_edit.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
self.text_edit.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.text_edit.setHtml(html_content)
layout.addWidget(self.text_edit)
self.setLayout(layout)
def open_help_window():
help_dialog = HelpWindow()
help_dialog.exec()
try:
from aqt.sound import av_player
from anki.sound import SoundOrVideoTag
legacy_play = None
except (ImportError, ModuleNotFoundError):
showWarning("Sound import error occured.")
from anki.sound import play as legacy_play
av_player = None
sounds=True
sound_list = ['ababo.mp3', 'abomasnow-mega.mp3', 'abomasnow.mp3', 'abra.mp3', 'absol-mega.mp3', 'absol.mp3', 'accelgor.mp3', 'aegislash.mp3', 'aerodactyl-mega.mp3', 'aerodactyl.mp3', 'aggron-mega.mp3', 'aggron.mp3', 'aipom.mp3', 'alakazam-mega.mp3', 'alakazam.mp3', 'alcremie.mp3', 'alomomola.mp3', 'altaria-mega.mp3', 'altaria.mp3', 'amaura.mp3', 'ambipom.mp3', 'amoonguss.mp3', 'ampharos-mega.mp3', 'ampharos.mp3', 'annihilape.mp3', 'anorith.mp3', 'appletun.mp3', 'applin.mp3', 'araquanid.mp3', 'arbok.mp3', 'arboliva.mp3', 'arcanine.mp3', 'arceus.mp3', 'archaludon.mp3', 'archen.mp3', 'archeops.mp3', 'arctibax.mp3', 'arctovish.mp3', 'arctozolt.mp3', 'argalis.mp3', 'arghonaut.mp3', 'ariados.mp3', 'armaldo.mp3', 'armarouge.mp3', 'aromatisse.mp3', 'aron.mp3', 'arrokuda.mp3', 'articuno.mp3', 'astrolotl.mp3', 'audino-mega.mp3', 'audino.mp3', 'aurorus.mp3', 'aurumoth.mp3', 'avalugg.mp3', 'axew.mp3', 'azelf.mp3', 'azumarill.mp3', 'azurill.mp3', 'bagon.mp3', 'baltoy.mp3', 'banette-mega.mp3', 'banette.mp3', 'barbaracle.mp3', 'barboach.mp3', 'barraskewda.mp3', 'basculegion.mp3', 'basculin.mp3', 'bastiodon.mp3', 'baxcalibur.mp3', 'bayleef.mp3', 'beartic.mp3', 'beautifly.mp3', 'beedrill-mega.mp3', 'beedrill.mp3', 'beheeyem.mp3', 'beldum.mp3', 'bellibolt.mp3', 'bellossom.mp3', 'bellsprout.mp3', 'bergmite.mp3', 'bewear.mp3', 'bibarel.mp3', 'bidoof.mp3', 'binacle.mp3', 'bisharp.mp3', 'blacephalon.mp3', 'blastoise-mega.mp3', 'blastoise.mp3', 'blaziken-mega.mp3', 'blaziken.mp3', 'blipbug.mp3', 'blissey.mp3', 'blitzle.mp3', 'boldore.mp3', 'boltund.mp3', 'bombirdier.mp3', 'bonsly.mp3', 'bouffalant.mp3', 'bounsweet.mp3', 'braixen.mp3', 'brambleghast.mp3', 'bramblin.mp3', 'brattler.mp3', 'braviary.mp3', 'breezi.mp3', 'breloom.mp3', 'brionne.mp3', 'bronzong.mp3', 'bronzor.mp3', 'brutebonnet.mp3', 'bruxish.mp3', 'budew.mp3', 'buizel.mp3', 'bulbasaur.mp3', 'buneary.mp3', 'bunnelby.mp3', 'burmy.mp3', 'butterfree.mp3', 'buzzwole.mp3', 'cacnea.mp3', 'cacturne.mp3', 'caimanoe.mp3', 'calyrex-ice.mp3', 'calyrex-shadow.mp3', 'calyrex.mp3', 'camerupt-mega.mp3', 'camerupt.mp3', 'capsakid.mp3', 'carbink.mp3', 'caribolt.mp3', 'carkol.mp3', 'carnivine.mp3', 'carracosta.mp3', 'carvanha.mp3', 'cascoon.mp3', 'castform.mp3', 'caterpie.mp3', 'cawdet.mp3', 'cawmodore.mp3', 'celebi.mp3', 'celesteela.mp3', 'centiskorch.mp3', 'ceruledge.mp3', 'cetitan.mp3', 'cetoddle.mp3', 'chandelure.mp3', 'chansey.mp3', 'charcadet.mp3', 'charizard-megax.mp3', 'charizard-megay.mp3', 'charizard.mp3', 'charjabug.mp3', 'charmander.mp3', 'charmeleon.mp3', 'chatot.mp3', 'cherrim.mp3', 'cherubi.mp3', 'chesnaught.mp3', 'chespin.mp3', 'chewtle.mp3', 'chienpao.mp3', 'chikorita.mp3', 'chimchar.mp3', 'chimecho.mp3', 'chinchou.mp3', 'chingling.mp3', 'chiyu.mp3', 'chromera.mp3', 'cinccino.mp3', 'cinderace.mp3', 'clamperl.mp3', 'clauncher.mp3', 'clawitzer.mp3', 'claydol.mp3', 'clefable.mp3', 'clefairy.mp3', 'cleffa.mp3', 'clobbopus.mp3', 'clodsire.mp3', 'cloyster.mp3', 'coalossal.mp3', 'cobalion.mp3', 'cofagrigus.mp3', 'colossoil.mp3', 'combee.mp3', 'combusken.mp3', 'comfey.mp3', 'conkeldurr.mp3', 'copperajah.mp3', 'coribalis.mp3', 'corphish.mp3', 'corsola.mp3', 'corviknight.mp3', 'corvisquire.mp3', 'cosmoem.mp3', 'cosmog.mp3', 'cottonee.mp3', 'crabominable.mp3', 'crabrawler.mp3', 'cradily.mp3', 'cramorant-gorging.mp3', 'cramorant-gulping.mp3', 'cramorant.mp3', 'cranidos.mp3', 'crawdaunt.mp3', 'cresselia.mp3', 'croagunk.mp3', 'crobat.mp3', 'crocalor.mp3', 'croconaw.mp3', 'crucibelle-mega.mp3', 'crucibelle.mp3', 'crustle.mp3', 'cryogonal.mp3', 'cubchoo.mp3', 'cubone.mp3', 'cufant.mp3', 'cupra.mp3', 'cursola.mp3', 'cutiefly.mp3', 'cyclizar.mp3', 'cyclohm.mp3', 'cyndaquil.mp3', 'dachsbun.mp3', 'darkrai.mp3', 'darmanitan.mp3', 'dartrix.mp3', 'darumaka.mp3', 'decidueye.mp3', 'dedenne.mp3', 'deerling.mp3', 'deino.mp3', 'delcatty.mp3', 'delibird.mp3', 'delphox.mp3', 'deoxys.mp3', 'dewgong.mp3', 'dewott.mp3', 'dewpider.mp3', 'dhelmise.mp3', 'dialga.mp3', 'diancie-mega.mp3', 'diancie.mp3', 'diggersby.mp3', 'diglett.mp3', 'dipplin.mp3', 'ditto.mp3', 'dodrio.mp3', 'doduo.mp3', 'dolliv.mp3', 'dondozo.mp3', 'donphan.mp3', 'dorsoil.mp3', 'dottler.mp3', 'doublade.mp3', 'dracovish.mp3', 'dracozolt.mp3', 'dragalge.mp3', 'dragapult.mp3', 'dragonair.mp3', 'dragonite.mp3', 'drakloak.mp3', 'drampa.mp3', 'drapion.mp3', 'dratini.mp3', 'drednaw.mp3', 'dreepy.mp3', 'drifblim.mp3', 'drifloon.mp3', 'drilbur.mp3', 'drizzile.mp3', 'drowzee.mp3', 'druddigon.mp3', 'dubwool.mp3', 'ducklett.mp3', 'dudunsparce.mp3', 'dugtrio.mp3', 'dunsparce.mp3', 'duohm.mp3', 'duosion.mp3', 'duraludon.mp3', 'durant.mp3', 'dusclops.mp3', 'dusknoir.mp3', 'duskull.mp3', 'dustox.mp3', 'dwebble.mp3', 'eelektrik.mp3', 'eelektross.mp3', 'eevee-starter.mp3', 'eevee.mp3', 'eiscue-noice.mp3', 'eiscue.mp3', 'ekans.mp3', 'eldegoss.mp3', 'electabuzz.mp3', 'electivire.mp3', 'electrelk.mp3', 'electrike.mp3', 'electrode.mp3', 'elekid.mp3', 'elgyem.mp3', 'embirch.mp3', 'emboar.mp3', 'emolga.mp3', 'empoleon.mp3', 'enamorus-therian.mp3', 'enamorus.mp3', 'entei.mp3', 'equilibra.mp3', 'escavalier.mp3', 'espathra.mp3', 'espeon.mp3', 'espurr.mp3', 'eternatus-eternamax.mp3', 'eternatus.mp3', 'excadrill.mp3', 'exeggcute.mp3', 'exeggutor.mp3', 'exploud.mp3', 'falinks.mp3', 'farfetchd.mp3', 'farigiraf.mp3', 'fawnifer.mp3', 'fearow.mp3', 'feebas.mp3', 'fennekin.mp3', 'feraligatr.mp3', 'ferroseed.mp3', 'ferrothorn.mp3', 'fezandipiti.mp3', 'fidgit.mp3', 'fidough.mp3', 'finizen.mp3', 'finneon.mp3', 'flaaffy.mp3', 'flabebe.mp3', 'flamigo.mp3', 'flapple.mp3', 'flarelm.mp3', 'flareon.mp3', 'fletchinder.mp3', 'fletchling.mp3', 'flittle.mp3', 'floatoy.mp3', 'floatzel.mp3', 'floette-eternal.mp3', 'floette.mp3', 'floragato.mp3', 'florges.mp3', 'fluttermane.mp3', 'flygon.mp3', 'fomantis.mp3', 'foongus.mp3', 'forretress.mp3', 'fraxure.mp3', 'frigibax.mp3', 'frillish.mp3', 'froakie.mp3', 'frogadier.mp3', 'froslass.mp3', 'frosmoth.mp3', 'fuecoco.mp3', 'furfrou.mp3', 'furret.mp3', 'gabite.mp3', 'gallade-mega.mp3', 'gallade.mp3', 'galvantula.mp3', 'garbodor.mp3', 'garchomp-mega.mp3', 'garchomp.mp3', 'gardevoir-mega.mp3', 'gardevoir.mp3', 'garganacl.mp3', 'gastly.mp3', 'gastrodon.mp3', 'genesect.mp3', 'gengar-mega.mp3', 'gengar.mp3', 'geodude.mp3', 'gholdengo.mp3', 'gible.mp3', 'gigalith.mp3', 'gimmighoul-roaming.mp3', 'gimmighoul.mp3', 'girafarig.mp3', 'giratina.mp3', 'glaceon.mp3', 'glalie-mega.mp3', 'glalie.mp3', 'glameow.mp3', 'glastrier.mp3', 'gligar.mp3', 'glimmet.mp3', 'glimmora.mp3', 'gliscor.mp3', 'gloom.mp3', 'gogoat.mp3', 'golbat.mp3', 'goldeen.mp3', 'golduck.mp3', 'golem.mp3', 'golett.mp3', 'golisopod.mp3', 'golurk.mp3', 'goodra.mp3', 'goomy.mp3', 'gorebyss.mp3', 'gossifleur.mp3', 'gothita.mp3', 'gothitelle.mp3', 'gothorita.mp3', 'gougingfire.mp3', 'gourgeist-super.mp3', 'gourgeist.mp3', 'grafaiai.mp3', 'granbull.mp3', 'grapploct.mp3', 'graveler.mp3', 'greattusk.mp3', 'greavard.mp3', 'greedent.mp3', 'greninja.mp3', 'grimer.mp3', 'grimmsnarl.mp3', 'grookey.mp3', 'grotle.mp3', 'groudon-primal.mp3', 'groudon.mp3', 'grovyle.mp3', 'growlithe.mp3', 'grubbin.mp3', 'grumpig.mp3', 'gulpin.mp3', 'gumshoos.mp3', 'gurdurr.mp3', 'guzzlord.mp3', 'gyarados-mega.mp3', 'gyarados.mp3', 'hakamoo.mp3', 'happiny.mp3', 'hariyama.mp3', 'hatenna.mp3', 'hatterene.mp3', 'hattrem.mp3', 'haunter.mp3', 'hawlucha.mp3', 'haxorus.mp3', 'heatmor.mp3', 'heatran.mp3', 'heliolisk.mp3', 'helioptile.mp3', 'hemogoblin.mp3', 'heracross-mega.mp3', 'heracross.mp3', 'herdier.mp3', 'hippopotas.mp3', 'hippowdon.mp3', 'hitmonchan.mp3', 'hitmonlee.mp3', 'hitmontop.mp3', 'honchkrow.mp3', 'honedge.mp3', 'hooh.mp3', 'hoopa-unbound.mp3', 'hoopa.mp3', 'hoothoot.mp3', 'hoppip.mp3', 'horsea.mp3', 'houndoom-mega.mp3', 'houndoom.mp3', 'houndour.mp3', 'houndstone.mp3', 'huntail.mp3', 'hydrapple.mp3', 'hydreigon.mp3', 'hypno.mp3', 'igglybuff.mp3', 'illumise.mp3', 'impidimp.mp3', 'incineroar.mp3', 'indeedee-f.mp3', 'indeedee.mp3', 'infernape.mp3', 'inkay.mp3', 'inteleon.mp3', 'ironboulder.mp3', 'ironbundle.mp3', 'ironcrown.mp3', 'ironhands.mp3', 'ironjugulis.mp3', 'ironleaves.mp3', 'ironmoth.mp3', 'ironthorns.mp3', 'irontreads.mp3', 'ironvaliant.mp3', 'ivysaur.mp3', 'jangmoo.mp3', 'jellicent.mp3', 'jigglypuff.mp3', 'jirachi.mp3', 'jolteon.mp3', 'joltik.mp3', 'jumbao.mp3', 'jumpluff.mp3', 'justyke.mp3', 'jynx.mp3', 'kabuto.mp3', 'kabutops.mp3', 'kadabra.mp3', 'kakuna.mp3', 'kangaskhan-mega.mp3', 'kangaskhan.mp3', 'karrablast.mp3', 'kartana.mp3', 'kecleon.mp3', 'keldeo.mp3', 'kerfluffle.mp3', 'kilowattrel.mp3', 'kingambit.mp3', 'kingdra.mp3', 'kingler.mp3', 'kirlia.mp3', 'kitsunoh.mp3', 'klang.mp3', 'klawf.mp3', 'kleavor.mp3', 'klefki.mp3', 'klink.mp3', 'klinklang.mp3', 'koffing.mp3', 'komala.mp3', 'kommoo.mp3', 'koraidon.mp3', 'krabby.mp3', 'kricketot.mp3', 'kricketune.mp3', 'krilowatt.mp3', 'krokorok.mp3', 'krookodile.mp3', 'kubfu.mp3', 'kyogre-primal.mp3', 'kyogre.mp3', 'kyurem-black.mp3', 'kyurem-white.mp3', 'kyurem.mp3', 'lairon.mp3', 'lampent.mp3', 'landorus-therian.mp3', 'landorus.mp3', 'lanturn.mp3', 'lapras.mp3', 'larvesta.mp3', 'larvitar.mp3', 'latias-mega.mp3', 'latias.mp3', 'latios-mega.mp3', 'latios.mp3', 'leafeon.mp3', 'leavanny.mp3', 'lechonk.mp3', 'ledian.mp3', 'ledyba.mp3', 'lickilicky.mp3', 'lickitung.mp3', 'liepard.mp3', 'lileep.mp3', 'lilligant.mp3', 'lillipup.mp3', 'linoone.mp3', 'litleo.mp3', 'litten.mp3', 'litwick.mp3', 'lokix.mp3', 'lombre.mp3', 'lopunny-mega.mp3', 'lopunny.mp3', 'lotad.mp3', 'loudred.mp3', 'lucario-mega.mp3', 'lucario.mp3', 'ludicolo.mp3', 'lugia.mp3', 'lumineon.mp3', 'lunala.mp3', 'lunatone.mp3', 'lurantis.mp3', 'luvdisc.mp3', 'luxio.mp3', 'luxray.mp3', 'lycanroc-dusk.mp3', 'lycanroc-midnight.mp3', 'lycanroc.mp3', 'mabosstiff.mp3', 'machamp.mp3', 'machoke.mp3', 'machop.mp3', 'magby.mp3', 'magcargo.mp3', 'magearna.mp3', 'magikarp.mp3', 'magmar.mp3', 'magmortar.mp3', 'magnemite.mp3', 'magneton.mp3', 'magnezone.mp3', 'makuhita.mp3', 'malaconda.mp3', 'malamar.mp3', 'mamoswine.mp3', 'manaphy.mp3', 'mandibuzz.mp3', 'manectric-mega.mp3', 'manectric.mp3', 'mankey.mp3', 'mantine.mp3', 'mantyke.mp3', 'maractus.mp3', 'mareanie.mp3', 'mareep.mp3', 'marill.mp3', 'marowak.mp3', 'marshadow.mp3', 'marshtomp.mp3', 'maschiff.mp3', 'masquerain.mp3', 'maushold-four.mp3', 'maushold.mp3', 'mawile-mega.mp3', 'mawile.mp3', 'medicham-mega.mp3', 'medicham.mp3', 'meditite.mp3', 'meganium.mp3', 'melmetal.mp3', 'meloetta.mp3', 'meltan.mp3', 'meowscarada.mp3', 'meowstic.mp3', 'meowth.mp3', 'mesprit.mp3', 'metagross-mega.mp3', 'metagross.mp3', 'metang.mp3', 'metapod.mp3', 'mew.mp3', 'mewtwo-megax.mp3', 'mewtwo-megay.mp3', 'mewtwo.mp3', 'miasmaw.mp3', 'miasmite.mp3', 'mienfoo.mp3', 'mienshao.mp3', 'mightyena.mp3', 'milcery.mp3', 'milotic.mp3', 'miltank.mp3', 'mimejr.mp3', 'mimikyu.mp3', 'minccino.mp3', 'minior.mp3', 'minun.mp3', 'miraidon.mp3', 'misdreavus.mp3', 'mismagius.mp3', 'mollux.mp3', 'moltres.mp3', 'monferno.mp3', 'monohm.mp3', 'morelull.mp3', 'morgrem.mp3', 'morpeko-hangry.mp3', 'morpeko.mp3', 'mothim.mp3', 'mrmime.mp3', 'mrrime.mp3', 'mudbray.mp3', 'mudkip.mp3', 'mudsdale.mp3', 'muk.mp3', 'mumbao.mp3', 'munchlax.mp3', 'munkidori.mp3', 'munna.mp3', 'murkrow.mp3', 'musharna.mp3', 'nacli.mp3', 'naclstack.mp3', 'naganadel.mp3', 'natu.mp3', 'naviathan.mp3', 'necrozma-dawnwings.mp3', 'necrozma-duskmane.mp3', 'necrozma-ultra.mp3', 'necrozma.mp3', 'necturine.mp3', 'necturna.mp3', 'nickit.mp3', 'nidoking.mp3', 'nidoqueen.mp3', 'nidoranf.mp3', 'nidoranm.mp3', 'nidorina.mp3', 'nidorino.mp3', 'nihilego.mp3', 'nincada.mp3', 'ninetales.mp3', 'ninjask.mp3', 'noctowl.mp3', 'nohface.mp3', 'noibat.mp3', 'noivern.mp3', 'nosepass.mp3', 'numel.mp3', 'nuzleaf.mp3', 'nymble.mp3', 'obstagoon.mp3', 'octillery.mp3', 'oddish.mp3', 'ogerpon.mp3', 'oinkologne-f.mp3', 'oinkologne.mp3', 'okidogi.mp3', 'omanyte.mp3', 'omastar.mp3', 'onix.mp3', 'oranguru.mp3', 'orbeetle.mp3', 'oricorio-pau.mp3', 'oricorio-pompom.mp3', 'oricorio-sensu.mp3', 'oricorio.mp3', 'orthworm.mp3', 'oshawott.mp3', 'overqwil.mp3', 'pachirisu.mp3', 'pajantom.mp3', 'palafin-hero.mp3', 'palafin.mp3', 'palkia.mp3', 'palossand.mp3', 'palpitoad.mp3', 'pancham.mp3', 'pangoro.mp3', 'panpour.mp3', 'pansage.mp3', 'pansear.mp3', 'paras.mp3', 'parasect.mp3', 'passimian.mp3', 'patrat.mp3', 'pawmi.mp3', 'pawmo.mp3', 'pawmot.mp3', 'pawniard.mp3', 'pecharunt.mp3', 'pelipper.mp3', 'perrserker.mp3', 'persian.mp3', 'petilil.mp3', 'phanpy.mp3', 'phantump.mp3', 'pheromosa.mp3', 'phione.mp3', 'pichu.mp3', 'pidgeot-mega.mp3', 'pidgeot.mp3', 'pidgeotto.mp3', 'pidgey.mp3', 'pidove.mp3', 'pignite.mp3', 'pikachu-starter.mp3', 'pikachu.mp3', 'pikipek.mp3', 'piloswine.mp3', 'pincurchin.mp3', 'pineco.mp3', 'pinsir-mega.mp3', 'pinsir.mp3', 'piplup.mp3', 'plasmanta.mp3', 'pluffle.mp3', 'plusle.mp3', 'poipole.mp3', 'politoed.mp3', 'poliwag.mp3', 'poliwhirl.mp3', 'poliwrath.mp3', 'poltchageist.mp3', 'polteageist.mp3', 'ponyta.mp3', 'poochyena.mp3', 'popplio.mp3', 'porygon.mp3', 'porygon2.mp3', 'porygonz.mp3', 'primarina.mp3', 'primeape.mp3', 'prinplup.mp3', 'privatyke.mp3', 'probopass.mp3', 'protowatt.mp3', 'psyduck.mp3', 'pumpkaboo-super.mp3', 'pumpkaboo.mp3', 'pupitar.mp3', 'purrloin.mp3', 'purugly.mp3', 'pyroak.mp3', 'pyroar.mp3', 'pyukumuku.mp3', 'quagsire.mp3', 'quaquaval.mp3', 'quaxly.mp3', 'quaxwell.mp3', 'quilava.mp3', 'quilladin.mp3', 'qwilfish.mp3', 'raboot.mp3', 'rabsca.mp3', 'ragingbolt.mp3', 'raichu.mp3', 'raikou.mp3', 'ralts.mp3', 'rampardos.mp3', 'rapidash.mp3', 'raticate.mp3', 'rattata.mp3', 'rayquaza-mega.mp3', 'rayquaza.mp3', 'rebble.mp3', 'regice.mp3', 'regidrago.mp3', 'regieleki.mp3', 'regigigas.mp3', 'regirock.mp3', 'registeel.mp3', 'relicanth.mp3', 'rellor.mp3', 'remoraid.mp3', 'reshiram.mp3', 'reuniclus.mp3', 'revavroom.mp3', 'revenankh.mp3', 'rhydon.mp3', 'rhyhorn.mp3', 'rhyperior.mp3', 'ribombee.mp3', 'rillaboom.mp3', 'riolu.mp3', 'roaringmoon.mp3', 'rockruff.mp3', 'roggenrola.mp3', 'rolycoly.mp3', 'rookidee.mp3', 'roselia.mp3', 'roserade.mp3', 'rotom.mp3', 'rowlet.mp3', 'rufflet.mp3', 'runerigus.mp3', 'sableye-mega.mp3', 'sableye.mp3', 'saharaja.mp3', 'saharascal.mp3', 'salamence-mega.mp3', 'salamence.mp3', 'salandit.mp3', 'salazzle.mp3', 'samurott.mp3', 'sandaconda.mp3', 'sandile.mp3', 'sandshrew.mp3', 'sandslash.mp3', 'sandygast.mp3', 'sandyshocks.mp3', 'sawk.mp3', 'sawsbuck.mp3', 'scatterbug.mp3', 'scattervein.mp3', 'sceptile-mega.mp3', 'sceptile.mp3', 'scizor-mega.mp3', 'scizor.mp3', 'scolipede.mp3', 'scorbunny.mp3', 'scovillain.mp3', 'scrafty.mp3', 'scraggy.mp3', 'scratchet.mp3', 'screamtail.mp3', 'scyther.mp3', 'seadra.mp3', 'seaking.mp3', 'sealeo.mp3', 'seedot.mp3', 'seel.mp3', 'seismitoad.mp3', 'sentret.mp3', 'serperior.mp3', 'servine.mp3', 'seviper.mp3', 'sewaddle.mp3', 'sharpedo-mega.mp3', 'sharpedo.mp3', 'shaymin-sky.mp3', 'shaymin.mp3', 'shedinja.mp3', 'shelgon.mp3', 'shellder.mp3', 'shellos.mp3', 'shelmet.mp3', 'shieldon.mp3', 'shiftry.mp3', 'shiinotic.mp3', 'shinx.mp3', 'shroodle.mp3', 'shroomish.mp3', 'shuckle.mp3', 'shuppet.mp3', 'sigilyph.mp3', 'silcoon.mp3', 'silicobra.mp3', 'silvally.mp3', 'simipour.mp3', 'simisage.mp3', 'simisear.mp3', 'sinistcha.mp3', 'sinistea.mp3', 'sirfetchd.mp3', 'sizzlipede.mp3', 'skarmory.mp3', 'skeledirge.mp3', 'skiddo.mp3', 'skiploom.mp3', 'skitty.mp3', 'skorupi.mp3', 'skrelp.mp3', 'skuntank.mp3', 'skwovet.mp3', 'slaking.mp3', 'slakoth.mp3', 'sliggoo.mp3', 'slitherwing.mp3', 'slowbro-mega.mp3', 'slowbro.mp3', 'slowking.mp3', 'slowpoke-galar.mp3', 'slowpoke.mp3', 'slugma.mp3', 'slurpuff.mp3', 'smeargle.mp3', 'smogecko.mp3', 'smoguana.mp3', 'smokomodo.mp3', 'smoliv.mp3', 'smoochum.mp3', 'snaelstrom.mp3', 'sneasel.mp3', 'sneasler.mp3', 'snivy.mp3', 'snom.mp3', 'snorlax.mp3', 'snorunt.mp3', 'snover.mp3', 'snubbull.mp3', 'snugglow.mp3', 'sobble.mp3', 'solgaleo.mp3', 'solosis.mp3', 'solotl.mp3', 'solrock.mp3', 'spearow.mp3', 'spectrier.mp3', 'spewpa.mp3', 'spheal.mp3', 'spidops.mp3', 'spinarak.mp3', 'spinda.mp3', 'spiritomb.mp3', 'spoink.mp3', 'sprigatito.mp3', 'spritzee.mp3', 'squawkabilly.mp3', 'squirtle.mp3', 'stakataka.mp3', 'stantler.mp3', 'staraptor.mp3', 'staravia.mp3', 'starly.mp3', 'starmie.mp3', 'staryu.mp3', 'steelix-mega.mp3', 'steelix.mp3', 'steenee.mp3', 'stonjourner.mp3', 'stoutland.mp3', 'stratagem.mp3', 'stufful.mp3', 'stunfisk.mp3', 'stunky.mp3', 'sudowoodo.mp3', 'suicune.mp3', 'sunflora.mp3', 'sunkern.mp3', 'surskit.mp3', 'swablu.mp3', 'swadloon.mp3', 'swalot.mp3', 'swampert-mega.mp3', 'swampert.mp3', 'swanna.mp3', 'swellow.mp3', 'swinub.mp3', 'swirlix.mp3', 'swirlpool.mp3', 'swoobat.mp3', 'syclant.mp3', 'syclar.mp3', 'sylveon.mp3', 'tactite.mp3', 'tadbulb.mp3', 'taillow.mp3', 'talonflame.mp3', 'tandemaus.mp3', 'tangela.mp3', 'tangrowth.mp3', 'tapubulu.mp3', 'tapufini.mp3', 'tapukoko.mp3', 'tapulele.mp3', 'tarountula.mp3', 'tatsugiri-droopy.mp3', 'tatsugiri-stretchy.mp3', 'tatsugiri.mp3', 'tauros.mp3', 'teddiursa.mp3', 'tentacool.mp3', 'tentacruel.mp3', 'tepig.mp3', 'terapagos.mp3', 'terrakion.mp3', 'thievul.mp3', 'throh.mp3', 'thundurus-therian.mp3', 'thundurus.mp3', 'thwackey.mp3', 'timburr.mp3', 'tinglu.mp3', 'tinkatink.mp3', 'tinkaton.mp3', 'tinkatuff.mp3', 'tirtouga.mp3', 'toedscool.mp3', 'toedscruel.mp3', 'togedemaru.mp3', 'togekiss.mp3', 'togepi.mp3', 'togetic.mp3', 'tomohawk.mp3', 'torchic.mp3', 'torkoal.mp3', 'tornadus-therian.mp3', 'tornadus.mp3', 'torracat.mp3', 'torterra.mp3', 'totodile.mp3', 'toucannon.mp3', 'toxapex.mp3', 'toxel.mp3', 'toxicroak.mp3', 'toxtricity-lowkey.mp3', 'toxtricity.mp3', 'tranquill.mp3', 'trapinch.mp3', 'treecko.mp3', 'trevenant.mp3', 'tropius.mp3', 'trubbish.mp3', 'trumbeak.mp3', 'tsareena.mp3', 'turtonator.mp3', 'turtwig.mp3', 'tympole.mp3', 'tynamo.mp3', 'typenull.mp3', 'typhlosion.mp3', 'tyranitar-mega.mp3', 'tyranitar.mp3', 'tyrantrum.mp3', 'tyrogue.mp3', 'tyrunt.mp3', 'umbreon.mp3', 'unfezant.mp3', 'unown.mp3', 'ursaluna.mp3', 'ursaring.mp3', 'urshifu-rapidstrike.mp3', 'urshifu.mp3', 'uxie.mp3', 'vanillish.mp3', 'vanillite.mp3', 'vanilluxe.mp3', 'vaporeon.mp3', 'varoom.mp3', 'veluza.mp3', 'venipede.mp3', 'venomicon.mp3', 'venomoth.mp3', 'venonat.mp3', 'venusaur-mega.mp3', 'venusaur.mp3', 'vespiquen.mp3', 'vibrava.mp3', 'victini.mp3', 'victreebel.mp3', 'vigoroth.mp3', 'vikavolt.mp3', 'vileplume.mp3', 'virizion.mp3', 'vivillon.mp3', 'volbeat.mp3', 'volcanion.mp3', 'volcarona.mp3', 'volkraken.mp3', 'volkritter.mp3', 'voltorb.mp3', 'voodoll.mp3', 'voodoom.mp3', 'vullaby.mp3', 'vulpix.mp3', 'wailmer.mp3', 'wailord.mp3', 'walkingwake.mp3', 'walrein.mp3', 'wartortle.mp3', 'watchog.mp3', 'wattrel.mp3', 'weavile.mp3', 'weedle.mp3', 'weepinbell.mp3', 'weezing.mp3', 'whimsicott.mp3', 'whirlipede.mp3', 'whiscash.mp3', 'whismur.mp3', 'wigglytuff.mp3', 'wiglett.mp3', 'wimpod.mp3', 'wingull.mp3', 'wishiwashi-school.mp3', 'wishiwashi.mp3', 'wobbuffet.mp3', 'wochien.mp3', 'woobat.mp3', 'wooloo.mp3', 'wooper.mp3', 'wormadam.mp3', 'wugtrio.mp3', 'wurmple.mp3', 'wynaut.mp3', 'wyrdeer.mp3', 'xatu.mp3', 'xerneas.mp3', 'xurkitree.mp3', 'yamask.mp3', 'yamper.mp3', 'yanma.mp3', 'yanmega.mp3', 'yungoos.mp3', 'yveltal.mp3', 'zacian-crowned.mp3', 'zacian.mp3', 'zamazenta-crowned.mp3', 'zamazenta.mp3', 'zangoose.mp3', 'zapdos.mp3', 'zarude.mp3', 'zebstrika.mp3', 'zekrom.mp3', 'zeraora.mp3', 'zigzagoon.mp3', 'zoroark.mp3', 'zorua.mp3', 'zubat.mp3', 'zweilous.mp3', 'zygarde-10.mp3', 'zygarde-complete.mp3', 'zygarde.mp3']
# Function to play the sound
def play_sound():
global timer, sounds
pass
if sounds is True:
global name
# Check if the sound should play
file_name = f"{name.lower()}.mp3"
audio_path = addon_dir / "user_files" / "sprites" / "sounds" / file_name
if not audio_path.is_file():
return
audio_path = str(audio_path)
if av_player:
av_player.play_file(filename=audio_path)
elif legacy_play:
legacy_play(audio_path)
else:
pass
#showWarning("No suitable audio player found in Anki.")
# Disconnect the timer's timeout signal to prevent further plays
try:
timer.timeout.disconnect(play_sound)
except TypeError:
pass # Do nothing if the signal was not connected
if sounds == True:
# Create a QTimer
timer = QTimer()
# Connect the timer's timeout signal to the play_sound function
timer.timeout.connect(play_sound)
#def play_pokemon_cry():
#play_sound()
#gui_hooks.reviewer_will_end.append(play_pokemon_cry)
gen_ids = {
"gen_1": 151,
"gen_2": 251,
"gen_3": 386,
"gen_4": 493,
"gen_5": 649,
"gen_6": 721,
"gen_7": 809,
"gen_8": 905,
"gen_9": 1025
}
gen_config = []
for i in range(1,10):
gen_config.append(config[f"gen{i}"])
def check_id_ok(id_num):
if isinstance(id_num, int):
pass
elif isinstance(id_num, list):
if len(id_num) > 0:
id_num = id_num[0]
else:
return False
# Determine the generation of the given ID
if id_num < 898:
generation = 0
for gen, max_id in gen_ids.items():
if id_num <= max_id:
generation = int(gen.split('_')[1])
break
if generation == 0:
return False # ID does not belong to any generation
return gen_config[generation - 1]
else:
return False
#count index - count 10 cards - easy = 20, good = 10, hard = 5, again = 0
# if index = 40 - 100 => normal ; multiply with damage
# if index < 40 => attack misses
#Badges needed for achievements:
badges = {
"1": "100 Cards in one Session",
"2": "200 Cards in one Session",
"3": "300 Cards in one Session",
"4": "500 Cards in one Session",
"5": "Leveled a Pokemon !",
"6": "Received the first Item !",
"7": "First Pokemon Caught !",
"8": "Caught first Ultra Pokemon",
"9": "Caught first Baby Pokemon",
"10": "Caught first Mythical Pokemon",
"11": "First Leech Card unleeched",
"12": "1000 Cards in one Session",
"13": "2000 Cards in one Session",
"14": "Received a Pokemon Egg",
"15": "Hatched a Pokemon Egg",
"16": "Evolved a Pokemon !",
"17": "Caught first Normal Pokemon",
"18": "Caught first Baby Pokemon",
"19": "changed",
"20": "changed",
"21": "changed",
"22": "changed",
"23": "changed",
"24": "changed",
"25": "changed",
"26": "changed",
"27": "changed",
"28": "changed",
"29": "changed",
"30": "changed",
"31": "changed",
"32": "changed",
"33": "changed",
"34": "changed",
"35": "changed",
"36": "changed",
"37": "changed",
"38": "changed",
"39": "changed",
"40": "changed",
"41": "changed",
"42": "changed",
"43": "changed",
"44": "changed",
"45": "changed",
"46": "changed",
"47": "changed",
"48": "changed",
"49": "changed",
"50": "changed",
"51": "changed",
"52": "changed",
"53": "changed",
"54": "changed",
"55": "changed",
"56": "changed",
"57": "changed",
"58": "changed",
"59": "Add",
"60": "Add",
"61": "Add",
"62": "Add",
"63": "Add",
"64": "Add",
"65": "Add",
"66": "Add",
"67": "Add"
}
achievements = {
"1": False,
"2": False,
"3": False,
"4": False,
"5": False,
"6": False,
"7": False,
"8": False,
"9": False,
"10": False,
"11": False,
"12": False,
"13": False,
"14": False,
"15": False,
"16": False,
"17": False,
"18": False,
"19": False,
"20": False,
"21": False,
"22": False,
"23": False,
"24": False,
"25": False,
"26": False,
"27": False,
"28": False,
"29": False,
"30": False,
"31": False,
"32": False,
"33": False,
"34": False,
"35": False,
"36": False,
"37": False,
"38": False,
"39": False,
"40": False,
"41": False,
"42": False,
"43": False,
"44": False,
"45": False,
"46": False,
"47": False,
"48": False,
"49": False,
"50": False,
"51": False,
"52": False,
"53": False,
"54": False,
"55": False,
"56": False,
"57": False,
"58": False,
"59": False,
"60": False,
"61": False,
"62": False,
"63": False,
"64": False,
"65": False,
"66": False,
"67": False,
"68": False
}
def check_badges(achievements):
with open(badgebag_path, 'r') as json_file:
badge_list = json.load(json_file)
for badge_num in badge_list:
achievements[str(badge_num)] = True
return achievements
def check_for_badge(achievements, rec_badge_num):
achievements = check_badges(achievements)
if achievements[str(rec_badge_num)] is False:
got_badge = False
else:
got_badge = True
return got_badge
def save_badges(badges_collection):
with open(badgebag_path, 'w') as json_file:
json.dump(badges_collection, json_file)
achievements = check_badges(achievements)
def receive_badge(badge_num,achievements):
achievements = check_badges(achievements)
#for badges in badge_list:
achievements[str(badge_num)] = True
badges_collection = []
for num in range(1,69):
if achievements[str(num)] is True:
badges_collection.append(int(num))
save_badges(badges_collection)
return achievements
def special_pokemon_names_for_min_level(name):
if name == "flabébé":
return "flabebe"
elif name == "sirfetch'd":
return "sirfetchd"
elif name == "farfetch'd":
return "farfetchd"
elif name == "porygon-z":
return "porygonz"
elif name == "kommo-o":
return "kommoo"
elif name == "hakamo-o":
return "hakamoo"
elif name == "jangmo-o":
return "jangmoo"
elif name == "mr. rime":
return "mrrime"
elif name == "mr. mime":
return "mrmime"
elif name == "mime jr.":
return "mimejr"
elif name == "nidoran♂":
return "nidoranm"
elif name == "nidoran":
return "nidoranf"
elif name == "keldeo[e]":
return "keldeo"
elif name == "mew[e]":
return "mew"
elif name == "deoxys[e]":
return "deoxys"
elif name == "jirachi[e]":
return "jirachi"
elif name == "arceus[e]":
return "arceus"
elif name == "shaymin[e]":
return "shaymin-land"
elif name == "darkrai [e]":
return "darkrai"
elif name == "manaphy[e]":
return "manaphy"
elif name == "phione[e]":
return "phione"
elif name == "celebi[e]":
return "celebi"
elif name == "magearna[e]":
return "magearna"
elif name == "type: null":
return "typenull"
else:
#showWarning("Error in Handling Pokémon name")
return name
def special_pokemon_names_for_pokedex_to_poke_api_db(name):
global pokedex_to_poke_api_db
return pokedex_to_poke_api_db.get(name, name)
def answerCard_before(filter, reviewer, card):
utils.answBtnAmt = reviewer.mw.col.sched.answerButtons(card)
return filter
aqt.gui_hooks.reviewer_will_answer_card.append(answerCard_before)
# Globale Variable für die Zählung der Bewertungen
card_ratings_count = {"Again": 0, "Hard": 0, "Good": 0, "Easy": 0}
def answerCard_after(rev, card, ease):
maxEase = utils.answBtnAmt
aw = aqt.mw.app.activeWindow() or aqt.mw
# Aktualisieren Sie die Zählung basierend auf der Bewertung
global card_ratings_count
if ease == 1:
card_ratings_count["Again"] += 1
elif ease == maxEase - 2:
card_ratings_count["Hard"] += 1
elif ease == maxEase - 1:
card_ratings_count["Good"] += 1
elif ease == maxEase:
card_ratings_count["Easy"] += 1
else:
# default behavior for unforeseen cases
tooltip("Error in ColorConfirmation add-on: Couldn't interpret ease")
aqt.gui_hooks.reviewer_did_answer_card.append(answerCard_after)
def get_image_as_base64(path):
with open(path, 'rb') as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
return encoded_string
if database_complete != False:
def get_random_moves_for_pokemon(pokemon_name, level):
"""
Get up to 4 random moves learned by a Pokémon at a specific level and lower, along with the highest level,
excluding moves that can be learned at a higher level.
Args:
json_file_name (str): The name of the JSON file containing Pokémon learnset data.
pokemon_name (str): The name of the Pokémon.
level (int): The level at which to check for moves.
Returns:
list: A list of up to 4 random moves and their highest levels.
"""
global learnset_path
# Load the JSON file
with open(learnset_path, 'r') as file:
learnsets = json.load(file)
# Normalize the Pokémon name to lowercase for consistency
pokemon_name = pokemon_name.lower()
# Retrieve the learnset for the specified Pokémon
pokemon_learnset = learnsets.get(pokemon_name, {})
# Create a dictionary to store moves and their corresponding highest levels
moves_at_level_and_lower = {}
# Loop through the learnset dictionary
for move, levels in pokemon_learnset.get('learnset', {}).items():
highest_level = float('-inf') # Initialize with negative infinity
eligible_moves = [] # Store moves eligible for inclusion
for move_level in levels:
# Check if the move_level string contains 'L'
if 'L' in move_level:
# Extract the level from the move_level string
move_level_int = int(move_level.split('L')[1])
# Check if the move can be learned at the specified level or lower
if move_level_int <= level:
# Update the highest_level if a higher level is found
highest_level = max(highest_level, move_level_int)
eligible_moves.append(move)
# Check if the eligible moves can be learned at a higher level
if highest_level != float('-inf'):
can_learn_at_higher_level = any(
int(move_level.split('L')[1]) > highest_level
for move_level in levels
if 'L' in move_level
)
if not can_learn_at_higher_level:
moves_at_level_and_lower[move] = highest_level
attacks = []
if moves_at_level_and_lower:
# Convert the dictionary into a list of tuples for random selection
moves_and_levels_list = list(moves_at_level_and_lower.items())
random.shuffle(moves_and_levels_list)
# Pick up to 4 random moves and append them to the attacks list
for move, highest_level in moves_and_levels_list[:4]:
#attacks.append(f"{move} at level: {highest_level}")
attacks.append(f"{move}")
return attacks
def get_all_pokemon_moves(pk_name, level):
"""
Args:
json_file_name (str): The name of the JSON file containing Pokémon learnset data.
pokemon_name (str): The name of the Pokémon.
level (int): The level at which to check for moves.
Returns:
list: A list of up to 4 random moves and their highest levels.
"""
global learnset_path
# Load the JSON file
with open(learnset_path, 'r') as file:
learnsets = json.load(file)
# Normalize the Pokémon name to lowercase for consistency
pk_name = pk_name.lower()
# Retrieve the learnset for the specified Pokémon
pokemon_learnset = learnsets.get(pk_name, {})
# Create a dictionary to store moves and their corresponding highest levels
moves_at_level_and_lower = {}
# Loop through the learnset dictionary
for move, levels in pokemon_learnset.get('learnset', {}).items():
highest_level = float('-inf') # Initialize with negative infinity
eligible_moves = [] # Store moves eligible for inclusion
for move_level in levels:
# Check if the move_level string contains 'L'
if 'L' in move_level:
# Extract the level from the move_level string
move_level_int = int(move_level.split('L')[1])
# Check if the move can be learned at the specified level or lower
if move_level_int <= level:
# Update the highest_level if a higher level is found
highest_level = max(highest_level, move_level_int)
eligible_moves.append(move)
# Check if the eligible moves can be learned at a higher level
if highest_level != float('-inf'):
can_learn_at_higher_level = any(
int(move_level.split('L')[1]) > highest_level
for move_level in levels
if 'L' in move_level
)
if not can_learn_at_higher_level:
moves_at_level_and_lower[move] = highest_level
attacks = []
if moves_at_level_and_lower:
# Convert the dictionary into a list of tuples for random selection
moves_and_levels_list = list(moves_at_level_and_lower.items())
# Pick up to 4 random moves and append them to the attacks list
for move, highest_level in moves_and_levels_list:
attacks.append(f"{move}")
return attacks
def pick_random_gender(pokemon_name):
"""
Randomly pick a gender for a given Pokémon based on its gender ratios.
Args:
pokemon_name (str): The name of the Pokémon.
pokedex_data (dict): Pokémon data loaded from the pokedex JSON file.
Returns:
str: "M" for male, "F" for female, or "Genderless" for genderless Pokémon.
"""
global pokedex_path
with open(pokedex_path, 'r', encoding="utf-8") as file:
pokedex_data = json.load(file)
pokemon_name = pokemon_name.lower() # Normalize Pokémon name to lowercase
pokemon = pokedex_data.get(pokemon_name)
if pokemon:
gender_ratio = pokemon.get("genderRatio")
if gender_ratio:
random_number = random.random() # Generate a random number between 0 and 1
if random_number < gender_ratio["M"]:
#return "M" # Male
gender = "M"
return gender
elif random_number > gender_ratio["M"]:
#return "F" # Female
gender = "F"
return gender
else:
genders = pokemon.get("gender")
if genders:
if genders == "F":
#return "M"
gender = "F"
elif genders == "M":
#return "F"
gender = "M"
elif genders == "N":
gender = "N"
return gender
else:
genders = ["M", "F"]
#genders = ["M", "♀"]
gender = random.choice(genders)
return gender
# Randomly choose between "M" and "F"
else:
genders = ["M", "F"]
gender = random.choice(genders)
return gender
if database_complete != False:
def get_levelup_move_for_pokemon(pokemon_name, level):
"""
Get a random move learned by a Pokémon at a specific level and lower, excluding moves that can be learned at a higher level.
Args:
pokemon_name (str): The name of the Pokémon.
level (int): The level at which to check for moves.
Returns:
str: A random move and its highest level.
"""
global learnset_path
# Load the JSON file
with open(learnset_path, 'r') as file:
learnsets = json.load(file)
# Normalize the Pokémon name to lowercase for consistency
pokemon_name = pokemon_name.lower()
# Retrieve the learnset for the specified Pokémon
pokemon_learnset = learnsets.get(pokemon_name, {})
# Create a dictionary to store moves and their corresponding highest levels
moves_at_level_and_lower = {}
# Loop through the learnset dictionary
for move, levels in pokemon_learnset.get('learnset', {}).items():
highest_level = float('-inf') # Initialize with negative infinity
eligible_moves = [] # Store moves eligible for inclusion
for move_level in levels:
# Check if the move_level string contains 'L'
if 'L' in move_level:
# Extract the level from the move_level string
move_level_int = int(move_level.split('L')[1])
# Check if the move can be learned at the specified level or lower
if move_level_int <= level:
# Update the highest_level if a higher level is found
highest_level = max(highest_level, move_level_int)
eligible_moves.append(move)
# Check if the move can be learned at a higher level
can_learn_at_higher_level = any(
'L' in move_level and int(move_level.split('L')[1]) > level
for move_level in levels
)
# Add the move and its highest level to the dictionary if not learnable at a higher level
if highest_level != float('-inf') and not can_learn_at_higher_level:
moves_at_level_and_lower[move] = highest_level
if moves_at_level_and_lower:
# Filter moves with the same highest level as the input level
eligible_moves = [
move for move, highest_level in moves_at_level_and_lower.items()
if highest_level == level
]
#if eligible_moves:
# Randomly select and return a move
#random_attack = random.choice(eligible_moves)
# return f"{random_attack} at level: {level}"
# else:
#return "No moves to be found."
# else:
#return f"{pokemon_name} does not learn any new moves at level {level} or lower."
return eligible_moves
def split_string_by_length(input_string, max_length):
current_length = 0
current_line = []
for word in input_string.split():
word_length = len(word) # Change this to calculate length in pixels
if current_length + len(current_line) + word_length <= max_length:
current_line.append(word)
current_length += word_length
else:
yield ' '.join(current_line)
current_line = [word]
current_length = word_length
yield ' '.join(current_line)
def split_japanese_string_by_length(input_string, max_length):
max_length = 30
current_length = 0
current_line = ""
for char in input_string:
if current_length + 1 <= max_length:
current_line += char
current_length += 1
else:
yield current_line
current_line = char
current_length = 1
if current_line: # Ensure the last line is also yielded
yield current_line
def resize_pixmap_img(pixmap, max_width):
original_width = pixmap.width()
original_height = pixmap.height()
new_width = max_width
new_height = (original_height * max_width) // original_width
pixmap2 = pixmap.scaled(new_width, new_height)
return pixmap2
def random_battle_scene():
global battlescene_path
battle_scenes = {}
for index, filename in enumerate(os.listdir(battlescene_path)):
if filename.endswith(".png"):
battle_scenes[index + 1] = filename
# Get the corresponding file name
battlescene_file = battle_scenes.get(random.randint(1, len(battle_scenes)))
return battlescene_file
if berries_sprites != False:
def random_berries():
global berries_path
berries = {}
for index, filename in enumerate(os.listdir(berries_path)):
if filename.endswith(".png"):
berries[index + 1] = filename
# Get the corresponding file name
berries_file = berries.get(random.randint(1, len(berries)))
return berries_file
if item_sprites != False:
def random_item():
global items_path
# Initialize an empty list to store the file names