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

@@ -49,8 +49,6 @@ module Settings
#============================================================================= #=============================================================================
# The amount of money the player starts the game with.
INITIAL_MONEY = 3000
# The maximum amount of money the player can have. # The maximum amount of money the player can have.
MAX_MONEY = 999_999 MAX_MONEY = 999_999
# The maximum number of Game Corner coins the player can have. # The maximum number of Game Corner coins the player can have.
@@ -66,9 +64,9 @@ module Settings
#============================================================================= #=============================================================================
# A set of arrays each containing a trainer type followed by a Global Variable # A set of arrays each containing a trainer type followed by a Game Variable
# number. If the variable isn't set to 0, then all trainers with the # number. If the Variable isn't set to 0, then all trainers with the
# associated trainer type will be named as whatever is in that variable. # associated trainer type will be named as whatever is in that Variable.
RIVAL_NAMES = [ RIVAL_NAMES = [
[:RIVAL1, 12], [:RIVAL1, 12],
[:RIVAL2, 12], [:RIVAL2, 12],
@@ -171,10 +169,6 @@ module Settings
#============================================================================= #=============================================================================
# The name of the person who created the Pokémon storage system.
def self.storage_creator_name
return _INTL("Bill")
end
# The number of boxes in Pokémon storage. # The number of boxes in Pokémon storage.
NUM_STORAGE_BOXES = 30 NUM_STORAGE_BOXES = 30
# Whether putting a Pokémon into Pokémon storage will heal it. IF false, they # Whether putting a Pokémon into Pokémon storage will heal it. IF false, they
@@ -183,9 +177,9 @@ module Settings
#============================================================================= #=============================================================================
# The names of each pocket of the Bag. Ignore the first entry (""). # The names of each pocket of the Bag.
def self.bag_pocket_names def self.bag_pocket_names
return ["", return [
_INTL("Items"), _INTL("Items"),
_INTL("Medicine"), _INTL("Medicine"),
_INTL("Poké Balls"), _INTL("Poké Balls"),
@@ -196,14 +190,12 @@ module Settings
_INTL("Key Items") _INTL("Key Items")
] ]
end end
# The maximum number of slots per pocket (-1 means infinite number). Ignore # The maximum number of slots per pocket (-1 means infinite number).
# the first number (0). BAG_MAX_POCKET_SIZE = [-1, -1, -1, -1, -1, -1, -1, -1]
BAG_MAX_POCKET_SIZE = [0, -1, -1, -1, -1, -1, -1, -1, -1] # Whether each pocket in turn auto-sorts itself by item ID number.
BAG_POCKET_AUTO_SORT = [false, false, false, true, true, false, false, false]
# The maximum number of items each slot in the Bag can hold. # The maximum number of items each slot in the Bag can hold.
BAG_MAX_PER_SLOT = 999 BAG_MAX_PER_SLOT = 999
# Whether each pocket in turn auto-sorts itself by item ID number. Ignore the
# first entry (the 0).
BAG_POCKET_AUTO_SORT = [0, false, false, false, true, true, false, false, false]
#============================================================================= #=============================================================================
@@ -220,8 +212,8 @@ module Settings
# page while viewing that Dex list will be the region map of the region the # page while viewing that Dex list will be the region map of the region the
# player is currently in. The National Dex entry should always behave like # player is currently in. The National Dex entry should always behave like
# this. If an entry is of the form [name, number], then the number is a region # this. If an entry is of the form [name, number], then the number is a region
# number. That region's map will appear in the Area page while viewing that # number, and that region's map will appear in the Area page while viewing
# Dex list, no matter which region the player is currently in. # that Dex list, no matter which region the player is currently in.
def self.pokedex_names def self.pokedex_names
return [ return [
[_INTL("Kanto Pokédex"), 0], [_INTL("Kanto Pokédex"), 0],

View File

@@ -622,6 +622,7 @@ module MessageTypes
ScriptTexts = 24 ScriptTexts = 24
RibbonNames = 25 RibbonNames = 25
RibbonDescriptions = 26 RibbonDescriptions = 26
StorageCreator = 27
@@messages = Messages.new @@messages = Messages.new
@@messagesFallback = Messages.new("Data/messages.dat",true) @@messagesFallback = Messages.new("Data/messages.dat",true)

View File

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

View File

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

View File

@@ -3,6 +3,7 @@ module GameData
attr_reader :id attr_reader :id
attr_reader :trainer_type attr_reader :trainer_type
attr_reader :walk_charset attr_reader :walk_charset
attr_reader :home
DATA = {} DATA = {}
DATA_FILENAME = "player_metadata.dat" DATA_FILENAME = "player_metadata.dat"
@@ -15,7 +16,8 @@ module GameData
"SurfCharset" => [5, "s"], "SurfCharset" => [5, "s"],
"DiveCharset" => [6, "s"], "DiveCharset" => [6, "s"],
"FishCharset" => [7, "s"], "FishCharset" => [7, "s"],
"SurfFishCharset" => [8, "s"] "SurfFishCharset" => [8, "s"],
"Home" => [9, "vuuu"]
} }
extend ClassMethodsIDNumbers extend ClassMethodsIDNumbers
@@ -23,14 +25,15 @@ module GameData
def self.editor_properties def self.editor_properties
return [ return [
["TrainerType", TrainerTypeProperty, _INTL("Trainer type of this player.")], ["TrainerType", TrainerTypeProperty, _INTL("Trainer type of this player.")],
["WalkCharset", CharacterProperty, _INTL("Charset used while the player is still or walking.")], ["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.")], ["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.")], ["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.")], ["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.")], ["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.")], ["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.")] ["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 end
@@ -52,6 +55,7 @@ module GameData
@dive_charset = hash[:dive_charset] @dive_charset = hash[:dive_charset]
@fish_charset = hash[:fish_charset] @fish_charset = hash[:fish_charset]
@surf_fish_charset = hash[:surf_fish_charset] @surf_fish_charset = hash[:surf_fish_charset]
@home = hash[:home]
end end
def run_charset def run_charset
@@ -88,6 +92,7 @@ module GameData
when "DiveCharset" then return @dive_charset when "DiveCharset" then return @dive_charset
when "FishCharset" then return @fish_charset when "FishCharset" then return @fish_charset
when "SurfFishCharset" then return @surf_fish_charset when "SurfFishCharset" then return @surf_fish_charset
when "Home" then return @home
end end
return nil return nil
end end

View File

@@ -103,7 +103,8 @@ def pbStartOver(gameover=false)
$scene.transfer_player if $scene.is_a?(Scene_Map) $scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh $game_map.refresh
else else
homedata = GameData::Metadata.get.home homedata = GameData::PlayerMetadata.get($player.character_ID)&.home
homedata = GameData::Metadata.get.home if !homedata
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0])) if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0]))
if $DEBUG if $DEBUG
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0])) pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))

