Rearranged Bag pockets, replaced Mail pocket with Held Items pocket

This commit is contained in:
Maruno17
2024-09-21 19:10:32 +01:00
parent f62a357cbd
commit 6d1013d34e
10 changed files with 21018 additions and 21008 deletions

View File

@@ -92,25 +92,31 @@ SaveData.register_conversion(:v22_convert_bag_object) do
to_value :bag do |bag|
bag.instance_eval do
all_pockets = GameData::BagPocket.all_pockets
if @pockets.is_a?(Array)
new_pockets = {}
all_pockets.each { |pckt| new_pockets[pckt] = [] }
@pockets.each_with_index do |value, i|
next if i == 0
value.each do |item|
pckt = GameData::Item.get(item[0]).bag_pocket
new_pockets[pckt].push(item)
end
end
@pockets = new_pockets
end
if @last_viewed_pocket.is_a?(Integer)
@last_viewed_pocket = all_pockets[@last_viewed_pocket - 1]
@last_viewed_pocket = all_pockets[@last_viewed_pocket - 1] || all_pockets.first
end
if @last_pocket_selections.is_a?(Array)
new_sels = {}
all_pockets.each { |pckt| new_sels[pckt] = 0 }
@last_pocket_selections.each_with_index do |value, i|
next if i == 0
new_sels[all_pockets[i - 1]] = value
pckt = all_pockets[i - 1]
new_sels[pckt] = value if pckt && value <= @pockets[pckt].length - 1
end
@last_pocket_selections = new_sels
end
if @pockets.is_a?(Array)
new_pockets = {}
@pockets.each_with_index do |value, i|
next if i == 0
new_pockets[all_pockets[i - 1]] = value
end
@pockets = new_pockets
end
end
end
end

View File

@@ -88,7 +88,7 @@ end
GameData::BagPocket.register({
:id => :Items,
:name => _INTL("Items"),
:name => _INTL("Other Items"),
:icon_position => 0,
:order => 10
})
@@ -107,6 +107,28 @@ GameData::BagPocket.register({
:order => 30
})
GameData::BagPocket.register({
:id => :Berries,
:name => _INTL("Berries"),
:icon_position => 3,
:order => 40,
:auto_sort => true
})
GameData::BagPocket.register({
:id => :HeldItems,
:name => _INTL("Held Items"),
:icon_position => 4,
:order => 50
})
GameData::BagPocket.register({
:id => :BattleItems,
:name => _INTL("Battle Items"),
:icon_position => 5,
:order => 60
})
# This pocket is hardcoded to allow showing the details of a machine item in
# this pocket in the Bag. The display of this information is toggled by pressing
# the Action input. It is not possible to open the screen menu with the Action
@@ -115,31 +137,9 @@ GameData::BagPocket.register({
GameData::BagPocket.register({
:id => :Machines,
:name => _INTL("TMs & HMs"),
:icon_position => 3,
:order => 40,
:auto_sort => true
})
GameData::BagPocket.register({
:id => :Berries,
:name => _INTL("Berries"),
:icon_position => 4,
:order => 50,
:auto_sort => true
})
GameData::BagPocket.register({
:id => :Mail,
:name => _INTL("Mail"),
:icon_position => 5,
:order => 60
})
GameData::BagPocket.register({
:id => :BattleItems,
:name => _INTL("Battle Items"),
:icon_position => 6,
:order => 70
:order => 70,
:auto_sort => true
})
GameData::BagPocket.register({

View File

@@ -30,7 +30,12 @@ class PokemonBag
def clear
@pockets.each_value { |pocket| pocket.clear }
GameData::BagPocket.all_pockets.each { |pckt| @last_pocket_selections[pckt] = 0 }
@pockets.clear
@last_pocket_selections.clear
GameData::BagPocket.all_pockets.each do |pckt|
@pockets[pckt] = []
@last_pocket_selections[pckt] = 0
end
end
#-----------------------------------------------------------------------------

View File

@@ -821,7 +821,6 @@ MenuHandlers.add(:debug_menu, :fill_bag, {
bag = $bag.pockets # Called here so that it only rearranges itself once
GameData::Item.each do |i|
bag_pocket = i.bag_pocket
next if GameData::BagPocket.get(bag_pocket).max_slots
next if !pocket_sizes[bag_pocket] || pocket_sizes[bag_pocket] == 0
next if pocket_sizes[bag_pocket] > 0 && bag[bag_pocket].length >= pocket_sizes[bag_pocket]
item_qty = (i.is_important?) ? 1 : qty

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff