diff --git a/Data/Map077.rxdata b/Data/Map077.rxdata index f5c47d99a..cc6ffe5ef 100644 Binary files a/Data/Map077.rxdata and b/Data/Map077.rxdata differ diff --git a/Data/Map105.rxdata b/Data/Map105.rxdata index b46e3cf31..c7a099d83 100644 Binary files a/Data/Map105.rxdata and b/Data/Map105.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index 41b03bc5d..31f328eb7 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ diff --git a/Data/Scripts/012_Overworld/001_Overworld.rb b/Data/Scripts/012_Overworld/001_Overworld.rb index ab4d9ca0b..4440566c9 100644 --- a/Data/Scripts/012_Overworld/001_Overworld.rb +++ b/Data/Scripts/012_Overworld/001_Overworld.rb @@ -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 diff --git a/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb b/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb index 10737b7c0..f3ea8140f 100644 --- a/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb +++ b/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb @@ -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,17 +430,18 @@ 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?")) - #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 + 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 + 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 speciesList end diff --git a/Data/Scripts/025-Randomizer/randomizer.rb b/Data/Scripts/025-Randomizer/randomizer.rb index d33971ffb..30683faf0 100644 --- a/Data/Scripts/025-Randomizer/randomizer.rb +++ b/Data/Scripts/025-Randomizer/randomizer.rb @@ -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 diff --git a/Data/Scripts/050_AddOns/GeneralUtils.rb b/Data/Scripts/050_AddOns/GeneralUtils.rb index 68decaab5..5c971f1cd 100644 --- a/Data/Scripts/050_AddOns/GeneralUtils.rb +++ b/Data/Scripts/050_AddOns/GeneralUtils.rb @@ -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 diff --git a/Data/Scripts/050_AddOns/HttpCalls.rb b/Data/Scripts/050_AddOns/HttpCalls.rb index 7d7e6c172..fae6171e9 100644 --- a/Data/Scripts/050_AddOns/HttpCalls.rb +++ b/Data/Scripts/050_AddOns/HttpCalls.rb @@ -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 diff --git a/Data/System.rxdata b/Data/System.rxdata index e79afde2e..a100d15d4 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ diff --git a/Data/encounters_randomized.dat b/Data/encounters_randomized.dat index 1a353d4ab..850858502 100644 Binary files a/Data/encounters_randomized.dat and b/Data/encounters_randomized.dat differ