More changes to console messages

This commit is contained in:
Maruno17
2021-10-23 23:56:54 +01:00
parent e417e4c659
commit 18049c22b9
6 changed files with 162 additions and 180 deletions

View File

@@ -654,7 +654,7 @@ module PluginManager
# Check if plugins need compiling # Check if plugins need compiling
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
def self.compilePlugins(order, plugins) def self.compilePlugins(order, plugins)
echo "Compiling plugin scripts..." echo " -> Compiling plugin scripts..."
scripts = [] scripts = []
# go through the entire order one by one # go through the entire order one by one
for o in order for o in order
@@ -677,12 +677,13 @@ module PluginManager
# collect garbage # collect garbage
GC.start GC.start
echoln_good "done" echoln_good "done"
echoln ""
end end
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Check if plugins need compiling # Check if plugins need compiling
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
def self.runPlugins def self.runPlugins
echoln_warn "*** Checking plugins ***"
echoln ""
# get the order of plugins to interpret # get the order of plugins to interpret
order, plugins = self.getPluginOrder order, plugins = self.getPluginOrder
# compile if necessary # compile if necessary
@@ -707,7 +708,7 @@ module PluginManager
# try to run the code # try to run the code
begin begin
eval(code, TOPLEVEL_BINDING, fname) 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) echoed_plugins.push(name)
rescue Exception # format error message to display rescue Exception # format error message to display
self.pluginErrorMsg(name, sname) self.pluginErrorMsg(name, sname)
@@ -715,7 +716,14 @@ module PluginManager
end end
end 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
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
end end

View File

@@ -195,13 +195,16 @@ module SaveData
conversions_to_run = self.get_conversions(save_data) conversions_to_run = self.get_conversions(save_data)
return false if conversions_to_run.none? return false if conversions_to_run.none?
File.open(SaveData::FILE_PATH + '.bak', 'wb') { |f| Marshal.dump(save_data, f) } 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| conversions_to_run.each do |conversion|
echo "#{conversion.title}..." echo " -> #{conversion.title}..."
conversion.run(save_data) conversion.run(save_data)
echoln_good "done" echoln_good "done"
end end
echoln "" if conversions_to_run.length > 0 echoln "" if conversions_to_run.length > 0
echoln_good "All save file conversions applied successfully"
echoln ""
save_data[:essentials_version] = Essentials::VERSION save_data[:essentials_version] = Essentials::VERSION
save_data[:game_version] = Settings::GAME_VERSION save_data[:game_version] = Settings::GAME_VERSION
return true return true

View File

@@ -699,6 +699,21 @@ module Compiler
#============================================================================= #=============================================================================
# Compile all data # 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) def compile_all(mustCompile)
return if !mustCompile return if !mustCompile
FileLineData.clear FileLineData.clear
@@ -725,18 +740,17 @@ module Compiler
compile_metadata # Depends on TrainerType compile_metadata # Depends on TrainerType
compile_map_metadata # No dependencies compile_map_metadata # No dependencies
compile_animations compile_animations
echoln ""
compile_trainer_events(mustCompile) compile_trainer_events(mustCompile)
echo _INTL("Saving messages...") echo _INTL(" -> Saving messages...")
pbSetTextMessages pbSetTextMessages
MessageTypes.saveMessages MessageTypes.saveMessages
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat") MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
echoln_good _INTL("done") echoln_good _INTL("done")
echo _INTL("Reloading cache...") echo _INTL(" -> Reloading cache...")
System.reload_cache System.reload_cache
echoln_good _INTL("done") echoln_good _INTL("done")
echoln "" echoln ""
echoln_warn _INTL("*** Finished full compile ***") echoln_good _INTL("Successfully fully compiled")
echoln "" echoln ""
end end

View File

