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.

View File

@@ -6,7 +6,7 @@
module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
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_GREEN_ID = 18

View File

@@ -13,6 +13,7 @@ class PokemonBag
end
def initialize
@descending_sort=false
@lastpocket = 1
@pockets = []
@choices = []
@@ -42,6 +43,36 @@ class PokemonBag
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
@pockets.each { |pocket| pocket.clear }
end

View File

@@ -676,19 +676,19 @@ class PokemonSummary_Scene
ability = @pokemon.ability
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
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
drawTextEx(overlay, 224, 320, 282, 2, ability.description, Color.new(64, 64, 64), Color.new(176, 176, 176))
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
pbDrawTextPositions(overlay, textpos)

View File

@@ -330,6 +330,11 @@ class PokemonBag_Scene
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
def pbChooseItem
@sprites["helpwindow"].visible = false
@@ -459,6 +464,7 @@ class PokemonBagScreen
cmdRegister = -1
cmdGive = -1
cmdToss = -1
cmdSort = -1
cmdDebug = -1
commands = []
# Generate command list
@@ -477,6 +483,7 @@ class PokemonBagScreen
elsif pbCanRegisterItem?(item)
commands[cmdRegister = commands.length] = _INTL("Register")
end
commands[cmdSort = commands.length] = _INTL("Sort bag")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[commands.length] = _INTL("Cancel")
# Show commands generated above
@@ -526,6 +533,24 @@ class PokemonBagScreen
@bag.pbRegisterItem(item)
end
@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
command = 0
loop do

View File

@@ -55,7 +55,7 @@ class FusionQuiz
end
round_multiplier += round_multiplier_increase
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!")
end
end
@@ -185,7 +185,7 @@ class FusionQuiz
pbSEPlay("buzzer", 80)
break_streak
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

Binary file not shown.

Binary file not shown.