Implemented GameData::Ribbon

This commit is contained in:
Maruno17
2021-02-02 20:53:43 +00:00
parent 66494b0044
commit 44e3c934ad
13 changed files with 332 additions and 408 deletions

View File

@@ -707,6 +707,8 @@ module Compiler
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"))
@@ -743,6 +745,7 @@ module Compiler
"moves.dat",
"phone.dat",
"regional_dexes.dat",
"ribbons.dat",
"shadow_movesets.dat",
"species.dat",
"species_eggmoves.dat",
@@ -768,6 +771,7 @@ module Compiler
"pokemon.txt",
"pokemonforms.txt",
"regionaldexes.txt",
"ribbons.txt",
"shadowmoves.txt",
"townmap.txt",
"trainerlists.txt",

View File

@@ -823,6 +823,41 @@ module Compiler
Graphics.update
end
#=============================================================================
# Compile ribbon data
#=============================================================================
def compile_ribbons
GameData::Ribbon::DATA.clear
ribbon_names = []
ribbon_descriptions = []
pbCompilerEachPreppedLine("PBS/ribbons.txt") { |line, line_no|
line = pbGetCsvRecord(line, line_no, [0, "vnss"])
ribbon_number = line[0]
ribbon_symbol = line[1].to_sym
if GameData::Ribbon::DATA[ribbon_number]
raise _INTL("Ribbon ID number '{1}' is used twice.\r\n{2}", ribbon_number, FileLineData.linereport)
elsif GameData::Ribbon::DATA[ribbon_symbol]
raise _INTL("Ribbon ID '{1}' is used twice.\r\n{2}", ribbon_symbol, FileLineData.linereport)
end
# Construct ribbon hash
ribbon_hash = {
:id => ribbon_symbol,
:id_number => ribbon_number,
:name => line[2],
:description => line[3]
}
# Add ribbon's data to records
GameData::Ribbon.register(ribbon_hash)
ribbon_names[ribbon_number] = ribbon_hash[:name]
ribbon_descriptions[ribbon_number] = ribbon_hash[:description]
}
# Save all data
GameData::Ribbon.save
MessageTypes.setMessages(MessageTypes::RibbonNames, ribbon_names)
MessageTypes.setMessages(MessageTypes::RibbonDescriptions, ribbon_descriptions)
Graphics.update
end
#=============================================================================
# Compile wild encounter data
#=============================================================================

View File

@@ -35,9 +35,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save map connections to PBS file
#===============================================================================
#=============================================================================
def normalize_connection(conn)
ret = conn.clone
if conn[1] < 0 && conn[4] < 0
@@ -96,9 +96,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save phone messages to PBS file
#===============================================================================
#=============================================================================
def write_phone
data = load_data("Data/phone.dat") rescue nil
return if !data
@@ -129,9 +129,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save type data to PBS file
#===============================================================================
#=============================================================================
def write_types
File.open("PBS/types.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -151,9 +151,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save ability data to PBS file
#===============================================================================
#=============================================================================
def write_abilities
File.open("PBS/abilities.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -170,9 +170,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save move data to PBS file
#===============================================================================
#=============================================================================
def write_moves
File.open("PBS/moves.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -203,9 +203,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save item data to PBS file
#===============================================================================
#=============================================================================
def write_items
File.open("PBS/items.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -236,9 +236,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save berry plant data to PBS file
#===============================================================================
#=============================================================================
def write_berry_plants
File.open("PBS/berryplants.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -256,9 +256,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save Pokémon data to PBS file
#===============================================================================
#=============================================================================
def write_pokemon
File.open("PBS/pokemon.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -351,9 +351,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save Pokémon forms data to PBS file
#===============================================================================
#=============================================================================
def write_pokemon_forms
File.open("PBS/pokemonforms.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -455,9 +455,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save Shadow movesets to PBS file
#===============================================================================
#=============================================================================
def write_shadow_movesets
shadow_movesets = pbLoadShadowMovesets
File.open("PBS/shadowmoves.txt", "wb") { |f|
@@ -472,9 +472,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save Regional Dexes to PBS file
#===============================================================================
#=============================================================================
def write_regional_dexes
dex_lists = pbLoadRegionalDexes
File.open("PBS/regionaldexes.txt", "wb") { |f|
@@ -503,9 +503,28 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save ability data to PBS file
#=============================================================================
def write_ribbons
File.open("PBS/ribbons.txt", "wb") { |f|
add_PBS_header_to_file(f)
f.write("\#-------------------------------\r\n")
GameData::Ribbon.each do |r|
f.write(sprintf("%d,%s,%s,%s\r\n",
r.id_number,
csvQuote(r.id.to_s),
csvQuote(r.real_name),
csvQuoteAlways(r.real_description)
))
end
}
Graphics.update
end
#=============================================================================
# Save wild encounter data to PBS file
#===============================================================================
#=============================================================================
def write_encounters
map_infos = load_data("Data/MapInfos.rxdata")
File.open("PBS/encounters.txt", "wb") { |f|
@@ -538,9 +557,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save trainer type data to PBS file
#===============================================================================
#=============================================================================
def write_trainer_types
File.open("PBS/trainertypes.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -563,9 +582,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save individual trainer data to PBS file
#===============================================================================
#=============================================================================
def write_trainers
File.open("PBS/trainers.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -607,9 +626,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save trainer list data to PBS file
#===============================================================================
#=============================================================================
def write_trainer_lists
trainerlists = load_data("Data/trainer_lists.dat") rescue nil
return if !trainerlists
@@ -628,9 +647,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save Battle Tower trainer data to PBS file
#===============================================================================
#=============================================================================
def write_battle_tower_trainers(bttrainers, filename)
return if !bttrainers || !filename
btTrainersRequiredTypes = {
@@ -666,9 +685,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save Battle Tower Pokémon data to PBS file
#===============================================================================
#=============================================================================
def write_battle_tower_pokemon(btpokemon,filename)
return if !btpokemon || !filename
species = { 0 => "" }
@@ -703,9 +722,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save metadata data to PBS file
#===============================================================================
#=============================================================================
def write_metadata
File.open("PBS/metadata.txt", "wb") { |f|
add_PBS_header_to_file(f)
@@ -744,9 +763,9 @@ module Compiler
Graphics.update
end
#===============================================================================
#=============================================================================
# Save all data to PBS files
#===============================================================================
#=============================================================================
def write_all
write_town_map
write_connections
@@ -760,6 +779,7 @@ module Compiler
write_pokemon_forms
write_shadow_movesets
write_regional_dexes
write_ribbons
write_encounters
write_trainer_types
write_trainers