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" BASE_SPRITES_FILE_PATH = "Data/sprites/BASE_SPRITES"
CUSTOM_DEX_ENTRIES_PATH = "Data/pokedex/dex.json" CUSTOM_DEX_ENTRIES_PATH = "Data/pokedex/dex.json"
AI_DEX_ENTRIES_PATH = "Data/pokedex/generated_entries.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" UPDATED_SPRITESHEETS_CACHE = "Data/sprites/updated_spritesheets_cache"
BACK_ITEM_ICON_PATH = "Graphics/Items/back.png" 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_x = Settings::FRONTSPRITE_SCALE
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE @sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
@spritesLoader = BattleSpriteLoader.new @spritesLoader = BattleSpriteLoader.new
@randomEntryText = nil
# @mapdata = pbLoadTownMapData # @mapdata = pbLoadTownMapData
# map_metadata = GameData::MapMetadata.try_get($game_map.map_id) # map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
# mappos = (map_metadata) ? map_metadata.town_map_position : nil # mappos = (map_metadata) ? map_metadata.town_map_position : nil
@@ -375,18 +375,12 @@ class PokemonPokedexInfo_Scene
entryText = customEntry entryText = customEntry
shadowColor = shadowCustom shadowColor = shadowCustom
else else
if false#$PokemonSystem.use_generated_dex_entries if $PokemonSystem.use_generated_dex_entries && species_data.is_a?(GameData::FusedSpecies)
aiEntry = getAIDexEntry(species_data.species, species_data.name) @randomEntryText = species_data.get_random_dex_entry if !@randomEntryText
if aiEntry entryText = @randomEntryText
entryText = aiEntry shadowColor = shadow
shadowColor = shadowAI
else
entryText = species_data.pokedex_entry
shadowColor = shadow
end
else 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. Please consider submitting an entry for this Pokémon on the game's Discord."
#entryText = "No custom Pokédex entry available for this Pokémon. Auto-generated placeholder entries can be enabled in the game's options."
shadowColor = shadow shadowColor = shadow
end end
end end

View File

@@ -297,6 +297,27 @@ module GameData
return split_and_combine_text(body_entry, head_entry, ".") return split_and_combine_text(body_entry, head_entry, ".")
end 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 def calculate_egg_groups
body_egg_groups = @body_pokemon.egg_groups body_egg_groups = @body_pokemon.egg_groups
head_egg_groups = @head_pokemon.egg_groups head_egg_groups = @head_pokemon.egg_groups
@@ -343,7 +364,7 @@ module GameData
beginningText = beginingText_split[0] beginningText = beginingText_split[0]
endText = endText_split[1] && endText_split[1] != "" ? endText_split[1] : endText_split[0] endText = endText_split[1] && endText_split[1] != "" ? endText_split[1] : endText_split[0]
return beginningText + separator + endText return beginningText + separator + " " + endText
end end
def calculate_fused_stats(dominantStat, otherStat) 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" "Automatically download missing custom sprites and Pokédex entries from the internet"
) )
# #
# generated_entries_option_selected=$PokemonSystem.use_generated_dex_entries ? 1 : 0 generated_entries_option_selected=$PokemonSystem.use_generated_dex_entries ? 1 : 0
# options << EnumOption.new(_INTL("Autogen dex entries"), [_INTL("Off"), _INTL("On")], options << EnumOption.new(_INTL("Autogen dex entries"), [_INTL("Off"), _INTL("On")],
# proc { generated_entries_option_selected }, proc { generated_entries_option_selected },
# proc { |value| proc { |value|
# $PokemonSystem.use_generated_dex_entries = value == 1 $PokemonSystem.use_generated_dex_entries = value == 1
# }, },
# [ [
# "Fusions without a custom Pokédex entry display nothing.", "Fusions without a custom Pokédex entry display nothing.",
# "Fusions without a custom Pokédex entry display an auto-generated placeholder." "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 <<

Binary file not shown.