Commented out support for ID numbers in Pokémon filenames, added class GameData::EggGroup

This commit is contained in:
Maruno17
2021-02-06 21:30:19 +00:00
parent e9ed260277
commit 033434807d
30 changed files with 180 additions and 70 deletions

View File

@@ -92,7 +92,7 @@ module GameData
"WildItemCommon" => [0, "e", :Item],
"WildItemUncommon" => [0, "e", :Item],
"WildItemRare" => [0, "e", :Item],
"Compatibility" => [0, "*e", :PBEggGroups],
"Compatibility" => [0, "*e", :EggGroup],
"StepsToHatch" => [0, "v"],
"Height" => [0, "f"],
"Weight" => [0, "f"],
@@ -153,7 +153,7 @@ module GameData
@wild_item_common = hash[:wild_item_common]
@wild_item_uncommon = hash[:wild_item_uncommon]
@wild_item_rare = hash[:wild_item_rare]
@egg_groups = hash[:egg_groups] || [PBEggGroups::Undiscovered]
@egg_groups = hash[:egg_groups] || [:Undiscovered]
@hatch_steps = hash[:hatch_steps] || 1
@incense = hash[:incense]
@evolutions = hash[:evolutions] || []

View File

@@ -2,8 +2,8 @@ module GameData
class Species
def self.check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, subfolder = "")
try_subfolder = sprintf("%s/", subfolder)
species_data = self.get_species_form(species, form)
species_id = sprintf("%03d", (species_data) ? self.get(species_data.species).id_number : 0)
# species_data = self.get_species_form(species, form)
# species_id = sprintf("%03d", (species_data) ? self.get(species_data.species).id_number : 0)
try_species = species
try_form = (form > 0) ? sprintf("_%d", form) : ""
try_gender = (gender == 1) ? "_female" : ""
@@ -28,13 +28,14 @@ module GameData
end
end
# Look for a graphic matching this combination's parameters
for j in 0...2 # Try using the species' ID symbol and then its ID number
next if !try_species || (try_species == "000" && j == 1)
try_species_text = (j == 0) ? try_species : species_id
# for j in 0...2 # Try using the species' ID symbol and then its ID number
# next if !try_species || (try_species == "000" && j == 1)
# try_species_text = (j == 0) ? try_species : species_id
try_species_text = try_species
ret = pbResolveBitmap(sprintf("%s%s%s%s%s%s", path, try_subfolder,
try_species_text, try_form, try_gender, try_shadow))
return ret if ret
end
# end
end
return nil
end
@@ -42,16 +43,17 @@ module GameData
def self.check_egg_graphic_file(path, species, form, suffix = "")
species_data = self.get_species_form(species, form)
return nil if species_data.nil?
species_id = self.get(species_data.species).id_number
# species_id = self.get(species_data.species).id_number
if form > 0
ret = pbResolveBitmap(sprintf("%s%s_%d%s", path, species_data.species, form, suffix))
return ret if ret
ret = pbResolveBitmap(sprintf("%s%03d_%d%s", path, species_id, form, suffix))
return ret if ret
# ret = pbResolveBitmap(sprintf("%s%03d_%d%s", path, species_id, form, suffix))
# return ret if ret
end
ret = pbResolveBitmap(sprintf("%s%s%s", path, species_data.species, suffix))
return ret if ret
return pbResolveBitmap(sprintf("%s%03d%s", path, species_id, suffix))
return ret
# return ret if ret
# return pbResolveBitmap(sprintf("%s%03d%s", path, species_id, suffix))
end
def self.front_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
@@ -148,16 +150,17 @@ module GameData
def self.footprint_filename(species, form = 0)
species_data = self.get_species_form(species, form)
return nil if species_data.nil?
species_id = self.get(species_data.species).id_number
# species_id = self.get(species_data.species).id_number
if form > 0
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s_%d", species_data.species, form))
return ret if ret
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d_%d", species_id, form))
return ret if ret
# ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d_%d", species_id, form))
# return ret if ret
end
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s", species_data.species))
return ret if ret
return pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d", species_id))
return ret
# return ret if ret
# return pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d", species_id))
end
#===========================================================================
@@ -165,18 +168,18 @@ module GameData
def self.shadow_filename(species, form = 0)
species_data = self.get_species_form(species, form)
return nil if species_data.nil?
species_id = self.get(species_data.species).id_number
# species_id = self.get(species_data.species).id_number
# Look for species-specific shadow graphic
if form > 0
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, form))
return ret if ret
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d_%d", species_id, form))
return ret if ret
# ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d_%d", species_id, form))
# return ret if ret
end
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
return ret if ret
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d", species_id))
return ret if ret
# ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d", species_id))
# return ret if ret
# Use general shadow graphic
return pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%d", species_data.shadow_size))
end
@@ -196,16 +199,16 @@ module GameData
def self.check_cry_file(species, form)
species_data = self.get_species_form(species, form)
return nil if species_data.nil?
species_id = self.get(species_data.species).id_number
# species_id = self.get(species_data.species).id_number
if form > 0
ret = sprintf("Cries/%s_%d", species_data.species, form)
return ret if pbResolveAudioSE(ret)
ret = sprintf("Cries/%03d_%d", species_id, form)
return ret if pbResolveAudioSE(ret)
# ret = sprintf("Cries/%03d_%d", species_id, form)
# return ret if pbResolveAudioSE(ret)
end
ret = sprintf("Cries/%s", species_data.species)
return ret if pbResolveAudioSE(ret)
ret = sprintf("Cries/%03d", species_id)
# return ret if pbResolveAudioSE(ret)
# ret = sprintf("Cries/%03d", species_id)
return (pbResolveAudioSE(ret)) ? ret : nil
end