View File

@@ -725,7 +725,7 @@ def pbItemBall(item,quantity=1)
pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname)) pbMessage(_INTL("\\me[{1}]You found a \\c[1]{2}\\c[0]!\\wtnp[30]",meName,itemname))
end end
pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.", pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
itemname, pocket, PokemonBag.pocket_names[pocket])) itemname, pocket, PokemonBag.pocket_names[pocket - 1]))
return true return true
end end
# Can't add the item # Can't add the item
@@ -771,7 +771,7 @@ def pbReceiveItem(item,quantity=1)
end end
if $bag.add(item, quantity) # If item can be added if $bag.add(item, quantity) # If item can be added
pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.", pbMessage(_INTL("You put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",
itemname, pocket, PokemonBag.pocket_names[pocket])) itemname, pocket, PokemonBag.pocket_names[pocket - 1]))
return true return true
end end
return false # Can't add the item return false # Can't add the item

View File

@@ -881,6 +881,7 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
next false next false
end end
healing = $PokemonGlobal.healingSpot healing = $PokemonGlobal.healingSpot
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
healing = GameData::Metadata.get.home if !healing # Home healing = GameData::Metadata.get.home if !healing # Home
if !healing if !healing
pbMessage(_INTL("Can't use that here.")) if showmsg pbMessage(_INTL("Can't use that here.")) if showmsg
@@ -895,6 +896,7 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn| HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
healing = $PokemonGlobal.healingSpot healing = $PokemonGlobal.healingSpot
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
healing = GameData::Metadata.get.home if !healing # Home healing = GameData::Metadata.get.home if !healing # Home
next false if !healing next false if !healing
mapname = pbGetMapNameFromId(healing[0]) mapname = pbGetMapNameFromId(healing[0])
@@ -903,6 +905,7 @@ HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon| HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
healing = $PokemonGlobal.healingSpot healing = $PokemonGlobal.healingSpot
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
healing = GameData::Metadata.get.home if !healing # Home healing = GameData::Metadata.get.home if !healing # Home
next false if !healing next false if !healing
if !pbHiddenMoveAnimation(pokemon) if !pbHiddenMoveAnimation(pokemon)

