mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Tidied and coloured console messages
This commit is contained in:
@@ -44,6 +44,27 @@ module Kernel
|
||||
echo string
|
||||
echo "\r\n"
|
||||
end
|
||||
|
||||
def echoln_good(string)
|
||||
echo "\e[32m" # Green text
|
||||
echo string
|
||||
echo "\e[0m" # Back to default text color
|
||||
echo "\r\n"
|
||||
end
|
||||
|
||||
def echoln_bad(string)
|
||||
echo "\e[31m" # Red text
|
||||
echo string
|
||||
echo "\e[0m" # Back to default text color
|
||||
echo "\r\n"
|
||||
end
|
||||
|
||||
def echoln_warn(string)
|
||||
echo "\e[33m" # Brown/yellow text
|
||||
echo string
|
||||
echo "\e[0m" # Back to default text color
|
||||
echo "\r\n"
|
||||
end
|
||||
end
|
||||
|
||||
Console.setup_console
|
||||
|
||||
@@ -676,7 +676,7 @@ module PluginManager
|
||||
File.open("Data/PluginScripts.rxdata", 'wb') { |f| Marshal.dump(scripts, f) }
|
||||
# collect garbage
|
||||
GC.start
|
||||
echoln " done."
|
||||
echoln_good "done"
|
||||
echoln ""
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -199,7 +199,7 @@ module SaveData
|
||||
conversions_to_run.each do |conversion|
|
||||
echo "#{conversion.title}..."
|
||||
conversion.run(save_data)
|
||||
echoln " done."
|
||||
echoln_good "done"
|
||||
end
|
||||
echoln "" if conversions_to_run.length > 0
|
||||
save_data[:essentials_version] = Essentials::VERSION
|
||||
|
||||
@@ -702,59 +702,41 @@ module Compiler
|
||||
def compile_all(mustCompile)
|
||||
return if !mustCompile
|
||||
FileLineData.clear
|
||||
echoln _INTL("*** Starting full compile ***")
|
||||
echoln_warn _INTL("*** Starting full compile ***")
|
||||
echoln ""
|
||||
yield(_INTL("Compiling town map data"))
|
||||
compile_town_map # No dependencies
|
||||
yield(_INTL("Compiling map connection data"))
|
||||
compile_connections # No dependencies
|
||||
yield(_INTL("Compiling phone data"))
|
||||
compile_phone # No dependencies
|
||||
yield(_INTL("Compiling type data"))
|
||||
compile_types # No dependencies
|
||||
yield(_INTL("Compiling ability data"))
|
||||
compile_abilities # No dependencies
|
||||
yield(_INTL("Compiling move data"))
|
||||
compile_moves # Depends on Type
|
||||
yield(_INTL("Compiling item data"))
|
||||
compile_items # Depends on Move
|
||||
yield(_INTL("Compiling berry plant data"))
|
||||
compile_berry_plants # Depends on Item
|
||||
yield(_INTL("Compiling Pokémon data"))
|
||||
compile_pokemon # Depends on Move, Item, Type, Ability
|
||||
yield(_INTL("Compiling Pokémon forms data"))
|
||||
compile_pokemon_forms # Depends on Species, Move, Item, Type, Ability
|
||||
yield(_INTL("Compiling Pokémon metrics data"))
|
||||
compile_pokemon_metrics # Depends on Species
|
||||
yield(_INTL("Compiling shadow moveset data"))
|
||||
compile_shadow_movesets # Depends on Species, Move
|
||||
yield(_INTL("Compiling Regional Dexes"))
|
||||
compile_regional_dexes # Depends on Species
|
||||
yield(_INTL("Compiling ribbon data"))
|
||||
compile_ribbons # No dependencies
|
||||
yield(_INTL("Compiling encounter data"))
|
||||
compile_encounters # Depends on Species
|
||||
yield(_INTL("Compiling Trainer type data"))
|
||||
compile_trainer_types # No dependencies
|
||||
yield(_INTL("Compiling Trainer data"))
|
||||
compile_trainers # Depends on Species, Item, Move
|
||||
yield(_INTL("Compiling battle Trainer data"))
|
||||
compile_trainer_lists # Depends on TrainerType
|
||||
yield(_INTL("Compiling metadata"))
|
||||
compile_metadata # Depends on TrainerType
|
||||
yield(_INTL("Compiling map metadata"))
|
||||
compile_map_metadata # No dependencies
|
||||
yield(_INTL("Compiling animations"))
|
||||
compile_animations
|
||||
yield("")
|
||||
echoln ""
|
||||
compile_trainer_events(mustCompile)
|
||||
yield(_INTL("Saving messages"))
|
||||
echo _INTL("Saving messages...")
|
||||
pbSetTextMessages
|
||||
MessageTypes.saveMessages
|
||||
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
|
||||
echoln_good _INTL("done")
|
||||
echo _INTL("Reloading cache...")
|
||||
System.reload_cache
|
||||
echoln_good _INTL("done")
|
||||
echoln ""
|
||||
echoln _INTL("*** Finished full compile ***")
|
||||
echoln_warn _INTL("*** Finished full compile ***")
|
||||
echoln ""
|
||||
end
|
||||
|
||||
@@ -851,7 +833,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
# Recompile all data
|
||||
compile_all(mustCompile) { |msg| echoln msg }
|
||||
compile_all(mustCompile)
|
||||
rescue Exception
|
||||
e = $!
|
||||
raise e if "#{e.class}"=="Reset" || e.is_a?(Reset) || e.is_a?(SystemExit)
|
||||
|
||||
@@ -5,6 +5,7 @@ module Compiler
|
||||
# Compile Town Map data
|
||||
#=============================================================================
|
||||
def compile_town_map(path = "PBS/town_map.txt")
|
||||
echo _INTL("Compiling Town Map data...")
|
||||
nonglobaltypes = {
|
||||
"Name" => [0, "s"],
|
||||
"Filename" => [1, "s"],
|
||||
@@ -47,12 +48,15 @@ module Compiler
|
||||
MessageTypes.setMessages(MessageTypes::RegionNames,rgnnames)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames,placenames)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions,placedescs)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Compile map connections
|
||||
#=============================================================================
|
||||
def compile_connections(path = "PBS/map_connections.txt")
|
||||
echo _INTL("Compiling map connections...")
|
||||
records = []
|
||||
pbCompilerEachPreppedLine(path) { |line,lineno|
|
||||
hashenum = {
|
||||
@@ -88,6 +92,7 @@ module Compiler
|
||||
records.push(record)
|
||||
}
|
||||
save_data(records,"Data/map_connections.dat")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -96,6 +101,7 @@ module Compiler
|
||||
#=============================================================================
|
||||
def compile_phone(path = "PBS/phone.txt")
|
||||
return if !safeExists?(path)
|
||||
echo _INTL("Compiling phone messages...")
|
||||
database = PhoneDatabase.new
|
||||
sections = []
|
||||
File.open(path, "rb") { |f|
|
||||
@@ -127,12 +133,15 @@ module Compiler
|
||||
}
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::PhoneMessages,sections)
|
||||
save_data(database,"Data/phone.dat")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Compile type data
|
||||
#=============================================================================
|
||||
def compile_types(path = "PBS/types.txt")
|
||||
echo _INTL("Compiling types...")
|
||||
GameData::Type::DATA.clear
|
||||
type_names = []
|
||||
# Read from PBS file
|
||||
@@ -201,6 +210,7 @@ module Compiler
|
||||
# Save all data
|
||||
GameData::Type.save
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Types, type_names)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -208,6 +218,7 @@ module Compiler
|
||||
# Compile ability data
|
||||
#=============================================================================
|
||||
def compile_abilities(path = "PBS/abilities.txt")
|
||||
echo _INTL("Compiling abilities...")
|
||||
GameData::Ability::DATA.clear
|
||||
schema = GameData::Ability::SCHEMA
|
||||
ability_names = []
|
||||
@@ -271,6 +282,7 @@ module Compiler
|
||||
GameData::Ability.save
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescs, ability_descriptions)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -278,13 +290,17 @@ module Compiler
|
||||
# Compile move data
|
||||
#=============================================================================
|
||||
def compile_moves(path = "PBS/moves.txt")
|
||||
echo _INTL("Compiling moves...")
|
||||
GameData::Move::DATA.clear
|
||||
schema = GameData::Move::SCHEMA
|
||||
move_names = []
|
||||
move_descriptions = []
|
||||
move_hash = nil
|
||||
# Read each line of moves.txt at a time and compile it into an move
|
||||
idx = 0
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
echo "." if idx % 500 == 0
|
||||
idx += 1
|
||||
if line[/^\s*\[\s*(.+)\s*\]\s*$/] # New section [move_id]
|
||||
# Add previous move's data to records
|
||||
if move_hash
|
||||
@@ -402,6 +418,7 @@ module Compiler
|
||||
GameData::Move.save
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Moves, move_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::MoveDescriptions, move_descriptions)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -409,6 +426,7 @@ module Compiler
|
||||
# Compile item data
|
||||
#=============================================================================
|
||||
def compile_items(path = "PBS/items.txt")
|
||||
echo _INTL("Compiling items...")
|
||||
GameData::Item::DATA.clear
|
||||
schema = GameData::Item::SCHEMA
|
||||
item_names = []
|
||||
@@ -416,7 +434,10 @@ module Compiler
|
||||
item_descriptions = []
|
||||
item_hash = nil
|
||||
# Read each line of items.txt at a time and compile it into an item
|
||||
idx = 0
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
echo "." if idx % 250 == 0
|
||||
idx += 1
|
||||
if line[/^\s*\[\s*(.+)\s*\]\s*$/] # New section [item_id]
|
||||
# Add previous item's data to records
|
||||
GameData::Item.register(item_hash) if item_hash
|
||||
@@ -492,6 +513,7 @@ module Compiler
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -499,6 +521,7 @@ module Compiler
|
||||
# Compile berry plant data
|
||||
#=============================================================================
|
||||
def compile_berry_plants(path = "PBS/berry_plants.txt")
|
||||
echo _INTL("Compiling berry plants...")
|
||||
GameData::BerryPlant::DATA.clear
|
||||
pbCompilerEachCommentedLine(path) { |line, line_no|
|
||||
if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY
|
||||
@@ -520,6 +543,7 @@ module Compiler
|
||||
}
|
||||
# Save all data
|
||||
GameData::BerryPlant.save
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -527,6 +551,7 @@ module Compiler
|
||||
# Compile Pokémon data
|
||||
#=============================================================================
|
||||
def compile_pokemon(path = "PBS/pokemon.txt")
|
||||
echo _INTL("Compiling Pokémon...")
|
||||
GameData::Species::DATA.clear
|
||||
species_names = []
|
||||
species_form_names = []
|
||||
@@ -539,7 +564,11 @@ module Compiler
|
||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||
schema = GameData::Species.schema
|
||||
idx = 0
|
||||
pbEachFileSection(f) { |contents, species_id|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
FileLineData.setSection(species_id, "header", nil) # For error reporting
|
||||
contents["InternalName"] = species_id if !species_id[/^\d+/]
|
||||
# Ensure all required properties have been defined, and raise an error
|
||||
@@ -641,7 +670,7 @@ module Compiler
|
||||
end
|
||||
}
|
||||
}
|
||||
# Enumerate all evolution species and parameters (this couldn't be done earlier)
|
||||
# Enumerate all evolution species and parameters (this couldn't bedone earlier)
|
||||
GameData::Species.each do |species|
|
||||
FileLineData.setSection(species.id.to_s, "Evolutions", nil) # For error reporting
|
||||
species.evolutions.each do |evo|
|
||||
@@ -673,6 +702,7 @@ module Compiler
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::FormNames, species_form_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Kinds, species_categories)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -680,6 +710,7 @@ module Compiler
|
||||
# Compile Pokémon forms data
|
||||
#=============================================================================
|
||||
def compile_pokemon_forms(path = "PBS/pokemon_forms.txt")
|
||||
echo _INTL("Compiling Pokémon forms...")
|
||||
species_names = []
|
||||
species_form_names = []
|
||||
species_categories = []
|
||||
@@ -692,7 +723,11 @@ module Compiler
|
||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||
schema = GameData::Species.schema(true)
|
||||
idx = 0
|
||||
pbEachFileSectionPokemonForms(f) { |contents, section_name|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
FileLineData.setSection(section_name, "header", nil) # For error reporting
|
||||
# Split section_name into a species number and form number
|
||||
split_section_name = section_name.split(/[-,\s]/)
|
||||
@@ -869,6 +904,7 @@ module Compiler
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::FormNames, species_form_names)
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::Kinds, species_categories)
|
||||
MessageTypes.addMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -877,6 +913,7 @@ module Compiler
|
||||
#=============================================================================
|
||||
def compile_pokemon_metrics(path = "PBS/pokemon_metrics.txt")
|
||||
return if !safeExists?(path)
|
||||
echo _INTL("Compiling Pokémon metrics...")
|
||||
schema = GameData::SpeciesMetrics::SCHEMA
|
||||
# Read from PBS file
|
||||
File.open(path, "rb") { |f|
|
||||
@@ -884,7 +921,11 @@ module Compiler
|
||||
# Read a whole section's lines at once, then run through this code.
|
||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||
idx = 0
|
||||
pbEachFileSection(f) { |contents, section_name|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
FileLineData.setSection(section_name, "header", nil) # For error reporting
|
||||
# Split section_name into a species number and form number
|
||||
split_section_name = section_name.split(/[-,\s]/)
|
||||
@@ -924,6 +965,7 @@ module Compiler
|
||||
}
|
||||
# Save all data
|
||||
GameData::SpeciesMetrics.save
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -931,10 +973,15 @@ module Compiler
|
||||
# Compile Shadow movesets
|
||||
#=============================================================================
|
||||
def compile_shadow_movesets(path = "PBS/shadow_movesets.txt")
|
||||
echo _INTL("Compiling Shadow Pokémon movesets...")
|
||||
sections = {}
|
||||
if safeExists?(path)
|
||||
idx = 0
|
||||
pbCompilerEachCommentedLine(path) { |line, _line_no|
|
||||
if line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
key = $1
|
||||
value = $2
|
||||
value = value.split(",")
|
||||
@@ -950,12 +997,15 @@ module Compiler
|
||||
}
|
||||
end
|
||||
save_data(sections, "Data/shadow_movesets.dat")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Compile Regional Dexes
|
||||
#=============================================================================
|
||||
def compile_regional_dexes(path = "PBS/regional_dexes.txt")
|
||||
echo _INTL("Compiling Pokédex lists...")
|
||||
dex_lists = []
|
||||
section = nil
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
@@ -987,6 +1037,7 @@ module Compiler
|
||||
end
|
||||
# Save all data
|
||||
save_data(dex_lists, "Data/regional_dexes.dat")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -994,6 +1045,7 @@ module Compiler
|
||||
# Compile ribbon data
|
||||
#=============================================================================
|
||||
def compile_ribbons(path = "PBS/ribbons.txt")
|
||||
echo _INTL("Compiling ribbons...")
|
||||
GameData::Ribbon::DATA.clear
|
||||
schema = GameData::Ribbon::SCHEMA
|
||||
ribbon_names = []
|
||||
@@ -1058,6 +1110,7 @@ module Compiler
|
||||
GameData::Ribbon.save
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::RibbonNames, ribbon_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::RibbonDescriptions, ribbon_descriptions)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -1065,12 +1118,17 @@ module Compiler
|
||||
# Compile wild encounter data
|
||||
#=============================================================================
|
||||
def compile_encounters(path = "PBS/encounters.txt")
|
||||
echo _INTL("Compiling encounters...")
|
||||
GameData::Encounter::DATA.clear
|
||||
encounter_hash = nil
|
||||
step_chances = nil
|
||||
current_type = nil
|
||||
max_level = GameData::GrowthRate.max_level
|
||||
idx = 0
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
next if line.length == 0
|
||||
if current_type && line[/^\d+,/] # Species line
|
||||
values = line.split(',').collect! { |v| v.strip }
|
||||
@@ -1162,6 +1220,7 @@ module Compiler
|
||||
end
|
||||
# Save all data
|
||||
GameData::Encounter.save
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -1169,6 +1228,7 @@ module Compiler
|
||||
# Compile trainer type data
|
||||
#=============================================================================
|
||||
def compile_trainer_types(path = "PBS/trainer_types.txt")
|
||||
echo _INTL("Compiling trainer types...")
|
||||
GameData::TrainerType::DATA.clear
|
||||
schema = GameData::TrainerType::SCHEMA
|
||||
tr_type_names = []
|
||||
@@ -1236,6 +1296,7 @@ module Compiler
|
||||
# Save all data
|
||||
GameData::TrainerType.save
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -1243,6 +1304,7 @@ module Compiler
|
||||
# Compile individual trainer data
|
||||
#=============================================================================
|
||||
def compile_trainers(path = "PBS/trainers.txt")
|
||||
echo _INTL("Compiling trainers...")
|
||||
GameData::Trainer::DATA.clear
|
||||
schema = GameData::Trainer::SCHEMA
|
||||
max_level = GameData::GrowthRate.max_level
|
||||
@@ -1251,7 +1313,11 @@ module Compiler
|
||||
trainer_hash = nil
|
||||
current_pkmn = nil
|
||||
# Read each line of trainers.txt at a time and compile it as a trainer property
|
||||
idx = 0
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
if line[/^\s*\[\s*(.+)\s*\]\s*$/]
|
||||
# New section [trainer_type, name] or [trainer_type, name, version]
|
||||
if trainer_hash
|
||||
@@ -1361,6 +1427,7 @@ module Compiler
|
||||
GameData::Trainer.save
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseText, trainer_lose_texts)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -1368,6 +1435,7 @@ module Compiler
|
||||
# Compile Battle Tower and other Cups trainers/Pokémon
|
||||
#=============================================================================
|
||||
def compile_trainer_lists(path = "PBS/battle_facility_lists.txt")
|
||||
echo _INTL("Compiling Battle Facility lists...")
|
||||
btTrainersRequiredTypes = {
|
||||
"Trainers" => [0, "s"],
|
||||
"Pokemon" => [1, "s"],
|
||||
@@ -1389,7 +1457,11 @@ module Compiler
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
|
||||
File.open(path, "rb") { |f|
|
||||
FileLineData.file = path
|
||||
idx = 0
|
||||
pbEachFileSection(f) { |section,name|
|
||||
echo "."
|
||||
idx += 1
|
||||
Graphics.update
|
||||
next if name!="DefaultTrainerList" && name!="TrainerList"
|
||||
rsection = []
|
||||
for key in section.keys
|
||||
@@ -1432,6 +1504,8 @@ module Compiler
|
||||
}
|
||||
}
|
||||
save_data(sections,"Data/trainer_lists.dat")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
def compile_battle_tower_trainers(filename)
|
||||
@@ -1479,6 +1553,7 @@ module Compiler
|
||||
# Compile metadata
|
||||
#=============================================================================
|
||||
def compile_metadata(path = "PBS/metadata.txt")
|
||||
echo _INTL("Compiling metadata...")
|
||||
GameData::Metadata::DATA.clear
|
||||
GameData::PlayerMetadata::DATA.clear
|
||||
# Read from PBS file
|
||||
@@ -1544,6 +1619,7 @@ module Compiler
|
||||
# Save all data
|
||||
GameData::Metadata.save
|
||||
GameData::PlayerMetadata.save
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -1551,6 +1627,7 @@ module Compiler
|
||||
# Compile map metadata
|
||||
#=============================================================================
|
||||
def compile_map_metadata(path = "PBS/map_metadata.txt")
|
||||
echo _INTL("Compiling map metadata...")
|
||||
GameData::MapMetadata::DATA.clear
|
||||
map_infos = pbLoadMapInfos
|
||||
map_names = []
|
||||
@@ -1562,7 +1639,11 @@ module Compiler
|
||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||
schema = GameData::MapMetadata::SCHEMA
|
||||
idx = 0
|
||||
pbEachFileSectionNumbered(f) { |contents, map_id|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
# Go through schema hash of compilable data and compile this section
|
||||
for key in schema.keys
|
||||
FileLineData.setSection(map_id, key, contents[key]) # For error reporting
|
||||
@@ -1607,6 +1688,7 @@ module Compiler
|
||||
# Save all data
|
||||
GameData::MapMetadata.save
|
||||
MessageTypes.setMessages(MessageTypes::MapNames, map_names)
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -1614,6 +1696,7 @@ module Compiler
|
||||
# Compile battle animations
|
||||
#=============================================================================
|
||||
def compile_animations
|
||||
echo _INTL("Compiling animations...")
|
||||
begin
|
||||
pbanims = load_data("Data/PkmnAnimations.rxdata")
|
||||
rescue
|
||||
@@ -1655,5 +1738,7 @@ module Compiler
|
||||
save_data(move2anim,"Data/move2anim.dat")
|
||||
save_data(pbanims,"Data/PkmnAnimations.rxdata")
|
||||
end
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,9 +14,14 @@ module Compiler
|
||||
def write_town_map
|
||||
mapdata = pbLoadTownMapData
|
||||
return if !mapdata
|
||||
echo _INTL("Writing Town Map data...")
|
||||
File.open("PBS/town_map.txt","wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
for i in 0...mapdata.length
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
map = mapdata[i]
|
||||
next if !map
|
||||
f.write("\#-------------------------------\r\n")
|
||||
@@ -32,6 +37,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -71,6 +77,7 @@ module Compiler
|
||||
def write_connections
|
||||
conndata = load_data("Data/map_connections.dat")
|
||||
return if !conndata
|
||||
echo _INTL("Writing map connections...")
|
||||
mapinfos = pbLoadMapInfos
|
||||
File.open("PBS/map_connections.txt","wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
@@ -93,6 +100,7 @@ module Compiler
|
||||
f.write("\r\n")
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -102,6 +110,7 @@ module Compiler
|
||||
def write_phone
|
||||
data = load_data("Data/phone.dat") rescue nil
|
||||
return if !data
|
||||
echo _INTL("Writing phone messages...")
|
||||
File.open("PBS/phone.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
f.write("\#-------------------------------\r\n")
|
||||
@@ -126,6 +135,7 @@ module Compiler
|
||||
f.write("[<Bodies2>]\r\n")
|
||||
f.write(data.bodies2.join("\r\n") + "\r\n")
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -133,6 +143,7 @@ module Compiler
|
||||
# Save type data to PBS file
|
||||
#=============================================================================
|
||||
def write_types
|
||||
echo _INTL("Writing types...")
|
||||
File.open("PBS/types.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
# Write each type in turn
|
||||
@@ -149,6 +160,7 @@ module Compiler
|
||||
f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -156,6 +168,7 @@ module Compiler
|
||||
# Save ability data to PBS file
|
||||
#=============================================================================
|
||||
def write_abilities
|
||||
echo _INTL("Writing abilities...")
|
||||
File.open("PBS/abilities.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
# Write each ability in turn
|
||||
@@ -167,6 +180,7 @@ module Compiler
|
||||
f.write(sprintf("Flags = %s\r\n", ability.flags.join(","))) if ability.flags.length > 0
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -174,10 +188,15 @@ module Compiler
|
||||
# Save move data to PBS file
|
||||
#=============================================================================
|
||||
def write_moves
|
||||
echo _INTL("Writing moves...")
|
||||
File.open("PBS/moves.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
# Write each move in turn
|
||||
GameData::Move.each do |move|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write("[#{move.id}]\r\n")
|
||||
f.write("Name = #{move.real_name}\r\n")
|
||||
@@ -195,6 +214,7 @@ module Compiler
|
||||
f.write("Description = #{move.real_description}\r\n")
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -202,9 +222,14 @@ module Compiler
|
||||
# Save item data to PBS file
|
||||
#=============================================================================
|
||||
def write_items
|
||||
echo _INTL("Writing items...")
|
||||
File.open("PBS/items.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
GameData::Item.each do |item|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%s]\r\n", item.id))
|
||||
f.write(sprintf("Name = %s\r\n", item.real_name))
|
||||
@@ -222,6 +247,7 @@ module Compiler
|
||||
f.write(sprintf("Description = %s\r\n", item.real_description))
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -229,6 +255,7 @@ module Compiler
|
||||
# Save berry plant data to PBS file
|
||||
#=============================================================================
|
||||
def write_berry_plants
|
||||
echo _INTL("Writing berry plants...")
|
||||
File.open("PBS/berry_plants.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
f.write("\#-------------------------------\r\n")
|
||||
@@ -242,6 +269,7 @@ module Compiler
|
||||
))
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -249,14 +277,14 @@ module Compiler
|
||||
# Save Pokémon data to PBS file
|
||||
#=============================================================================
|
||||
def write_pokemon
|
||||
echo _INTL("Writing species...")
|
||||
echo _INTL("Writing Pokémon...")
|
||||
File.open("PBS/pokemon.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
GameData::Species.each_species do |species|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 100 == 0
|
||||
Graphics.update if idx % 250 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%s]\r\n", species.id))
|
||||
f.write(sprintf("Name = %s\r\n", species.real_name))
|
||||
@@ -331,7 +359,7 @@ module Compiler
|
||||
f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense
|
||||
end
|
||||
}
|
||||
echoln _INTL("done")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -339,14 +367,16 @@ module Compiler
|
||||
# Save Pokémon forms data to PBS file
|
||||
#=============================================================================
|
||||
def write_pokemon_forms
|
||||
echo _INTL("Writing Pokémon forms...")
|
||||
File.open("PBS/pokemon_forms.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
GameData::Species.each do |species|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
next if species.form == 0
|
||||
base_species = GameData::Species.get(species.species)
|
||||
idx += 1
|
||||
Graphics.update if idx % 100 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(sprintf("[%s,%d]\r\n", species.species, species.form))
|
||||
f.write(sprintf("FormName = %s\r\n", species.real_form_name)) if species.real_form_name && !species.real_form_name.empty?
|
||||
@@ -430,6 +460,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -437,7 +468,7 @@ module Compiler
|
||||
# Write species metrics
|
||||
#=============================================================================
|
||||
def write_pokemon_metrics
|
||||
echo _INTL("Writing species metrics...")
|
||||
echo _INTL("Writing Pokémon metrics...")
|
||||
# Get in species order then in form order
|
||||
sort_array = []
|
||||
dex_numbers = {}
|
||||
@@ -455,7 +486,7 @@ module Compiler
|
||||
sort_array.each do |val|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 100 == 0
|
||||
Graphics.update if idx % 250 == 0
|
||||
species = GameData::SpeciesMetrics.get(val[1])
|
||||
if species.form > 0
|
||||
base_species = GameData::SpeciesMetrics.get(val[2])
|
||||
@@ -482,7 +513,7 @@ module Compiler
|
||||
f.write(sprintf("ShadowSize = %d\r\n", species.shadow_size))
|
||||
end
|
||||
}
|
||||
echoln _INTL("done")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -490,16 +521,21 @@ module Compiler
|
||||
# Save Shadow movesets to PBS file
|
||||
#=============================================================================
|
||||
def write_shadow_movesets
|
||||
echo _INTL("Writing Shadow Pokémon movesets...")
|
||||
shadow_movesets = pbLoadShadowMovesets
|
||||
File.open("PBS/shadow_movesets.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
f.write("\#-------------------------------\r\n")
|
||||
GameData::Species.each do |species_data|
|
||||
echo "." if idx % 150 == 0
|
||||
idx += 1
|
||||
moveset = shadow_movesets[species_data.id]
|
||||
next if !moveset || moveset.length == 0
|
||||
f.write(sprintf("%s = %s\r\n", species_data.id, moveset.join(",")))
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -507,6 +543,7 @@ module Compiler
|
||||
# Save Regional Dexes to PBS file
|
||||
#=============================================================================
|
||||
def write_regional_dexes
|
||||
echo _INTL("Writing Pokédex lists...")
|
||||
dex_lists = pbLoadRegionalDexes
|
||||
File.open("PBS/regional_dexes.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
@@ -531,6 +568,7 @@ module Compiler
|
||||
f.write("\r\n")
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -538,6 +576,7 @@ module Compiler
|
||||
# Save ability data to PBS file
|
||||
#=============================================================================
|
||||
def write_ribbons
|
||||
echo _INTL("Writing ribbons...")
|
||||
File.open("PBS/ribbons.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
# Write each ability in turn
|
||||
@@ -550,6 +589,7 @@ module Compiler
|
||||
f.write(sprintf("Flags = %s\r\n", ribbon.flags.join(","))) if ribbon.flags.length > 0
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -557,10 +597,15 @@ module Compiler
|
||||
# Save wild encounter data to PBS file
|
||||
#=============================================================================
|
||||
def write_encounters
|
||||
echo _INTL("Writing encounters...")
|
||||
map_infos = pbLoadMapInfos
|
||||
File.open("PBS/encounters.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
GameData::Encounter.each do |encounter_data|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
map_name = (map_infos[encounter_data.map]) ? " # #{map_infos[encounter_data.map].name}" : ""
|
||||
if encounter_data.version > 0
|
||||
@@ -585,6 +630,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -592,6 +638,7 @@ module Compiler
|
||||
# Save trainer type data to PBS file
|
||||
#=============================================================================
|
||||
def write_trainer_types
|
||||
echo _INTL("Writing trainer types...")
|
||||
File.open("PBS/trainer_types.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
GameData::TrainerType.each do |t|
|
||||
@@ -608,6 +655,7 @@ module Compiler
|
||||
f.write(sprintf("VictoryME = %s\r\n", t.victory_ME)) if !nil_or_empty?(t.victory_ME)
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -622,7 +670,7 @@ module Compiler
|
||||
GameData::Trainer.each do |trainer|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 50 == 0
|
||||
Graphics.update if idx % 250 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
if trainer.version > 0
|
||||
f.write(sprintf("[%s,%s,%d]\r\n", trainer.trainer_type, trainer.real_name, trainer.version))
|
||||
@@ -660,7 +708,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
}
|
||||
echoln _INTL("done")
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -670,9 +718,11 @@ module Compiler
|
||||
def write_trainer_lists
|
||||
trainerlists = load_data("Data/trainer_lists.dat") rescue nil
|
||||
return if !trainerlists
|
||||
echo _INTL("Writing Battle Facility lists...")
|
||||
File.open("PBS/battle_facility_lists.txt","wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
for tr in trainerlists
|
||||
echo "."
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write(((tr[5]) ? "[DefaultTrainerList]" : "[TrainerList]")+"\r\n")
|
||||
f.write("Trainers = "+tr[3]+"\r\n")
|
||||
@@ -682,6 +732,7 @@ module Compiler
|
||||
write_battle_tower_pokemon(tr[1],"PBS/"+tr[4])
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -747,7 +798,10 @@ module Compiler
|
||||
Graphics.update if i % 500 == 0
|
||||
pkmn = btpokemon[i]
|
||||
c1 = (species[pkmn.species]) ? species[pkmn.species] : (species[pkmn.species] = GameData::Species.get(pkmn.species).species.to_s)
|
||||
c2 = (items[pkmn.item]) ? items[pkmn.item] : (items[pkmn.item] = GameData::Item.get(pkmn.item).id.to_s)
|
||||
c2 = nil
|
||||
if pkmn.item && GameData::Item.exists?(pkmn.item)
|
||||
c2 = (items[pkmn.item]) ? items[pkmn.item] : (items[pkmn.item] = GameData::Item.get(pkmn.item).id.to_s)
|
||||
end
|
||||
c3 = (natures[pkmn.nature]) ? natures[pkmn.nature] : (natures[pkmn.nature] = GameData::Nature.get(pkmn.nature).id.to_s)
|
||||
evlist = ""
|
||||
pkmn.ev.each_with_index do |stat, i|
|
||||
@@ -775,6 +829,7 @@ module Compiler
|
||||
# Save metadata data to PBS file
|
||||
#=============================================================================
|
||||
def write_metadata
|
||||
echo _INTL("Writing metadata...")
|
||||
File.open("PBS/metadata.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
# Write metadata
|
||||
@@ -805,6 +860,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -812,12 +868,17 @@ module Compiler
|
||||
# Save map metadata data to PBS file
|
||||
#=============================================================================
|
||||
def write_map_metadata
|
||||
echo _INTL("Writing map metadata...")
|
||||
map_infos = pbLoadMapInfos
|
||||
schema = GameData::MapMetadata::SCHEMA
|
||||
keys = schema.keys.sort { |a, b| schema[a][0] <=> schema[b][0] }
|
||||
File.open("PBS/map_metadata.txt", "wb") { |f|
|
||||
idx = 0
|
||||
add_PBS_header_to_file(f)
|
||||
GameData::MapMetadata.each do |map_data|
|
||||
echo "." if idx % 50 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
f.write("\#-------------------------------\r\n")
|
||||
map_name = (map_infos && map_infos[map_data.id]) ? map_infos[map_data.id].name : nil
|
||||
if map_name
|
||||
@@ -834,6 +895,7 @@ module Compiler
|
||||
end
|
||||
end
|
||||
}
|
||||
echoln_good _INTL("done")
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -841,6 +903,9 @@ module Compiler
|
||||
# Save all data to PBS files
|
||||
#=============================================================================
|
||||
def write_all
|
||||
echoln ""
|
||||
echoln_warn _INTL("*** Writing all PBS files ***")
|
||||
echoln ""
|
||||
write_town_map
|
||||
write_connections
|
||||
write_phone
|
||||
@@ -861,5 +926,8 @@ module Compiler
|
||||
write_trainer_lists
|
||||
write_metadata
|
||||
write_map_metadata
|
||||
echoln ""
|
||||
echoln_warn _INTL("*** Finished writing all PBS files ***")
|
||||
echoln ""
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1435,9 +1435,13 @@ module Compiler
|
||||
t = Time.now.to_i
|
||||
Graphics.update
|
||||
trainerChecker = TrainerChecker.new
|
||||
any_changed = false
|
||||
echoln _INTL("Processing {1} maps...", mapData.mapinfos.keys.length)
|
||||
change_record = []
|
||||
echo _INTL("Processing {1} maps...", mapData.mapinfos.keys.length)
|
||||
idx = 0
|
||||
for id in mapData.mapinfos.keys.sort
|
||||
echo "." if idx % 20 == 0
|
||||
idx += 1
|
||||
Graphics.update if idx % 250 == 0
|
||||
changed = false
|
||||
map = mapData.getMap(id)
|
||||
next if !map || !mapData.mapinfos[id]
|
||||
@@ -1470,29 +1474,29 @@ module Compiler
|
||||
end
|
||||
changed = true if check_counters(map,id,mapData)
|
||||
if changed
|
||||
any_changed = true
|
||||
mapData.saveMap(id)
|
||||
mapData.saveTilesets
|
||||
echoln _INTL("Map {1}: '{2}' modified and saved.", id, mapData.mapinfos[id].name)
|
||||
change_record.push(_INTL("Map {1}: '{2}' modified and saved.", id, mapData.mapinfos[id].name))
|
||||
end
|
||||
end
|
||||
echoln ""
|
||||
echoln_good "done"
|
||||
change_record.each { |msg| echoln_warn msg }
|
||||
changed = false
|
||||
Graphics.update
|
||||
commonEvents = load_data("Data/CommonEvents.rxdata")
|
||||
echoln _INTL("Processing common events")
|
||||
echo _INTL("Processing common events...")
|
||||
for key in 0...commonEvents.length
|
||||
newevent = fix_event_use(commonEvents[key],0,mapData)
|
||||
if newevent
|
||||
commonEvents[key] = newevent
|
||||
changed = true
|
||||
any_changed = true
|
||||
end
|
||||
end
|
||||
save_data(commonEvents,"Data/CommonEvents.rxdata") if changed
|
||||
echoln ""
|
||||
if any_changed
|
||||
echoln _INTL("!!! RMXP data was altered. Close RMXP now to ensure changes are applied. !!!")
|
||||
echoln_good "done"
|
||||
if change_record.length > 0 || changed
|
||||
echoln ""
|
||||
echoln_warn _INTL("!!! RMXP data was altered. Close RMXP now to ensure changes are applied. !!!")
|
||||
echoln ""
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user