mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Removed all uses of ID numbers for species, some other code changes for abolishing ID numbers
This commit is contained in:
@@ -114,8 +114,13 @@ module GameData
|
|||||||
return self::DATA.keys
|
return self::DATA.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
# Yields all data in alphabetical order.
|
# Yields all data in the order they were defined.
|
||||||
def each
|
def each
|
||||||
|
self::DATA.each_value { |value| yield value }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Yields all data in alphabetical order.
|
||||||
|
def each_alphabetically
|
||||||
keys = self::DATA.keys.sort { |a, b| self::DATA[a].real_name <=> self::DATA[b].real_name }
|
keys = self::DATA.keys.sort { |a, b| self::DATA[a].real_name <=> self::DATA[b].real_name }
|
||||||
keys.each { |key| yield self::DATA[key] }
|
keys.each { |key| yield self::DATA[key] }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
module GameData
|
module GameData
|
||||||
class Type
|
class Type
|
||||||
attr_reader :id
|
attr_reader :id
|
||||||
attr_reader :id_number
|
|
||||||
attr_reader :real_name
|
attr_reader :real_name
|
||||||
attr_reader :special_type
|
attr_reader :special_type
|
||||||
attr_reader :pseudo_type
|
attr_reader :pseudo_type
|
||||||
@@ -27,10 +26,6 @@ module GameData
|
|||||||
extend ClassMethodsSymbols
|
extend ClassMethodsSymbols
|
||||||
include InstanceMethods
|
include InstanceMethods
|
||||||
|
|
||||||
def self.each
|
|
||||||
DATA.each_value { |type| yield type }
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize(hash)
|
def initialize(hash)
|
||||||
@id = hash[:id]
|
@id = hash[:id]
|
||||||
@real_name = hash[:name] || "Unnamed"
|
@real_name = hash[:name] || "Unnamed"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
module GameData
|
module GameData
|
||||||
class Species
|
class Species
|
||||||
attr_reader :id
|
attr_reader :id
|
||||||
attr_reader :id_number
|
|
||||||
attr_reader :species
|
attr_reader :species
|
||||||
attr_reader :form
|
attr_reader :form
|
||||||
attr_reader :real_name
|
attr_reader :real_name
|
||||||
@@ -51,9 +50,13 @@ module GameData
|
|||||||
DATA = {}
|
DATA = {}
|
||||||
DATA_FILENAME = "species.dat"
|
DATA_FILENAME = "species.dat"
|
||||||
|
|
||||||
extend ClassMethods
|
extend ClassMethodsSymbols
|
||||||
include InstanceMethods
|
include InstanceMethods
|
||||||
|
|
||||||
|
def self.each_species
|
||||||
|
DATA.each_value { |species| yield species if species.form == 0 }
|
||||||
|
end
|
||||||
|
|
||||||
# @param species [Symbol, self, String, Integer]
|
# @param species [Symbol, self, String, Integer]
|
||||||
# @param form [Integer]
|
# @param form [Integer]
|
||||||
# @return [self, nil]
|
# @return [self, nil]
|
||||||
@@ -128,7 +131,6 @@ module GameData
|
|||||||
|
|
||||||
def initialize(hash)
|
def initialize(hash)
|
||||||
@id = hash[:id]
|
@id = hash[:id]
|
||||||
@id_number = hash[:id_number] || -1
|
|
||||||
@species = hash[:species] || @id
|
@species = hash[:species] || @id
|
||||||
@form = hash[:form] || 0
|
@form = hash[:form] || 0
|
||||||
@real_name = hash[:name] || "Unnamed"
|
@real_name = hash[:name] || "Unnamed"
|
||||||
@@ -182,22 +184,22 @@ module GameData
|
|||||||
|
|
||||||
# @return [String] the translated name of this species
|
# @return [String] the translated name of this species
|
||||||
def name
|
def name
|
||||||
return pbGetMessage(MessageTypes::Species, @id_number)
|
return pbGetMessageFromHash(MessageTypes::Species, @real_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String] the translated name of this form of this species
|
# @return [String] the translated name of this form of this species
|
||||||
def form_name
|
def form_name
|
||||||
return pbGetMessage(MessageTypes::FormNames, @id_number)
|
return pbGetMessageFromHash(MessageTypes::FormNames, @real_form_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String] the translated Pokédex category of this species
|
# @return [String] the translated Pokédex category of this species
|
||||||
def category
|
def category
|
||||||
return pbGetMessage(MessageTypes::Kinds, @id_number)
|
return pbGetMessageFromHash(MessageTypes::Kinds, @real_category)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [String] the translated Pokédex entry of this species
|
# @return [String] the translated Pokédex entry of this species
|
||||||
def pokedex_entry
|
def pokedex_entry
|
||||||
return pbGetMessage(MessageTypes::Entries, @id_number)
|
return pbGetMessageFromHash(MessageTypes::Entries, @real_pokedex_entry)
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_metrics_to_sprite(sprite, index, shadow = false)
|
def apply_metrics_to_sprite(sprite, index, shadow = false)
|
||||||
@@ -234,7 +236,7 @@ module GameData
|
|||||||
|
|
||||||
def get_family_evolutions(exclude_invalid = true)
|
def get_family_evolutions(exclude_invalid = true)
|
||||||
evos = self.get_evolutions(exclude_invalid)
|
evos = self.get_evolutions(exclude_invalid)
|
||||||
evos = evos.sort { |a, b| GameData::Species.get(a[0]).id_number <=> GameData::Species.get(b[0]).id_number }
|
evos = evos.sort { |a, b| GameData::Species.keys.index(a[0]) <=> GameData::Species.keys.index(b[0]) }
|
||||||
ret = []
|
ret = []
|
||||||
evos.each do |evo|
|
evos.each do |evo|
|
||||||
ret.push([@species].concat(evo)) # [Prevo species, evo species, method, parameter]
|
ret.push([@species].concat(evo)) # [Prevo species, evo species, method, parameter]
|
||||||
|
|||||||
@@ -134,9 +134,10 @@ module GameData
|
|||||||
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
|
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
|
||||||
if pkmn_data[:nature]
|
if pkmn_data[:nature]
|
||||||
pkmn.nature = pkmn_data[:nature]
|
pkmn.nature = pkmn_data[:nature]
|
||||||
else
|
else # Make the nature random but consistent for the same species used by the same trainer type
|
||||||
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
|
species_num = GameData::Species.keys.index(species) || 1
|
||||||
pkmn.nature = nature % (GameData::Nature::DATA.length / 2)
|
tr_type_num = GameData::TrainerType.keys.index(@trainer_type) || 1
|
||||||
|
pkmn.nature = (species_num + tr_type_num) % (GameData::Nature::DATA.length / 2)
|
||||||
end
|
end
|
||||||
GameData::Stat.each_main do |s|
|
GameData::Stat.each_main do |s|
|
||||||
if pkmn_data[:iv]
|
if pkmn_data[:iv]
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class Player < Trainer
|
|||||||
def seen_any?(dex = -1)
|
def seen_any?(dex = -1)
|
||||||
validate dex => Integer
|
validate dex => Integer
|
||||||
if dex == -1
|
if dex == -1
|
||||||
GameData::Species.each { |s| return true if s.form == 0 && @seen[s.species] }
|
GameData::Species.each_species { |s| return true if @seen[s.species] }
|
||||||
else
|
else
|
||||||
pbAllRegionalSpecies(dex).each { |s| return true if s && @seen[s] }
|
pbAllRegionalSpecies(dex).each { |s| return true if s && @seen[s] }
|
||||||
end
|
end
|
||||||
@@ -269,7 +269,7 @@ class Player < Trainer
|
|||||||
def count_species(hash, region = -1)
|
def count_species(hash, region = -1)
|
||||||
ret = 0
|
ret = 0
|
||||||
if region == -1
|
if region == -1
|
||||||
GameData::Species.each { |s| ret += 1 if s.form == 0 && hash[s.species] }
|
GameData::Species.each_species { |s| ret += 1 if hash[s.species] }
|
||||||
else
|
else
|
||||||
pbAllRegionalSpecies(region).each { |s| ret += 1 if s && hash[s] }
|
pbAllRegionalSpecies(region).each { |s| ret += 1 if s && hash[s] }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ class HallOfFame_Scene
|
|||||||
@useMusic=false
|
@useMusic=false
|
||||||
@battlerIndex=0
|
@battlerIndex=0
|
||||||
@hallEntry=[]
|
@hallEntry=[]
|
||||||
|
@nationalDexList = [:NONE]
|
||||||
|
GameData::Species.each_species { |s| @nationalDexList.push(s.species) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbStartSceneEntry
|
def pbStartSceneEntry
|
||||||
@@ -305,8 +307,8 @@ class HallOfFame_Scene
|
|||||||
idno=(pokemon.owner.name.empty? || pokemon.egg?) ? "?????" : sprintf("%05d",pokemon.owner.public_id)
|
idno=(pokemon.owner.name.empty? || pokemon.egg?) ? "?????" : sprintf("%05d",pokemon.owner.public_id)
|
||||||
dexnumber = _INTL("No. ???")
|
dexnumber = _INTL("No. ???")
|
||||||
if !pokemon.egg?
|
if !pokemon.egg?
|
||||||
species_data = GameData::Species.get(pokemon.species)
|
number = @nationalDexList.index(pokemon.species) || 0
|
||||||
dexnumber = _ISPRINTF("No. {1:03d}",species_data.id_number)
|
dexnumber = _ISPRINTF("No. {1:03d}", number)
|
||||||
end
|
end
|
||||||
textPositions=[
|
textPositions=[
|
||||||
[dexnumber,32,Graphics.height-86,0,BASECOLOR,SHADOWCOLOR],
|
[dexnumber,32,Graphics.height-86,0,BASECOLOR,SHADOWCOLOR],
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class PokemonPokedex_Scene
|
|||||||
if !regionalSpecies || regionalSpecies.length == 0
|
if !regionalSpecies || regionalSpecies.length == 0
|
||||||
# If no Regional Dex defined for the given region, use the National Pokédex
|
# If no Regional Dex defined for the given region, use the National Pokédex
|
||||||
regionalSpecies = []
|
regionalSpecies = []
|
||||||
GameData::Species.each { |s| regionalSpecies.push(s.id) if s.form == 0 }
|
GameData::Species.each_species { |s| regionalSpecies.push(s.id) }
|
||||||
end
|
end
|
||||||
shift = Settings::DEXES_WITH_OFFSETS.include?(region)
|
shift = Settings::DEXES_WITH_OFFSETS.include?(region)
|
||||||
ret = []
|
ret = []
|
||||||
|
|||||||
@@ -74,10 +74,13 @@ class PokemonPokedexInfo_Scene
|
|||||||
dexnumshift = false
|
dexnumshift = false
|
||||||
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
|
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
|
||||||
species_data = GameData::Species.try_get(species)
|
species_data = GameData::Species.try_get(species)
|
||||||
dexnum = species_data.id_number if species_data
|
if species_data
|
||||||
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1)
|
nationalDexList = [:NONE]
|
||||||
|
GameData::Species.each_species { |s| nationalDexList.push(s.species) }
|
||||||
|
dexnum = nationalDexList.index(species_data.species) || 0
|
||||||
|
dexnumshift = true if dexnum > 0 && Settings::DEXES_WITH_OFFSETS.include?(-1)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
dexnum = 0
|
|
||||||
for i in 0...$Trainer.pokedex.dexes_count - 1 # Regional Dexes
|
for i in 0...$Trainer.pokedex.dexes_count - 1 # Regional Dexes
|
||||||
next if !$Trainer.pokedex.unlocked?(i)
|
next if !$Trainer.pokedex.unlocked?(i)
|
||||||
num = pbGetRegionalNumber(i,species)
|
num = pbGetRegionalNumber(i,species)
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ class PokemonSummary_Scene
|
|||||||
@sprites["messagebox"].visible = false
|
@sprites["messagebox"].visible = false
|
||||||
@sprites["messagebox"].letterbyletter = true
|
@sprites["messagebox"].letterbyletter = true
|
||||||
pbBottomLeftLines(@sprites["messagebox"],2)
|
pbBottomLeftLines(@sprites["messagebox"],2)
|
||||||
|
@nationalDexList = [:NONE]
|
||||||
|
GameData::Species.each_species { |s| @nationalDexList.push(s.species) }
|
||||||
drawPage(@page)
|
drawPage(@page)
|
||||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||||
end
|
end
|
||||||
@@ -391,12 +393,12 @@ class PokemonSummary_Scene
|
|||||||
[_INTL("ID No."),238,202,0,base,shadow],
|
[_INTL("ID No."),238,202,0,base,shadow],
|
||||||
]
|
]
|
||||||
# Write the Regional/National Dex number
|
# Write the Regional/National Dex number
|
||||||
dexnum = GameData::Species.get(@pokemon.species).id_number
|
dexnum = 0
|
||||||
dexnumshift = false
|
dexnumshift = false
|
||||||
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
|
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
|
||||||
|
dexnum = @nationalDexList.index(@pokemon.species_data.species) || 0
|
||||||
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1)
|
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1)
|
||||||
else
|
else
|
||||||
dexnum = 0
|
|
||||||
for i in 0...$Trainer.pokedex.dexes_count - 1
|
for i in 0...$Trainer.pokedex.dexes_count - 1
|
||||||
next if !$Trainer.pokedex.unlocked?(i)
|
next if !$Trainer.pokedex.unlocked?(i)
|
||||||
num = pbGetRegionalNumber(i,@pokemon.species)
|
num = pbGetRegionalNumber(i,@pokemon.species)
|
||||||
|
|||||||
@@ -1050,8 +1050,7 @@ end
|
|||||||
def pbBuyTriads
|
def pbBuyTriads
|
||||||
commands = []
|
commands = []
|
||||||
realcommands = []
|
realcommands = []
|
||||||
GameData::Species.each do |s|
|
GameData::Species.each_species do |s|
|
||||||
next if s.form != 0
|
|
||||||
next if !$Trainer.owned?(s.species)
|
next if !$Trainer.owned?(s.species)
|
||||||
price = TriadCard.new(s.id).price
|
price = TriadCard.new(s.id).price
|
||||||
commands.push([price, s.name, _INTL("{1} - ${2}", s.name, price.to_s_formatted), s.id])
|
commands.push([price, s.name, _INTL("{1} - ${2}", s.name, price.to_s_formatted), s.id])
|
||||||
|
|||||||
@@ -112,9 +112,8 @@ module NicknameChecker
|
|||||||
name = name.upcase
|
name = name.upcase
|
||||||
return true if name == getName(species)
|
return true if name == getName(species)
|
||||||
return false if @@names.values.include?(name)
|
return false if @@names.values.include?(name)
|
||||||
GameData::Species.each do |species_data|
|
GameData::Species.each_species do |species_data|
|
||||||
next if species_data.species == species || species_data.form != 0
|
return false if species_data.species != species && getName(species_data.id) == name
|
||||||
return false if getName(species_data.id) == name
|
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ def pbRandomMove
|
|||||||
loop do
|
loop do
|
||||||
move_id = keys[rand(keys.length)]
|
move_id = keys[rand(keys.length)]
|
||||||
move = GameData::Move.get(move_id)
|
move = GameData::Move.get(move_id)
|
||||||
next if move.id_number > 384 || move.id == :SKETCH || move.id == :STRUGGLE
|
next if move.id == :SKETCH || move.id == :STRUGGLE
|
||||||
return move.id
|
return move.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ end
|
|||||||
def pbGetRegionalDexLength(region_dex)
|
def pbGetRegionalDexLength(region_dex)
|
||||||
if region_dex < 0
|
if region_dex < 0
|
||||||
ret = 0
|
ret = 0
|
||||||
GameData::Species.each { |s| ret += 1 if s.form == 0 }
|
GameData::Species.each_species { |s| ret += 1 }
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
dex_list = pbLoadRegionalDexes[region_dex]
|
dex_list = pbLoadRegionalDexes[region_dex]
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ def pbEncounterMapVersionEditor(enc_data)
|
|||||||
elsif ret == commands.length - 1 # Add new encounter type
|
elsif ret == commands.length - 1 # Add new encounter type
|
||||||
new_type_commands = []
|
new_type_commands = []
|
||||||
new_types = []
|
new_types = []
|
||||||
GameData::EncounterType.each do |enc|
|
GameData::EncounterType.each_alphabetically do |enc|
|
||||||
next if enc_data.types[enc.id]
|
next if enc_data.types[enc.id]
|
||||||
new_type_commands.push(enc.real_name)
|
new_type_commands.push(enc.real_name)
|
||||||
new_types.push(enc.id)
|
new_types.push(enc.id)
|
||||||
@@ -212,7 +212,7 @@ def pbEncounterMapVersionEditor(enc_data)
|
|||||||
when 1 # Copy
|
when 1 # Copy
|
||||||
new_type_commands = []
|
new_type_commands = []
|
||||||
new_types = []
|
new_types = []
|
||||||
GameData::EncounterType.each do |enc|
|
GameData::EncounterType.each_alphabetically do |enc|
|
||||||
next if enc_data.types[enc.id]
|
next if enc_data.types[enc.id]
|
||||||
new_type_commands.push(enc.real_name)
|
new_type_commands.push(enc.real_name)
|
||||||
new_types.push(enc.id)
|
new_types.push(enc.id)
|
||||||
@@ -285,7 +285,7 @@ def pbEncounterTypeEditor(enc_data, enc_type)
|
|||||||
new_type_commands = []
|
new_type_commands = []
|
||||||
new_types = []
|
new_types = []
|
||||||
chosen_type_cmd = 0
|
chosen_type_cmd = 0
|
||||||
GameData::EncounterType.each do |enc|
|
GameData::EncounterType.each_alphabetically do |enc|
|
||||||
next if enc_data.types[enc.id] && enc.id != enc_type
|
next if enc_data.types[enc.id] && enc.id != enc_type
|
||||||
new_type_commands.push(enc.real_name)
|
new_type_commands.push(enc.real_name)
|
||||||
new_types.push(enc.id)
|
new_types.push(enc.id)
|
||||||
@@ -954,7 +954,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbPokemonEditor
|
def pbPokemonEditor
|
||||||
species_properties = [
|
species_properties = [
|
||||||
[_INTL("InternalName"), ReadOnlyProperty, _INTL("Internal name of the Pokémon.")],
|
[_INTL("ID"), ReadOnlyProperty, _INTL("The ID of the Pokémon.")],
|
||||||
[_INTL("Name"), LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")],
|
[_INTL("Name"), LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")],
|
||||||
[_INTL("FormName"), StringProperty, _INTL("Name of this form of the Pokémon.")],
|
[_INTL("FormName"), StringProperty, _INTL("Name of this form of the Pokémon.")],
|
||||||
[_INTL("Kind"), StringProperty, _INTL("Kind of Pokémon species.")],
|
[_INTL("Kind"), StringProperty, _INTL("Kind of Pokémon species.")],
|
||||||
@@ -1004,9 +1004,7 @@ def pbPokemonEditor
|
|||||||
if button == Input::ACTION
|
if button == Input::ACTION
|
||||||
if species.is_a?(Symbol)
|
if species.is_a?(Symbol)
|
||||||
if pbConfirmMessageSerious("Delete this species?")
|
if pbConfirmMessageSerious("Delete this species?")
|
||||||
id_number = GameData::Species.get(species).id_number
|
|
||||||
GameData::Species::DATA.delete(species)
|
GameData::Species::DATA.delete(species)
|
||||||
GameData::Species::DATA.delete(id_number)
|
|
||||||
GameData::Species.save
|
GameData::Species.save
|
||||||
Compiler.write_pokemon
|
Compiler.write_pokemon
|
||||||
pbMessage(_INTL("The species was deleted."))
|
pbMessage(_INTL("The species was deleted."))
|
||||||
@@ -1079,7 +1077,6 @@ def pbPokemonEditor
|
|||||||
# Construct species hash
|
# Construct species hash
|
||||||
species_hash = {
|
species_hash = {
|
||||||
:id => spec.id,
|
:id => spec.id,
|
||||||
:id_number => spec.id_number,
|
|
||||||
:name => data[1],
|
:name => data[1],
|
||||||
:form_name => data[2],
|
:form_name => data[2],
|
||||||
:category => data[3],
|
:category => data[3],
|
||||||
@@ -1292,14 +1289,14 @@ def pbRegionalDexEditorMain
|
|||||||
refresh_list = true
|
refresh_list = true
|
||||||
when 1 # Fill with National Dex
|
when 1 # Fill with National Dex
|
||||||
new_dex = []
|
new_dex = []
|
||||||
GameData::Species.each { |s| new_dex.push(s.species) if s.form == 0 }
|
GameData::Species.each_species { |s| new_dex.push(s.species) }
|
||||||
dex_lists.push(new_dex)
|
dex_lists.push(new_dex)
|
||||||
refresh_list = true
|
refresh_list = true
|
||||||
when 2 # Fill with National Dex (grouped families)
|
when 2 # Fill with National Dex (grouped families)
|
||||||
new_dex = []
|
new_dex = []
|
||||||
seen = []
|
seen = []
|
||||||
GameData::Species.each do |s|
|
GameData::Species.each_species do |s|
|
||||||
next if s.form != 0 || seen.include?(s.species)
|
next if seen.include?(s.species)
|
||||||
family = s.get_related_species
|
family = s.get_related_species
|
||||||
new_dex.concat(family)
|
new_dex.concat(family)
|
||||||
seen.concat(family)
|
seen.concat(family)
|
||||||
@@ -1350,7 +1347,6 @@ def pbAppendEvoToFamilyArray(species, array, seenarray)
|
|||||||
seenarray[species] = true
|
seenarray[species] = true
|
||||||
evos = GameData::Species.get(species).get_evolutions
|
evos = GameData::Species.get(species).get_evolutions
|
||||||
if evos.length > 0
|
if evos.length > 0
|
||||||
evos.sort! { |a, b| GameData::Species.get(a[0]).id_number <=> GameData::Species.get(b[0]).id_number }
|
|
||||||
subarray = []
|
subarray = []
|
||||||
for i in evos
|
for i in evos
|
||||||
pbAppendEvoToFamilyArray(i[0], subarray, seenarray)
|
pbAppendEvoToFamilyArray(i[0], subarray, seenarray)
|
||||||
@@ -1362,8 +1358,7 @@ end
|
|||||||
def pbGetEvoFamilies
|
def pbGetEvoFamilies
|
||||||
seen = []
|
seen = []
|
||||||
ret = []
|
ret = []
|
||||||
GameData::Species.each do |sp|
|
GameData::Species.each_species do |sp|
|
||||||
next if sp.form > 0
|
|
||||||
species = sp.get_baby_species
|
species = sp.get_baby_species
|
||||||
next if seen[species]
|
next if seen[species]
|
||||||
subret = []
|
subret = []
|
||||||
|
|||||||
@@ -12,8 +12,12 @@ def findBottom(bitmap)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbAutoPositionAll
|
def pbAutoPositionAll
|
||||||
|
t = Time.now.to_i
|
||||||
GameData::Species.each do |sp|
|
GameData::Species.each do |sp|
|
||||||
Graphics.update if sp.id_number % 50 == 0
|
if Time.now.to_i - t >= 5
|
||||||
|
t = Time.now.to_i
|
||||||
|
Graphics.update
|
||||||
|
end
|
||||||
bitmap1 = GameData::Species.sprite_bitmap(sp.species, sp.form, nil, nil, nil, true)
|
bitmap1 = GameData::Species.sprite_bitmap(sp.species, sp.form, nil, nil, nil, true)
|
||||||
bitmap2 = GameData::Species.sprite_bitmap(sp.species, sp.form)
|
bitmap2 = GameData::Species.sprite_bitmap(sp.species, sp.form)
|
||||||
if bitmap1 && bitmap1.bitmap # Player's y
|
if bitmap1 && bitmap1.bitmap # Player's y
|
||||||
|
|||||||
@@ -117,15 +117,21 @@ end
|
|||||||
# the list sorting between numerical and alphabetical.
|
# the list sorting between numerical and alphabetical.
|
||||||
def pbChooseSpeciesList(default = nil)
|
def pbChooseSpeciesList(default = nil)
|
||||||
commands = []
|
commands = []
|
||||||
GameData::Species.each { |s| commands.push([s.id_number, s.real_name, s.id]) if s.form == 0 }
|
index = 1
|
||||||
|
GameData::Species.each_species do |s|
|
||||||
|
commands.push([index, s.real_name, s.id])
|
||||||
|
index += 1
|
||||||
|
end
|
||||||
return pbChooseList(commands, default, nil, -1)
|
return pbChooseList(commands, default, nil, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseSpeciesFormList(default = nil)
|
def pbChooseSpeciesFormList(default = nil)
|
||||||
commands = []
|
commands = []
|
||||||
|
index = 1
|
||||||
GameData::Species.each do |s|
|
GameData::Species.each do |s|
|
||||||
name = (s.form == 0) ? s.real_name : sprintf("%s_%d", s.real_name, s.form)
|
name = (s.form == 0) ? s.real_name : sprintf("%s_%d", s.real_name, s.form)
|
||||||
commands.push([s.id_number, name, s.id])
|
commands.push([index, name, s.id])
|
||||||
|
index += 1
|
||||||
end
|
end
|
||||||
return pbChooseList(commands, default, nil, -1)
|
return pbChooseList(commands, default, nil, -1)
|
||||||
end
|
end
|
||||||
@@ -136,18 +142,24 @@ end
|
|||||||
# between numerical and alphabetical.
|
# between numerical and alphabetical.
|
||||||
def pbChooseMoveList(default = nil)
|
def pbChooseMoveList(default = nil)
|
||||||
commands = []
|
commands = []
|
||||||
GameData::Move.each { |i| commands.push([i.id_number, i.real_name, i.id]) }
|
index = 1
|
||||||
|
GameData::Move.each do |m|
|
||||||
|
commands.push([index, m.real_name, m.id])
|
||||||
|
index += 1
|
||||||
|
end
|
||||||
return pbChooseList(commands, default, nil, -1)
|
return pbChooseList(commands, default, nil, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||||
cmdwin = pbListWindow([], 200)
|
cmdwin = pbListWindow([], 200)
|
||||||
commands = []
|
commands = []
|
||||||
|
index = 1
|
||||||
# Get all legal moves
|
# Get all legal moves
|
||||||
legalMoves = pbGetLegalMoves(species)
|
legalMoves = pbGetLegalMoves(species)
|
||||||
legalMoves.each do |move|
|
legalMoves.each do |move|
|
||||||
move_data = GameData::Move.get(move)
|
move_data = GameData::Move.get(move)
|
||||||
commands.push([move_data.id_number, move_data.name, move_data.id])
|
commands.push([index, move_data.name, move_data.id])
|
||||||
|
index += 1
|
||||||
end
|
end
|
||||||
commands.sort! { |a, b| a[1] <=> b[1] }
|
commands.sort! { |a, b| a[1] <=> b[1] }
|
||||||
moveDefault = 0
|
moveDefault = 0
|
||||||
@@ -159,7 +171,8 @@ def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
|||||||
# Get all moves
|
# Get all moves
|
||||||
commands2 = []
|
commands2 = []
|
||||||
GameData::Move.each do |move_data|
|
GameData::Move.each do |move_data|
|
||||||
commands2.push([move_data.id_number, move_data.name, move_data.id])
|
commands2.push([index, move_data.name, move_data.id])
|
||||||
|
index += 1
|
||||||
end
|
end
|
||||||
commands2.sort! { |a, b| a[1] <=> b[1] }
|
commands2.sort! { |a, b| a[1] <=> b[1] }
|
||||||
if defaultMoveID
|
if defaultMoveID
|
||||||
@@ -197,7 +210,11 @@ end
|
|||||||
# between numerical and alphabetical.
|
# between numerical and alphabetical.
|
||||||
def pbChooseItemList(default = nil)
|
def pbChooseItemList(default = nil)
|
||||||
commands = []
|
commands = []
|
||||||
GameData::Item.each { |i| commands.push([i.id_number, i.name, i.id]) }
|
index = 1
|
||||||
|
GameData::Item.each do |i|
|
||||||
|
commands.push([index, i.name, i.id])
|
||||||
|
index += 1
|
||||||
|
end
|
||||||
return pbChooseList(commands, default, nil, -1)
|
return pbChooseList(commands, default, nil, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -207,7 +224,11 @@ end
|
|||||||
# sorting between numerical and alphabetical.
|
# sorting between numerical and alphabetical.
|
||||||
def pbChooseAbilityList(default = nil)
|
def pbChooseAbilityList(default = nil)
|
||||||
commands = []
|
commands = []
|
||||||
GameData::Ability.each { |a| commands.push([a.id_number, a.name, a.id]) }
|
index = 1
|
||||||
|
GameData::Ability.each do |a|
|
||||||
|
commands.push([index, a.name, a.id])
|
||||||
|
index += 1
|
||||||
|
end
|
||||||
return pbChooseList(commands, default, nil, -1)
|
return pbChooseList(commands, default, nil, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1165,7 +1165,7 @@ class EvolutionsProperty
|
|||||||
def initialize
|
def initialize
|
||||||
@methods = []
|
@methods = []
|
||||||
@evo_ids = []
|
@evo_ids = []
|
||||||
GameData::Evolution.each do |e|
|
GameData::Evolution.each_alphabetically do |e|
|
||||||
@methods.push(e.real_name)
|
@methods.push(e.real_name)
|
||||||
@evo_ids.push(e.id)
|
@evo_ids.push(e.id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -337,9 +337,10 @@ class SpeciesLister
|
|||||||
@commands.clear
|
@commands.clear
|
||||||
@ids.clear
|
@ids.clear
|
||||||
cmds = []
|
cmds = []
|
||||||
GameData::Species.each do |species|
|
idx = 1
|
||||||
next if species.form != 0
|
GameData::Species.each_species do |species|
|
||||||
cmds.push([species.id_number, species.id, species.real_name])
|
cmds.push([idx, species.id, species.real_name])
|
||||||
|
idx += 1
|
||||||
end
|
end
|
||||||
cmds.sort! { |a, b| a[2].downcase <=> b[2].downcase }
|
cmds.sort! { |a, b| a[2].downcase <=> b[2].downcase }
|
||||||
if @includeNew
|
if @includeNew
|
||||||
@@ -395,8 +396,10 @@ class ItemLister
|
|||||||
@commands.clear
|
@commands.clear
|
||||||
@ids.clear
|
@ids.clear
|
||||||
cmds = []
|
cmds = []
|
||||||
|
idx = 1
|
||||||
GameData::Item.each do |item|
|
GameData::Item.each do |item|
|
||||||
cmds.push([item.id_number, item.id, item.real_name])
|
cmds.push([idx, item.id, item.real_name])
|
||||||
|
idx += 1
|
||||||
end
|
end
|
||||||
cmds.sort! { |a, b| a[2].downcase <=> b[2].downcase }
|
cmds.sort! { |a, b| a[2].downcase <=> b[2].downcase }
|
||||||
if @includeNew
|
if @includeNew
|
||||||
@@ -454,8 +457,10 @@ class TrainerTypeLister
|
|||||||
@commands.clear
|
@commands.clear
|
||||||
@ids.clear
|
@ids.clear
|
||||||
cmds = []
|
cmds = []
|
||||||
|
idx = 1
|
||||||
GameData::TrainerType.each do |tr_type|
|
GameData::TrainerType.each do |tr_type|
|
||||||
cmds.push([tr_type.id_number, tr_type.id, tr_type.real_name])
|
cmds.push([idx, tr_type.id, tr_type.real_name])
|
||||||
|
idx += 1
|
||||||
end
|
end
|
||||||
cmds.sort! { |a, b| a[2] == b[2] ? a[0] <=> b[0] : a[2].downcase <=> b[2].downcase }
|
cmds.sort! { |a, b| a[2] == b[2] ? a[0] <=> b[0] : a[2].downcase <=> b[2].downcase }
|
||||||
if @includeNew
|
if @includeNew
|
||||||
@@ -532,8 +537,10 @@ class TrainerBattleLister
|
|||||||
@commands.clear
|
@commands.clear
|
||||||
@ids.clear
|
@ids.clear
|
||||||
cmds = []
|
cmds = []
|
||||||
|
idx = 1
|
||||||
GameData::Trainer.each do |trainer|
|
GameData::Trainer.each do |trainer|
|
||||||
cmds.push([trainer.id_number, trainer.trainer_type, trainer.real_name, trainer.version])
|
cmds.push([idx, trainer.trainer_type, trainer.real_name, trainer.version])
|
||||||
|
idx += 1
|
||||||
end
|
end
|
||||||
cmds.sort! { |a, b|
|
cmds.sort! { |a, b|
|
||||||
if a[1] == b[1]
|
if a[1] == b[1]
|
||||||
|
|||||||
@@ -122,8 +122,8 @@ module Compiler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
lineno += 1
|
lineno += 1
|
||||||
Graphics.update if lineno%200==0
|
Graphics.update if lineno%1000==0
|
||||||
pbSetWindowText(_INTL("Processing {1} line {2}",FileLineData.file,lineno)) if lineno%50==0
|
pbSetWindowText(_INTL("Processing {1} line {2}",FileLineData.file,lineno)) if lineno%200==0
|
||||||
}
|
}
|
||||||
yield lastsection,sectionname if havesection
|
yield lastsection,sectionname if havesection
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -187,15 +187,15 @@ module Compiler
|
|||||||
GameData::Type.each do |type|
|
GameData::Type.each do |type|
|
||||||
type.weaknesses.each do |other_type|
|
type.weaknesses.each do |other_type|
|
||||||
next if GameData::Type.exists?(other_type)
|
next if GameData::Type.exists?(other_type)
|
||||||
raise _INTL("'{1}' is not a defined type ({2}, section {3}, Weaknesses).", other_type.to_s, path, type.id_number)
|
raise _INTL("'{1}' is not a defined type ({2}, section {3}, Weaknesses).", other_type.to_s, path, type.id)
|
||||||
end
|
end
|
||||||
type.resistances.each do |other_type|
|
type.resistances.each do |other_type|
|
||||||
next if GameData::Type.exists?(other_type)
|
next if GameData::Type.exists?(other_type)
|
||||||
raise _INTL("'{1}' is not a defined type ({2}, section {3}, Resistances).", other_type.to_s, path, type.id_number)
|
raise _INTL("'{1}' is not a defined type ({2}, section {3}, Resistances).", other_type.to_s, path, type.id)
|
||||||
end
|
end
|
||||||
type.immunities.each do |other_type|
|
type.immunities.each do |other_type|
|
||||||
next if GameData::Type.exists?(other_type)
|
next if GameData::Type.exists?(other_type)
|
||||||
raise _INTL("'{1}' is not a defined type ({2}, section {3}, Immunities).", other_type.to_s, path, type.id_number)
|
raise _INTL("'{1}' is not a defined type ({2}, section {3}, Immunities).", other_type.to_s, path, type.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Save all data
|
# Save all data
|
||||||
@@ -387,30 +387,26 @@ 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
|
||||||
pbEachFileSection(f) { |contents, species_number|
|
pbEachFileSection3(f) { |contents, species_id|
|
||||||
FileLineData.setSection(species_number, "header", nil) # For error reporting
|
FileLineData.setSection(species_id, "header", nil) # For error reporting
|
||||||
# Raise an error if a species number is invalid or used twice
|
contents["InternalName"] = species_id if !species_id[/^\d+/]
|
||||||
if species_number == 0
|
# Ensure all required properties have been defined, and raise an error
|
||||||
raise _INTL("A Pokémon species can't be numbered 0 ({1}).", path)
|
# if not
|
||||||
elsif GameData::Species::DATA[species_number]
|
|
||||||
raise _INTL("Species ID number '{1}' is used twice.\r\n{2}", species_number, FileLineData.linereport)
|
|
||||||
end
|
|
||||||
# Go through schema hash of compilable data and compile this section
|
|
||||||
for key in schema.keys
|
for key in schema.keys
|
||||||
# Skip empty properties, or raise an error if a required property is
|
next if !nil_or_empty?(contents[key])
|
||||||
# empty
|
|
||||||
if nil_or_empty?(contents[key])
|
|
||||||
if ["Name", "InternalName"].include?(key)
|
if ["Name", "InternalName"].include?(key)
|
||||||
raise _INTL("The entry {1} is required in {2} section {3}.", key, path, species_number)
|
raise _INTL("The entry {1} is required in {2} section {3}.", key, path, species_id)
|
||||||
end
|
end
|
||||||
contents[key] = nil
|
contents[key] = nil
|
||||||
next
|
|
||||||
end
|
end
|
||||||
# Raise an error if a species internal name is used twice
|
# Raise an error if a species ID is used twice
|
||||||
FileLineData.setSection(species_number, key, contents[key]) # For error reporting
|
|
||||||
if GameData::Species::DATA[contents["InternalName"].to_sym]
|
if GameData::Species::DATA[contents["InternalName"].to_sym]
|
||||||
raise _INTL("Species ID '{1}' is used twice.\r\n{2}", contents["InternalName"], FileLineData.linereport)
|
raise _INTL("Species ID '{1}' is used twice.\r\n{2}", contents["InternalName"], FileLineData.linereport)
|
||||||
end
|
end
|
||||||
|
# Go through schema hash of compilable data and compile this section
|
||||||
|
for key in schema.keys
|
||||||
|
next if nil_or_empty?(contents[key])
|
||||||
|
FileLineData.setSection(species_id, key, contents[key]) # For error reporting
|
||||||
# Compile value for key
|
# Compile value for key
|
||||||
value = pbGetCsvRecord(contents[key], key, schema[key])
|
value = pbGetCsvRecord(contents[key], key, schema[key])
|
||||||
value = nil if value.is_a?(Array) && value.length == 0
|
value = nil if value.is_a?(Array) && value.length == 0
|
||||||
@@ -427,7 +423,7 @@ module Compiler
|
|||||||
# Convert height/weight to 1 decimal place and multiply by 10
|
# Convert height/weight to 1 decimal place and multiply by 10
|
||||||
value = (value * 10).round
|
value = (value * 10).round
|
||||||
if value <= 0
|
if value <= 0
|
||||||
raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, {3})", key, species_number, path)
|
raise _INTL("Value for '{1}' can't be less than or close to 0 (section {2}, {3})", key, species_id, path)
|
||||||
end
|
end
|
||||||
contents[key] = value
|
contents[key] = value
|
||||||
when "Moves"
|
when "Moves"
|
||||||
@@ -450,10 +446,8 @@ module Compiler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Construct species hash
|
# Construct species hash
|
||||||
species_symbol = contents["InternalName"].to_sym
|
|
||||||
species_hash = {
|
species_hash = {
|
||||||
:id => species_symbol,
|
:id => contents["InternalName"].to_sym,
|
||||||
:id_number => species_number,
|
|
||||||
:name => contents["Name"],
|
:name => contents["Name"],
|
||||||
:form_name => contents["FormName"],
|
:form_name => contents["FormName"],
|
||||||
:category => contents["Kind"],
|
:category => contents["Kind"],
|
||||||
@@ -495,26 +489,24 @@ module Compiler
|
|||||||
}
|
}
|
||||||
# Add species' data to records
|
# Add species' data to records
|
||||||
GameData::Species.register(species_hash)
|
GameData::Species.register(species_hash)
|
||||||
species_names[species_number] = species_hash[:name]
|
species_names.push(species_hash[:name])
|
||||||
species_form_names[species_number] = species_hash[:form_name]
|
species_form_names.push(species_hash[:form_name])
|
||||||
species_categories[species_number] = species_hash[:category]
|
species_categories.push(species_hash[:category])
|
||||||
species_pokedex_entries[species_number] = species_hash[:pokedex_entry]
|
species_pokedex_entries.push(species_hash[:pokedex_entry])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Enumerate all evolution species and parameters (this couldn't be done earlier)
|
# Enumerate all evolution species and parameters (this couldn't be done earlier)
|
||||||
GameData::Species.each do |species|
|
GameData::Species.each do |species|
|
||||||
FileLineData.setSection(species.id_number, "Evolutions", nil) # For error reporting
|
FileLineData.setSection(species.id.to_s, "Evolutions", nil) # For error reporting
|
||||||
Graphics.update if species.id_number % 200 == 0
|
|
||||||
pbSetWindowText(_INTL("Processing {1} evolution line {2}", FileLineData.file, species.id_number)) if species.id_number % 50 == 0
|
|
||||||
species.evolutions.each do |evo|
|
species.evolutions.each do |evo|
|
||||||
evo[0] = csvEnumField!(evo[0], :Species, "Evolutions", species.id_number)
|
evo[0] = csvEnumField!(evo[0], :Species, "Evolutions", species.id)
|
||||||
param_type = GameData::Evolution.get(evo[1]).parameter
|
param_type = GameData::Evolution.get(evo[1]).parameter
|
||||||
if param_type.nil?
|
if param_type.nil?
|
||||||
evo[2] = nil
|
evo[2] = nil
|
||||||
elsif param_type == Integer
|
elsif param_type == Integer
|
||||||
evo[2] = csvPosInt!(evo[2])
|
evo[2] = csvPosInt!(evo[2])
|
||||||
else
|
else
|
||||||
evo[2] = csvEnumField!(evo[2], param_type, "Evolutions", species.id_number)
|
evo[2] = csvEnumField!(evo[2], param_type, "Evolutions", species.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -530,10 +522,10 @@ module Compiler
|
|||||||
end
|
end
|
||||||
# Save all data
|
# Save all data
|
||||||
GameData::Species.save
|
GameData::Species.save
|
||||||
MessageTypes.setMessages(MessageTypes::Species, species_names)
|
MessageTypes.setMessagesAsHash(MessageTypes::Species, species_names)
|
||||||
MessageTypes.setMessages(MessageTypes::FormNames, species_form_names)
|
MessageTypes.setMessagesAsHash(MessageTypes::FormNames, species_form_names)
|
||||||
MessageTypes.setMessages(MessageTypes::Kinds, species_categories)
|
MessageTypes.setMessagesAsHash(MessageTypes::Kinds, species_categories)
|
||||||
MessageTypes.setMessages(MessageTypes::Entries, species_pokedex_entries)
|
MessageTypes.setMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
|
||||||
Graphics.update
|
Graphics.update
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -546,11 +538,6 @@ module Compiler
|
|||||||
species_categories = []
|
species_categories = []
|
||||||
species_pokedex_entries = []
|
species_pokedex_entries = []
|
||||||
used_forms = {}
|
used_forms = {}
|
||||||
# Get maximum species ID number
|
|
||||||
form_number = 0
|
|
||||||
GameData::Species.each do |species|
|
|
||||||
form_number = species.id_number if form_number < species.id_number
|
|
||||||
end
|
|
||||||
# Read from PBS file
|
# Read from PBS file
|
||||||
File.open(path, "rb") { |f|
|
File.open(path, "rb") { |f|
|
||||||
FileLineData.file = path # For error reporting
|
FileLineData.file = path # For error reporting
|
||||||
@@ -578,7 +565,6 @@ module Compiler
|
|||||||
end
|
end
|
||||||
used_forms[species_symbol] = [] if !used_forms[species_symbol]
|
used_forms[species_symbol] = [] if !used_forms[species_symbol]
|
||||||
used_forms[species_symbol].push(form)
|
used_forms[species_symbol].push(form)
|
||||||
form_number += 1
|
|
||||||
base_data = GameData::Species.get(species_symbol)
|
base_data = GameData::Species.get(species_symbol)
|
||||||
# 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
|
||||||
@@ -649,7 +635,6 @@ module Compiler
|
|||||||
end
|
end
|
||||||
species_hash = {
|
species_hash = {
|
||||||
:id => form_symbol,
|
:id => form_symbol,
|
||||||
:id_number => form_number,
|
|
||||||
:species => species_symbol,
|
:species => species_symbol,
|
||||||
:form => form,
|
:form => form,
|
||||||
:name => base_data.real_name,
|
:name => base_data.real_name,
|
||||||
@@ -681,7 +666,7 @@ module Compiler
|
|||||||
:height => contents["Height"] || base_data.height,
|
:height => contents["Height"] || base_data.height,
|
||||||
:weight => contents["Weight"] || base_data.weight,
|
:weight => contents["Weight"] || base_data.weight,
|
||||||
:color => contents["Color"] || base_data.color,
|
:color => contents["Color"] || base_data.color,
|
||||||
:shape => (contents["Shape"]) ? GameData::BodyShape.get(contents["Shape"]).id : base_data.shape,
|
:shape => contents["Shape"] || base_data.shape,
|
||||||
:habitat => contents["Habitat"] || base_data.habitat,
|
:habitat => contents["Habitat"] || base_data.habitat,
|
||||||
:generation => contents["Generation"] || base_data.generation,
|
:generation => contents["Generation"] || base_data.generation,
|
||||||
:mega_stone => contents["MegaStone"],
|
:mega_stone => contents["MegaStone"],
|
||||||
@@ -706,10 +691,10 @@ module Compiler
|
|||||||
end
|
end
|
||||||
# Add form's data to records
|
# Add form's data to records
|
||||||
GameData::Species.register(species_hash)
|
GameData::Species.register(species_hash)
|
||||||
species_names[form_number] = species_hash[:name]
|
species_names.push(species_hash[:name])
|
||||||
species_form_names[form_number] = species_hash[:form_name]
|
species_form_names.push(species_hash[:form_name])
|
||||||
species_categories[form_number] = species_hash[:category]
|
species_categories.push(species_hash[:category])
|
||||||
species_pokedex_entries[form_number] = species_hash[:pokedex_entry]
|
species_pokedex_entries.push(species_hash[:pokedex_entry])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Add prevolution "evolution" entry for all evolved forms that define their
|
# Add prevolution "evolution" entry for all evolved forms that define their
|
||||||
@@ -727,10 +712,10 @@ module Compiler
|
|||||||
end
|
end
|
||||||
# Save all data
|
# Save all data
|
||||||
GameData::Species.save
|
GameData::Species.save
|
||||||
MessageTypes.addMessages(MessageTypes::Species, species_names)
|
MessageTypes.addMessagesAsHash(MessageTypes::Species, species_names)
|
||||||
MessageTypes.addMessages(MessageTypes::FormNames, species_form_names)
|
MessageTypes.addMessagesAsHash(MessageTypes::FormNames, species_form_names)
|
||||||
MessageTypes.addMessages(MessageTypes::Kinds, species_categories)
|
MessageTypes.addMessagesAsHash(MessageTypes::Kinds, species_categories)
|
||||||
MessageTypes.addMessages(MessageTypes::Entries, species_pokedex_entries)
|
MessageTypes.addMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
|
||||||
Graphics.update
|
Graphics.update
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -975,7 +960,7 @@ module Compiler
|
|||||||
end
|
end
|
||||||
need_step_chances = false
|
need_step_chances = false
|
||||||
values = pbGetCsvRecord(line, line_no, [0, "vvv"])
|
values = pbGetCsvRecord(line, line_no, [0, "vvv"])
|
||||||
GameData::EncounterType.each do |enc_type|
|
GameData::EncounterType.each_alphabetically do |enc_type|
|
||||||
case enc_type.id
|
case enc_type.id
|
||||||
when :land, :contest then step_chances[enc_type.id] = values[0]
|
when :land, :contest then step_chances[enc_type.id] = values[0]
|
||||||
when :cave then step_chances[enc_type.id] = values[1]
|
when :cave then step_chances[enc_type.id] = values[1]
|
||||||
|
|||||||
@@ -261,15 +261,15 @@ module Compiler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
def write_pokemon
|
def write_pokemon
|
||||||
File.open("PBS/pokemon.txt", "wb") { |f|
|
File.open("PBS/pokemon.txt", "wb") { |f|
|
||||||
|
idx = 0
|
||||||
add_PBS_header_to_file(f)
|
add_PBS_header_to_file(f)
|
||||||
GameData::Species.each do |species|
|
GameData::Species.each_species do |species|
|
||||||
next if species.form != 0
|
idx += 1
|
||||||
pbSetWindowText(_INTL("Writing species {1}...", species.id_number))
|
pbSetWindowText(_INTL("Writing species {1}...", idx))
|
||||||
Graphics.update if species.id_number % 50 == 0
|
Graphics.update if idx % 100 == 0
|
||||||
f.write("\#-------------------------------\r\n")
|
f.write("\#-------------------------------\r\n")
|
||||||
f.write(sprintf("[%d]\r\n", species.id_number))
|
f.write(sprintf("[%s]\r\n", species.id))
|
||||||
f.write(sprintf("Name = %s\r\n", species.real_name))
|
f.write(sprintf("Name = %s\r\n", species.real_name))
|
||||||
f.write(sprintf("InternalName = %s\r\n", species.species))
|
|
||||||
f.write(sprintf("Type1 = %s\r\n", species.type1))
|
f.write(sprintf("Type1 = %s\r\n", species.type1))
|
||||||
f.write(sprintf("Type2 = %s\r\n", species.type2)) if species.type2 != species.type1
|
f.write(sprintf("Type2 = %s\r\n", species.type2)) if species.type2 != species.type1
|
||||||
stats_array = []
|
stats_array = []
|
||||||
@@ -356,12 +356,14 @@ module Compiler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
def write_pokemon_forms
|
def write_pokemon_forms
|
||||||
File.open("PBS/pokemonforms.txt", "wb") { |f|
|
File.open("PBS/pokemonforms.txt", "wb") { |f|
|
||||||
|
idx = 0
|
||||||
add_PBS_header_to_file(f)
|
add_PBS_header_to_file(f)
|
||||||
GameData::Species.each do |species|
|
GameData::Species.each do |species|
|
||||||
next if species.form == 0
|
next if species.form == 0
|
||||||
base_species = GameData::Species.get(species.species)
|
base_species = GameData::Species.get(species.species)
|
||||||
pbSetWindowText(_INTL("Writing species {1}...", species.id_number))
|
idx += 1
|
||||||
Graphics.update if species.id_number % 50 == 0
|
pbSetWindowText(_INTL("Writing form {1}...", idx))
|
||||||
|
Graphics.update if idx % 100 == 0
|
||||||
f.write("\#-------------------------------\r\n")
|
f.write("\#-------------------------------\r\n")
|
||||||
f.write(sprintf("[%s,%d]\r\n", species.species, species.form))
|
f.write(sprintf("[%s,%d]\r\n", species.species, species.form))
|
||||||
f.write(sprintf("FormName = %s\r\n", species.real_form_name)) if species.real_form_name && !species.real_form_name.empty?
|
f.write(sprintf("FormName = %s\r\n", species.real_form_name)) if species.real_form_name && !species.real_form_name.empty?
|
||||||
@@ -587,10 +589,12 @@ module Compiler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
def write_trainers
|
def write_trainers
|
||||||
File.open("PBS/trainers.txt", "wb") { |f|
|
File.open("PBS/trainers.txt", "wb") { |f|
|
||||||
|
idx = 0
|
||||||
add_PBS_header_to_file(f)
|
add_PBS_header_to_file(f)
|
||||||
GameData::Trainer.each do |trainer|
|
GameData::Trainer.each do |trainer|
|
||||||
pbSetWindowText(_INTL("Writing trainer {1}...", trainer.id_number))
|
idx += 1
|
||||||
Graphics.update if trainer.id_number % 50 == 0
|
pbSetWindowText(_INTL("Writing trainer {1}...", idx))
|
||||||
|
Graphics.update if idx % 50 == 0
|
||||||
f.write("\#-------------------------------\r\n")
|
f.write("\#-------------------------------\r\n")
|
||||||
if trainer.version > 0
|
if trainer.version > 0
|
||||||
f.write(sprintf("[%s,%s,%d]\r\n", trainer.trainer_type, trainer.real_name, trainer.version))
|
f.write(sprintf("[%s,%s,%d]\r\n", trainer.trainer_type, trainer.real_name, trainer.version))
|
||||||
|
|||||||
2427
PBS/pokemon.txt
2427
PBS/pokemon.txt
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user