mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Promps users for updating spritepack files
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -43,6 +43,7 @@ def download_file(url, saveLocation)
|
||||
return saveLocation
|
||||
else
|
||||
echoln _INTL("Failed to download file {1}", url)
|
||||
echoln caller
|
||||
end
|
||||
return nil
|
||||
rescue MKXPError, Errno::ENOENT => error
|
||||
@@ -72,6 +73,7 @@ def fetch_sprite_from_web(url, destinationPath)
|
||||
return true
|
||||
end
|
||||
echoln "Failed to download #{url}"
|
||||
echoln caller
|
||||
return false
|
||||
rescue MKXPError => e
|
||||
echoln "MKXPError: #{e.message}"
|
||||
@@ -85,8 +87,7 @@ def fetch_sprite_from_web(url, destinationPath)
|
||||
end
|
||||
|
||||
def download_spritesheet(pif_sprite, dest)
|
||||
#return nil if requestRateExceeded?(Settings::CUSTOMSPRITES_RATE_LOG_FILE,Settings::CUSTOMSPRITES_ENTRIES_RATE_TIME_WINDOW,Settings::CUSTOMSPRITES_RATE_MAX_NB_REQUESTS)
|
||||
return nil if requestRateExceeded?(Settings::CUSTOMSPRITES_RATE_LOG_FILE, 60, 15)
|
||||
return nil if requestRateExceeded?(Settings::CUSTOMSPRITES_RATE_LOG_FILE,Settings::CUSTOMSPRITES_ENTRIES_RATE_TIME_WINDOW,Settings::CUSTOMSPRITES_RATE_MAX_NB_REQUESTS)
|
||||
case pif_sprite.type
|
||||
when :AUTOGEN
|
||||
return
|
||||
@@ -420,8 +421,8 @@ def requestRateExceeded?(logFile, timeWindow, maxRequests, update_log_file = tru
|
||||
# Write the updated log back to the file
|
||||
if update_log_file
|
||||
File.write(logFile, request_timestamps.join("\n"))
|
||||
echoln "Rate limiting: Current: #{request_timestamps.size}, Max: #{maxRequests}"
|
||||
end
|
||||
echoln "Rate limiting: Current: #{request_timestamps.size}, Max: #{maxRequests}"
|
||||
rateLimitExceeded = request_timestamps.size > maxRequests
|
||||
return rateLimitExceeded
|
||||
end
|
||||
|
||||
@@ -379,9 +379,22 @@ class PokemonLoadScreen
|
||||
def check_for_spritepack_update()
|
||||
$updated_spritesheets = [] if !$updated_spritesheets
|
||||
if new_spritepack_was_released()
|
||||
reset_updated_spritesheets_cache()
|
||||
$updated_spritesheets = []
|
||||
end
|
||||
pbFadeOutIn() {
|
||||
return if !downloadAllowed?()
|
||||
should_update = pbConfirmMessage("A new spritepack was released. Would you like to let the game update your game's sprites automatically?")
|
||||
if should_update
|
||||
updateCreditsFile()
|
||||
updateOnlineCustomSpritesFile()
|
||||
reset_updated_spritesheets_cache()
|
||||
spritesLoader = BattleSpriteLoader.new
|
||||
spritesLoader.clear_sprites_cache(:CUSTOM)
|
||||
spritesLoader.clear_sprites_cache(:BASE)
|
||||
|
||||
$updated_spritesheets = []
|
||||
pbMessage("Data files updated. New sprites will now be downloaded as you play!")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def reset_updated_spritesheets_cache()
|
||||
@@ -426,9 +439,7 @@ class PokemonLoadScreen
|
||||
|
||||
def pbStartLoadScreen
|
||||
updateHttpSettingsFile
|
||||
updateCreditsFile
|
||||
updateCustomDexFile
|
||||
updateOnlineCustomSpritesFile
|
||||
newer_version = find_newer_available_version
|
||||
if newer_version
|
||||
pbMessage(_INTL("Version {1} is now available! Please use the game's installer to download the newest version. Check the Discord for more information.", newer_version))
|
||||
@@ -444,6 +455,7 @@ class PokemonLoadScreen
|
||||
pbMessage(_INTL("{1} new custom sprites were imported into the game", $game_temp.nb_imported_sprites.to_s))
|
||||
end
|
||||
checkEnableSpritesDownload
|
||||
|
||||
$game_temp.nb_imported_sprites = nil
|
||||
copyKeybindings()
|
||||
save_file_list = SaveData::AUTO_SLOTS + SaveData::MANUAL_SLOTS
|
||||
@@ -507,11 +519,11 @@ class PokemonLoadScreen
|
||||
@scene.pbEndScene
|
||||
Game.load(@save_data)
|
||||
$game_switches[SWITCH_V5_1] = true
|
||||
check_for_spritepack_update()
|
||||
ensureCorrectDifficulty()
|
||||
setGameMode()
|
||||
initialize_alt_sprite_substitutions()
|
||||
$PokemonGlobal.autogen_sprites_cache = {}
|
||||
check_for_spritepack_update()
|
||||
preload_party(@save_data[:player])
|
||||
return
|
||||
when cmd_new_game
|
||||
|
||||
@@ -32,8 +32,8 @@ module Settings
|
||||
BASE_POKEMON_SPRITESHEET_TRUE_SIZE_URL = "https://infinitefusion.net/customsprites/spritesheets/spritesheets_base/"
|
||||
CUSTOM_FUSIONS_SPRITESHEET_TRUE_SIZE_URL = "https://infinitefusion.net/customsprites/spritesheets/spritesheets_custom/"
|
||||
|
||||
CUSTOMSPRITES_RATE_MAX_NB_REQUESTS = 5 #Nb. requests allowed in each time window
|
||||
CUSTOMSPRITES_ENTRIES_RATE_TIME_WINDOW = 120 # In seconds
|
||||
CUSTOMSPRITES_RATE_MAX_NB_REQUESTS = 15 #Nb. requests allowed in each time window
|
||||
CUSTOMSPRITES_ENTRIES_RATE_TIME_WINDOW = 60 # In seconds
|
||||
MAX_NB_SPRITES_TO_DOWNLOAD_AT_ONCE =5
|
||||
|
||||
#POKEDEX ENTRIES
|
||||
@@ -44,7 +44,7 @@ module Settings
|
||||
AI_ENTRIES_RATE_LOG_FILE = 'Data/pokedex/rate_limit.log' # Path to the log file
|
||||
|
||||
#Spritepack
|
||||
NEWEST_SPRITEPACK_MONTH = 2
|
||||
NEWEST_SPRITEPACK_MONTH = 4
|
||||
NEWEST_SPRITEPACK_YEAR = 2025
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 24 KiB |
Reference in New Issue
Block a user