Adds toggle for displaying generated entries or not + fixes issue when cleaning json strings

This commit is contained in:
infinitefusion
2024-12-23 23:52:04 -05:00
parent d2e5dfb8cd
commit 950c942b20
21 changed files with 41 additions and 14 deletions

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.

View File

@@ -119,11 +119,11 @@ def downloadAllowed?()
end end
def clean_json_string(str) def clean_json_string(str)
return str if $PokemonSystem.on_mobile #echoln str
#return str if $PokemonSystem.on_mobile
# Remove non-UTF-8 characters and unexpected control characters # Remove non-UTF-8 characters and unexpected control characters
#cleaned_str = str.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
cleaned_str = str cleaned_str = str
cleaned_str = str.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
# Remove literal \n, \r, \t, etc. # Remove literal \n, \r, \t, etc.
cleaned_str = cleaned_str.gsub(/\\n|\\r|\\t/, '') cleaned_str = cleaned_str.gsub(/\\n|\\r|\\t/, '')
@@ -137,6 +137,7 @@ def clean_json_string(str)
cleaned_str = cleaned_str.gsub(/\\u([\da-fA-F]{4})/) { |match| cleaned_str = cleaned_str.gsub(/\\u([\da-fA-F]{4})/) { |match|
[$1.to_i(16)].pack("U") [$1.to_i(16)].pack("U")
} }
echoln cleaned_str
return cleaned_str return cleaned_str
end end

View File

@@ -323,7 +323,7 @@ class PokemonPokedexInfo_Scene
# species_data.pokedex_entry, base, shadow) # species_data.pokedex_entry, base, shadow)
# #
# #
#$PokemonSystem.use_generated_dex_entries=true if $PokemonSystem.use_generated_dex_entries ==nil
drawEntryText(overlay, species_data) drawEntryText(overlay, species_data)
# Draw the footprint # Draw the footprint
@@ -362,7 +362,8 @@ class PokemonPokedexInfo_Scene
pbDrawImagePositions(overlay, imagepos) pbDrawImagePositions(overlay, imagepos)
end end
def drawEntryText(overlay, species_data)
def drawEntryText(overlay, species_data)
baseColor = Color.new(88, 88, 80) baseColor = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184) shadow = Color.new(168, 184, 184)
shadowCustom = Color.new(160, 200, 150) shadowCustom = Color.new(160, 200, 150)
@@ -374,12 +375,17 @@ class PokemonPokedexInfo_Scene
entryText = customEntry entryText = customEntry
shadowColor = shadowCustom shadowColor = shadowCustom
else else
aiEntry = getAIDexEntry(species_data.species, species_data.name) if $PokemonSystem.use_generated_dex_entries
if aiEntry aiEntry = getAIDexEntry(species_data.species, species_data.name)
entryText = aiEntry if aiEntry
shadowColor = shadowAI entryText = aiEntry
shadowColor = shadowAI
else
entryText = species_data.pokedex_entry
shadowColor = shadow
end
else else
entryText = species_data.pokedex_entry entryText = "No custom Pokédex entry available for this Pokémon. Placeholder entries can be enabled in the game's options."
shadowColor = shadow shadowColor = shadow
end end
end end

View File

@@ -22,6 +22,7 @@ class PokemonSystem
attr_accessor :max_nb_sprites_download attr_accessor :max_nb_sprites_download
attr_accessor :on_mobile attr_accessor :on_mobile
attr_accessor :type_icons attr_accessor :type_icons
attr_accessor :use_generated_dex_entries
def initialize def initialize
@textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast) @textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast)
@@ -43,6 +44,7 @@ class PokemonSystem
@max_nb_sprites_download = 5 @max_nb_sprites_download = 5
@on_mobile = false @on_mobile = false
@type_icons = true @type_icons = true
@use_generated_dex_entries = true
end end
end end

View File

@@ -111,6 +111,19 @@ class PokemonGameOption_Scene < PokemonOption_Scene
"Automatically download missing custom sprites and Pokédex entries from the internet" "Automatically download missing custom sprites and Pokédex entries from the internet"
) )
generated_entries_option_selected=$PokemonSystem.use_generated_dex_entries ? 1 : 0
options << EnumOption.new(_INTL("Autogen dex entries"), [_INTL("Off"), _INTL("On")],
proc { generated_entries_option_selected },
proc { |value|
$PokemonSystem.use_generated_dex_entries = value == 1
},
[
"Fusions without a custom Pokédex entry display nothing.",
"Fusions without a custom Pokédex entry display an auto-generated placeholder."
]
)
if $game_switches && ($game_switches[SWITCH_NEW_GAME_PLUS] || $game_switches[SWITCH_BEAT_THE_LEAGUE]) #beat the league if $game_switches && ($game_switches[SWITCH_NEW_GAME_PLUS] || $game_switches[SWITCH_BEAT_THE_LEAGUE]) #beat the league
options << options <<
EnumOption.new(_INTL("Battle type"), [_INTL("1v1"), _INTL("2v2"), _INTL("3v3")], EnumOption.new(_INTL("Battle type"), [_INTL("1v1"), _INTL("2v2"), _INTL("3v3")],
@@ -177,6 +190,8 @@ class PokemonGameOption_Scene < PokemonOption_Scene
"Display the enemy Pokémon type in battles." "Display the enemy Pokémon type in battles."
) )
end end
options << EnumOption.new(_INTL("Screen Size"), [_INTL("S"), _INTL("M"), _INTL("L"), _INTL("XL"), _INTL("Full")], options << EnumOption.new(_INTL("Screen Size"), [_INTL("S"), _INTL("M"), _INTL("L"), _INTL("XL"), _INTL("Full")],
proc { [$PokemonSystem.screensize, 4].min }, proc { [$PokemonSystem.screensize, 4].min },

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
1734884784 1735012654

View File

@@ -1,2 +1,5 @@
1734276281 1734914400
1734276286 1734914401
1734914402
1734914434
1734914435