Adds option to sort bag

This commit is contained in:
infinitefusion
2023-07-02 18:47:17 -04:00
parent 28c91aec12
commit 681c5e4dbf
11 changed files with 68 additions and 12 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@
module Settings module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format. # The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '5.0.0' GAME_VERSION = '5.0.0'
GAME_VERSION_NUMBER = "5.2.1" GAME_VERSION_NUMBER = "5.3.0"
POKERADAR_LIGHT_ANIMATION_RED_ID = 17 POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18 POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
+31
View File
@@ -13,6 +13,7 @@ class PokemonBag
end end
def initialize def initialize
@descending_sort=false
@lastpocket = 1 @lastpocket = 1
@pockets = [] @pockets = []
@choices = [] @choices = []
@@ -42,6 +43,36 @@ class PokemonBag
end end
end end
def sort_pocket_alphabetically()
current_pocket = @pockets[@lastpocket]
sorted = current_pocket.sort_by do |item|
GameData::Item.get(item[0]).name
end
sorted.reverse! if @descending_sort
@descending_sort = !@descending_sort
@pockets[@lastpocket] = sorted
end
def sort_pocket_by_quantity()
current_pocket = @pockets[@lastpocket]
sorted = current_pocket.sort_by do |item|
if @descending_sort
-item[1]
else
item[1]
end
end
@descending_sort = !@descending_sort
@pockets[@lastpocket] = sorted
end
def sort_pocket_by_last_used()
end
def sort_pocket_by_frequent_use()
end
def clear def clear
@pockets.each { |pocket| pocket.clear } @pockets.each { |pocket| pocket.clear }
end end
+9 -9
View File
@@ -676,19 +676,19 @@ class PokemonSummary_Scene
ability = @pokemon.ability ability = @pokemon.ability
ability2 = @pokemon.ability2 ability2 = @pokemon.ability2
# if ability
# textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
# drawTextEx(overlay, 224, 320, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176))
# end
#fixme temp
if ability if ability
textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)]) textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
if ability2 drawTextEx(overlay, 224, 320, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176))
drawTextEx(overlay, 224, 320, 282, 2, ability2.name, Color.new(64, 64, 64), Color.new(176, 176, 176))
end
end end
#fixme temp double abilities
# if ability
# textpos.push([ability.name, 362, 278, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
# if ability2
# drawTextEx(overlay, 224, 320, 282, 2, ability2.name, Color.new(64, 64, 64), Color.new(176, 176, 176))
# end
# end
# Draw all text # Draw all text
pbDrawTextPositions(overlay, textpos) pbDrawTextPositions(overlay, textpos)
+25
View File
@@ -330,6 +330,11 @@ class PokemonBag_Scene
end end
end end
def get_current_pocket
itemwindow = @sprites["itemlist"]
return @bag.pockets[itemwindow.pocket]
end
# Called when the item screen wants an item to be chosen from the screen # Called when the item screen wants an item to be chosen from the screen
def pbChooseItem def pbChooseItem
@sprites["helpwindow"].visible = false @sprites["helpwindow"].visible = false
@@ -459,6 +464,7 @@ class PokemonBagScreen
cmdRegister = -1 cmdRegister = -1
cmdGive = -1 cmdGive = -1
cmdToss = -1 cmdToss = -1
cmdSort = -1
cmdDebug = -1 cmdDebug = -1
commands = [] commands = []
# Generate command list # Generate command list
@@ -477,6 +483,7 @@ class PokemonBagScreen
elsif pbCanRegisterItem?(item) elsif pbCanRegisterItem?(item)
commands[cmdRegister = commands.length] = _INTL("Register") commands[cmdRegister = commands.length] = _INTL("Register")
end end
commands[cmdSort = commands.length] = _INTL("Sort bag")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[commands.length] = _INTL("Cancel") commands[commands.length] = _INTL("Cancel")
# Show commands generated above # Show commands generated above
@@ -526,6 +533,24 @@ class PokemonBagScreen
@bag.pbRegisterItem(item) @bag.pbRegisterItem(item)
end end
@scene.pbRefresh @scene.pbRefresh
elsif cmdSort >=0 && command == cmdSort # Sort bag
command = @scene.pbShowCommands(_INTL("How to sort?",itemname),[
_INTL("Alphabetically"),
_INTL("By quantity"),
# _INTL("Recently used"),
# _INTL("Recently obtained"),
_INTL("Cancel")
],0)
case command
### Cancel ###
when -1, 3
next
when 0
@bag.sort_pocket_alphabetically()
when 1
@bag.sort_pocket_by_quantity()
end
@scene.pbRefresh
elsif cmdDebug>=0 && command==cmdDebug # Debug elsif cmdDebug>=0 && command==cmdDebug # Debug
command = 0 command = 0
loop do loop do
+2 -2
View File
@@ -55,7 +55,7 @@ class FusionQuiz
end end
round_multiplier += round_multiplier_increase round_multiplier += round_multiplier_increase
else else
pbMessage(_INTL("That concludes our quiz! You've cumulated {1} points in total.", @score)) pbMessage(_INTL("This concludes our quiz! You've cumulated {1} points in total.", @score))
pbMessage("Thanks for playing with us today!") pbMessage("Thanks for playing with us today!")
end end
end end
@@ -185,7 +185,7 @@ class FusionQuiz
pbSEPlay("buzzer", 80) pbSEPlay("buzzer", 80)
break_streak break_streak
pbMessage("Unfortunately, that was a wrong answer.") pbMessage("Unfortunately, that was a wrong answer.")
pbMessage("But you'll get another chance!") if other_chance_later pbMessage("But you'll get another chance at it!") if other_chance_later
end end
end end
Binary file not shown.
BIN
View File
Binary file not shown.