Track dyed clothes individually

This commit is contained in:
infinitefusion
2024-12-27 22:58:50 -05:00
parent 5e07802681
commit de8f9603dc
23 changed files with 3435 additions and 73 deletions

View File

@@ -2,6 +2,14 @@ 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?"))
$Trainer.clothes_color = 0
end
end
end
def initialize(stock = nil, isShop = nil)
super
end
@@ -29,10 +37,34 @@ class ClothesMartAdapter < OutfitsMartAdapter
return if !item
previewWindow.clothes = item.id
$Trainer.clothes = item.id
set_dye_color(item,previewWindow)
pbRefreshSceneMap
previewWindow.updatePreview()
end
def get_dye_color(item)
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
if $Trainer.dyed_clothes.include?(item.id)
return $Trainer.dyed_clothes[item.id]
end
return 0
end
def set_dye_color(item,previewWindow)
if !isShop?
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
if $Trainer.dyed_clothes.include?(item.id)
dye_color = $Trainer.dyed_clothes[item.id]
$Trainer.clothes_color = dye_color
previewWindow.clothes_color = dye_color
else
$Trainer.clothes_color=0
previewWindow.clothes_color=0
end
echoln $Trainer.dyed_clothes
end
end
def addItem(item)
changed_clothes = obtainClothes(item.id)

View File

@@ -3,11 +3,58 @@ class ClothesShopPresenter < PokemonMartScreen
end
def initialize(scene, stock, adapter = nil, versions=false)
super(scene,stock,adapter)
def initialize(scene, stock, adapter = nil, versions = false)
super(scene, stock, adapter)
@use_versions = versions
end
def putOnClothes(item)
@adapter.putOnOutfit(item)
@scene.pbEndBuyScene
end
def playerHatActionsMenu(item)
if $Trainer.hat_color != 0
choice = pbMessage("What would you like to do?", ["Wear", "Remove dye", "Cancel"])
if choice == 0
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
end
else
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
putOnClothes(item)
return
end
end
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
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
end
end
end
def pbBuyScreen
@scene.pbStartBuyScene(@stock, @adapter)
@@ -17,15 +64,21 @@ class ClothesShopPresenter < PokemonMartScreen
break if !item
if !@adapter.isShop?
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
@adapter.putOnOutfit(item)
@scene.pbEndBuyScene
return
if @adapter.is_a?(ClothesMartAdapter)
stay_in_menu = playerClothesActionsMenu(item)
next if stay_in_menu
elsif @adapter.is_a?(HatsMartAdapter)
stay_in_menu = playerHatActionsMenu(item)
next if stay_in_menu
else
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
putOnClothes(item)
return
end
next
end
next
end
itemname = @adapter.getDisplayName(item)
price = @adapter.getPrice(item)
if !price.is_a?(Integer)

View File

@@ -93,6 +93,7 @@ class ClothesShopView < PokemonMart_Scene
def pbChooseBuyItem
itemwindow = @sprites["itemwindow"]
refreshStock(@adapter) if !itemwindow
displayNewItem(itemwindow)
@sprites["helpwindow"].visible = false
pbActivateWindow(@sprites, "itemwindow") {

View File

@@ -49,6 +49,7 @@ class HatsMartAdapter < OutfitsMartAdapter
if item.is_a?(Outfit)
previewWindow.hat = item.id
$Trainer.hat = item.id# unless $Trainer.hat==nil
set_dye_color(item,previewWindow)
else
$Trainer.hat=nil
previewWindow.hat= nil
@@ -56,6 +57,31 @@ class HatsMartAdapter < OutfitsMartAdapter
pbRefreshSceneMap
previewWindow.updatePreview()
end
def get_dye_color(item)
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
if $Trainer.dyed_hats.include?(item.id)
return $Trainer.dyed_hats[item.id]
end
return 0
end
def set_dye_color(item,previewWindow)
if !isShop?
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
if $Trainer.dyed_hats.include?(item.id)
dye_color = $Trainer.dyed_hats[item.id]
$Trainer.hat_color = dye_color
previewWindow.hat_color = dye_color
else
$Trainer.hat_color=0
previewWindow.hat_color=0
end
echoln $Trainer.dyed_hats
end
end
def addItem(item)
return unless item.is_a?(Outfit)