mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Removed all uses of ID numbers for types, Shape property in pokemon.txt must now be a name and not a number
This commit is contained in:
@@ -128,7 +128,7 @@ module Compiler
|
||||
yield lastsection,sectionname if havesection
|
||||
end
|
||||
|
||||
# Used for types.txt, pokemon.txt, metadata.txt
|
||||
# Used for pokemon.txt, metadata.txt
|
||||
def pbEachFileSection(f)
|
||||
pbEachFileSectionEx(f) { |section,name|
|
||||
yield section,name.to_i if block_given? && name[/^\d+$/]
|
||||
@@ -142,6 +142,13 @@ module Compiler
|
||||
}
|
||||
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
|
||||
@@ -600,6 +607,7 @@ module Compiler
|
||||
# Parse string into a likely constant name and return its ID number (if any).
|
||||
# Last ditch attempt to figure out whether a constant is defined.
|
||||
#=============================================================================
|
||||
# Unused
|
||||
def pbGetConst(mod,item,err)
|
||||
isDef = false
|
||||
begin
|
||||
@@ -735,11 +743,12 @@ module Compiler
|
||||
return if !$DEBUG
|
||||
begin
|
||||
dataFiles = [
|
||||
"abilities.dat",
|
||||
"berry_plants.dat",
|
||||
"encounters.dat",
|
||||
"form2species.dat",
|
||||
"items.dat",
|
||||
"map_connections.dat",
|
||||
"map_metadata.dat",
|
||||
"metadata.dat",
|
||||
"moves.dat",
|
||||
"phone.dat",
|
||||
@@ -747,11 +756,6 @@ module Compiler
|
||||
"ribbons.dat",
|
||||
"shadow_movesets.dat",
|
||||
"species.dat",
|
||||
"species_eggmoves.dat",
|
||||
"species_evolutions.dat",
|
||||
"species_metrics.dat",
|
||||
"species_movesets.dat",
|
||||
"tm.dat",
|
||||
"town_map.dat",
|
||||
"trainer_lists.dat",
|
||||
"trainer_types.dat",
|
||||
|
||||
@@ -142,10 +142,12 @@ 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
|
||||
pbEachFileSection(f) { |contents, type_number|
|
||||
pbEachFileSection3(f) { |contents, type_id|
|
||||
contents["InternalName"] = type_id if !type_id[/^\d+/]
|
||||
id_number = (type_id[/^\d+/]) ? type_id.to_i : nil
|
||||
# Go through schema hash of compilable data and compile this section
|
||||
for key in schema.keys
|
||||
FileLineData.setSection(type_number, key, contents[key]) # For error reporting
|
||||
FileLineData.setSection(type_id, key, contents[key]) # For error reporting
|
||||
# Skip empty properties, or raise an error if a required property is
|
||||
# empty
|
||||
if contents[key].nil?
|
||||
@@ -166,20 +168,19 @@ module Compiler
|
||||
end
|
||||
end
|
||||
# Construct type hash
|
||||
type_symbol = contents["InternalName"].to_sym
|
||||
type_hash = {
|
||||
:id => type_symbol,
|
||||
:id_number => type_number,
|
||||
:name => contents["Name"],
|
||||
:pseudo_type => contents["IsPseudoType"],
|
||||
:special_type => contents["IsSpecialType"],
|
||||
:weaknesses => contents["Weaknesses"],
|
||||
:resistances => contents["Resistances"],
|
||||
:immunities => contents["Immunities"]
|
||||
:id => contents["InternalName"].to_sym,
|
||||
:name => contents["Name"],
|
||||
:pseudo_type => contents["IsPseudoType"],
|
||||
:special_type => contents["IsSpecialType"],
|
||||
:weaknesses => contents["Weaknesses"],
|
||||
:resistances => contents["Resistances"],
|
||||
:immunities => contents["Immunities"],
|
||||
:icon_position => contents["IconPosition"] || id_number
|
||||
}
|
||||
# Add type's data to records
|
||||
GameData::Type.register(type_hash)
|
||||
type_names[type_number] = type_hash[:name]
|
||||
type_names.push(type_hash[:name])
|
||||
}
|
||||
}
|
||||
# Ensure all weaknesses/resistances/immunities are valid types
|
||||
@@ -199,7 +200,7 @@ module Compiler
|
||||
end
|
||||
# Save all data
|
||||
GameData::Type.save
|
||||
MessageTypes.setMessages(MessageTypes::Types, type_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Types, type_names)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -481,7 +482,7 @@ module Compiler
|
||||
:height => contents["Height"],
|
||||
:weight => contents["Weight"],
|
||||
:color => contents["Color"],
|
||||
:shape => GameData::BodyShape.get(contents["Shape"]).id,
|
||||
:shape => contents["Shape"],
|
||||
:habitat => contents["Habitat"],
|
||||
:generation => contents["Generation"],
|
||||
:back_sprite_x => contents["BattlerPlayerX"],
|
||||
|
||||
@@ -138,9 +138,9 @@ module Compiler
|
||||
# Write each type in turn
|
||||
GameData::Type.each do |type|
|
||||
f.write("\#-------------------------------\r\n")
|
||||
f.write("[#{type.id_number}]\r\n")
|
||||
f.write("[#{type.id}]\r\n")
|
||||
f.write("Name = #{type.real_name}\r\n")
|
||||
f.write("InternalName = #{type.id}\r\n")
|
||||
f.write("IconPosition = #{type.icon_position}\r\n")
|
||||
f.write("IsPseudoType = true\r\n") if type.pseudo_type
|
||||
f.write("IsSpecialType = true\r\n") if type.special?
|
||||
f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0
|
||||
|
||||
Reference in New Issue
Block a user