mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-03-10 02:12:01 +00:00
Removed all uses of ID numbers for species, some other code changes for abolishing ID numbers
This commit is contained in:
@@ -184,7 +184,7 @@ def pbEncounterMapVersionEditor(enc_data)
|
||||
elsif ret == commands.length - 1 # Add new encounter type
|
||||
new_type_commands = []
|
||||
new_types = []
|
||||
GameData::EncounterType.each do |enc|
|
||||
GameData::EncounterType.each_alphabetically do |enc|
|
||||
next if enc_data.types[enc.id]
|
||||
new_type_commands.push(enc.real_name)
|
||||
new_types.push(enc.id)
|
||||
@@ -212,7 +212,7 @@ def pbEncounterMapVersionEditor(enc_data)
|
||||
when 1 # Copy
|
||||
new_type_commands = []
|
||||
new_types = []
|
||||
GameData::EncounterType.each do |enc|
|
||||
GameData::EncounterType.each_alphabetically do |enc|
|
||||
next if enc_data.types[enc.id]
|
||||
new_type_commands.push(enc.real_name)
|
||||
new_types.push(enc.id)
|
||||
@@ -285,7 +285,7 @@ def pbEncounterTypeEditor(enc_data, enc_type)
|
||||
new_type_commands = []
|
||||
new_types = []
|
||||
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
|
||||
new_type_commands.push(enc.real_name)
|
||||
new_types.push(enc.id)
|
||||
@@ -954,7 +954,7 @@ end
|
||||
#===============================================================================
|
||||
def pbPokemonEditor
|
||||
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("FormName"), StringProperty, _INTL("Name of this form of the Pokémon.")],
|
||||
[_INTL("Kind"), StringProperty, _INTL("Kind of Pokémon species.")],
|
||||
@@ -1004,9 +1004,7 @@ def pbPokemonEditor
|
||||
if button == Input::ACTION
|
||||
if species.is_a?(Symbol)
|
||||
if pbConfirmMessageSerious("Delete this species?")
|
||||
id_number = GameData::Species.get(species).id_number
|
||||
GameData::Species::DATA.delete(species)
|
||||
GameData::Species::DATA.delete(id_number)
|
||||
GameData::Species.save
|
||||
Compiler.write_pokemon
|
||||
pbMessage(_INTL("The species was deleted."))
|
||||
@@ -1079,7 +1077,6 @@ def pbPokemonEditor
|
||||
# Construct species hash
|
||||
species_hash = {
|
||||
:id => spec.id,
|
||||
:id_number => spec.id_number,
|
||||
:name => data[1],
|
||||
:form_name => data[2],
|
||||
:category => data[3],
|
||||
@@ -1292,14 +1289,14 @@ def pbRegionalDexEditorMain
|
||||
refresh_list = true
|
||||
when 1 # Fill with National 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)
|
||||
refresh_list = true
|
||||
when 2 # Fill with National Dex (grouped families)
|
||||
new_dex = []
|
||||
seen = []
|
||||
GameData::Species.each do |s|
|
||||
next if s.form != 0 || seen.include?(s.species)
|
||||
GameData::Species.each_species do |s|
|
||||
next if seen.include?(s.species)
|
||||
family = s.get_related_species
|
||||
new_dex.concat(family)
|
||||
seen.concat(family)
|
||||
@@ -1350,7 +1347,6 @@ def pbAppendEvoToFamilyArray(species, array, seenarray)
|
||||
seenarray[species] = true
|
||||
evos = GameData::Species.get(species).get_evolutions
|
||||
if evos.length > 0
|
||||
evos.sort! { |a, b| GameData::Species.get(a[0]).id_number <=> GameData::Species.get(b[0]).id_number }
|
||||
subarray = []
|
||||
for i in evos
|
||||
pbAppendEvoToFamilyArray(i[0], subarray, seenarray)
|
||||
@@ -1362,8 +1358,7 @@ end
|
||||
def pbGetEvoFamilies
|
||||
seen = []
|
||||
ret = []
|
||||
GameData::Species.each do |sp|
|
||||
next if sp.form > 0
|
||||
GameData::Species.each_species do |sp|
|
||||
species = sp.get_baby_species
|
||||
next if seen[species]
|
||||
subret = []
|
||||
|
||||
@@ -12,8 +12,12 @@ def findBottom(bitmap)
|
||||
end
|
||||
|
||||
def pbAutoPositionAll
|
||||
t = Time.now.to_i
|
||||
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)
|
||||
bitmap2 = GameData::Species.sprite_bitmap(sp.species, sp.form)
|
||||
if bitmap1 && bitmap1.bitmap # Player's y
|
||||
|
||||
@@ -117,15 +117,21 @@ end
|
||||
# the list sorting between numerical and alphabetical.
|
||||
def pbChooseSpeciesList(default = nil)
|
||||
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)
|
||||
end
|
||||
|
||||
def pbChooseSpeciesFormList(default = nil)
|
||||
commands = []
|
||||
index = 1
|
||||
GameData::Species.each do |s|
|
||||
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
|
||||
return pbChooseList(commands, default, nil, -1)
|
||||
end
|
||||
@@ -136,18 +142,24 @@ end
|
||||
# between numerical and alphabetical.
|
||||
def pbChooseMoveList(default = nil)
|
||||
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)
|
||||
end
|
||||
|
||||
def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||
cmdwin = pbListWindow([], 200)
|
||||
commands = []
|
||||
index = 1
|
||||
# Get all legal moves
|
||||
legalMoves = pbGetLegalMoves(species)
|
||||
legalMoves.each do |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
|
||||
commands.sort! { |a, b| a[1] <=> b[1] }
|
||||
moveDefault = 0
|
||||
@@ -159,7 +171,8 @@ def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||
# Get all moves
|
||||
commands2 = []
|
||||
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
|
||||
commands2.sort! { |a, b| a[1] <=> b[1] }
|
||||
if defaultMoveID
|
||||
@@ -197,7 +210,11 @@ end
|
||||
# between numerical and alphabetical.
|
||||
def pbChooseItemList(default = nil)
|
||||
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)
|
||||
end
|
||||
|
||||
@@ -207,7 +224,11 @@ end
|
||||
# sorting between numerical and alphabetical.
|
||||
def pbChooseAbilityList(default = nil)
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -1165,7 +1165,7 @@ class EvolutionsProperty
|
||||
def initialize
|
||||
@methods = []
|
||||
@evo_ids = []
|
||||
GameData::Evolution.each do |e|
|
||||
GameData::Evolution.each_alphabetically do |e|
|
||||
@methods.push(e.real_name)
|
||||
@evo_ids.push(e.id)
|
||||
end
|
||||
|
||||
@@ -337,9 +337,10 @@ class SpeciesLister
|
||||
@commands.clear
|
||||
@ids.clear
|
||||
cmds = []
|
||||
GameData::Species.each do |species|
|
||||
next if species.form != 0
|
||||
cmds.push([species.id_number, species.id, species.real_name])
|
||||
idx = 1
|
||||
GameData::Species.each_species do |species|
|
||||
cmds.push([idx, species.id, species.real_name])
|
||||
idx += 1
|
||||
end
|
||||
cmds.sort! { |a, b| a[2].downcase <=> b[2].downcase }
|
||||
if @includeNew
|
||||
@@ -395,8 +396,10 @@ class ItemLister
|
||||
@commands.clear
|
||||
@ids.clear
|
||||
cmds = []
|
||||
idx = 1
|
||||
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
|
||||
cmds.sort! { |a, b| a[2].downcase <=> b[2].downcase }
|
||||
if @includeNew
|
||||
@@ -454,8 +457,10 @@ class TrainerTypeLister
|
||||
@commands.clear
|
||||
@ids.clear
|
||||
cmds = []
|
||||
idx = 1
|
||||
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
|
||||
cmds.sort! { |a, b| a[2] == b[2] ? a[0] <=> b[0] : a[2].downcase <=> b[2].downcase }
|
||||
if @includeNew
|
||||
@@ -532,8 +537,10 @@ class TrainerBattleLister
|
||||
@commands.clear
|
||||
@ids.clear
|
||||
cmds = []
|
||||
idx = 1
|
||||
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
|
||||
cmds.sort! { |a, b|
|
||||
if a[1] == b[1]
|
||||
|
||||
Reference in New Issue
Block a user