Removed all other uses of and support for ID numbers

This commit is contained in:
Maruno17
2021-06-19 20:01:12 +01:00
parent 49655165e1
commit c55324145d
15 changed files with 92 additions and 194 deletions

View File

@@ -1,7 +1,6 @@
module GameData
class Move
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :function_code
attr_reader :base_damage
@@ -18,12 +17,11 @@ module GameData
DATA = {}
DATA_FILENAME = "moves.dat"
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@function_code = hash[:function_code]
@base_damage = hash[:base_damage]
@@ -40,12 +38,12 @@ module GameData
# @return [String] the translated name of this move
def name
return pbGetMessage(MessageTypes::Moves, @id_number)
return pbGetMessage(MessageTypes::Moves, @real_name)
end
# @return [String] the translated description of this move
def description
return pbGetMessage(MessageTypes::MoveDescriptions, @id_number)
return pbGetMessage(MessageTypes::MoveDescriptions, @real_description)
end
def physical?

View File

@@ -1,7 +1,6 @@
module GameData
class Item
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :real_name_plural
attr_reader :pocket
@@ -15,7 +14,7 @@ module GameData
DATA = {}
DATA_FILENAME = "items.dat"
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def self.icon_filename(item)
@@ -65,7 +64,6 @@ module GameData
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@real_name_plural = hash[:name_plural] || "Unnamed"
@pocket = hash[:pocket] || 1
@@ -79,17 +77,17 @@ module GameData
# @return [String] the translated name of this item
def name
return pbGetMessage(MessageTypes::Items, @id_number)
return pbGetMessageFromHash(MessageTypes::Items, @real_name)
end
# @return [String] the translated plural version of the name of this item
def name_plural
return pbGetMessage(MessageTypes::ItemPlurals, @id_number)
return pbGetMessageFromHash(MessageTypes::ItemPlurals, @real_name_plural)
end
# @return [String] the translated description of this item
def description
return pbGetMessage(MessageTypes::ItemDescriptions, @id_number)
return pbGetMessageFromHash(MessageTypes::ItemDescriptions, @real_description)
end
def is_TM?; return @field_use == 3; end

View File

@@ -53,18 +53,14 @@ module GameData
extend ClassMethodsSymbols
include InstanceMethods
# @param species [Symbol, self, String, Integer]
# @param species [Symbol, self, String]
# @param form [Integer]
# @return [self, nil]
def self.get_species_form(species, form)
return nil if !species || !form
validate species => [Symbol, self, String, Integer]
validate species => [Symbol, self, String]
validate form => Integer
# if other.is_a?(Integer)
# p "Please switch to symbols, thanks."
# end
species = species.species if species.is_a?(self)
species = DATA[species].species if species.is_a?(Integer)
species = species.to_sym if species.is_a?(String)
trial = sprintf("%s_%d", species, form).to_sym
species_form = (DATA[trial].nil?) ? species : trial

View File

@@ -1,31 +1,31 @@
module GameData
class Ribbon
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :real_description
attr_reader :icon_position # Where this ribbon's graphic is within ribbons.png
DATA = {}
DATA_FILENAME = "ribbons.dat"
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@real_description = hash[:description] || "???"
@real_name = hash[:name] || "Unnamed"
@real_description = hash[:description] || "???"
@icon_position = hash[:icon_position] || -1
end
# @return [String] the translated name of this ribbon
def name
return pbGetMessage(MessageTypes::RibbonNames, @id_number)
return pbGetMessageFromHash(MessageTypes::RibbonNames, @real_name)
end
# @return [String] the translated description of this ribbon
def description
return pbGetMessage(MessageTypes::RibbonDescriptions, @id_number)
return pbGetMessageFromHash(MessageTypes::RibbonDescriptions, @real_description)
end
end
end

View File

@@ -1,7 +1,6 @@
module GameData
class TrainerType
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :base_money
attr_reader :battle_BGM
@@ -14,7 +13,7 @@ module GameData
DATA = {}
DATA_FILENAME = "trainer_types.dat"
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
@@ -68,7 +67,6 @@ module GameData
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@base_money = hash[:base_money] || 30
@battle_BGM = hash[:battle_BGM]
@@ -81,7 +79,7 @@ module GameData
# @return [String] the translated name of this trainer type
def name
return pbGetMessage(MessageTypes::TrainerTypes, @id_number)
return pbGetMessageFromHash(MessageTypes::TrainerTypes, @real_name)
end
def male?; return @gender == 0; end

View File

@@ -1,7 +1,6 @@
module GameData
class Trainer
attr_reader :id
attr_reader :id_number
attr_reader :trainer_type
attr_reader :real_name
attr_reader :version
@@ -33,7 +32,7 @@ module GameData
"Ball" => [:poke_ball, "e", :Item],
}
extend ClassMethods
extend ClassMethodsSymbols
include InstanceMethods
# @param tr_type [Symbol, String]
@@ -72,7 +71,6 @@ module GameData
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number]
@trainer_type = hash[:trainer_type]
@real_name = hash[:name] || "Unnamed"
@version = hash[:version] || 0