diff --git a/Data/Scripts/001_Technical/005_PluginManager.rb b/Data/Scripts/001_Technical/005_PluginManager.rb index 8035f292c..a379d7582 100644 --- a/Data/Scripts/001_Technical/005_PluginManager.rb +++ b/Data/Scripts/001_Technical/005_PluginManager.rb @@ -654,7 +654,7 @@ module PluginManager # Check if plugins need compiling #----------------------------------------------------------------------------- def self.compilePlugins(order, plugins) - echo "Compiling plugin scripts..." + echo " -> Compiling plugin scripts..." scripts = [] # go through the entire order one by one for o in order @@ -677,12 +677,13 @@ module PluginManager # collect garbage GC.start echoln_good "done" - echoln "" end #----------------------------------------------------------------------------- # Check if plugins need compiling #----------------------------------------------------------------------------- def self.runPlugins + echoln_warn "*** Checking plugins ***" + echoln "" # get the order of plugins to interpret order, plugins = self.getPluginOrder # compile if necessary @@ -707,7 +708,7 @@ module PluginManager # try to run the code begin eval(code, TOPLEVEL_BINDING, fname) - echoln "Loaded plugin: #{name}" if !echoed_plugins.include?(name) + echoln " -> Loaded plugin: \e[35m#{name}\e[0m" if !echoed_plugins.include?(name) echoed_plugins.push(name) rescue Exception # format error message to display self.pluginErrorMsg(name, sname) @@ -715,7 +716,14 @@ module PluginManager end end end - echoln "" if !echoed_plugins.empty? + if scripts.length > 0 + echoln "" + echoln_good "Successfully loaded #{scripts.length} plugin(s)" + echoln "" + else + echoln_good "No plugins found" + echoln "" + end end #----------------------------------------------------------------------------- end diff --git a/Data/Scripts/002_Save data/003_SaveData_Conversion.rb b/Data/Scripts/002_Save data/003_SaveData_Conversion.rb index 72f998c2e..04dc82b2c 100644 --- a/Data/Scripts/002_Save data/003_SaveData_Conversion.rb +++ b/Data/Scripts/002_Save data/003_SaveData_Conversion.rb @@ -195,13 +195,16 @@ module SaveData conversions_to_run = self.get_conversions(save_data) return false if conversions_to_run.none? File.open(SaveData::FILE_PATH + '.bak', 'wb') { |f| Marshal.dump(save_data, f) } - echoln "Running #{conversions_to_run.length} conversions..." + echoln_warn "*** Running #{conversions_to_run.length} save file conversions ***" + echoln "" conversions_to_run.each do |conversion| - echo "#{conversion.title}..." + echo " -> #{conversion.title}..." conversion.run(save_data) echoln_good "done" end echoln "" if conversions_to_run.length > 0 + echoln_good "All save file conversions applied successfully" + echoln "" save_data[:essentials_version] = Essentials::VERSION save_data[:game_version] = Settings::GAME_VERSION return true diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 321f190ec..22fe251a2 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -699,6 +699,21 @@ module Compiler #============================================================================= # Compile all data #============================================================================= + def compile_pbs_file_message_start(filename) + # Filename is in magenta + echo _INTL(" -> Compiling PBS file {1}\"{2}\"{3}...", "\e[36m", filename.split("/").last, "\e[0m") + end + + def write_pbs_file_message_start(filename) + # Filename is in magenta + echo _INTL(" -> Writing PBS file {1}\"{2}\"{3}...", "\e[36m", filename.split("/").last, "\e[0m") + end + + def process_pbs_file_message_end + echoln_good _INTL("done") + Graphics.update + end + def compile_all(mustCompile) return if !mustCompile FileLineData.clear @@ -725,18 +740,17 @@ module Compiler compile_metadata # Depends on TrainerType compile_map_metadata # No dependencies compile_animations - echoln "" compile_trainer_events(mustCompile) - echo _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...") + echo _INTL(" -> Reloading cache...") System.reload_cache echoln_good _INTL("done") echoln "" - echoln_warn _INTL("*** Finished full compile ***") + echoln_good _INTL("Successfully fully compiled") echoln "" end diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index bc46dec0e..63719c674 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -5,7 +5,7 @@ module Compiler # Compile Town Map data #============================================================================= def compile_town_map(path = "PBS/town_map.txt") - echo _INTL("Compiling Town Map data...") + compile_pbs_file_message_start(path) nonglobaltypes = { "Name" => [0, "s"], "Filename" => [1, "s"], @@ -48,15 +48,14 @@ module Compiler MessageTypes.setMessages(MessageTypes::RegionNames,rgnnames) MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames,placenames) MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions,placedescs) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile map connections #============================================================================= def compile_connections(path = "PBS/map_connections.txt") - echo _INTL("Compiling map connections...") + compile_pbs_file_message_start(path) records = [] pbCompilerEachPreppedLine(path) { |line,lineno| hashenum = { @@ -92,8 +91,7 @@ module Compiler records.push(record) } save_data(records,"Data/map_connections.dat") - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= @@ -101,7 +99,7 @@ module Compiler #============================================================================= def compile_phone(path = "PBS/phone.txt") return if !safeExists?(path) - echo _INTL("Compiling phone messages...") + compile_pbs_file_message_start(path) database = PhoneDatabase.new sections = [] File.open(path, "rb") { |f| @@ -133,15 +131,14 @@ module Compiler } MessageTypes.setMessagesAsHash(MessageTypes::PhoneMessages,sections) save_data(database,"Data/phone.dat") - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile type data #============================================================================= def compile_types(path = "PBS/types.txt") - echo _INTL("Compiling types...") + compile_pbs_file_message_start(path) GameData::Type::DATA.clear type_names = [] # Read from PBS file @@ -210,15 +207,14 @@ module Compiler # Save all data GameData::Type.save MessageTypes.setMessagesAsHash(MessageTypes::Types, type_names) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile ability data #============================================================================= def compile_abilities(path = "PBS/abilities.txt") - echo _INTL("Compiling abilities...") + compile_pbs_file_message_start(path) GameData::Ability::DATA.clear schema = GameData::Ability::SCHEMA ability_names = [] @@ -282,15 +278,14 @@ module Compiler GameData::Ability.save MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names) MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescs, ability_descriptions) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile move data #============================================================================= def compile_moves(path = "PBS/moves.txt") - echo _INTL("Compiling moves...") + compile_pbs_file_message_start(path) GameData::Move::DATA.clear schema = GameData::Move::SCHEMA move_names = [] @@ -418,15 +413,14 @@ module Compiler GameData::Move.save MessageTypes.setMessagesAsHash(MessageTypes::Moves, move_names) MessageTypes.setMessagesAsHash(MessageTypes::MoveDescriptions, move_descriptions) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile item data #============================================================================= def compile_items(path = "PBS/items.txt") - echo _INTL("Compiling items...") + compile_pbs_file_message_start(path) GameData::Item::DATA.clear schema = GameData::Item::SCHEMA item_names = [] @@ -513,15 +507,14 @@ 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 + process_pbs_file_message_end end #============================================================================= # Compile berry plant data #============================================================================= def compile_berry_plants(path = "PBS/berry_plants.txt") - echo _INTL("Compiling berry plants...") + compile_pbs_file_message_start(path) GameData::BerryPlant::DATA.clear pbCompilerEachCommentedLine(path) { |line, line_no| if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY @@ -543,15 +536,14 @@ module Compiler } # Save all data GameData::BerryPlant.save - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile Pokémon data #============================================================================= def compile_pokemon(path = "PBS/pokemon.txt") - echo _INTL("Compiling Pokémon...") + compile_pbs_file_message_start(path) GameData::Species::DATA.clear species_names = [] species_form_names = [] @@ -702,15 +694,14 @@ 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 + process_pbs_file_message_end end #============================================================================= # Compile Pokémon forms data #============================================================================= def compile_pokemon_forms(path = "PBS/pokemon_forms.txt") - echo _INTL("Compiling Pokémon forms...") + compile_pbs_file_message_start(path) species_names = [] species_form_names = [] species_categories = [] @@ -904,8 +895,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 + process_pbs_file_message_end end #============================================================================= @@ -913,7 +903,7 @@ module Compiler #============================================================================= def compile_pokemon_metrics(path = "PBS/pokemon_metrics.txt") return if !safeExists?(path) - echo _INTL("Compiling Pokémon metrics...") + compile_pbs_file_message_start(path) schema = GameData::SpeciesMetrics::SCHEMA # Read from PBS file File.open(path, "rb") { |f| @@ -965,15 +955,14 @@ module Compiler } # Save all data GameData::SpeciesMetrics.save - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile Shadow movesets #============================================================================= def compile_shadow_movesets(path = "PBS/shadow_movesets.txt") - echo _INTL("Compiling Shadow Pokémon movesets...") + compile_pbs_file_message_start(path) sections = {} if safeExists?(path) idx = 0 @@ -997,15 +986,14 @@ module Compiler } end save_data(sections, "Data/shadow_movesets.dat") - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile Regional Dexes #============================================================================= def compile_regional_dexes(path = "PBS/regional_dexes.txt") - echo _INTL("Compiling Pokédex lists...") + compile_pbs_file_message_start(path) dex_lists = [] section = nil pbCompilerEachPreppedLine(path) { |line, line_no| @@ -1037,15 +1025,14 @@ module Compiler end # Save all data save_data(dex_lists, "Data/regional_dexes.dat") - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile ribbon data #============================================================================= def compile_ribbons(path = "PBS/ribbons.txt") - echo _INTL("Compiling ribbons...") + compile_pbs_file_message_start(path) GameData::Ribbon::DATA.clear schema = GameData::Ribbon::SCHEMA ribbon_names = [] @@ -1110,15 +1097,14 @@ module Compiler GameData::Ribbon.save MessageTypes.setMessagesAsHash(MessageTypes::RibbonNames, ribbon_names) MessageTypes.setMessagesAsHash(MessageTypes::RibbonDescriptions, ribbon_descriptions) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile wild encounter data #============================================================================= def compile_encounters(path = "PBS/encounters.txt") - echo _INTL("Compiling encounters...") + compile_pbs_file_message_start(path) GameData::Encounter::DATA.clear encounter_hash = nil step_chances = nil @@ -1220,15 +1206,14 @@ module Compiler end # Save all data GameData::Encounter.save - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile trainer type data #============================================================================= def compile_trainer_types(path = "PBS/trainer_types.txt") - echo _INTL("Compiling trainer types...") + compile_pbs_file_message_start(path) GameData::TrainerType::DATA.clear schema = GameData::TrainerType::SCHEMA tr_type_names = [] @@ -1296,15 +1281,14 @@ module Compiler # Save all data GameData::TrainerType.save MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile individual trainer data #============================================================================= def compile_trainers(path = "PBS/trainers.txt") - echo _INTL("Compiling trainers...") + compile_pbs_file_message_start(path) GameData::Trainer::DATA.clear schema = GameData::Trainer::SCHEMA max_level = GameData::GrowthRate.max_level @@ -1427,15 +1411,14 @@ module Compiler GameData::Trainer.save MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names) MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseText, trainer_lose_texts) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # 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...") + compile_pbs_file_message_start(path) btTrainersRequiredTypes = { "Trainers" => [0, "s"], "Pokemon" => [1, "s"], @@ -1504,8 +1487,7 @@ module Compiler } } save_data(sections,"Data/trainer_lists.dat") - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end def compile_battle_tower_trainers(filename) @@ -1553,7 +1535,7 @@ module Compiler # Compile metadata #============================================================================= def compile_metadata(path = "PBS/metadata.txt") - echo _INTL("Compiling metadata...") + compile_pbs_file_message_start(path) GameData::Metadata::DATA.clear GameData::PlayerMetadata::DATA.clear # Read from PBS file @@ -1619,15 +1601,14 @@ module Compiler # Save all data GameData::Metadata.save GameData::PlayerMetadata.save - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile map metadata #============================================================================= def compile_map_metadata(path = "PBS/map_metadata.txt") - echo _INTL("Compiling map metadata...") + compile_pbs_file_message_start(path) GameData::MapMetadata::DATA.clear map_infos = pbLoadMapInfos map_names = [] @@ -1688,15 +1669,14 @@ module Compiler # Save all data GameData::MapMetadata.save MessageTypes.setMessages(MessageTypes::MapNames, map_names) - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Compile battle animations #============================================================================= def compile_animations - echo _INTL("Compiling animations...") + echo _INTL(" -> Compiling animations...") begin pbanims = load_data("Data/PkmnAnimations.rxdata") rescue @@ -1738,7 +1718,6 @@ module Compiler save_data(move2anim,"Data/move2anim.dat") save_data(pbanims,"Data/PkmnAnimations.rxdata") end - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end end diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index bb72462e5..0d3f85589 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -11,11 +11,11 @@ module Compiler #============================================================================= # Save Town Map data to PBS file #============================================================================= - def write_town_map + def write_town_map(path = "PBS/town_map.txt") mapdata = pbLoadTownMapData return if !mapdata - echo _INTL("Writing Town Map data...") - File.open("PBS/town_map.txt","wb") { |f| + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) for i in 0...mapdata.length @@ -37,8 +37,7 @@ module Compiler end end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= @@ -74,12 +73,12 @@ module Compiler return sprintf("%d,%d,%d,%d,%d,%d", map1, x1, y1, map2, x2, y2) end - def write_connections + def write_connections(path = "PBS/map_connections.txt") conndata = load_data("Data/map_connections.dat") return if !conndata - echo _INTL("Writing map connections...") + write_pbs_file_message_start(path) mapinfos = pbLoadMapInfos - File.open("PBS/map_connections.txt","wb") { |f| + File.open(path, "wb") { |f| add_PBS_header_to_file(f) f.write("\#-------------------------------\r\n") for conn in conndata @@ -100,18 +99,17 @@ module Compiler f.write("\r\n") end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save phone messages to PBS file #============================================================================= - def write_phone + def write_phone(path = "PBS/phone.txt") data = load_data("Data/phone.dat") rescue nil return if !data - echo _INTL("Writing phone messages...") - File.open("PBS/phone.txt", "wb") { |f| + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) f.write("\#-------------------------------\r\n") f.write("[]\r\n") @@ -135,16 +133,15 @@ module Compiler f.write("[]\r\n") f.write(data.bodies2.join("\r\n") + "\r\n") } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save type data to PBS file #============================================================================= - def write_types - echo _INTL("Writing types...") - File.open("PBS/types.txt", "wb") { |f| + def write_types(path = "PBS/types.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) # Write each type in turn GameData::Type.each do |type| @@ -160,16 +157,15 @@ module Compiler f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0 end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save ability data to PBS file #============================================================================= - def write_abilities - echo _INTL("Writing abilities...") - File.open("PBS/abilities.txt", "wb") { |f| + def write_abilities(path = "PBS/abilities.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) # Write each ability in turn GameData::Ability.each do |ability| @@ -180,16 +176,15 @@ module Compiler f.write(sprintf("Flags = %s\r\n", ability.flags.join(","))) if ability.flags.length > 0 end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save move data to PBS file #============================================================================= - def write_moves - echo _INTL("Writing moves...") - File.open("PBS/moves.txt", "wb") { |f| + def write_moves(path = "PBS/moves.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) # Write each move in turn @@ -214,16 +209,15 @@ module Compiler f.write("Description = #{move.real_description}\r\n") end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save item data to PBS file #============================================================================= - def write_items - echo _INTL("Writing items...") - File.open("PBS/items.txt", "wb") { |f| + def write_items(path = "PBS/items.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Item.each do |item| @@ -247,16 +241,15 @@ module Compiler f.write(sprintf("Description = %s\r\n", item.real_description)) end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save berry plant data to PBS file #============================================================================= - def write_berry_plants - echo _INTL("Writing berry plants...") - File.open("PBS/berry_plants.txt", "wb") { |f| + def write_berry_plants(path = "PBS/berry_plants.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) f.write("\#-------------------------------\r\n") GameData::BerryPlant.each do |bp| @@ -269,16 +262,15 @@ module Compiler )) end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save Pokémon data to PBS file #============================================================================= - def write_pokemon - echo _INTL("Writing Pokémon...") - File.open("PBS/pokemon.txt", "wb") { |f| + def write_pokemon(path = "PBS/pokemon.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Species.each_species do |species| @@ -359,16 +351,15 @@ module Compiler f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # 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| + def write_pokemon_forms(path = "PBS/pokemon_forms.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Species.each do |species| @@ -460,15 +451,14 @@ module Compiler end end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Write species metrics #============================================================================= - def write_pokemon_metrics - echo _INTL("Writing Pokémon metrics...") + def write_pokemon_metrics(path = "PBS/pokemon_metrics.txt") + write_pbs_file_message_start(path) # Get in species order then in form order sort_array = [] dex_numbers = {} @@ -480,7 +470,7 @@ module Compiler end sort_array.sort! { |a, b| (a[0] == b[0]) ? a[3] <=> b[3] : a[0] <=> b[0] } # Write file - File.open("PBS/pokemon_metrics.txt", "wb") { |f| + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) sort_array.each do |val| @@ -513,17 +503,16 @@ module Compiler f.write(sprintf("ShadowSize = %d\r\n", species.shadow_size)) end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save Shadow movesets to PBS file #============================================================================= - def write_shadow_movesets - echo _INTL("Writing Shadow Pokémon movesets...") + def write_shadow_movesets(path = "PBS/shadow_movesets.txt") + write_pbs_file_message_start(path) shadow_movesets = pbLoadShadowMovesets - File.open("PBS/shadow_movesets.txt", "wb") { |f| + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) f.write("\#-------------------------------\r\n") @@ -535,17 +524,16 @@ module Compiler f.write(sprintf("%s = %s\r\n", species_data.id, moveset.join(","))) end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save Regional Dexes to PBS file #============================================================================= - def write_regional_dexes - echo _INTL("Writing Pokédex lists...") + def write_regional_dexes(path = "PBS/regional_dexes.txt") + write_pbs_file_message_start(path) dex_lists = pbLoadRegionalDexes - File.open("PBS/regional_dexes.txt", "wb") { |f| + File.open(path, "wb") { |f| add_PBS_header_to_file(f) # Write each Dex list in turn dex_lists.each_with_index do |list, index| @@ -568,16 +556,15 @@ module Compiler f.write("\r\n") end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save ability data to PBS file #============================================================================= - def write_ribbons - echo _INTL("Writing ribbons...") - File.open("PBS/ribbons.txt", "wb") { |f| + def write_ribbons(path = "PBS/ribbons.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) # Write each ability in turn GameData::Ribbon.each do |ribbon| @@ -589,17 +576,16 @@ module Compiler f.write(sprintf("Flags = %s\r\n", ribbon.flags.join(","))) if ribbon.flags.length > 0 end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save wild encounter data to PBS file #============================================================================= - def write_encounters - echo _INTL("Writing encounters...") + def write_encounters(path = "PBS/encounters.txt") + write_pbs_file_message_start(path) map_infos = pbLoadMapInfos - File.open("PBS/encounters.txt", "wb") { |f| + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Encounter.each do |encounter_data| @@ -630,16 +616,15 @@ module Compiler end end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save trainer type data to PBS file #============================================================================= - def write_trainer_types - echo _INTL("Writing trainer types...") - File.open("PBS/trainer_types.txt", "wb") { |f| + def write_trainer_types(path = "PBS/trainer_types.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) GameData::TrainerType.each do |t| f.write("\#-------------------------------\r\n") @@ -655,16 +640,15 @@ 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 + process_pbs_file_message_end end #============================================================================= # Save individual trainer data to PBS file #============================================================================= - def write_trainers - echo _INTL("Writing trainers...") - File.open("PBS/trainers.txt", "wb") { |f| + def write_trainers(path = "PBS/trainers.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::Trainer.each do |trainer| @@ -708,18 +692,17 @@ module Compiler end end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save trainer list data to PBS file #============================================================================= - def write_trainer_lists + def write_trainer_lists(path = "PBS/battle_facility_lists.txt") 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| + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) for tr in trainerlists echo "." @@ -732,8 +715,7 @@ module Compiler write_battle_tower_pokemon(tr[1],"PBS/"+tr[4]) end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= @@ -828,9 +810,9 @@ module Compiler #============================================================================= # Save metadata data to PBS file #============================================================================= - def write_metadata - echo _INTL("Writing metadata...") - File.open("PBS/metadata.txt", "wb") { |f| + def write_metadata(path = "PBS/metadata.txt") + write_pbs_file_message_start(path) + File.open(path, "wb") { |f| add_PBS_header_to_file(f) # Write metadata f.write("\#-------------------------------\r\n") @@ -860,19 +842,18 @@ module Compiler end end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= # Save map metadata data to PBS file #============================================================================= - def write_map_metadata - echo _INTL("Writing map metadata...") + def write_map_metadata(path = "PBS/map_metadata.txt") + write_pbs_file_message_start(path) 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| + File.open(path, "wb") { |f| idx = 0 add_PBS_header_to_file(f) GameData::MapMetadata.each do |map_data| @@ -895,8 +876,7 @@ module Compiler end end } - echoln_good _INTL("done") - Graphics.update + process_pbs_file_message_end end #============================================================================= @@ -927,7 +907,7 @@ module Compiler write_metadata write_map_metadata echoln "" - echoln_warn _INTL("*** Finished writing all PBS files ***") + echoln_good _INTL("Successfully rewrote all PBS files") echoln "" end end diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index 80b732592..fa89327b8 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -1436,7 +1436,7 @@ module Compiler Graphics.update trainerChecker = TrainerChecker.new change_record = [] - echo _INTL("Processing {1} maps...", mapData.mapinfos.keys.length) + echo _INTL(" -> Processing {1} maps...", mapData.mapinfos.keys.length) idx = 0 for id in mapData.mapinfos.keys.sort echo "." if idx % 20 == 0 @@ -1476,7 +1476,7 @@ module Compiler if changed mapData.saveMap(id) mapData.saveTilesets - change_record.push(_INTL("Map {1}: '{2}' modified and saved.", id, mapData.mapinfos[id].name)) + change_record.push(_INTL(" Map {1}: '{2}' was modified and saved.", id, mapData.mapinfos[id].name)) end end echoln_good "done" @@ -1484,7 +1484,7 @@ module Compiler changed = false Graphics.update commonEvents = load_data("Data/CommonEvents.rxdata") - echo _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 @@ -1495,9 +1495,7 @@ module Compiler save_data(commonEvents,"Data/CommonEvents.rxdata") if changed 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 "" + echoln_bad _INTL("!!! RMXP data was altered. Close RMXP now to ensure changes are applied. !!!") end end end