View File

@@ -449,7 +449,7 @@ def pbPickBerry(berry, qty = 1)
end end
pocket = berry.pocket pocket = berry.pocket
pbMessage(_INTL("{1} put the \\c[1]{2}\\c[0] in the <icon=bagPocket{3}>\\c[1]{4}\\c[0] Pocket.\1", pbMessage(_INTL("{1} put the \\c[1]{2}\\c[0] in the <icon=bagPocket{3}>\\c[1]{4}\\c[0] Pocket.\1",
$player.name, berry_name, pocket, PokemonBag.pocket_names[pocket])) $player.name, berry_name, pocket, PokemonBag.pocket_names[pocket - 1]))
if Settings::NEW_BERRY_PLANTS if Settings::NEW_BERRY_PLANTS
pbMessage(_INTL("The soil returned to its soft and earthy state.")) pbMessage(_INTL("The soil returned to its soft and earthy state."))
else else

View File

@@ -12,7 +12,7 @@ class PokemonBag
end end
def self.pocket_count def self.pocket_count
return self.pocket_names.length - 1 return self.pocket_names.length
end end
def initialize def initialize
@@ -89,7 +89,7 @@ class PokemonBag
max_size = @pockets[pocket].length + 1 if max_size < 0 # Infinite size max_size = @pockets[pocket].length + 1 if max_size < 0 # Infinite size
ret = ItemStorageHelper.add(@pockets[pocket], ret = ItemStorageHelper.add(@pockets[pocket],
max_size, Settings::BAG_MAX_PER_SLOT, item_data.id, qty) max_size, Settings::BAG_MAX_PER_SLOT, item_data.id, qty)
if ret && Settings::BAG_POCKET_AUTO_SORT[pocket] if ret && Settings::BAG_POCKET_AUTO_SORT[pocket - 1]
@pockets[pocket].sort! { |a, b| GameData::Item.keys.index(a[0]) <=> GameData::Item.keys.index(b[0]) } @pockets[pocket].sort! { |a, b| GameData::Item.keys.index(a[0]) <=> GameData::Item.keys.index(b[0]) }
end end
return ret return ret
@@ -163,7 +163,7 @@ class PokemonBag
private private
def max_pocket_size(pocket) def max_pocket_size(pocket)
return Settings::BAG_MAX_POCKET_SIZE[pocket] || -1 return Settings::BAG_MAX_POCKET_SIZE[pocket - 1] || -1
end end
def rearrange def rearrange
@@ -183,7 +183,7 @@ class PokemonBag
end end
end end
new_pockets.each_with_index do |pocket, i| new_pockets.each_with_index do |pocket, i|
next if i == 0 || !Settings::BAG_POCKET_AUTO_SORT[i] next if i == 0 || !Settings::BAG_POCKET_AUTO_SORT[i - 1]
pocket.sort! { |a, b| GameData::Item.keys.index(a[0]) <=> GameData::Item.keys.index(b[0]) } pocket.sort! { |a, b| GameData::Item.keys.index(a[0]) <=> GameData::Item.keys.index(b[0]) }
end end
@pockets = new_pockets @pockets = new_pockets
@@ -203,8 +203,10 @@ class PCItemStorage
def initialize def initialize
@items = [] @items = []
# Start storage with a Potion # Start storage with initial items (e.g. a Potion)
add(:POTION) if GameData::Item.exists?(:POTION) GameData::Metadata.get.start_item_storage.each do |item|
add(item) if GameData::Item.exists?(item)
end
end end
def [](i) def [](i)

