Tidying up

This commit is contained in:
Maruno17
2021-06-19 20:36:17 +01:00
parent e472d0fcdf
commit 9b4bc66dc0
5 changed files with 20 additions and 20 deletions

View File

@@ -146,8 +146,8 @@ SaveData.register_conversion(:v19_1_fix_phone_contacts) do
end
end
SaveData.register_conversion(:v19_1_1_fix_berry_plants) do
essentials_version "19.1.1"
SaveData.register_conversion(:v19_2_fix_berry_plants) do
essentials_version 19.2
display_title 'Fixing berry plant data'
to_value :global_metadata do |global|
berry_conversion = {

View File

@@ -239,7 +239,7 @@ class Pokemon
end
# Sets this Pokémon's status. See {GameData::Status} for all possible status effects.
# @param value [Symbol, String, GameData::Status, Integer] status to set
# @param value [Symbol, String, GameData::Status] status to set
def status=(value)
return if !able?
new_status = GameData::Status.try_get(value)

View File

@@ -11,7 +11,7 @@ class Pokemon
attr_reader :ppup
# Creates a new Move object.
# @param move_id [Symbol, String, Integer] move ID
# @param move_id [Symbol, String, GameData::Move] move ID
def initialize(move_id)
@id = GameData::Move.get(move_id).id
@ppup = 0
@@ -20,7 +20,7 @@ class Pokemon
# Sets this move's ID, and caps the PP amount if it is now greater than this
# move's total PP.
# @param value [Symbol, String, Integer] the new move ID
# @param value [Symbol, String, GameData::Move] the new move ID
def id=(value)
@id = GameData::Move.get(value).id
@pp = @pp.clamp(0, total_pp)

View File

@@ -128,27 +128,27 @@ module Compiler
yield lastsection,sectionname if havesection
end
# Used for pokemon.txt, metadata.txt
# Used for types.txt, pokemon.txt, trainerlists.txt and Battle Tower trainers PBS files
def pbEachFileSection(f)
pbEachFileSectionEx(f) { |section,name|
yield section,name if block_given? && name[/^.+$/]
}
end
# Used for metadata.txt
def pbEachFileSectionNumbered(f)
pbEachFileSectionEx(f) { |section,name|
yield section,name.to_i if block_given? && name[/^\d+$/]
}
end
# Used for pokemonforms.txt
def pbEachFileSection2(f)
def pbEachFileSectionPokemonForms(f)
pbEachFileSectionEx(f) { |section,name|
yield section,name if block_given? && name[/^\w+[-,\s]{1}\d+$/]
}
end
# Used for types.txt
def pbEachFileSection3(f)
pbEachFileSectionEx(f) { |section,name|
yield section,name if block_given? && name[/^.+$/]
}
end
# Used for phone.txt
def pbEachSection(f)
lineno = 1

View File

@@ -142,7 +142,7 @@ module Compiler
# contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings).
schema = GameData::Type::SCHEMA
pbEachFileSection3(f) { |contents, type_id|
pbEachFileSection(f) { |contents, type_id|
contents["InternalName"] = type_id if !type_id[/^\d+/]
icon_pos = (type_id[/^\d+/]) ? type_id.to_i : nil
# Go through schema hash of compilable data and compile this section
@@ -373,7 +373,7 @@ module Compiler
# contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings).
schema = GameData::Species.schema
pbEachFileSection3(f) { |contents, species_id|
pbEachFileSection(f) { |contents, species_id|
FileLineData.setSection(species_id, "header", nil) # For error reporting
contents["InternalName"] = species_id if !species_id[/^\d+/]
# Ensure all required properties have been defined, and raise an error
@@ -531,7 +531,7 @@ module Compiler
# contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings).
schema = GameData::Species.schema(true)
pbEachFileSection2(f) { |contents, section_name|
pbEachFileSectionPokemonForms(f) { |contents, section_name|
FileLineData.setSection(section_name, "header", nil) # For error reporting
# Split section_name into a species number and form number
split_section_name = section_name.split(/[-,\s]/)
@@ -1208,7 +1208,7 @@ module Compiler
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
File.open(path, "rb") { |f|
FileLineData.file = path
pbEachFileSectionEx(f) { |section,name|
pbEachFileSection(f) { |section,name|
next if name!="DefaultTrainerList" && name!="TrainerList"
rsection = []
for key in section.keys
@@ -1270,7 +1270,7 @@ module Compiler
if safeExists?(filename)
File.open(filename,"rb") { |f|
FileLineData.file = filename
pbEachFileSectionEx(f) { |section,name|
pbEachFileSection(f) { |section,name|
rsection = []
for key in section.keys
FileLineData.setSection(name,key,section[key])
@@ -1306,7 +1306,7 @@ module Compiler
# Read a whole section's lines at once, then run through this code.
# contents is a hash containing all the XXX=YYY lines in that section, where
# the keys are the XXX and the values are the YYY (as unprocessed strings).
pbEachFileSection(f) { |contents, map_id|
pbEachFileSectionNumbered(f) { |contents, map_id|
schema = (map_id == 0) ? GameData::Metadata::SCHEMA : GameData::MapMetadata::SCHEMA
# Go through schema hash of compilable data and compile this section
for key in schema.keys