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
def clothes_color=(value)
echoln value
echoln @clothes
echoln $Trainer.dyed_clothes
echoln caller
@clothes_color=value
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
$Trainer.dyed_clothes[@clothes] = value
$Trainer.dyed_clothes= {} if !$Trainer.dyed_clothes
$Trainer.dyed_clothes[@clothes] = value if value
refreshPlayerOutfit()
end
def hat_color=(value)
@hat_color=value
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
$Trainer.dyed_hats[@hat] = value
$Trainer.dyed_hats[@hat] = value if value
refreshPlayerOutfit()
end

View File

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

View File

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

View File

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

View File

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

View File

@@ -59,6 +59,7 @@ class HatsMartAdapter < OutfitsMartAdapter
end
def get_dye_color(item)
return 0 if isShop?
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
if $Trainer.dyed_hats.include?(item.id)
return $Trainer.dyed_hats[item.id]
@@ -79,6 +80,9 @@ class HatsMartAdapter < OutfitsMartAdapter
previewWindow.hat_color=0
end
echoln $Trainer.dyed_hats
else
$Trainer.hat_color=0
previewWindow.hat_color=0
end
end
@@ -103,6 +107,7 @@ class HatsMartAdapter < OutfitsMartAdapter
def reset_player_clothes()
$Trainer.hat = @worn_clothes
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
end
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"
},
{
"id": "figthing",
"id": "fighting",
"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.",
"done": "yes",

View File

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