@@ -5,7 +5,7 @@ module Compiler
# Compile Town Map data # Compile Town Map data
#============================================================================= #=============================================================================
def compile_town_map(path = "PBS/town_map.txt") def compile_town_map(path = "PBS/town_map.txt")
echo _INTL("Compiling Town Map data...") compile_pbs_file_message_start(path)
nonglobaltypes = { nonglobaltypes = {
"Name" => [0, "s"], "Name" => [0, "s"],
"Filename" => [1, "s"], "Filename" => [1, "s"],
@@ -48,15 +48,14 @@ module Compiler
MessageTypes.setMessages(MessageTypes::RegionNames,rgnnames) MessageTypes.setMessages(MessageTypes::RegionNames,rgnnames)
MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames,placenames) MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames,placenames)
MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions,placedescs) MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions,placedescs)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile map connections # Compile map connections
#============================================================================= #=============================================================================
def compile_connections(path = "PBS/map_connections.txt") def compile_connections(path = "PBS/map_connections.txt")
echo _INTL("Compiling map connections...") compile_pbs_file_message_start(path)
records = [] records = []
pbCompilerEachPreppedLine(path) { |line,lineno| pbCompilerEachPreppedLine(path) { |line,lineno|
hashenum = { hashenum = {
@@ -92,8 +91,7 @@ module Compiler
records.push(record) records.push(record)
} }
save_data(records,"Data/map_connections.dat") save_data(records,"Data/map_connections.dat")
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
@@ -101,7 +99,7 @@ module Compiler
#============================================================================= #=============================================================================
def compile_phone(path = "PBS/phone.txt") def compile_phone(path = "PBS/phone.txt")
return if !safeExists?(path) return if !safeExists?(path)
echo _INTL("Compiling phone messages...") compile_pbs_file_message_start(path)
database = PhoneDatabase.new database = PhoneDatabase.new
sections = [] sections = []
File.open(path, "rb") { |f| File.open(path, "rb") { |f|
@@ -133,15 +131,14 @@ module Compiler
} }
MessageTypes.setMessagesAsHash(MessageTypes::PhoneMessages,sections) MessageTypes.setMessagesAsHash(MessageTypes::PhoneMessages,sections)
save_data(database,"Data/phone.dat") save_data(database,"Data/phone.dat")
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile type data # Compile type data
#============================================================================= #=============================================================================
def compile_types(path = "PBS/types.txt") def compile_types(path = "PBS/types.txt")
echo _INTL("Compiling types...") compile_pbs_file_message_start(path)
GameData::Type::DATA.clear GameData::Type::DATA.clear
type_names = [] type_names = []
# Read from PBS file # Read from PBS file
@@ -210,15 +207,14 @@ module Compiler
# Save all data # Save all data
GameData::Type.save GameData::Type.save
MessageTypes.setMessagesAsHash(MessageTypes::Types, type_names) MessageTypes.setMessagesAsHash(MessageTypes::Types, type_names)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile ability data # Compile ability data
#============================================================================= #=============================================================================
def compile_abilities(path = "PBS/abilities.txt") def compile_abilities(path = "PBS/abilities.txt")
echo _INTL("Compiling abilities...") compile_pbs_file_message_start(path)
GameData::Ability::DATA.clear GameData::Ability::DATA.clear
schema = GameData::Ability::SCHEMA schema = GameData::Ability::SCHEMA
ability_names = [] ability_names = []
@@ -282,15 +278,14 @@ module Compiler
GameData::Ability.save GameData::Ability.save
MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names) MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names)
MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescs, ability_descriptions) MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescs, ability_descriptions)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile move data # Compile move data
#============================================================================= #=============================================================================
def compile_moves(path = "PBS/moves.txt") def compile_moves(path = "PBS/moves.txt")
echo _INTL("Compiling moves...") compile_pbs_file_message_start(path)
GameData::Move::DATA.clear GameData::Move::DATA.clear
schema = GameData::Move::SCHEMA schema = GameData::Move::SCHEMA
move_names = [] move_names = []
@@ -418,15 +413,14 @@ module Compiler
GameData::Move.save GameData::Move.save
MessageTypes.setMessagesAsHash(MessageTypes::Moves, move_names) MessageTypes.setMessagesAsHash(MessageTypes::Moves, move_names)
MessageTypes.setMessagesAsHash(MessageTypes::MoveDescriptions, move_descriptions) MessageTypes.setMessagesAsHash(MessageTypes::MoveDescriptions, move_descriptions)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile item data # Compile item data
#============================================================================= #=============================================================================
def compile_items(path = "PBS/items.txt") def compile_items(path = "PBS/items.txt")
echo _INTL("Compiling items...") compile_pbs_file_message_start(path)
GameData::Item::DATA.clear GameData::Item::DATA.clear
schema = GameData::Item::SCHEMA schema = GameData::Item::SCHEMA
item_names = [] item_names = []
@@ -513,15 +507,14 @@ module Compiler
MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names) MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural) MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural)
MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions) MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile berry plant data # Compile berry plant data
#============================================================================= #=============================================================================
def compile_berry_plants(path = "PBS/berry_plants.txt") def compile_berry_plants(path = "PBS/berry_plants.txt")
echo _INTL("Compiling berry plants...") compile_pbs_file_message_start(path)
GameData::BerryPlant::DATA.clear GameData::BerryPlant::DATA.clear
pbCompilerEachCommentedLine(path) { |line, line_no| pbCompilerEachCommentedLine(path) { |line, line_no|
if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY if line[/^\s*(\w+)\s*=\s*(.*)$/] # Of the format XXX = YYY
@@ -543,15 +536,14 @@ module Compiler
} }
# Save all data # Save all data
GameData::BerryPlant.save GameData::BerryPlant.save
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile Pokémon data # Compile Pokémon data
#============================================================================= #=============================================================================
def compile_pokemon(path = "PBS/pokemon.txt") def compile_pokemon(path = "PBS/pokemon.txt")
echo _INTL("Compiling Pokémon...") compile_pbs_file_message_start(path)
GameData::Species::DATA.clear GameData::Species::DATA.clear
species_names = [] species_names = []
species_form_names = [] species_form_names = []
@@ -702,15 +694,14 @@ module Compiler
MessageTypes.setMessagesAsHash(MessageTypes::FormNames, species_form_names) MessageTypes.setMessagesAsHash(MessageTypes::FormNames, species_form_names)
MessageTypes.setMessagesAsHash(MessageTypes::Kinds, species_categories) MessageTypes.setMessagesAsHash(MessageTypes::Kinds, species_categories)
MessageTypes.setMessagesAsHash(MessageTypes::Entries, species_pokedex_entries) MessageTypes.setMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile Pokémon forms data # Compile Pokémon forms data
#============================================================================= #=============================================================================
def compile_pokemon_forms(path = "PBS/pokemon_forms.txt") def compile_pokemon_forms(path = "PBS/pokemon_forms.txt")
echo _INTL("Compiling Pokémon forms...") compile_pbs_file_message_start(path)
species_names = [] species_names = []
species_form_names = [] species_form_names = []
species_categories = [] species_categories = []
@@ -904,8 +895,7 @@ module Compiler
MessageTypes.addMessagesAsHash(MessageTypes::FormNames, species_form_names) MessageTypes.addMessagesAsHash(MessageTypes::FormNames, species_form_names)
MessageTypes.addMessagesAsHash(MessageTypes::Kinds, species_categories) MessageTypes.addMessagesAsHash(MessageTypes::Kinds, species_categories)
MessageTypes.addMessagesAsHash(MessageTypes::Entries, species_pokedex_entries) MessageTypes.addMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
@@ -913,7 +903,7 @@ module Compiler
#============================================================================= #=============================================================================
def compile_pokemon_metrics(path = "PBS/pokemon_metrics.txt") def compile_pokemon_metrics(path = "PBS/pokemon_metrics.txt")
return if !safeExists?(path) return if !safeExists?(path)
echo _INTL("Compiling Pokémon metrics...") compile_pbs_file_message_start(path)
schema = GameData::SpeciesMetrics::SCHEMA schema = GameData::SpeciesMetrics::SCHEMA
# Read from PBS file # Read from PBS file
File.open(path, "rb") { |f| File.open(path, "rb") { |f|
@@ -965,15 +955,14 @@ module Compiler
} }
# Save all data # Save all data
GameData::SpeciesMetrics.save GameData::SpeciesMetrics.save
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile Shadow movesets # Compile Shadow movesets
#============================================================================= #=============================================================================
def compile_shadow_movesets(path = "PBS/shadow_movesets.txt") def compile_shadow_movesets(path = "PBS/shadow_movesets.txt")
echo _INTL("Compiling Shadow Pokémon movesets...") compile_pbs_file_message_start(path)
sections = {} sections = {}
if safeExists?(path) if safeExists?(path)
idx = 0 idx = 0
@@ -997,15 +986,14 @@ module Compiler
} }
end end
save_data(sections, "Data/shadow_movesets.dat") save_data(sections, "Data/shadow_movesets.dat")
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile Regional Dexes # Compile Regional Dexes
#============================================================================= #=============================================================================
def compile_regional_dexes(path = "PBS/regional_dexes.txt") def compile_regional_dexes(path = "PBS/regional_dexes.txt")
echo _INTL("Compiling Pokédex lists...") compile_pbs_file_message_start(path)
dex_lists = [] dex_lists = []
section = nil section = nil
pbCompilerEachPreppedLine(path) { |line, line_no| pbCompilerEachPreppedLine(path) { |line, line_no|
@@ -1037,15 +1025,14 @@ module Compiler
end end
# Save all data # Save all data
save_data(dex_lists, "Data/regional_dexes.dat") save_data(dex_lists, "Data/regional_dexes.dat")
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile ribbon data # Compile ribbon data
#============================================================================= #=============================================================================
def compile_ribbons(path = "PBS/ribbons.txt") def compile_ribbons(path = "PBS/ribbons.txt")
echo _INTL("Compiling ribbons...") compile_pbs_file_message_start(path)
GameData::Ribbon::DATA.clear GameData::Ribbon::DATA.clear
schema = GameData::Ribbon::SCHEMA schema = GameData::Ribbon::SCHEMA
ribbon_names = [] ribbon_names = []
@@ -1110,15 +1097,14 @@ module Compiler
GameData::Ribbon.save GameData::Ribbon.save
MessageTypes.setMessagesAsHash(MessageTypes::RibbonNames, ribbon_names) MessageTypes.setMessagesAsHash(MessageTypes::RibbonNames, ribbon_names)
MessageTypes.setMessagesAsHash(MessageTypes::RibbonDescriptions, ribbon_descriptions) MessageTypes.setMessagesAsHash(MessageTypes::RibbonDescriptions, ribbon_descriptions)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile wild encounter data # Compile wild encounter data
#============================================================================= #=============================================================================
def compile_encounters(path = "PBS/encounters.txt") def compile_encounters(path = "PBS/encounters.txt")
echo _INTL("Compiling encounters...") compile_pbs_file_message_start(path)
GameData::Encounter::DATA.clear GameData::Encounter::DATA.clear
encounter_hash = nil encounter_hash = nil
step_chances = nil step_chances = nil
@@ -1220,15 +1206,14 @@ module Compiler
end end
# Save all data # Save all data
GameData::Encounter.save GameData::Encounter.save
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile trainer type data # Compile trainer type data
#============================================================================= #=============================================================================
def compile_trainer_types(path = "PBS/trainer_types.txt") def compile_trainer_types(path = "PBS/trainer_types.txt")
echo _INTL("Compiling trainer types...") compile_pbs_file_message_start(path)
GameData::TrainerType::DATA.clear GameData::TrainerType::DATA.clear
schema = GameData::TrainerType::SCHEMA schema = GameData::TrainerType::SCHEMA
tr_type_names = [] tr_type_names = []
@@ -1296,15 +1281,14 @@ module Compiler
# Save all data # Save all data
GameData::TrainerType.save GameData::TrainerType.save
MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names) MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile individual trainer data # Compile individual trainer data
#============================================================================= #=============================================================================
def compile_trainers(path = "PBS/trainers.txt") def compile_trainers(path = "PBS/trainers.txt")
echo _INTL("Compiling trainers...") compile_pbs_file_message_start(path)
GameData::Trainer::DATA.clear GameData::Trainer::DATA.clear
schema = GameData::Trainer::SCHEMA schema = GameData::Trainer::SCHEMA
max_level = GameData::GrowthRate.max_level max_level = GameData::GrowthRate.max_level
@@ -1427,15 +1411,14 @@ module Compiler
GameData::Trainer.save GameData::Trainer.save
MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names) MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names)
MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseText, trainer_lose_texts) MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseText, trainer_lose_texts)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile Battle Tower and other Cups trainers/Pokémon # Compile Battle Tower and other Cups trainers/Pokémon
#============================================================================= #=============================================================================
def compile_trainer_lists(path = "PBS/battle_facility_lists.txt") def compile_trainer_lists(path = "PBS/battle_facility_lists.txt")
echo _INTL("Compiling Battle Facility lists...") compile_pbs_file_message_start(path)
btTrainersRequiredTypes = { btTrainersRequiredTypes = {
"Trainers" => [0, "s"], "Trainers" => [0, "s"],
"Pokemon" => [1, "s"], "Pokemon" => [1, "s"],
@@ -1504,8 +1487,7 @@ module Compiler
} }
} }
save_data(sections,"Data/trainer_lists.dat") save_data(sections,"Data/trainer_lists.dat")
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
def compile_battle_tower_trainers(filename) def compile_battle_tower_trainers(filename)
@@ -1553,7 +1535,7 @@ module Compiler
# Compile metadata # Compile metadata
#============================================================================= #=============================================================================
def compile_metadata(path = "PBS/metadata.txt") def compile_metadata(path = "PBS/metadata.txt")
echo _INTL("Compiling metadata...") compile_pbs_file_message_start(path)
GameData::Metadata::DATA.clear GameData::Metadata::DATA.clear
GameData::PlayerMetadata::DATA.clear GameData::PlayerMetadata::DATA.clear
# Read from PBS file # Read from PBS file
@@ -1619,15 +1601,14 @@ module Compiler
# Save all data # Save all data
GameData::Metadata.save GameData::Metadata.save
GameData::PlayerMetadata.save GameData::PlayerMetadata.save
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile map metadata # Compile map metadata
#============================================================================= #=============================================================================
def compile_map_metadata(path = "PBS/map_metadata.txt") def compile_map_metadata(path = "PBS/map_metadata.txt")
echo _INTL("Compiling map metadata...") compile_pbs_file_message_start(path)
GameData::MapMetadata::DATA.clear GameData::MapMetadata::DATA.clear
map_infos = pbLoadMapInfos map_infos = pbLoadMapInfos
map_names = [] map_names = []
@@ -1688,15 +1669,14 @@ module Compiler
# Save all data # Save all data
GameData::MapMetadata.save GameData::MapMetadata.save
MessageTypes.setMessages(MessageTypes::MapNames, map_names) MessageTypes.setMessages(MessageTypes::MapNames, map_names)
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Compile battle animations # Compile battle animations
#============================================================================= #=============================================================================
def compile_animations def compile_animations
echo _INTL("Compiling animations...") echo _INTL(" -> Compiling animations...")
begin begin
pbanims = load_data("Data/PkmnAnimations.rxdata") pbanims = load_data("Data/PkmnAnimations.rxdata")
rescue rescue
@@ -1738,7 +1718,6 @@ module Compiler
save_data(move2anim,"Data/move2anim.dat") save_data(move2anim,"Data/move2anim.dat")
save_data(pbanims,"Data/PkmnAnimations.rxdata") save_data(pbanims,"Data/PkmnAnimations.rxdata")
end end
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
end end

