dynamic autogen entries

This commit is contained in:
infinitefusion
2024-12-25 14:13:03 -05:00
parent 0a59474542
commit 479cfd07fd
5 changed files with 42 additions and 25 deletions

View File

@@ -35,6 +35,8 @@ module Settings
BASE_SPRITES_FILE_PATH = "Data/sprites/BASE_SPRITES"
CUSTOM_DEX_ENTRIES_PATH = "Data/pokedex/dex.json"
AI_DEX_ENTRIES_PATH = "Data/pokedex/generated_entries.json"
POKEDEX_ENTRIES_PATH = "Data/pokedex/all_entries.json"
UPDATED_SPRITESHEETS_CACHE = "Data/sprites/updated_spritesheets_cache"
BACK_ITEM_ICON_PATH = "Graphics/Items/back.png"

View File

@@ -21,7 +21,7 @@ class PokemonPokedexInfo_Scene
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
@spritesLoader = BattleSpriteLoader.new
@randomEntryText = nil
# @mapdata = pbLoadTownMapData
# map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
# mappos = (map_metadata) ? map_metadata.town_map_position : nil
@@ -375,18 +375,12 @@ class PokemonPokedexInfo_Scene
entryText = customEntry
shadowColor = shadowCustom
else
if false#$PokemonSystem.use_generated_dex_entries
aiEntry = getAIDexEntry(species_data.species, species_data.name)
if aiEntry
entryText = aiEntry
shadowColor = shadowAI
else
entryText = species_data.pokedex_entry
if $PokemonSystem.use_generated_dex_entries && species_data.is_a?(GameData::FusedSpecies)
@randomEntryText = species_data.get_random_dex_entry if !@randomEntryText
entryText = @randomEntryText
shadowColor = shadow
end
else
entryText = "No custom Pokédex entry available for this Pokémon. Due to community backlash, auto-generated Pokédex entries are no longer available."
#entryText = "No custom Pokédex entry available for this Pokémon. Auto-generated placeholder entries can be enabled in the game's options."
entryText = "No custom Pokédex entry available for this Pokémon. Please consider submitting an entry for this Pokémon on the game's Discord."
shadowColor = shadow
end
end

View File

@@ -297,6 +297,27 @@ module GameData
return split_and_combine_text(body_entry, head_entry, ".")
end
def get_random_dex_entry()
begin
file_path = Settings::POKEDEX_ENTRIES_PATH
json_data = File.read(file_path)
all_body_entries = HTTPLite::JSON.parse(json_data)
body_entry = all_body_entries[@body_pokemon.id_number.to_s].sample
head_entry = all_body_entries[@head_pokemon.id_number.to_s].sample
rescue
@body_pokemon.real_pokedex_entry.gsub(@body_pokemon.real_name, @real_name)
head_entry = @head_pokemon.real_pokedex_entry.gsub(@head_pokemon.real_name, @real_name)
end
body_entry = clean_json_string(body_entry).gsub(@body_pokemon.real_name, @real_name)
head_entry = clean_json_string(head_entry).gsub(@head_pokemon.real_name, @real_name)
echoln body_entry
echoln head_entry
return split_and_combine_text(body_entry, head_entry, ".")
end
def calculate_egg_groups
body_egg_groups = @body_pokemon.egg_groups
head_egg_groups = @head_pokemon.egg_groups
@@ -343,7 +364,7 @@ module GameData
beginningText = beginingText_split[0]
endText = endText_split[1] && endText_split[1] != "" ? endText_split[1] : endText_split[0]
return beginningText + separator + endText
return beginningText + separator + " " + endText
end
def calculate_fused_stats(dominantStat, otherStat)

View File

@@ -111,18 +111,18 @@ class PokemonGameOption_Scene < PokemonOption_Scene
"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."
#
# ]
# )
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
options <<

Binary file not shown.