mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Merge pull request #74 from Suamppa/sprite-download-path-fix
Fixes to sprite downloading pathing
This commit is contained in:
@@ -22,7 +22,7 @@ module Settings
|
|||||||
#Infinite fusion settings
|
#Infinite fusion settings
|
||||||
NB_POKEMON = 420
|
NB_POKEMON = 420
|
||||||
CUSTOM_BATTLERS_FOLDER = "Graphics/CustomBattlers/"
|
CUSTOM_BATTLERS_FOLDER = "Graphics/CustomBattlers/"
|
||||||
CUSTOM_BATTLERS_FOLDER_INDEXED = "Graphics/CustomBattlers/indexed"
|
CUSTOM_BATTLERS_FOLDER_INDEXED = "Graphics/CustomBattlers/indexed/"
|
||||||
BATTLERS_FOLDER = "Graphics/Battlers/"
|
BATTLERS_FOLDER = "Graphics/Battlers/"
|
||||||
DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/"
|
DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/"
|
||||||
DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png"
|
DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png"
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class PokeBattle_Battle
|
|||||||
end
|
end
|
||||||
|
|
||||||
#######
|
#######
|
||||||
# end of class
|
# end of class
|
||||||
######
|
######
|
||||||
|
|
||||||
####methodes utilitaires
|
####methodes utilitaires
|
||||||
@@ -401,10 +401,10 @@ end
|
|||||||
# i = rand(filesList.length-1)
|
# i = rand(filesList.length-1)
|
||||||
# path = filesList[i]
|
# path = filesList[i]
|
||||||
# file = File.basename(path, ".*")
|
# file = File.basename(path, ".*")
|
||||||
# splitPoke = file.split(".")
|
# splitPoke = file.split(".")
|
||||||
# head = splitPoke[0].to_i
|
# head = splitPoke[0].to_i
|
||||||
# body = splitPoke[1].to_i
|
# body = splitPoke[1].to_i
|
||||||
# return (body*NB_POKEMON)+head
|
# return (body*NB_POKEMON)+head
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ def getCustomSpeciesList(allowOnline=true)
|
|||||||
speciesList = []
|
speciesList = []
|
||||||
|
|
||||||
for num in 1..NB_POKEMON
|
for num in 1..NB_POKEMON
|
||||||
path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + "/" + num.to_s + "/*"
|
path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + num.to_s + "/*"
|
||||||
filesList = Dir[path]
|
filesList = Dir[path]
|
||||||
maxDexNumber = (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
maxDexNumber = (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||||
maxVal = filesList.length - 1
|
maxVal = filesList.length - 1
|
||||||
@@ -695,7 +695,7 @@ def replaceRivalStarterIfNecessary(species)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fixRivalStarter()
|
def fixRivalStarter()
|
||||||
#set starter baseform
|
#set starter baseform
|
||||||
if $PokemonGlobal.psuedoBSTHash == nil
|
if $PokemonGlobal.psuedoBSTHash == nil
|
||||||
psuedoHash = Hash.new
|
psuedoHash = Hash.new
|
||||||
for i in 0..NB_POKEMON
|
for i in 0..NB_POKEMON
|
||||||
@@ -738,4 +738,3 @@ def fixRivalStarter()
|
|||||||
pbSet(250, rivalStarter)
|
pbSet(250, rivalStarter)
|
||||||
$game_switches[840] = true
|
$game_switches[840] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ def get_unfused_sprite_path(dex_number)
|
|||||||
filename = sprintf("%s.png", dex_number)
|
filename = sprintf("%s.png", dex_number)
|
||||||
|
|
||||||
normal_path = Settings::BATTLERS_FOLDER + folder + "/" + filename
|
normal_path = Settings::BATTLERS_FOLDER + folder + "/" + filename
|
||||||
lightmode_path = Settings::BATTLERS_FOLDER + filename
|
lightmode_path = Settings::BATTLERS_FOLDER + filename
|
||||||
return normal_path if pbResolveBitmap(normal_path)
|
return normal_path if pbResolveBitmap(normal_path)
|
||||||
return lightmode_path
|
return lightmode_path
|
||||||
end
|
end
|
||||||
@@ -203,7 +203,7 @@ end
|
|||||||
def get_fusion_sprite_path(head_id,body_id)
|
def get_fusion_sprite_path(head_id,body_id)
|
||||||
#Try local custom sprite
|
#Try local custom sprite
|
||||||
filename = sprintf("%s.%s.png", head_id, body_id)
|
filename = sprintf("%s.%s.png", head_id, body_id)
|
||||||
local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + "/" + head_id.to_s + "/" +filename
|
local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" +filename
|
||||||
return local_custom_path if pbResolveBitmap(local_custom_path)
|
return local_custom_path if pbResolveBitmap(local_custom_path)
|
||||||
|
|
||||||
#Try to download custom sprite if none found locally
|
#Try to download custom sprite if none found locally
|
||||||
@@ -219,4 +219,4 @@ def get_fusion_sprite_path(head_id,body_id)
|
|||||||
return autogen_path if pbResolveBitmap(autogen_path)
|
return autogen_path if pbResolveBitmap(autogen_path)
|
||||||
|
|
||||||
return Settings::DEFAULT_SPRITE_PATH
|
return Settings::DEFAULT_SPRITE_PATH
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ end
|
|||||||
def download_autogen_sprite(head_id, body_id)
|
def download_autogen_sprite(head_id, body_id)
|
||||||
return nil if $PokemonSystem.download_sprites != 0
|
return nil if $PokemonSystem.download_sprites != 0
|
||||||
url = "https://raw.githubusercontent.com/Aegide/autogen-fusion-sprites/master/Battlers/{1}/{1}.{2}.png"
|
url = "https://raw.githubusercontent.com/Aegide/autogen-fusion-sprites/master/Battlers/{1}/{1}.{2}.png"
|
||||||
destPath = _INTL("{1}/{2}",Settings::BATTLERS_FOLDER,head_id)
|
destPath = _INTL("{1}{2}",Settings::BATTLERS_FOLDER,head_id)
|
||||||
sprite = download_sprite(_INTL(url,head_id,body_id),head_id,body_id,destPath)
|
sprite = download_sprite(_INTL(url,head_id,body_id),head_id,body_id,destPath)
|
||||||
return sprite if sprite
|
return sprite if sprite
|
||||||
return nil
|
return nil
|
||||||
@@ -44,7 +44,7 @@ def download_custom_sprite(head_id, body_id)
|
|||||||
return nil if $PokemonSystem.download_sprites != 0
|
return nil if $PokemonSystem.download_sprites != 0
|
||||||
#base_path = "https://raw.githubusercontent.com/Aegide/custom-fusion-sprites/main/CustomBattlers/{1}.{2}.png"
|
#base_path = "https://raw.githubusercontent.com/Aegide/custom-fusion-sprites/main/CustomBattlers/{1}.{2}.png"
|
||||||
url = "https://raw.githubusercontent.com/infinitefusion/sprites/main/CustomBattlers/{1}.{2}.png"
|
url = "https://raw.githubusercontent.com/infinitefusion/sprites/main/CustomBattlers/{1}.{2}.png"
|
||||||
destPath= _INTL("{1}/{2}",Settings::CUSTOM_BATTLERS_FOLDER_INDEXED,head_id)
|
destPath= _INTL("{1}{2}",Settings::CUSTOM_BATTLERS_FOLDER_INDEXED,head_id)
|
||||||
sprite = download_sprite(_INTL(url,head_id,body_id),head_id,body_id,destPath)
|
sprite = download_sprite(_INTL(url,head_id,body_id),head_id,body_id,destPath)
|
||||||
return sprite if sprite
|
return sprite if sprite
|
||||||
return nil
|
return nil
|
||||||
@@ -64,4 +64,4 @@ def list_online_custom_sprites
|
|||||||
# api_url = "https://api.github.com/repos/#{repo}/contents/#{folder}"
|
# api_url = "https://api.github.com/repos/#{repo}/contents/#{folder}"
|
||||||
# response = HTTPLite.get(api_url)
|
# response = HTTPLite.get(api_url)
|
||||||
# return HTTPLite::JSON.parse(response[:body]).map { |file| file['name'] }
|
# return HTTPLite::JSON.parse(response[:body]).map { |file| file['name'] }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ class PokedexUtils
|
|||||||
head_id = getHeadID(species, body_id)
|
head_id = getHeadID(species, body_id)
|
||||||
|
|
||||||
baseFilename = head_id.to_s + "." + body_id.to_s
|
baseFilename = head_id.to_s + "." + body_id.to_s
|
||||||
baseFilePath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + "/" + head_id.to_s + "/" + baseFilename + ".png"
|
baseFilePath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" + baseFilename + ".png"
|
||||||
if pbResolveBitmap(baseFilePath)
|
if pbResolveBitmap(baseFilePath)
|
||||||
ret << baseFilePath
|
ret << baseFilePath
|
||||||
end
|
end
|
||||||
POSSIBLE_ALTS.each { |alt_letter|
|
POSSIBLE_ALTS.each { |alt_letter|
|
||||||
altFilePath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + "/" + head_id.to_s + "/" + baseFilename + alt_letter + ".png"
|
altFilePath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" + baseFilename + alt_letter + ".png"
|
||||||
if pbResolveBitmap(altFilePath)
|
if pbResolveBitmap(altFilePath)
|
||||||
ret << altFilePath
|
ret << altFilePath
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ def sortCustomBattlers()
|
|||||||
next if filename == '.' or filename == '..'
|
next if filename == '.' or filename == '..'
|
||||||
next if !filename.end_with?(".png")
|
next if !filename.end_with?(".png")
|
||||||
headNum = filename.split('.')[0]
|
headNum = filename.split('.')[0]
|
||||||
oldPath = Settings::CUSTOM_BATTLERS_FOLDER + "/" + filename
|
oldPath = Settings::CUSTOM_BATTLERS_FOLDER + filename
|
||||||
newPath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + "/" + headNum.to_s + "/" +filename
|
newPath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + headNum.to_s + "/" + filename
|
||||||
begin
|
begin
|
||||||
if File.file?(newPath)
|
if File.file?(newPath)
|
||||||
alreadyExists[oldPath] = newPath
|
alreadyExists[oldPath] = newPath
|
||||||
|
|||||||
Reference in New Issue
Block a user