View File

@@ -0,0 +1,109 @@
module GameData
class EggGroup
attr_reader :id
attr_reader :real_name
DATA = {}
extend ClassMethods
include InstanceMethods
def register(hash)
self::DATA[hash[:id]] = self.new(hash)
end
# Yields all data in alphabetical order.
def each
keys = self::DATA.keys.sort { |a, b| self::DATA[a].real_name <=> self::DATA[b].real_name }
keys.each { |key| yield self::DATA[key] }
end
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
end
# @return [String] the translated name of this egg group
def name
return _INTL(@real_name)
end
end
end
GameData::EggGroup.register({
:id => :Undiscovered,
:name => _INTL("Undiscovered")
})
GameData::EggGroup.register({
:id => :Monster,
:name => _INTL("Monster")
})
GameData::EggGroup.register({
:id => :Water1,
:name => _INTL("Water 1")
})
GameData::EggGroup.register({
:id => :Bug,
:name => _INTL("Bug")
})
GameData::EggGroup.register({
:id => :Flying,
:name => _INTL("Flying")
})
GameData::EggGroup.register({
:id => :Field,
:name => _INTL("Field")
})
GameData::EggGroup.register({
:id => :Fairy,
:name => _INTL("Fairy")
})
GameData::EggGroup.register({
:id => :Grass,
:name => _INTL("Grass")
})
GameData::EggGroup.register({
:id => :Humanlike,
:name => _INTL("Humanlike")
})
GameData::EggGroup.register({
:id => :Water3,
:name => _INTL("Water 3")
})
GameData::EggGroup.register({
:id => :Mineral,
:name => _INTL("Mineral")
})
GameData::EggGroup.register({
:id => :Amorphous,
:name => _INTL("Amorphous")
})
GameData::EggGroup.register({
:id => :Water2,
:name => _INTL("Water 2")
})
GameData::EggGroup.register({
:id => :Ditto,
:name => _INTL("Ditto")
})
GameData::EggGroup.register({
:id => :Dragon,
:name => _INTL("Dragon")
})

View File

@@ -1,19 +0,0 @@
module PBEggGroups
Undiscovered = 0 # NoEggs, None, NA
Monster = 1
Water1 = 2
Bug = 3
Flying = 4
Field = 5 # Ground
Fairy = 6
Grass = 7 # Plant
Humanlike = 8 # Humanoid, Humanshape, Human
Water3 = 9
Mineral = 10
Amorphous = 11 # Indeterminate
Water2 = 12
Ditto = 13
Dragon = 14
def self.maxValue; 14; end
end