View File

@@ -11,11 +11,11 @@ module Compiler
#============================================================================= #=============================================================================
# Save Town Map data to PBS file # Save Town Map data to PBS file
#============================================================================= #=============================================================================
def write_town_map def write_town_map(path = "PBS/town_map.txt")
mapdata = pbLoadTownMapData mapdata = pbLoadTownMapData
return if !mapdata return if !mapdata
echo _INTL("Writing Town Map data...") write_pbs_file_message_start(path)
File.open("PBS/town_map.txt","wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
for i in 0...mapdata.length for i in 0...mapdata.length
@@ -37,8 +37,7 @@ module Compiler
end end
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
@@ -74,12 +73,12 @@ module Compiler
return sprintf("%d,%d,%d,%d,%d,%d", map1, x1, y1, map2, x2, y2) return sprintf("%d,%d,%d,%d,%d,%d", map1, x1, y1, map2, x2, y2)
end end
def write_connections def write_connections(path = "PBS/map_connections.txt")
conndata = load_data("Data/map_connections.dat") conndata = load_data("Data/map_connections.dat")
return if !conndata return if !conndata
echo _INTL("Writing map connections...") write_pbs_file_message_start(path)
mapinfos = pbLoadMapInfos mapinfos = pbLoadMapInfos
File.open("PBS/map_connections.txt","wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
for conn in conndata for conn in conndata
@@ -100,18 +99,17 @@ module Compiler
f.write("\r\n") f.write("\r\n")
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save phone messages to PBS file # Save phone messages to PBS file
#============================================================================= #=============================================================================
def write_phone def write_phone(path = "PBS/phone.txt")
data = load_data("Data/phone.dat") rescue nil data = load_data("Data/phone.dat") rescue nil
return if !data return if !data
echo _INTL("Writing phone messages...") write_pbs_file_message_start(path)
File.open("PBS/phone.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
f.write("[<Generics>]\r\n") f.write("[<Generics>]\r\n")
@@ -135,16 +133,15 @@ module Compiler
f.write("[<Bodies2>]\r\n") f.write("[<Bodies2>]\r\n")
f.write(data.bodies2.join("\r\n") + "\r\n") f.write(data.bodies2.join("\r\n") + "\r\n")
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save type data to PBS file # Save type data to PBS file
#============================================================================= #=============================================================================
def write_types def write_types(path = "PBS/types.txt")
echo _INTL("Writing types...") write_pbs_file_message_start(path)
File.open("PBS/types.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
# Write each type in turn # Write each type in turn
GameData::Type.each do |type| GameData::Type.each do |type|
@@ -160,16 +157,15 @@ module Compiler
f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0 f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save ability data to PBS file # Save ability data to PBS file
#============================================================================= #=============================================================================
def write_abilities def write_abilities(path = "PBS/abilities.txt")
echo _INTL("Writing abilities...") write_pbs_file_message_start(path)
File.open("PBS/abilities.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
# Write each ability in turn # Write each ability in turn
GameData::Ability.each do |ability| 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 f.write(sprintf("Flags = %s\r\n", ability.flags.join(","))) if ability.flags.length > 0
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save move data to PBS file # Save move data to PBS file
#============================================================================= #=============================================================================
def write_moves def write_moves(path = "PBS/moves.txt")
echo _INTL("Writing moves...") write_pbs_file_message_start(path)
File.open("PBS/moves.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
# Write each move in turn # Write each move in turn
@@ -214,16 +209,15 @@ module Compiler
f.write("Description = #{move.real_description}\r\n") f.write("Description = #{move.real_description}\r\n")
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save item data to PBS file # Save item data to PBS file
#============================================================================= #=============================================================================
def write_items def write_items(path = "PBS/items.txt")
echo _INTL("Writing items...") write_pbs_file_message_start(path)
File.open("PBS/items.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::Item.each do |item| GameData::Item.each do |item|
@@ -247,16 +241,15 @@ module Compiler
f.write(sprintf("Description = %s\r\n", item.real_description)) f.write(sprintf("Description = %s\r\n", item.real_description))
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save berry plant data to PBS file # Save berry plant data to PBS file
#============================================================================= #=============================================================================
def write_berry_plants def write_berry_plants(path = "PBS/berry_plants.txt")
echo _INTL("Writing berry plants...") write_pbs_file_message_start(path)
File.open("PBS/berry_plants.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
GameData::BerryPlant.each do |bp| GameData::BerryPlant.each do |bp|
@@ -269,16 +262,15 @@ module Compiler
)) ))
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save Pokémon data to PBS file # Save Pokémon data to PBS file
#============================================================================= #=============================================================================
def write_pokemon def write_pokemon(path = "PBS/pokemon.txt")
echo _INTL("Writing Pokémon...") write_pbs_file_message_start(path)
File.open("PBS/pokemon.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::Species.each_species do |species| GameData::Species.each_species do |species|
@@ -359,16 +351,15 @@ module Compiler
f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save Pokémon forms data to PBS file # Save Pokémon forms data to PBS file
#============================================================================= #=============================================================================
def write_pokemon_forms def write_pokemon_forms(path = "PBS/pokemon_forms.txt")
echo _INTL("Writing Pokémon forms...") write_pbs_file_message_start(path)
File.open("PBS/pokemon_forms.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::Species.each do |species| GameData::Species.each do |species|
@@ -460,15 +451,14 @@ module Compiler
end end
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Write species metrics # Write species metrics
#============================================================================= #=============================================================================
def write_pokemon_metrics def write_pokemon_metrics(path = "PBS/pokemon_metrics.txt")
echo _INTL("Writing Pokémon metrics...") write_pbs_file_message_start(path)
# Get in species order then in form order # Get in species order then in form order
sort_array = [] sort_array = []
dex_numbers = {} dex_numbers = {}
@@ -480,7 +470,7 @@ module Compiler
end end
sort_array.sort! { |a, b| (a[0] == b[0]) ? a[3] <=> b[3] : a[0] <=> b[0] } sort_array.sort! { |a, b| (a[0] == b[0]) ? a[3] <=> b[3] : a[0] <=> b[0] }
# Write file # Write file
File.open("PBS/pokemon_metrics.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
sort_array.each do |val| sort_array.each do |val|
@@ -513,17 +503,16 @@ module Compiler
f.write(sprintf("ShadowSize = %d\r\n", species.shadow_size)) f.write(sprintf("ShadowSize = %d\r\n", species.shadow_size))
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save Shadow movesets to PBS file # Save Shadow movesets to PBS file
#============================================================================= #=============================================================================
def write_shadow_movesets def write_shadow_movesets(path = "PBS/shadow_movesets.txt")
echo _INTL("Writing Shadow Pokémon movesets...") write_pbs_file_message_start(path)
shadow_movesets = pbLoadShadowMovesets shadow_movesets = pbLoadShadowMovesets
File.open("PBS/shadow_movesets.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
@@ -535,17 +524,16 @@ module Compiler
f.write(sprintf("%s = %s\r\n", species_data.id, moveset.join(","))) f.write(sprintf("%s = %s\r\n", species_data.id, moveset.join(",")))
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save Regional Dexes to PBS file # Save Regional Dexes to PBS file
#============================================================================= #=============================================================================
def write_regional_dexes def write_regional_dexes(path = "PBS/regional_dexes.txt")
echo _INTL("Writing Pokédex lists...") write_pbs_file_message_start(path)
dex_lists = pbLoadRegionalDexes dex_lists = pbLoadRegionalDexes
File.open("PBS/regional_dexes.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
# Write each Dex list in turn # Write each Dex list in turn
dex_lists.each_with_index do |list, index| dex_lists.each_with_index do |list, index|
@@ -568,16 +556,15 @@ module Compiler
f.write("\r\n") f.write("\r\n")
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save ability data to PBS file # Save ability data to PBS file
#============================================================================= #=============================================================================
def write_ribbons def write_ribbons(path = "PBS/ribbons.txt")
echo _INTL("Writing ribbons...") write_pbs_file_message_start(path)
File.open("PBS/ribbons.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
# Write each ability in turn # Write each ability in turn
GameData::Ribbon.each do |ribbon| 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 f.write(sprintf("Flags = %s\r\n", ribbon.flags.join(","))) if ribbon.flags.length > 0
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save wild encounter data to PBS file # Save wild encounter data to PBS file
#============================================================================= #=============================================================================
def write_encounters def write_encounters(path = "PBS/encounters.txt")
echo _INTL("Writing encounters...") write_pbs_file_message_start(path)
map_infos = pbLoadMapInfos map_infos = pbLoadMapInfos
File.open("PBS/encounters.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::Encounter.each do |encounter_data| GameData::Encounter.each do |encounter_data|
@@ -630,16 +616,15 @@ module Compiler
end end
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save trainer type data to PBS file # Save trainer type data to PBS file
#============================================================================= #=============================================================================
def write_trainer_types def write_trainer_types(path = "PBS/trainer_types.txt")
echo _INTL("Writing trainer types...") write_pbs_file_message_start(path)
File.open("PBS/trainer_types.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::TrainerType.each do |t| GameData::TrainerType.each do |t|
f.write("\#-------------------------------\r\n") 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) f.write(sprintf("VictoryME = %s\r\n", t.victory_ME)) if !nil_or_empty?(t.victory_ME)
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save individual trainer data to PBS file # Save individual trainer data to PBS file
#============================================================================= #=============================================================================
def write_trainers def write_trainers(path = "PBS/trainers.txt")
echo _INTL("Writing trainers...") write_pbs_file_message_start(path)
File.open("PBS/trainers.txt", "wb") { |f| File.open(path, "wb") { |f|
idx = 0 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::Trainer.each do |trainer| GameData::Trainer.each do |trainer|
@@ -708,18 +692,17 @@ module Compiler
end end
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save trainer list data to PBS file # 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 trainerlists = load_data("Data/trainer_lists.dat") rescue nil
return if !trainerlists return if !trainerlists
echo _INTL("Writing Battle Facility lists...") write_pbs_file_message_start(path)
File.open("PBS/battle_facility_lists.txt","wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
for tr in trainerlists for tr in trainerlists
echo "." echo "."
@@ -732,8 +715,7 @@ module Compiler
write_battle_tower_pokemon(tr[1],"PBS/"+tr[4]) write_battle_tower_pokemon(tr[1],"PBS/"+tr[4])
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
@@ -828,9 +810,9 @@ module Compiler
#============================================================================= #=============================================================================
# Save metadata data to PBS file # Save metadata data to PBS file
#============================================================================= #=============================================================================
def write_metadata def write_metadata(path = "PBS/metadata.txt")
echo _INTL("Writing metadata...") write_pbs_file_message_start(path)
File.open("PBS/metadata.txt", "wb") { |f| File.open(path, "wb") { |f|
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
# Write metadata # Write metadata
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
@@ -860,19 +842,18 @@ module Compiler
end end
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
# Save map metadata data to PBS file # Save map metadata data to PBS file
#============================================================================= #=============================================================================
def write_map_metadata def write_map_metadata(path = "PBS/map_metadata.txt")
echo _INTL("Writing map metadata...") write_pbs_file_message_start(path)
map_infos = pbLoadMapInfos map_infos = pbLoadMapInfos
schema = GameData::MapMetadata::SCHEMA schema = GameData::MapMetadata::SCHEMA
keys = schema.keys.sort { |a, b| schema[a][0] <=> schema[b][0] } 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 idx = 0
add_PBS_header_to_file(f) add_PBS_header_to_file(f)
GameData::MapMetadata.each do |map_data| GameData::MapMetadata.each do |map_data|
@@ -895,8 +876,7 @@ module Compiler
end end
end end
} }
echoln_good _INTL("done") process_pbs_file_message_end
Graphics.update
end end
#============================================================================= #=============================================================================
@@ -927,7 +907,7 @@ module Compiler
write_metadata write_metadata
write_map_metadata write_map_metadata
echoln "" echoln ""
echoln_warn _INTL("*** Finished writing all PBS files ***") echoln_good _INTL("Successfully rewrote all PBS files")
echoln "" echoln ""
end end
end end

View File

@@ -1436,7 +1436,7 @@ module Compiler
Graphics.update Graphics.update
trainerChecker = TrainerChecker.new trainerChecker = TrainerChecker.new
change_record = [] change_record = []
echo _INTL("Processing {1} maps...", mapData.mapinfos.keys.length) echo _INTL(" -> Processing {1} maps...", mapData.mapinfos.keys.length)
idx = 0 idx = 0
for id in mapData.mapinfos.keys.sort for id in mapData.mapinfos.keys.sort
echo "." if idx % 20 == 0 echo "." if idx % 20 == 0
@@ -1476,7 +1476,7 @@ module Compiler
if changed if changed
mapData.saveMap(id) mapData.saveMap(id)
mapData.saveTilesets 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
end end
echoln_good "done" echoln_good "done"
@@ -1484,7 +1484,7 @@ module Compiler
changed = false changed = false
Graphics.update Graphics.update
commonEvents = load_data("Data/CommonEvents.rxdata") commonEvents = load_data("Data/CommonEvents.rxdata")
echo _INTL("Processing common events...") echo _INTL(" -> Processing common events...")
for key in 0...commonEvents.length for key in 0...commonEvents.length
newevent = fix_event_use(commonEvents[key],0,mapData) newevent = fix_event_use(commonEvents[key],0,mapData)
if newevent if newevent
@@ -1495,9 +1495,7 @@ module Compiler
save_data(commonEvents,"Data/CommonEvents.rxdata") if changed save_data(commonEvents,"Data/CommonEvents.rxdata") if changed
echoln_good "done" echoln_good "done"
if change_record.length > 0 || changed if change_record.length > 0 || changed
echoln "" echoln_bad _INTL("!!! RMXP data was altered. Close RMXP now to ensure changes are applied. !!!")
echoln_warn _INTL("!!! RMXP data was altered. Close RMXP now to ensure changes are applied. !!!")
echoln ""
end end
end end
end end