Fixes clothes/hats menu

This commit is contained in:
infinitefusion
2024-12-29 15:11:31 -05:00
parent 3415c85618
commit de9029eb1b
9 changed files with 71 additions and 39 deletions

View File

@@ -126,15 +126,20 @@ class Player < Trainer
end end
def clothes_color=(value) def clothes_color=(value)
echoln value
echoln @clothes
echoln $Trainer.dyed_clothes
echoln caller
@clothes_color=value @clothes_color=value
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes $Trainer.dyed_clothes= {} if !$Trainer.dyed_clothes
$Trainer.dyed_clothes[@clothes] = value $Trainer.dyed_clothes[@clothes] = value if value
refreshPlayerOutfit() refreshPlayerOutfit()
end end
def hat_color=(value) def hat_color=(value)
@hat_color=value @hat_color=value
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats $Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
$Trainer.dyed_hats[@hat] = value $Trainer.dyed_hats[@hat] = value if value
refreshPlayerOutfit() refreshPlayerOutfit()
end end

View File

@@ -1,4 +1,6 @@
class OutfitsMartAdapter < PokemonMartAdapter class OutfitsMartAdapter < PokemonMartAdapter
attr_accessor :worn_clothes
WORN_ITEM_BASE_COLOR = MessageConfig::BLUE_TEXT_MAIN_COLOR WORN_ITEM_BASE_COLOR = MessageConfig::BLUE_TEXT_MAIN_COLOR
WORN_ITEM_SHADOW_COLOR = MessageConfig::BLUE_TEXT_SHADOW_COLOR WORN_ITEM_SHADOW_COLOR = MessageConfig::BLUE_TEXT_SHADOW_COLOR

View File

@@ -1,7 +1,6 @@
class ClothesMartAdapter < OutfitsMartAdapter class ClothesMartAdapter < OutfitsMartAdapter
DEFAULT_NAME = "[unknown]" DEFAULT_NAME = "[unknown]"
DEFAULT_DESCRIPTION = "A piece of clothing that trainers can wear." DEFAULT_DESCRIPTION = "A piece of clothing that trainers can wear."
def toggleEvent(item) def toggleEvent(item)
if !isShop? && $Trainer.clothes_color != 0 if !isShop? && $Trainer.clothes_color != 0
if pbConfirmMessage(_INTL("Would you like to remove the dye?")) if pbConfirmMessage(_INTL("Would you like to remove the dye?"))
@@ -44,6 +43,7 @@ class ClothesMartAdapter < OutfitsMartAdapter
end end
def get_dye_color(item) def get_dye_color(item)
return 0 if isShop?
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes $Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
if $Trainer.dyed_clothes.include?(item.id) if $Trainer.dyed_clothes.include?(item.id)
return $Trainer.dyed_clothes[item.id] return $Trainer.dyed_clothes[item.id]
@@ -62,7 +62,9 @@ class ClothesMartAdapter < OutfitsMartAdapter
$Trainer.clothes_color=0 $Trainer.clothes_color=0
previewWindow.clothes_color=0 previewWindow.clothes_color=0
end end
echoln $Trainer.dyed_clothes else
$Trainer.clothes_color=0
previewWindow.clothes_color=0
end end
end end
@@ -84,6 +86,7 @@ class ClothesMartAdapter < OutfitsMartAdapter
def reset_player_clothes() def reset_player_clothes()
$Trainer.clothes = @worn_clothes $Trainer.clothes = @worn_clothes
$Trainer.clothes_color = $Trainer.dyed_clothes[@worn_clothes] if $Trainer.dyed_clothes && $Trainer.dyed_clothes[@worn_clothes]
end end
def get_unlocked_items_list() def get_unlocked_items_list()

View File

@@ -14,46 +14,58 @@ class ClothesShopPresenter < PokemonMartScreen
end end
def playerHatActionsMenu(item) def playerHatActionsMenu(item)
if $Trainer.hat_color != 0 is_player_hat = item.id == @adapter.worn_clothes
choice = pbMessage("What would you like to do?", ["Wear", "Remove dye", "Cancel"]) options = []
if choice == 0 if is_player_hat
options << "Take off"
else
options << "Wear"
end
remove_dye_option_available = $Trainer.hat_color != 0
options << "Remove dye" if remove_dye_option_available
options << "Cancel"
#if $Trainer.hat_color != 0
choice = pbMessage("What would you like to do?",options,-1)
if choice == 0
if is_player_hat #remove
@adapter.doSpecialItemAction(:REMOVE)
@scene.pbEndBuyScene
return false
else
#wear
putOnClothes(item) putOnClothes(item)
$Trainer.hat_color = @adapter.get_dye_color(item) $Trainer.hat_color = @adapter.get_dye_color(item)
return return false
elsif choice == 1
if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name))
$Trainer.hat_color = 0
end
return
end end
else elsif choice == 1 && remove_dye_option_available
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name)) if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name))
putOnClothes(item) $Trainer.hat_color = 0
return
end end
return true
end end
echoln "cancelled"
return true
end end
#returns if should stay in the menu #returns if should stay in the menu
def playerClothesActionsMenu(item) def playerClothesActionsMenu(item)
if $Trainer.clothes_color != 0 is_worn = item.id == @adapter.worn_clothes
choice = pbMessage("What would you like to do?", ["Wear", "Remove dye", "Cancel"]) options = []
if choice == 0 options << "Wear"
options << "Remove dye" if $Trainer.clothes_color != 0
options << "Cancel"
choice = pbMessage("What would you like to do?",options,-1)
if choice == 0
putOnClothes(item) putOnClothes(item)
$Trainer.clothes_color = @adapter.get_dye_color(item) $Trainer.clothes_color = @adapter.get_dye_color(item)
return false return false
elsif choice == 1 elsif choice == 1
if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name)) if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name))
$Trainer.clothes_color = 0 $Trainer.clothes_color = 0
end
return true
end
else
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
putOnClothes(item)
return false
end end
end end
return true
end end
def pbBuyScreen def pbBuyScreen
@@ -67,9 +79,12 @@ class ClothesShopPresenter < PokemonMartScreen
if @adapter.is_a?(ClothesMartAdapter) if @adapter.is_a?(ClothesMartAdapter)
stay_in_menu = playerClothesActionsMenu(item) stay_in_menu = playerClothesActionsMenu(item)
next if stay_in_menu next if stay_in_menu
return
elsif @adapter.is_a?(HatsMartAdapter) elsif @adapter.is_a?(HatsMartAdapter)
stay_in_menu = playerHatActionsMenu(item) stay_in_menu = playerHatActionsMenu(item)
echoln stay_in_menu
next if stay_in_menu next if stay_in_menu
return
else else
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name)) if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
putOnClothes(item) putOnClothes(item)

