fetch custom sprites list from github (small fixes)

This commit is contained in:
infinitefusion
2023-04-23 12:30:54 -04:00
parent 521e9a410f
commit e8f8a215b5
2 changed files with 14 additions and 19 deletions

View File

@@ -360,8 +360,7 @@ def Kernel.pbShuffleTrainersCustom(bst_range = 50)
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
Kernel.pbMessage(_INTL("Parsing custom sprites folder"))
customsList = getCustomSpeciesList(true )
p customsList
customsList = getCustomSpeciesList(true)
Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s))
if customsList.length == 0
@@ -373,7 +372,7 @@ def Kernel.pbShuffleTrainersCustom(bst_range = 50)
Kernel.pbMessage(_INTL("Trainer Pokémon will include auto-generated sprites."))
return Kernel.pbShuffleTrainers(bst_range) ##use regular shuffle if not enough sprites
end
if Kernel.pbConfirmMessage(_INTL("This will result in a very low Pokémon variety for trainers. Continue anyway?"))
if Kernel.pbConfirmMessage(_INTL("This will result in a very low Pokémon variety for trainers. Continue anyway?"))
bst_range = 999
else
Kernel.pbMessage(_INTL("Trainer Pokémon will include auto-generated sprites."))
@@ -383,7 +382,6 @@ def Kernel.pbShuffleTrainersCustom(bst_range = 50)
Kernel.pbShuffleTrainers(bst_range, true, customsList)
end
# trainers=load_data("Data/trainers.dat")
# i=0
# for trainer in trainers
@@ -412,8 +410,7 @@ end
# return (body*NB_POKEMON)+head
#end
def getCustomSpeciesList(allowOnline=false)
def getCustomSpeciesList(allowOnline = false)
speciesList = []
for num in 1..NB_POKEMON
@@ -432,20 +429,19 @@ def getCustomSpeciesList(allowOnline=false)
end
end
if speciesList.length <= 200 && allowOnline
Kernel.pbMessage(_INTL("Not enough local sprites found, attempting to fetch list from the internet."))
#try to get list from github
online_list = list_online_custom_sprites(true)
return speciesList if !online_list
species_id_list = []
for file in online_list
dexnum = getDexNumFromFilename(file)
species_id_list << dexnum if dexnum && dexnum <= maxDexNumber && dexnum > 0
if Kernel.pbConfirmMessage(_INTL("Not enough local sprites found. Attempt to fetch list from the internet?"))
#try to get list from github
online_list = list_online_custom_sprites(true)
return speciesList if !online_list
species_id_list = []
for file in online_list
dexnum = getDexNumFromFilename(file)
species_id_list << dexnum if dexnum && dexnum <= maxDexNumber && dexnum > 0
end
return species_id_list
end
return species_id_list
end
return speciesList
end
@@ -460,7 +456,7 @@ def getDexNumFromFilename(filename)
head = splitPoke[0].to_i
body = splitPoke[1].to_i
return nil if (body * NB_POKEMON) + head > (NB_POKEMON*NB_POKEMON)+420
return nil if (body * NB_POKEMON) + head > (NB_POKEMON * NB_POKEMON) + 420
return (body * NB_POKEMON) + head
end
@@ -482,7 +478,6 @@ end
# end
# end
def Kernel.getBaseStats(species)
if $pkmn_dex[species] == nil
print species