Refactor: double hats

This commit is contained in:
chardub
2025-02-20 17:10:24 -05:00
parent d099d788f4
commit 0f416eecaf
23 changed files with 208 additions and 147 deletions

View File

@@ -13,7 +13,7 @@ class ClothesShopPresenter < PokemonMartScreen
@scene.pbEndBuyScene
end
def playerHatActionsMenu(item)
def playerHatActionsMenu(item, is_secondary=false)
is_player_hat = item.id == @adapter.worn_clothes
options = []
if is_player_hat
@@ -22,10 +22,10 @@ class ClothesShopPresenter < PokemonMartScreen
options << "Wear"
end
remove_dye_option_available = $Trainer.hat_color != 0
remove_dye_option_available = $Trainer.hat_color(@adapter.is_secondary_hat) != 0
options << "Remove dye" if remove_dye_option_available
options << "Mark as favorite" if $Trainer.favorite_hat != item.id
options << "Unmark as favorite" if $Trainer.favorite_hat == item.id
options << "Mark as favorite" if $Trainer.favorite_hat(@adapter.is_secondary_hat) != item.id
options << "Unmark as favorite" if $Trainer.favorite_hat(@adapter.is_secondary_hat) == item.id
options << "Cancel"
# if $Trainer.hat_color != 0
@@ -38,21 +38,22 @@ class ClothesShopPresenter < PokemonMartScreen
else
# wear
putOnClothes(item)
$Trainer.hat_color = @adapter.get_dye_color(item)
$Trainer.set_hat_color(@adapter.get_dye_color(item),@adapter.is_secondary_hat)
return false
end
elsif choice == 1 && remove_dye_option_available
if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name))
$Trainer.hat_color = 0
$Trainer.set_hat_color(0,@adapter.is_secondary_hat)
end
return true
elsif options[choice] == "Mark as favorite"
$Trainer.favorite_hat = item.id
pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is now your favorite!")
echoln "marked #{item.id} as favorite hat"
slot = @adapter.is_secondary_hat ? "slot 1" : "slot 2"
$Trainer.set_favorite_hat(item.id,@adapter.is_secondary_hat)
pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is now your favorite (#{slot})!")
echoln "marked #{item.id} as favorite hat"
elsif options[choice] == "Unmark as favorite"
$Trainer.favorite_hat = nil
$Trainer.set_favorite_hat(nil,@adapter.is_secondary_hat)
pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is no longer marked as your favorite!")
end
@@ -80,9 +81,9 @@ class ClothesShopPresenter < PokemonMartScreen
$Trainer.clothes_color = 0
end
elsif options[choice] == "Mark as favorite"
$Trainer.favorite_clothes = item.id
pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is now your favorite!")
$Trainer.favorite_clothes = item.id
pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is now your favorite!")
elsif options[choice] == "Unmark favorite"
$Trainer.favorite_clothes = nil
pbSEPlay("GUI storage show party panel")