View File

@@ -152,8 +152,10 @@ class ClothesShopView < PokemonMart_Scene
end end
def pbEndBuyScene def pbEndBuyScene
@sprites["trainerPreview"].erase() if !@sprites.empty?
@sprites["trainerPreview"] = nil @sprites["trainerPreview"].erase()
@sprites["trainerPreview"] = nil
end
pbDisposeSpriteHash(@sprites) pbDisposeSpriteHash(@sprites)
@viewport.dispose @viewport.dispose
Kernel.pbClearText() Kernel.pbClearText()

View File

@@ -59,6 +59,7 @@ class HatsMartAdapter < OutfitsMartAdapter
end end
def get_dye_color(item) def get_dye_color(item)
return 0 if isShop?
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats $Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
if $Trainer.dyed_hats.include?(item.id) if $Trainer.dyed_hats.include?(item.id)
return $Trainer.dyed_hats[item.id] return $Trainer.dyed_hats[item.id]
@@ -79,6 +80,9 @@ class HatsMartAdapter < OutfitsMartAdapter
previewWindow.hat_color=0 previewWindow.hat_color=0
end end
echoln $Trainer.dyed_hats echoln $Trainer.dyed_hats
else
$Trainer.hat_color=0
previewWindow.hat_color=0
end end
end end
@@ -103,6 +107,7 @@ class HatsMartAdapter < OutfitsMartAdapter
def reset_player_clothes() def reset_player_clothes()
$Trainer.hat = @worn_clothes $Trainer.hat = @worn_clothes
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
end end
def get_unlocked_items_list() def get_unlocked_items_list()

Binary file not shown.

View File

@@ -190,7 +190,7 @@
"howToGet": "Given by exotic pokemon quest npc after completing all the quests" "howToGet": "Given by exotic pokemon quest npc after completing all the quests"
}, },
{ {
"id": "figthing", "id": "fighting",
"name": "Fighting Outfit", "name": "Fighting Outfit",
"description": "A sportsy outfit that is liked by those who practice martial arts. It captures the essence of Fighting-type Pokémon.", "description": "A sportsy outfit that is liked by those who practice martial arts. It captures the essence of Fighting-type Pokémon.",
"done": "yes", "done": "yes",

View File

@@ -125,7 +125,7 @@
"done": "yes", "done": "yes",
"len": 64, "len": 64,
"price": 0, "price": 0,
"tags": "headband,type-bug,special,", "tags": "headband,azalea",
"howToGet": "type trainer" "howToGet": "type trainer"
}, },
{ {
@@ -245,8 +245,8 @@
"name": "Designer Headphones", "name": "Designer Headphones",
"description": "Stylish headphones with an electrifying design that adds a spark to your look.", "description": "Stylish headphones with an electrifying design that adds a spark to your look.",
"done": "yes", "done": "yes",
"price": 0, "price": 30000,
"tags": "type-electric,special,", "tags": "hat",
"howToGet": "type trainer" "howToGet": "type trainer"
}, },
{ {
@@ -334,7 +334,7 @@
"name": "Firefighter Hat", "name": "Firefighter Hat",
"description": "A safety helmet made for brave heroes who put their lives on the line every day.", "description": "A safety helmet made for brave heroes who put their lives on the line every day.",
"price": 0, "price": 0,
"tags": "type-fire,special,", "tags": "hat, cinnabar,",
"howToGet": "type trainer" "howToGet": "type trainer"
}, },
{ {
@@ -775,7 +775,7 @@
{ {
"id": "parashroom", "id": "parashroom",
"name": "Mushroom", "name": "Mushroom",
"description": "a Tochukaso mushroom that normally grows on Paras and Parasect. Wear it. WEAR IT.", "description": "A Tochukaso mushroom that normally grows on Paras and Parasect. Wear it. WEAR IT.",
"done": "yes", "done": "yes",
"len": 81, "len": 81,
"price": 8000, "price": 8000,