Fixes starter pokemon not being downloaded

This commit is contained in:
infinitefusion
2023-04-23 15:54:05 -04:00
parent 8534a51656
commit 087fe9a446
10 changed files with 34 additions and 18 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -833,11 +833,10 @@ end
# Being given an item
#===============================================================================
def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom=true)
#item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire
canRandom = false if !$game_switches[SWITCH_RANDOM_ITEMS_GENERAL]
original_item = GameData::Item.get(item).is_TM?
original_item = GameData::Item.get(item)
if canRandom && ((!original_item.is_TM? && $game_switches[SWITCH_RANDOM_GIVEN_ITEMS]) || (original_item.is_TM? && $game_switches[SWITCH_RANDOM_GIVEN_TMS]))
item = pbGetRandomItem(item) if canRandom #fait rien si pas activé
else

View File

@@ -360,7 +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)
customsList = getCustomSpeciesList(true,true)
Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s))
if customsList.length == 0
@@ -410,7 +410,7 @@ end
# return (body*NB_POKEMON)+head
#end
def getCustomSpeciesList(allowOnline = false)
def getCustomSpeciesList(allowOnline = true, redownload_file=false)
speciesList = []
for num in 1..NB_POKEMON
@@ -430,7 +430,9 @@ def getCustomSpeciesList(allowOnline = false)
end
if speciesList.length <= 200 && allowOnline
if Kernel.pbConfirmMessage(_INTL("Not enough local sprites found. Attempt to fetch list from the internet?"))
if redownload_file && Kernel.pbConfirmMessage(_INTL("Not enough local sprites found. Attempt to fetch list from the internet?"))
updateOnlineCustomSpritesFile
end
#try to get list from github
online_list = list_online_custom_sprites(true)
return speciesList if !online_list
@@ -441,7 +443,6 @@ def getCustomSpeciesList(allowOnline = false)
end
return species_id_list
end
end
return speciesList
end

View File

@@ -82,9 +82,8 @@ def Kernel.pbShuffleDex(range = 50, type = 0)
range = 1 if range == 0
should_include_fusions = $game_switches[SWITCH_RANDOM_WILD_TO_FUSION]
only_customs = $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && should_include_fusions
# create hash
pokemon_list = only_customs ? getCustomSpeciesList() : get_pokemon_list(should_include_fusions)
pokemon_list = only_customs ? getCustomSpeciesList(true) : get_pokemon_list(should_include_fusions)
if !pokemon_list #when not enough custom sprites
pokemon_list = get_pokemon_list(should_include_fusions)
end

View File

@@ -382,9 +382,10 @@ end
def obtainPokemonSpritePath(bodyId, headId, include_customs = true)
download_pokemon_sprite_if_missing(bodyId,headId)
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", headId, bodyId)
if include_customs
if include_customs && customSpriteExists(bodyId,headId)
pathCustom = getCustomSpritePath(bodyId,headId)
if (pbResolveBitmap(pathCustom))
picturePath = pathCustom
@@ -406,6 +407,16 @@ def customSpriteExists(species)
return download_custom_sprite(head, body) != nil
end
def customSpriteExists(body, head)
pathCustom = getCustomSpritePath(body,head)
return true if pbResolveBitmap(pathCustom) != nil
return download_custom_sprite(head, body) != nil
end
def customSpriteExistsBase(body,head)
pathCustom = getCustomSpritePath(body,head)
return true if pbResolveBitmap(pathCustom) != nil

View File

@@ -28,6 +28,13 @@ def download_file(url, saveLocation)
end
end
def download_pokemon_sprite_if_missing(body, head)
return if $PokemonSystem.download_sprites != 0
get_fusion_sprite_path(head,body)
end
def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp")
begin
downloaded_file_name = _INTL("{1}/{2}.{3}.png", saveLocation, head_id, body_id)
@@ -114,7 +121,6 @@ end
def list_online_custom_sprites(updateList=false)
updateOnlineCustomSpritesFile if updateList
sprites_list= []
File.foreach(Settings::CUSTOM_SPRITES_FILE_PATH) do |line|
sprites_list << line

Binary file not shown.

Binary file not shown.