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.
MAX_MONEY = 999_999
# 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
# 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.
# 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
# associated trainer type will be named as whatever is in that Variable.
RIVAL_NAMES = [
[:RIVAL1, 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.
NUM_STORAGE_BOXES = 30
# 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
return ["",
return [
_INTL("Items"),
_INTL("Medicine"),
_INTL("Poké Balls"),
@@ -196,14 +190,12 @@ module Settings
_INTL("Key Items")
]
end
# The maximum number of slots per pocket (-1 means infinite number). Ignore
# the first number (0).
BAG_MAX_POCKET_SIZE = [0, -1, -1, -1, -1, -1, -1, -1, -1]
# The maximum number of slots per pocket (-1 means infinite number).
BAG_MAX_POCKET_SIZE = [-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.
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
# 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
# number. That region's map will appear in the Area page while viewing that
# Dex list, no matter which region the player is currently in.
# number, and that region's map will appear in the Area page while viewing
# that Dex list, no matter which region the player is currently in.
def self.pokedex_names
return [
[_INTL("Kanto Pokédex"), 0],

View File

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

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

View File

@@ -103,7 +103,8 @@ def pbStartOver(gameover=false)
$scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh
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 $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]))

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))
end
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
end
# Can't add the item
@@ -771,7 +771,7 @@ def pbReceiveItem(item,quantity=1)
end
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.",
itemname, pocket, PokemonBag.pocket_names[pocket]))
itemname, pocket, PokemonBag.pocket_names[pocket - 1]))
return true
end
return false # Can't add the item

View File

@@ -881,6 +881,7 @@ HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
next false
end
healing = $PokemonGlobal.healingSpot
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
healing = GameData::Metadata.get.home if !healing # Home
if !healing
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|
healing = $PokemonGlobal.healingSpot
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
healing = GameData::Metadata.get.home if !healing # Home
next false if !healing
mapname = pbGetMapNameFromId(healing[0])
@@ -903,6 +905,7 @@ HiddenMoveHandlers::ConfirmUseMove.add(:TELEPORT,proc { |move,pkmn|
HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
healing = $PokemonGlobal.healingSpot
healing = GameData::PlayerMetadata.get($player.character_ID)&.home if !healing
healing = GameData::Metadata.get.home if !healing # Home
next false if !healing
if !pbHiddenMoveAnimation(pokemon)

View File

@@ -449,7 +449,7 @@ def pbPickBerry(berry, qty = 1)
end
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",
$player.name, berry_name, pocket, PokemonBag.pocket_names[pocket]))
$player.name, berry_name, pocket, PokemonBag.pocket_names[pocket - 1]))
if Settings::NEW_BERRY_PLANTS
pbMessage(_INTL("The soil returned to its soft and earthy state."))
else

View File

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

View File

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

View File

@@ -287,7 +287,7 @@ class PokemonBag_Scene
overlay.clear
# Draw the pocket name
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
showslider = false
@@ -424,7 +424,7 @@ class PokemonBag_Scene
elsif Input.trigger?(Input::ACTION) # Start switching the selected item
if !@choosing
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
swapinitialpos = itemwindow.index
pbPlayDecisionSE

View File

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

View File

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

View File

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

View File

@@ -864,7 +864,6 @@ end
module PocketProperty
def self.set(_settingname, oldsetting)
commands = Settings.bag_pocket_names.clone
commands.shift
cmd = pbMessage(_INTL("Choose a pocket for this item."), commands, -1)
return (cmd >= 0) ? cmd + 1 : oldsetting
end
@@ -875,7 +874,7 @@ module PocketProperty
def self.format(value)
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
@@ -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
def self.set(_settingname, oldsetting)
# Get all moves in move pool
@@ -1094,6 +1195,7 @@ module MovePoolProperty
case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0
realcmds.shift
for i in 0...realcmds.length
realcmds[i].pop # Remove name
realcmds[i].pop # Remove index in this list

View File

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

View File

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