mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Tidying up
This commit is contained in:
@@ -146,8 +146,8 @@ SaveData.register_conversion(:v19_1_fix_phone_contacts) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
SaveData.register_conversion(:v19_1_1_fix_berry_plants) do
|
SaveData.register_conversion(:v19_2_fix_berry_plants) do
|
||||||
essentials_version "19.1.1"
|
essentials_version 19.2
|
||||||
display_title 'Fixing berry plant data'
|
display_title 'Fixing berry plant data'
|
||||||
to_value :global_metadata do |global|
|
to_value :global_metadata do |global|
|
||||||
berry_conversion = {
|
berry_conversion = {
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ class Pokemon
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Sets this Pokémon's status. See {GameData::Status} for all possible status effects.
|
# 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)
|
def status=(value)
|
||||||
return if !able?
|
return if !able?
|
||||||
new_status = GameData::Status.try_get(value)
|
new_status = GameData::Status.try_get(value)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Pokemon
|
|||||||
attr_reader :ppup
|
attr_reader :ppup
|
||||||
|
|
||||||
# Creates a new Move object.
|
# 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)
|
def initialize(move_id)
|
||||||
@id = GameData::Move.get(move_id).id
|
@id = GameData::Move.get(move_id).id
|
||||||
@ppup = 0
|
@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
|
# Sets this move's ID, and caps the PP amount if it is now greater than this
|
||||||
# move's total PP.
|
# 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)
|
def id=(value)
|
||||||
@id = GameData::Move.get(value).id
|
@id = GameData::Move.get(value).id
|
||||||
@pp = @pp.clamp(0, total_pp)
|
@pp = @pp.clamp(0, total_pp)
|
||||||
|
|||||||
@@ -128,27 +128,27 @@ module Compiler
|
|||||||
yield lastsection,sectionname if havesection
|
yield lastsection,sectionname if havesection
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used for pokemon.txt, metadata.txt
|
# Used for types.txt, pokemon.txt, trainerlists.txt and Battle Tower trainers PBS files
|
||||||
def pbEachFileSection(f)
|
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|
|
pbEachFileSectionEx(f) { |section,name|
|
||||||
yield section,name.to_i if block_given? && name[/^\d+$/]
|
yield section,name.to_i if block_given? && name[/^\d+$/]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used for pokemonforms.txt
|
# Used for pokemonforms.txt
|
||||||
def pbEachFileSection2(f)
|
def pbEachFileSectionPokemonForms(f)
|
||||||
pbEachFileSectionEx(f) { |section,name|
|
pbEachFileSectionEx(f) { |section,name|
|
||||||
yield section,name if block_given? && name[/^\w+[-,\s]{1}\d+$/]
|
yield section,name if block_given? && name[/^\w+[-,\s]{1}\d+$/]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used for types.txt
|
|
||||||
def pbEachFileSection3(f)
|
|
||||||
pbEachFileSectionEx(f) { |section,name|
|
|
||||||
yield section,name if block_given? && name[/^.+$/]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Used for phone.txt
|
# Used for phone.txt
|
||||||
def pbEachSection(f)
|
def pbEachSection(f)
|
||||||
lineno = 1
|
lineno = 1
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ module Compiler
|
|||||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
# 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).
|
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||||
schema = GameData::Type::SCHEMA
|
schema = GameData::Type::SCHEMA
|
||||||
pbEachFileSection3(f) { |contents, type_id|
|
pbEachFileSection(f) { |contents, type_id|
|
||||||
contents["InternalName"] = type_id if !type_id[/^\d+/]
|
contents["InternalName"] = type_id if !type_id[/^\d+/]
|
||||||
icon_pos = (type_id[/^\d+/]) ? type_id.to_i : nil
|
icon_pos = (type_id[/^\d+/]) ? type_id.to_i : nil
|
||||||
# Go through schema hash of compilable data and compile this section
|
# 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
|
# 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).
|
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||||
schema = GameData::Species.schema
|
schema = GameData::Species.schema
|
||||||
pbEachFileSection3(f) { |contents, species_id|
|
pbEachFileSection(f) { |contents, species_id|
|
||||||
FileLineData.setSection(species_id, "header", nil) # For error reporting
|
FileLineData.setSection(species_id, "header", nil) # For error reporting
|
||||||
contents["InternalName"] = species_id if !species_id[/^\d+/]
|
contents["InternalName"] = species_id if !species_id[/^\d+/]
|
||||||
# Ensure all required properties have been defined, and raise an error
|
# 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
|
# 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).
|
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||||
schema = GameData::Species.schema(true)
|
schema = GameData::Species.schema(true)
|
||||||
pbEachFileSection2(f) { |contents, section_name|
|
pbEachFileSectionPokemonForms(f) { |contents, section_name|
|
||||||
FileLineData.setSection(section_name, "header", nil) # For error reporting
|
FileLineData.setSection(section_name, "header", nil) # For error reporting
|
||||||
# Split section_name into a species number and form number
|
# Split section_name into a species number and form number
|
||||||
split_section_name = section_name.split(/[-,\s]/)
|
split_section_name = section_name.split(/[-,\s]/)
|
||||||
@@ -1208,7 +1208,7 @@ module Compiler
|
|||||||
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
|
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
|
||||||
File.open(path, "rb") { |f|
|
File.open(path, "rb") { |f|
|
||||||
FileLineData.file = path
|
FileLineData.file = path
|
||||||
pbEachFileSectionEx(f) { |section,name|
|
pbEachFileSection(f) { |section,name|
|
||||||
next if name!="DefaultTrainerList" && name!="TrainerList"
|
next if name!="DefaultTrainerList" && name!="TrainerList"
|
||||||
rsection = []
|
rsection = []
|
||||||
for key in section.keys
|
for key in section.keys
|
||||||
@@ -1270,7 +1270,7 @@ module Compiler
|
|||||||
if safeExists?(filename)
|
if safeExists?(filename)
|
||||||
File.open(filename,"rb") { |f|
|
File.open(filename,"rb") { |f|
|
||||||
FileLineData.file = filename
|
FileLineData.file = filename
|
||||||
pbEachFileSectionEx(f) { |section,name|
|
pbEachFileSection(f) { |section,name|
|
||||||
rsection = []
|
rsection = []
|
||||||
for key in section.keys
|
for key in section.keys
|
||||||
FileLineData.setSection(name,key,section[key])
|
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.
|
# 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
|
# 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).
|
# 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
|
schema = (map_id == 0) ? GameData::Metadata::SCHEMA : GameData::MapMetadata::SCHEMA
|
||||||
# Go through schema hash of compilable data and compile this section
|
# Go through schema hash of compilable data and compile this section
|
||||||
for key in schema.keys
|
for key in schema.keys
|
||||||
|
|||||||
Reference in New Issue
Block a user