View File

@@ -93,7 +93,7 @@ class Player < Trainer
@character_ID = 0 @character_ID = 0
@outfit = 0 @outfit = 0
@badges = [false] * 8 @badges = [false] * 8
@money = Settings::INITIAL_MONEY @money = GameData::Metadata.get.start_money
@coins = 0 @coins = 0
@battle_points = 0 @battle_points = 0
@soot = 0 @soot = 0

View File

@@ -287,7 +287,7 @@ class PokemonBag_Scene
overlay.clear overlay.clear
# Draw the pocket name # Draw the pocket name
pbDrawTextPositions(overlay,[ pbDrawTextPositions(overlay,[
[PokemonBag.pocket_names[@bag.last_viewed_pocket], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR] [PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]
]) ])
# Draw slider arrows # Draw slider arrows
showslider = false showslider = false
@@ -424,7 +424,7 @@ class PokemonBag_Scene
elsif Input.trigger?(Input::ACTION) # Start switching the selected item elsif Input.trigger?(Input::ACTION) # Start switching the selected item
if !@choosing if !@choosing
if thispocket.length>1 && itemwindow.index<thispocket.length && if thispocket.length>1 && itemwindow.index<thispocket.length &&
!Settings::BAG_POCKET_AUTO_SORT[itemwindow.pocket] !Settings::BAG_POCKET_AUTO_SORT[itemwindow.pocket - 1]
itemwindow.sorting = true itemwindow.sorting = true
swapinitialpos = itemwindow.index swapinitialpos = itemwindow.index
pbPlayDecisionSE pbPlayDecisionSE

View File

@@ -247,9 +247,7 @@ def pbPokeCenterPC
end end
def pbGetStorageCreator def pbGetStorageCreator
creator = Settings.storage_creator_name return GameData::Metadata.get.storage_creator
creator = _INTL("Bill") if nil_or_empty?(creator)
return creator
end end
#=============================================================================== #===============================================================================

View File

@@ -241,7 +241,6 @@ def pbTrainerName(name = nil, outfit = 0)
end end
$player.name = name $player.name = name
$player.outfit = outfit $player.outfit = outfit
$game_temp.begun_new_game = true
end end
def pbSuggestTrainerName(gender) def pbSuggestTrainerName(gender)

View File

@@ -737,14 +737,17 @@ def pbEditMetadata
# Construct metadata hash # Construct metadata hash
metadata_hash = { metadata_hash = {
:id => 0, :id => 0,
:home => data[0], :start_money => data[0],
:wild_battle_BGM => data[1], :start_item_storage => data[1],
:trainer_battle_BGM => data[2], :home => data[2],
:wild_victory_ME => data[3], :storage_creator => data[3],
:trainer_victory_ME => data[4], :wild_battle_BGM => data[4],
:wild_capture_ME => data[5], :trainer_battle_BGM => data[5],
:surf_BGM => data[6], :wild_victory_ME => data[6],
:bicycle_BGM => data[7] :trainer_victory_ME => data[7],
:wild_capture_ME => data[8],
:surf_BGM => data[9],
:bicycle_BGM => data[10]
} }
# Add metadata's data to records # Add metadata's data to records
GameData::Metadata.register(metadata_hash) GameData::Metadata.register(metadata_hash)

View File

