mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
check for newer version + small bugFixes
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,7 +6,7 @@
|
||||
module Settings
|
||||
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
|
||||
GAME_VERSION = '5.0.0'
|
||||
GAME_VERSION_NUMBER = "5.1.3"
|
||||
GAME_VERSION_NUMBER = "5.1.3.2"
|
||||
|
||||
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
|
||||
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
|
||||
@@ -26,8 +26,11 @@ module Settings
|
||||
BATTLERS_FOLDER = "Graphics/Battlers/"
|
||||
DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/"
|
||||
DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png"
|
||||
CREDITS_FILE_PATH = "Data/credits.csv"
|
||||
CREDITS_FILE_PATH = "Data/SPRITE_CREDS"
|
||||
VERSION_FILE_PATH = "Data/VERSION"
|
||||
CREDITS_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/sprites/main/Sprite Credits.csv"
|
||||
VERSION_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/VERSION"
|
||||
|
||||
FRONTSPRITE_POSITION_OFFSET = 20
|
||||
FRONTSPRITE_SCALE = 0.6666666666
|
||||
BACKRPSPRITE_SCALE = 1
|
||||
|
||||
@@ -782,7 +782,7 @@ end
|
||||
|
||||
def pbEndSurf(_xOffset, _yOffset)
|
||||
return false if !$PokemonGlobal.surfing
|
||||
return false if !$PokemonGlobal.diving
|
||||
return false if $PokemonGlobal.diving
|
||||
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
@@ -796,6 +796,7 @@ def pbEndSurf(_xOffset, _yOffset)
|
||||
end
|
||||
$PokemonTemp.surfJump = nil
|
||||
return true
|
||||
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -415,7 +415,8 @@ end
|
||||
def getSpriteCredits(spriteName)
|
||||
File.foreach(Settings::CREDITS_FILE_PATH) do |line|
|
||||
row = line.split(';')
|
||||
if row[0].include?(spriteName)
|
||||
echo row[0]
|
||||
if row[0] == spriteName
|
||||
return row[1]
|
||||
end
|
||||
end
|
||||
@@ -557,3 +558,25 @@ def get_default_moves_at_level(species,level)
|
||||
p moves
|
||||
return moves
|
||||
end
|
||||
|
||||
|
||||
def find_newer_available_version
|
||||
latest_Version = fetch_latest_game_version
|
||||
return nil if !latest_Version
|
||||
return nil if is_higher_version(Settings::GAME_VERSION_NUMBER,latest_Version)
|
||||
return latest_Version
|
||||
end
|
||||
|
||||
def is_higher_version(gameVersion, latestVersion)
|
||||
gameVersion_parts = gameVersion.split('.').map(&:to_i)
|
||||
latestVersion_parts = latestVersion.split('.').map(&:to_i)
|
||||
|
||||
# Compare each part of the version numbers from left to right
|
||||
gameVersion_parts.each_with_index do |part, i|
|
||||
return true if (latestVersion_parts[i].nil? || part > latestVersion_parts[i])
|
||||
return false if part < latestVersion_parts[i]
|
||||
end
|
||||
|
||||
# If all parts are equal up to this point, the longer version is considered higher
|
||||
return latestVersion_parts.length < gameVersion_parts.length
|
||||
end
|
||||
|
||||
@@ -6,10 +6,6 @@ def test_http_get
|
||||
end
|
||||
end
|
||||
|
||||
def downloadCustomSprite(head_id, body_id)
|
||||
base_custom_path = "https://raw.githubusercontent.com/infinitefusion/sprites/main/Sprite%20Credits.csv"
|
||||
end
|
||||
|
||||
def updateCreditsFile
|
||||
return if $PokemonSystem.download_sprites != 0
|
||||
download_file(Settings::CREDITS_FILE_URL,Settings::CREDITS_FILE_PATH,)
|
||||
@@ -18,6 +14,7 @@ end
|
||||
def download_file(url, saveLocation)
|
||||
begin
|
||||
response = HTTPLite.get(url)
|
||||
p response
|
||||
if response[:status] == 200
|
||||
File.open(saveLocation, "wb") do |file|
|
||||
file.write(response[:body])
|
||||
@@ -26,7 +23,8 @@ def download_file(url, saveLocation)
|
||||
return saveLocation
|
||||
end
|
||||
return nil
|
||||
rescue MKXPError
|
||||
rescue MKXPError => error
|
||||
echo error
|
||||
return nil
|
||||
end
|
||||
end
|
||||
@@ -84,3 +82,22 @@ def list_online_custom_sprites
|
||||
# response = HTTPLite.get(api_url)
|
||||
# return HTTPLite::JSON.parse(response[:body]).map { |file| file['name'] }
|
||||
end
|
||||
|
||||
GAME_VERSION_FORMAT_REGEX = /\A\d+(\.\d+)*\z/
|
||||
def fetch_latest_game_version
|
||||
begin
|
||||
download_file(Settings::VERSION_FILE_URL,Settings::VERSION_FILE_PATH,)
|
||||
version_file = File.open(Settings::VERSION_FILE_PATH, "r")
|
||||
version = version_file.first
|
||||
version_file.close
|
||||
|
||||
version_format_valid = version.match(GAME_VERSION_FORMAT_REGEX)
|
||||
|
||||
return version if version_format_valid
|
||||
return nil
|
||||
rescue MKXPError, Errno::ENOENT => error
|
||||
echo error
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -321,6 +321,11 @@ class PokemonLoadScreen
|
||||
|
||||
def pbStartLoadScreen
|
||||
updateCreditsFile
|
||||
newer_version = find_newer_available_version
|
||||
if newer_version
|
||||
pbMessage(_INTL("Version {1} is now available! Please check the game's official page to download the newest version.",newer_version))
|
||||
end
|
||||
|
||||
if ($game_temp.unimportedSprites && $game_temp.unimportedSprites.size > 0)
|
||||
handleReplaceExistingSprites()
|
||||
end
|
||||
|
||||
@@ -88,7 +88,7 @@ end
|
||||
def getSpriteCredits(spriteName)
|
||||
File.foreach(Settings::CREDITS_FILE_PATH) do |line|
|
||||
row = line.split(',')
|
||||
if row[0].include?(spriteName)
|
||||
if row[0] == (spriteName)
|
||||
return row[1]
|
||||
end
|
||||
end
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user