Moved initial money/storage creator's name from Settings to metadata.txt, added initial item storage contents property to global metadata, added Home property to player metadata

This commit is contained in:
Maruno17
2021-10-25 23:07:58 +01:00
parent 680c1de392
commit 6c38f769c7
19 changed files with 220 additions and 84 deletions

View File

@@ -55,12 +55,12 @@ module GameData
# @return [String] the translated name of this move
def name
return pbGetMessage(MessageTypes::Moves, @real_name)
return pbGetMessageFromHash(MessageTypes::Moves, @real_name)
end
# @return [String] the translated description of this move
def description
return pbGetMessage(MessageTypes::MoveDescriptions, @real_description)
return pbGetMessageFromHash(MessageTypes::MoveDescriptions, @real_description)
end
def physical?

View File

@@ -1,7 +1,10 @@
module GameData
class Metadata
attr_reader :id
attr_reader :start_money
attr_reader :start_item_storage
attr_reader :home
attr_reader :real_storage_creator
attr_reader :wild_battle_BGM
attr_reader :trainer_battle_BGM
attr_reader :wild_victory_ME
@@ -14,14 +17,17 @@ module GameData
DATA_FILENAME = "metadata.dat"
SCHEMA = {
"Home" => [1, "vuuu"],
"WildBattleBGM" => [2, "s"],
"TrainerBattleBGM" => [3, "s"],
"WildVictoryME" => [4, "s"],
"TrainerVictoryME" => [5, "s"],
"WildCaptureME" => [6, "s"],
"SurfBGM" => [7, "s"],
"BicycleBGM" => [8, "s"]
"StartMoney" => [1, "u"],
"StartItemStorage" => [2, "*e", :Item],
"Home" => [3, "vuuu"],
"StorageCreator" => [4, "s"],
"WildBattleBGM" => [5, "s"],
"TrainerBattleBGM" => [6, "s"],
"WildVictoryME" => [7, "s"],
"TrainerVictoryME" => [8, "s"],
"WildCaptureME" => [9, "s"],
"SurfBGM" => [10, "s"],
"BicycleBGM" => [11, "s"]
}
extend ClassMethodsIDNumbers
@@ -29,14 +35,17 @@ module GameData
def self.editor_properties
return [
["Home", MapCoordsFacingProperty, _INTL("Map ID and X and Y coordinates of where the player goes if no Pokémon Center was entered after a loss.")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for Trainer battles.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle.")],
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a Pokémon.")],
["SurfBGM", BGMProperty, _INTL("BGM played while surfing.")],
["BicycleBGM", BGMProperty, _INTL("BGM played while on a bicycle.")]
["StartMoney", LimitProperty.new(Settings::MAX_MONEY), _INTL("The amount of money that the player starts the game with.")],
["StartItemStorage", ItemPoolProperty, _INTL("Items that are already in the player's PC at the start of the game.")],
["Home", MapCoordsFacingProperty, _INTL("Map ID and X/Y coordinates of where the player goes after a loss if no Pokémon Center was visited.")],
["StorageCreator", StringProperty, _INTL("Name of the Pokémon Storage creator (the storage option is named \"XXX's PC\").")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for Trainer battles.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle.")],
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a Pokémon.")],
["SurfBGM", BGMProperty, _INTL("BGM played while surfing.")],
["BicycleBGM", BGMProperty, _INTL("BGM played while on a bicycle.")]
]
end
@@ -45,20 +54,32 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@home = hash[:home]
@wild_battle_BGM = hash[:wild_battle_BGM]
@trainer_battle_BGM = hash[:trainer_battle_BGM]
@wild_victory_ME = hash[:wild_victory_ME]
@trainer_victory_ME = hash[:trainer_victory_ME]
@wild_capture_ME = hash[:wild_capture_ME]
@surf_BGM = hash[:surf_BGM]
@bicycle_BGM = hash[:bicycle_BGM]
@id = hash[:id]
@start_money = hash[:start_money] || 3000
@start_item_storage = hash[:start_item_storage] || []
@home = hash[:home]
@real_storage_creator = hash[:storage_creator]
@wild_battle_BGM = hash[:wild_battle_BGM]
@trainer_battle_BGM = hash[:trainer_battle_BGM]
@wild_victory_ME = hash[:wild_victory_ME]
@trainer_victory_ME = hash[:trainer_victory_ME]
@wild_capture_ME = hash[:wild_capture_ME]
@surf_BGM = hash[:surf_BGM]
@bicycle_BGM = hash[:bicycle_BGM]
end
# @return [String] the translated name of the Pokémon Storage creator
def storage_creator
ret = pbGetMessage(MessageTypes::StorageCreator, 0)
return nil_or_empty?(ret) ? _INTL("Bill") : ret
end
def property_from_string(str)
case str
when "StartMoney" then return @start_money
when "StartItemStorage" then return @start_item_storage
when "Home" then return @home
when "StorageCreator" then return @real_storage_creator
when "WildBattleBGM" then return @wild_battle_BGM
when "TrainerBattleBGM" then return @trainer_battle_BGM
when "WildVictoryME" then return @wild_victory_ME

View File

@@ -3,6 +3,7 @@ module GameData
attr_reader :id
attr_reader :trainer_type
attr_reader :walk_charset
attr_reader :home
DATA = {}
DATA_FILENAME = "player_metadata.dat"
@@ -15,7 +16,8 @@ module GameData
"SurfCharset" => [5, "s"],
"DiveCharset" => [6, "s"],
"FishCharset" => [7, "s"],
"SurfFishCharset" => [8, "s"]
"SurfFishCharset" => [8, "s"],
"Home" => [9, "vuuu"]
}
extend ClassMethodsIDNumbers
@@ -23,14 +25,15 @@ module GameData
def self.editor_properties
return [
["TrainerType", TrainerTypeProperty, _INTL("Trainer type of this player.")],
["WalkCharset", CharacterProperty, _INTL("Charset used while the player is still or walking.")],
["RunCharset", CharacterProperty, _INTL("Charset used while the player is running. Uses WalkCharset if undefined.")],
["CycleCharset", CharacterProperty, _INTL("Charset used while the player is cycling. Uses RunCharset if undefined.")],
["SurfCharset", CharacterProperty, _INTL("Charset used while the player is surfing. Uses CycleCharset if undefined.")],
["DiveCharset", CharacterProperty, _INTL("Charset used while the player is diving. Uses SurfCharset if undefined.")],
["FishCharset", CharacterProperty, _INTL("Charset used while the player is fishing. Uses WalkCharset if undefined.")],
["SurfFishCharset", CharacterProperty, _INTL("Charset used while the player is fishing while surfing. Uses FishCharset if undefined.")]
["TrainerType", TrainerTypeProperty, _INTL("Trainer type of this player.")],
["WalkCharset", CharacterProperty, _INTL("Charset used while the player is still or walking.")],
["RunCharset", CharacterProperty, _INTL("Charset used while the player is running. Uses WalkCharset if undefined.")],
["CycleCharset", CharacterProperty, _INTL("Charset used while the player is cycling. Uses RunCharset if undefined.")],
["SurfCharset", CharacterProperty, _INTL("Charset used while the player is surfing. Uses CycleCharset if undefined.")],
["DiveCharset", CharacterProperty, _INTL("Charset used while the player is diving. Uses SurfCharset if undefined.")],
["FishCharset", CharacterProperty, _INTL("Charset used while the player is fishing. Uses WalkCharset if undefined.")],
["SurfFishCharset", CharacterProperty, _INTL("Charset used while the player is fishing while surfing. Uses FishCharset if undefined.")],
["Home", MapCoordsFacingProperty, _INTL("Map ID and X/Y coordinates of where the player goes after a loss if no Pokémon Center was visited.")]
]
end
@@ -52,6 +55,7 @@ module GameData
@dive_charset = hash[:dive_charset]
@fish_charset = hash[:fish_charset]
@surf_fish_charset = hash[:surf_fish_charset]
@home = hash[:home]
end
def run_charset
@@ -88,6 +92,7 @@ module GameData
when "DiveCharset" then return @dive_charset
when "FishCharset" then return @fish_charset
when "SurfFishCharset" then return @surf_fish_charset
when "Home" then return @home
end
return nil
end