@@ -864,7 +864,6 @@ end
module PocketProperty module PocketProperty
def self.set(_settingname, oldsetting) def self.set(_settingname, oldsetting)
commands = Settings.bag_pocket_names.clone commands = Settings.bag_pocket_names.clone
commands.shift
cmd = pbMessage(_INTL("Choose a pocket for this item."), commands, -1) cmd = pbMessage(_INTL("Choose a pocket for this item."), commands, -1)
return (cmd >= 0) ? cmd + 1 : oldsetting return (cmd >= 0) ? cmd + 1 : oldsetting
end end
@@ -875,7 +874,7 @@ module PocketProperty
def self.format(value) def self.format(value)
return _INTL("No Pocket") if value == 0 return _INTL("No Pocket") if value == 0
return (value) ? Settings.bag_pocket_names[value] : value.inspect return (value) ? Settings.bag_pocket_names[value - 1] : value.inspect
end end
end end
@@ -976,6 +975,108 @@ end
module ItemPoolProperty
def self.set(_settingname, oldsetting)
# Get all items in the pool
realcmds = []
realcmds.push([nil, "-", -1]) # Item ID, index in this list, name
for i in 0...oldsetting.length
realcmds.push([oldsetting[i], GameData::Item.get(oldsetting[i]).real_name, i])
end
# Edit item pool
cmdwin = pbListWindow([], 200)
oldsel = -1
ret = oldsetting
cmd = [0, 0]
commands = []
refreshlist = true
loop do
if refreshlist
realcmds.sort! { |a, b| a[2] <=> b[2] }
commands = []
realcmds.each_with_index do |entry, i|
commands.push((entry[0].nil?) ? _INTL("[ADD ITEM]") : entry[1])
end
end
refreshlist = false
oldsel = -1
cmd = pbCommands3(cmdwin, commands, -1, cmd[1], true)
case cmd[0]
when 1 # Swap item up
if cmd[1] > 0 && cmd[1] < realcmds.length - 1
realcmds[cmd[1] + 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] + 1][2]
refreshlist = true
end
when 2 # Swap item down
if cmd[1] > 1
realcmds[cmd[1] - 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] - 1][2]
refreshlist = true
end
when 0
if cmd[1] >= 0 # Chose an entry
entry = realcmds[cmd[1]]
if entry[0].nil? # Add new item
new_item = pbChooseItemList
if new_item
maxid = -1
realcmds.each { |e| maxid = [maxid, e[2]].max }
realcmds.push([new_item, GameData::Item.get(new_item).real_name, maxid + 1])
refreshlist = true
end
else # Edit existing item
case pbMessage(_INTL("\\ts[]Do what with this item?"),
[_INTL("Change item"), _INTL("Delete"), _INTL("Cancel")], 3)
when 0 # Change item
new_item = pbChooseItemList(entry[0])
if new_item && new_item != entry[0]
entry[0] = new_item
entry[1] = GameData::Item.get(new_item).real_name
oldsel = entry[2]
refreshlist = true
end
when 1 # Delete
realcmds.delete_at(cmd[1])
cmd[1] = [cmd[1], realcmds.length - 1].min
refreshlist = true
end
end
else # Cancel/quit
case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0
realcmds.shift
for i in 0...realcmds.length
realcmds[i] = realcmds[i][0]
end
realcmds.compact!
ret = realcmds
break
when 1
break
end
end
end
end
cmdwin.dispose
return ret
end
def self.defaultValue
return []
end
def self.format(value)
ret = ""
for i in 0...value.length
ret << "," if i > 0
ret << GameData::Item.get(value[i]).real_name
end
return ret
end
end
module MovePoolProperty module MovePoolProperty
def self.set(_settingname, oldsetting) def self.set(_settingname, oldsetting)
# Get all moves in move pool # Get all moves in move pool
@@ -1094,6 +1195,7 @@ module MovePoolProperty
case pbMessage(_INTL("Save changes?"), case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3) [_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0 when 0
realcmds.shift
for i in 0...realcmds.length for i in 0...realcmds.length
realcmds[i].pop # Remove name realcmds[i].pop # Remove name
realcmds[i].pop # Remove index in this list realcmds[i].pop # Remove index in this list

View File

@@ -506,8 +506,8 @@ DebugMenuCommands.register("fillbag", {
pocket_sizes = Settings::BAG_MAX_POCKET_SIZE pocket_sizes = Settings::BAG_MAX_POCKET_SIZE
bag = $bag.pockets # Called here so that it only rearranges itself once bag = $bag.pockets # Called here so that it only rearranges itself once
GameData::Item.each do |i| GameData::Item.each do |i|
next if !pocket_sizes[i.pocket] || pocket_sizes[i.pocket] == 0 next if !pocket_sizes[i.pocket - 1] || pocket_sizes[i.pocket - 1] == 0
next if pocket_sizes[i.pocket] > 0 && bag[i.pocket].length >= pocket_sizes[i.pocket] next if pocket_sizes[i.pocket - 1] > 0 && bag[i.pocket].length >= pocket_sizes[i.pocket - 1]
item_qty = (i.is_important?) ? 1 : qty item_qty = (i.is_important?) ? 1 : qty
bag[i.pocket].push([i.id, item_qty]) bag[i.pocket].push([i.id, item_qty])
end end

View File

@@ -1538,6 +1538,7 @@ module Compiler
compile_pbs_file_message_start(path) compile_pbs_file_message_start(path)
GameData::Metadata::DATA.clear GameData::Metadata::DATA.clear
GameData::PlayerMetadata::DATA.clear GameData::PlayerMetadata::DATA.clear
storage_creator = []
# Read from PBS file # Read from PBS file
File.open(path, "rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = path # For error reporting FileLineData.file = path # For error reporting
@@ -1566,7 +1567,10 @@ module Compiler
# Construct metadata hash # Construct metadata hash
metadata_hash = { metadata_hash = {
:id => section_id, :id => section_id,
:start_money => contents["StartMoney"],
:start_item_storage => contents["StartItemStorage"],
:home => contents["Home"], :home => contents["Home"],
:storage_creator => contents["StorageCreator"],
:wild_battle_BGM => contents["WildBattleBGM"], :wild_battle_BGM => contents["WildBattleBGM"],
:trainer_battle_BGM => contents["TrainerBattleBGM"], :trainer_battle_BGM => contents["TrainerBattleBGM"],
:wild_victory_ME => contents["WildVictoryME"], :wild_victory_ME => contents["WildVictoryME"],
@@ -1575,6 +1579,7 @@ module Compiler
:surf_BGM => contents["SurfBGM"], :surf_BGM => contents["SurfBGM"],
:bicycle_BGM => contents["BicycleBGM"] :bicycle_BGM => contents["BicycleBGM"]
} }
storage_creator[0] = contents["StorageCreator"]
# Add metadata's data to records # Add metadata's data to records
GameData::Metadata.register(metadata_hash) GameData::Metadata.register(metadata_hash)
else # Player metadata else # Player metadata
@@ -1601,6 +1606,7 @@ module Compiler
# Save all data # Save all data
GameData::Metadata.save GameData::Metadata.save
GameData::PlayerMetadata.save GameData::PlayerMetadata.save
MessageTypes.setMessages(MessageTypes::StorageCreator, storage_creator)
process_pbs_file_message_end process_pbs_file_message_end
end end

View File

@@ -1,7 +1,10 @@
# See the documentation on the wiki to learn how to edit this file. # See the documentation on the wiki to learn how to edit this file.
#------------------------------- #-------------------------------
[0] [0]
StartMoney = 3000
StartItemStorage = POTION
Home = 3,7,5,8 Home = 3,7,5,8
StorageCreator = Bill
WildBattleBGM = Battle wild.mid WildBattleBGM = Battle wild.mid
TrainerBattleBGM = Battle trainer.mid TrainerBattleBGM = Battle trainer.mid
WildVictoryME = Battle victory wild.ogg WildVictoryME = Battle victory wild.ogg