Fixed minor bug in sprite position editor, made trainers' Pokémon nicknames translatable, generalised code for optional PBS files

This commit is contained in:
Maruno17
2023-02-08 23:51:42 +00:00
parent 4749bd5201
commit 8a3353973b
10 changed files with 49 additions and 31 deletions

View File

@@ -256,7 +256,11 @@ module GameData
ret = []
self.constants.each do |c|
next if !self.const_get(c).is_a?(Class)
ret.push(self.const_get(c)::DATA_FILENAME) if self.const_get(c).const_defined?(:DATA_FILENAME)
next if !self.const_get(c).const_defined?(:DATA_FILENAME)
if self.const_get(c).const_defined?(:OPTIONAL) && self.const_get(c)::OPTIONAL
next if !safeExists?(self.const_get(c)::DATA_FILENAME)
end
ret.push(self.const_get(c)::DATA_FILENAME)
end
return ret
end

View File

@@ -50,19 +50,21 @@ module GameData
battle_use_array = [_INTL("Can't use in battle")]
self.schema["BattleUse"][2].each { |key, value| battle_use_array[value] = key if !battle_use_array[value] }
return [
["ID", ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")],
["Name", ItemNameProperty, _INTL("Name of this item as displayed by the game.")],
["NamePlural", ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")],
["Pocket", PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
["Price", LimitProperty.new(Settings::MAX_MONEY), _INTL("Purchase price of this item.")],
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is half the purchase price.")],
["BPPrice", LimitProperty.new(Settings::MAX_BATTLE_POINTS), _INTL("Purchase price of this item in Battle Points (BP).")],
["FieldUse", EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
["Flags", StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")],
["Consumable", BooleanProperty, _INTL("Whether this item is consumed after use.")],
["Move", MoveProperty, _INTL("Move taught by this HM, TM or TR.")],
["Description", StringProperty, _INTL("Description of this item.")]
["ID", ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")],
["Name", ItemNameProperty, _INTL("Name of this item as displayed by the game.")],
["NamePlural", ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")],
["PortionName", ItemNameProperty, _INTL("Name of a portion of this item as displayed by the game.")],
["PortionNamePlural", ItemNameProperty, _INTL("Name of 2 or more portions of this item as displayed by the game.")],
["Pocket", PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
["Price", LimitProperty.new(Settings::MAX_MONEY), _INTL("Purchase price of this item.")],
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is half the purchase price.")],
["BPPrice", LimitProperty.new(Settings::MAX_BATTLE_POINTS), _INTL("Purchase price of this item in Battle Points (BP).")],
["FieldUse", EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
["Flags", StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")],
["Consumable", BooleanProperty, _INTL("Whether this item is consumed after use.")],
["Move", MoveProperty, _INTL("Move taught by this HM, TM or TR.")],
["Description", StringProperty, _INTL("Description of this item.")]
]
end

View File

@@ -9,6 +9,7 @@ module GameData
DATA = {}
DATA_FILENAME = "shadow_pokemon.dat"
PBS_BASE_FILENAME = "shadow_pokemon"
OPTIONAL = true
SCHEMA = {
"SectionName" => [:id, "e", :Species],
@@ -21,7 +22,7 @@ module GameData
extend ClassMethodsSymbols
include InstanceMethods
alias __orig__load load unless private_method_defined?(:__orig__load)
singleton_class.alias_method(:__orig__load, :load) unless singleton_class.method_defined?(:__orig__load)
def self.load
__orig__load if safeExists?("Data/#{self::DATA_FILENAME}")
end

View File

@@ -167,7 +167,9 @@ module GameData
end
end
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
pkmn.name = pkmn_data[:real_name] if !nil_or_empty?(pkmn_data[:real_name])
if !nil_or_empty?(pkmn_data[:real_name])
pkmn.name = pbGetMessageFromHash(MessageTypes::POKEMON_NICKNAMES, pkmn_data[:real_name])
end
if pkmn_data[:shadowness]
pkmn.makeShadow
pkmn.shiny = false