mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed minor bug in sprite position editor, made trainers' Pokémon nicknames translatable, generalised code for optional PBS files
This commit is contained in:
@@ -702,6 +702,7 @@ module MessageTypes
|
||||
STORAGE_CREATOR_NAME = 27
|
||||
ITEM_PORTION_NAMES = 28
|
||||
ITEM_PORTION_NAME_PLURALS = 29
|
||||
POKEMON_NICKNAMES = 30
|
||||
@@messages = Translation.new
|
||||
|
||||
def self.load_default_messages
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -37,7 +37,7 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
|
||||
if save_changes
|
||||
trainer_hash = {
|
||||
:trainer_type => tr_type,
|
||||
:name => tr_name,
|
||||
:real_name => tr_name,
|
||||
:version => tr_version,
|
||||
:pokemon => []
|
||||
}
|
||||
@@ -50,7 +50,7 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
|
||||
)
|
||||
end
|
||||
# Add trainer's data to records
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]]
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:real_name], trainer_hash[:version]]
|
||||
GameData::Trainer.register(trainer_hash)
|
||||
GameData::Trainer.save
|
||||
pbConvertTrainerData
|
||||
|
||||
@@ -525,7 +525,7 @@ def pbTrainerBattleEditor
|
||||
else
|
||||
trainer_hash = {
|
||||
:trainer_type => data[0],
|
||||
:name => data[1],
|
||||
:real_name => data[1],
|
||||
:version => data[2],
|
||||
:lose_text => data[3],
|
||||
:pokemon => party,
|
||||
@@ -533,7 +533,7 @@ def pbTrainerBattleEditor
|
||||
:pbs_file_suffix => tr_data.pbs_file_suffix
|
||||
}
|
||||
# Add trainer type's data to records
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]]
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:real_name], trainer_hash[:version]]
|
||||
GameData::Trainer.register(trainer_hash)
|
||||
if data[0] != old_type || data[1] != old_name || data[2] != old_version
|
||||
GameData::Trainer::DATA.delete([old_type, old_name, old_version])
|
||||
@@ -568,7 +568,7 @@ def pbTrainerBattleEditor
|
||||
if t
|
||||
trainer_hash = {
|
||||
:trainer_type => tr_type,
|
||||
:name => tr_name,
|
||||
:real_name => tr_name,
|
||||
:version => tr_version,
|
||||
:pokemon => []
|
||||
}
|
||||
@@ -581,7 +581,7 @@ def pbTrainerBattleEditor
|
||||
)
|
||||
end
|
||||
# Add trainer's data to records
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]]
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:real_name], trainer_hash[:version]]
|
||||
GameData::Trainer.register(trainer_hash)
|
||||
pbMessage(_INTL("The Trainer battle was added."))
|
||||
modified = true
|
||||
@@ -607,7 +607,7 @@ module TrainerPokemonProperty
|
||||
oldsetting = [
|
||||
initsetting[:species],
|
||||
initsetting[:level],
|
||||
initsetting[:name],
|
||||
initsetting[:real_name],
|
||||
initsetting[:form],
|
||||
initsetting[:gender],
|
||||
initsetting[:shininess],
|
||||
@@ -629,7 +629,7 @@ module TrainerPokemonProperty
|
||||
pkmn_properties = [
|
||||
[_INTL("Species"), SpeciesProperty, _INTL("Species of the Pokémon.")],
|
||||
[_INTL("Level"), NonzeroLimitProperty.new(max_level), _INTL("Level of the Pokémon (1-{1}).", max_level)],
|
||||
[_INTL("Name"), StringProperty, _INTL("Name of the Pokémon.")],
|
||||
[_INTL("Name"), StringProperty, _INTL("Nickname of the Pokémon.")],
|
||||
[_INTL("Form"), LimitProperty2.new(999), _INTL("Form of the Pokémon.")],
|
||||
[_INTL("Gender"), GenderProperty, _INTL("Gender of the Pokémon.")],
|
||||
[_INTL("Shiny"), BooleanProperty2, _INTL("If set to true, the Pokémon is a different-colored Pokémon.")],
|
||||
@@ -655,7 +655,7 @@ module TrainerPokemonProperty
|
||||
ret = {
|
||||
:species => oldsetting[0],
|
||||
:level => oldsetting[1],
|
||||
:name => oldsetting[2],
|
||||
:real_name => oldsetting[2],
|
||||
:form => oldsetting[3],
|
||||
:gender => oldsetting[4],
|
||||
:shininess => oldsetting[5],
|
||||
|
||||
@@ -213,6 +213,7 @@ class SpritePositioner
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
@metricsChanged = true if metrics_data.shadow_size != oldval
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -889,7 +889,7 @@ module Compiler
|
||||
rescue SystemCallError
|
||||
mustCompile = true
|
||||
end
|
||||
elsif filename != "shadow_pokemon.dat"
|
||||
else
|
||||
mustCompile = true
|
||||
break
|
||||
end
|
||||
|
||||
@@ -2,6 +2,9 @@ module Compiler
|
||||
module_function
|
||||
|
||||
def compile_PBS_file_generic(game_data, *paths)
|
||||
if game_data.const_defined?(:OPTIONAL) && game_data::OPTIONAL
|
||||
return if paths.none? { |p| safeExists?(p) }
|
||||
end
|
||||
game_data::DATA.clear
|
||||
schema = game_data.schema
|
||||
# Read from PBS file(s)
|
||||
@@ -214,10 +217,10 @@ module Compiler
|
||||
def validate_compiled_move(hash)
|
||||
if (hash[:category] || 2) == 2 && (hash[:base_damage] || 0) != 0
|
||||
raise _INTL("Move {1} is defined as a Status move with a non-zero base damage.\r\n{2}",
|
||||
hash[:name], FileLineData.linereport)
|
||||
hash[:real_name], FileLineData.linereport)
|
||||
elsif (hash[:category] || 2) != 2 && (hash[:base_damage] || 0) == 0
|
||||
print _INTL("Warning: Move {1} is defined as Physical or Special but has a base damage of 0. Changing it to a Status move.\r\n{2}",
|
||||
hash[:name], FileLineData.linereport)
|
||||
hash[:real_name], FileLineData.linereport)
|
||||
hash[:category] = 2
|
||||
end
|
||||
end
|
||||
@@ -542,7 +545,6 @@ module Compiler
|
||||
# Compile Shadow Pokémon data
|
||||
#=============================================================================
|
||||
def compile_shadow_pokemon(*paths)
|
||||
return if !safeExists?("PBS/shadow_pokemon.txt")
|
||||
compile_PBS_file_generic(GameData::ShadowPokemon, *paths) do |final_validate, hash|
|
||||
(final_validate) ? validate_all_compiled_shadow_pokemon : validate_compiled_shadow_pokemon(hash)
|
||||
end
|
||||
@@ -847,9 +849,9 @@ module Compiler
|
||||
pkmn[:level], max_level, FileLineData.linereport)
|
||||
end
|
||||
# Ensure valid name length
|
||||
if pkmn[:name] && pkmn[:name].length > Pokemon::MAX_NAME_SIZE
|
||||
if pkmn[:real_name] && pkmn[:real_name].length > Pokemon::MAX_NAME_SIZE
|
||||
raise _INTL("Invalid Pokémon nickname: {1} (must be 1-{2} characters).\r\n{3}",
|
||||
pkmn[:name], Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
|
||||
pkmn[:real_name], Pokemon::MAX_NAME_SIZE, FileLineData.linereport)
|
||||
end
|
||||
# Ensure no duplicate moves
|
||||
pkmn[:moves].uniq! if pkmn[:moves]
|
||||
@@ -904,12 +906,17 @@ module Compiler
|
||||
# Get trainer names and lose texts for translating
|
||||
trainer_names = []
|
||||
lose_texts = []
|
||||
pokemon_nicknames = []
|
||||
GameData::Trainer.each do |trainer|
|
||||
trainer_names.push(trainer.real_name)
|
||||
lose_texts.push(trainer.real_lose_text)
|
||||
trainer.pokemon.each do |pkmn|
|
||||
pokemon_nicknames.push(pkmn[:real_name]) if !nil_or_empty?(pkmn[:real_name])
|
||||
end
|
||||
end
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_NAMES, trainer_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_SPEECHES_LOSE, lose_texts)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::POKEMON_NICKNAMES, pokemon_nicknames)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
Reference in New Issue
Block a user