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

@@ -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