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 # Being given an item
#=============================================================================== #===============================================================================
def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom=true) 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 #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] 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])) 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é item = pbGetRandomItem(item) if canRandom #fait rien si pas activé
else else

View File

@@ -360,7 +360,7 @@ def Kernel.pbShuffleTrainersCustom(bst_range = 50)
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST) bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
Kernel.pbMessage(_INTL("Parsing custom sprites folder")) Kernel.pbMessage(_INTL("Parsing custom sprites folder"))
customsList = getCustomSpeciesList(true) customsList = getCustomSpeciesList(true,true)
Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s)) Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s))
if customsList.length == 0 if customsList.length == 0
@@ -410,7 +410,7 @@ end
# return (body*NB_POKEMON)+head # return (body*NB_POKEMON)+head
#end #end
def getCustomSpeciesList(allowOnline = false) def getCustomSpeciesList(allowOnline = true, redownload_file=false)
speciesList = [] speciesList = []
for num in 1..NB_POKEMON for num in 1..NB_POKEMON
@@ -430,7 +430,9 @@ def getCustomSpeciesList(allowOnline = false)
end end
if speciesList.length <= 200 && allowOnline 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 #try to get list from github
online_list = list_online_custom_sprites(true) online_list = list_online_custom_sprites(true)
return speciesList if !online_list return speciesList if !online_list
@@ -441,7 +443,6 @@ def getCustomSpeciesList(allowOnline = false)
end end
return species_id_list return species_id_list
end end
end
return speciesList return speciesList
end end

View File

@@ -82,9 +82,8 @@ def Kernel.pbShuffleDex(range = 50, type = 0)
range = 1 if range == 0 range = 1 if range == 0
should_include_fusions = $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] should_include_fusions = $game_switches[SWITCH_RANDOM_WILD_TO_FUSION]
only_customs = $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && should_include_fusions only_customs = $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && should_include_fusions
# create hash # 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 if !pokemon_list #when not enough custom sprites
pokemon_list = get_pokemon_list(should_include_fusions) pokemon_list = get_pokemon_list(should_include_fusions)
end end

View File

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

View File

@@ -28,6 +28,13 @@ def download_file(url, saveLocation)
end end
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") def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp")
begin begin
downloaded_file_name = _INTL("{1}/{2}.{3}.png", saveLocation, head_id, body_id) 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) def list_online_custom_sprites(updateList=false)
updateOnlineCustomSpritesFile if updateList
sprites_list= [] sprites_list= []
File.foreach(Settings::CUSTOM_SPRITES_FILE_PATH) do |line| File.foreach(Settings::CUSTOM_SPRITES_FILE_PATH) do |line|
sprites_list << line sprites_list << line

Binary file not shown.

Binary file not shown.