mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 21:54:58 +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
|
STORAGE_CREATOR_NAME = 27
|
||||||
ITEM_PORTION_NAMES = 28
|
ITEM_PORTION_NAMES = 28
|
||||||
ITEM_PORTION_NAME_PLURALS = 29
|
ITEM_PORTION_NAME_PLURALS = 29
|
||||||
|
POKEMON_NICKNAMES = 30
|
||||||
@@messages = Translation.new
|
@@messages = Translation.new
|
||||||
|
|
||||||
def self.load_default_messages
|
def self.load_default_messages
|
||||||
|
|||||||
@@ -256,7 +256,11 @@ module GameData
|
|||||||
ret = []
|
ret = []
|
||||||
self.constants.each do |c|
|
self.constants.each do |c|
|
||||||
next if !self.const_get(c).is_a?(Class)
|
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
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ module GameData
|
|||||||
["ID", ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")],
|
["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.")],
|
["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.")],
|
["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.")],
|
["Pocket", PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
|
||||||
["Price", LimitProperty.new(Settings::MAX_MONEY), _INTL("Purchase price of this item.")],
|
["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.")],
|
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is half the purchase price.")],
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ module GameData
|
|||||||
DATA = {}
|
DATA = {}
|
||||||
DATA_FILENAME = "shadow_pokemon.dat"
|
DATA_FILENAME = "shadow_pokemon.dat"
|
||||||
PBS_BASE_FILENAME = "shadow_pokemon"
|
PBS_BASE_FILENAME = "shadow_pokemon"
|
||||||
|
OPTIONAL = true
|
||||||
|
|
||||||
SCHEMA = {
|
SCHEMA = {
|
||||||
"SectionName" => [:id, "e", :Species],
|
"SectionName" => [:id, "e", :Species],
|
||||||
@@ -21,7 +22,7 @@ module GameData
|
|||||||
extend ClassMethodsSymbols
|
extend ClassMethodsSymbols
|
||||||
include InstanceMethods
|
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
|
def self.load
|
||||||
__orig__load if safeExists?("Data/#{self::DATA_FILENAME}")
|
__orig__load if safeExists?("Data/#{self::DATA_FILENAME}")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -167,7 +167,9 @@ module GameData
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
|
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]
|
if pkmn_data[:shadowness]
|
||||||
pkmn.makeShadow
|
pkmn.makeShadow
|
||||||
pkmn.shiny = false
|
pkmn.shiny = false
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
|
|||||||
if save_changes
|
if save_changes
|
||||||
trainer_hash = {
|
trainer_hash = {
|
||||||
:trainer_type => tr_type,
|
:trainer_type => tr_type,
|
||||||
:name => tr_name,
|
:real_name => tr_name,
|
||||||
:version => tr_version,
|
:version => tr_version,
|
||||||
:pokemon => []
|
:pokemon => []
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
# Add trainer's data to records
|
# 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.register(trainer_hash)
|
||||||
GameData::Trainer.save
|
GameData::Trainer.save
|
||||||
pbConvertTrainerData
|
pbConvertTrainerData
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ def pbTrainerBattleEditor
|
|||||||
else
|
else
|
||||||
trainer_hash = {
|
trainer_hash = {
|
||||||
:trainer_type => data[0],
|
:trainer_type => data[0],
|
||||||
:name => data[1],
|
:real_name => data[1],
|
||||||
:version => data[2],
|
:version => data[2],
|
||||||
:lose_text => data[3],
|
:lose_text => data[3],
|
||||||
:pokemon => party,
|
:pokemon => party,
|
||||||
@@ -533,7 +533,7 @@ def pbTrainerBattleEditor
|
|||||||
:pbs_file_suffix => tr_data.pbs_file_suffix
|
:pbs_file_suffix => tr_data.pbs_file_suffix
|
||||||
}
|
}
|
||||||
# Add trainer type's data to records
|
# 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)
|
GameData::Trainer.register(trainer_hash)
|
||||||
if data[0] != old_type || data[1] != old_name || data[2] != old_version
|
if data[0] != old_type || data[1] != old_name || data[2] != old_version
|
||||||
GameData::Trainer::DATA.delete([old_type, old_name, old_version])
|
GameData::Trainer::DATA.delete([old_type, old_name, old_version])
|
||||||
@@ -568,7 +568,7 @@ def pbTrainerBattleEditor
|
|||||||
if t
|
if t
|
||||||
trainer_hash = {
|
trainer_hash = {
|
||||||
:trainer_type => tr_type,
|
:trainer_type => tr_type,
|
||||||
:name => tr_name,
|
:real_name => tr_name,
|
||||||
:version => tr_version,
|
:version => tr_version,
|
||||||
:pokemon => []
|
:pokemon => []
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ def pbTrainerBattleEditor
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
# Add trainer's data to records
|
# 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.register(trainer_hash)
|
||||||
pbMessage(_INTL("The Trainer battle was added."))
|
pbMessage(_INTL("The Trainer battle was added."))
|
||||||
modified = true
|
modified = true
|
||||||
@@ -607,7 +607,7 @@ module TrainerPokemonProperty
|
|||||||
oldsetting = [
|
oldsetting = [
|
||||||
initsetting[:species],
|
initsetting[:species],
|
||||||
initsetting[:level],
|
initsetting[:level],
|
||||||
initsetting[:name],
|
initsetting[:real_name],
|
||||||
initsetting[:form],
|
initsetting[:form],
|
||||||
initsetting[:gender],
|
initsetting[:gender],
|
||||||
initsetting[:shininess],
|
initsetting[:shininess],
|
||||||
@@ -629,7 +629,7 @@ module TrainerPokemonProperty
|
|||||||
pkmn_properties = [
|
pkmn_properties = [
|
||||||
[_INTL("Species"), SpeciesProperty, _INTL("Species of the Pokémon.")],
|
[_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("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("Form"), LimitProperty2.new(999), _INTL("Form of the Pokémon.")],
|
||||||
[_INTL("Gender"), GenderProperty, _INTL("Gender 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.")],
|
[_INTL("Shiny"), BooleanProperty2, _INTL("If set to true, the Pokémon is a different-colored Pokémon.")],
|
||||||
@@ -655,7 +655,7 @@ module TrainerPokemonProperty
|
|||||||
ret = {
|
ret = {
|
||||||
:species => oldsetting[0],
|
:species => oldsetting[0],
|
||||||
:level => oldsetting[1],
|
:level => oldsetting[1],
|
||||||
:name => oldsetting[2],
|
:real_name => oldsetting[2],
|
||||||
:form => oldsetting[3],
|
:form => oldsetting[3],
|
||||||
:gender => oldsetting[4],
|
:gender => oldsetting[4],
|
||||||
:shininess => oldsetting[5],
|
:shininess => oldsetting[5],
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ class SpritePositioner
|
|||||||
break
|
break
|
||||||
elsif Input.trigger?(Input::USE)
|
elsif Input.trigger?(Input::USE)
|
||||||
pbPlayDecisionSE
|
pbPlayDecisionSE
|
||||||
|
@metricsChanged = true if metrics_data.shadow_size != oldval
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ module Compiler
|
|||||||
rescue SystemCallError
|
rescue SystemCallError
|
||||||
mustCompile = true
|
mustCompile = true
|
||||||
end
|
end
|
||||||
elsif filename != "shadow_pokemon.dat"
|
else
|
||||||
mustCompile = true
|
mustCompile = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ module Compiler
|
|||||||
module_function
|
module_function
|
||||||
|
|
||||||
def compile_PBS_file_generic(game_data, *paths)
|
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
|
game_data::DATA.clear
|
||||||
schema = game_data.schema
|
schema = game_data.schema
|
||||||
# Read from PBS file(s)
|
# Read from PBS file(s)
|
||||||
@@ -214,10 +217,10 @@ module Compiler
|
|||||||
def validate_compiled_move(hash)
|
def validate_compiled_move(hash)
|
||||||
if (hash[:category] || 2) == 2 && (hash[:base_damage] || 0) != 0
|
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}",
|
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
|
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}",
|
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
|
hash[:category] = 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -542,7 +545,6 @@ module Compiler
|
|||||||
# Compile Shadow Pokémon data
|
# Compile Shadow Pokémon data
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def compile_shadow_pokemon(*paths)
|
def compile_shadow_pokemon(*paths)
|
||||||
return if !safeExists?("PBS/shadow_pokemon.txt")
|
|
||||||
compile_PBS_file_generic(GameData::ShadowPokemon, *paths) do |final_validate, hash|
|
compile_PBS_file_generic(GameData::ShadowPokemon, *paths) do |final_validate, hash|
|
||||||
(final_validate) ? validate_all_compiled_shadow_pokemon : validate_compiled_shadow_pokemon(hash)
|
(final_validate) ? validate_all_compiled_shadow_pokemon : validate_compiled_shadow_pokemon(hash)
|
||||||
end
|
end
|
||||||
@@ -847,9 +849,9 @@ module Compiler
|
|||||||
pkmn[:level], max_level, FileLineData.linereport)
|
pkmn[:level], max_level, FileLineData.linereport)
|
||||||
end
|
end
|
||||||
# Ensure valid name length
|
# 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}",
|
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
|
end
|
||||||
# Ensure no duplicate moves
|
# Ensure no duplicate moves
|
||||||
pkmn[:moves].uniq! if pkmn[:moves]
|
pkmn[:moves].uniq! if pkmn[:moves]
|
||||||
@@ -904,12 +906,17 @@ module Compiler
|
|||||||
# Get trainer names and lose texts for translating
|
# Get trainer names and lose texts for translating
|
||||||
trainer_names = []
|
trainer_names = []
|
||||||
lose_texts = []
|
lose_texts = []
|
||||||
|
pokemon_nicknames = []
|
||||||
GameData::Trainer.each do |trainer|
|
GameData::Trainer.each do |trainer|
|
||||||
trainer_names.push(trainer.real_name)
|
trainer_names.push(trainer.real_name)
|
||||||
lose_texts.push(trainer.real_lose_text)
|
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
|
end
|
||||||
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_NAMES, trainer_names)
|
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_NAMES, trainer_names)
|
||||||
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_SPEECHES_LOSE, lose_texts)
|
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_SPEECHES_LOSE, lose_texts)
|
||||||
|
MessageTypes.setMessagesAsHash(MessageTypes::POKEMON_NICKNAMES, pokemon_nicknames)
|
||||||
end
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user