mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Track dyed clothes individually
This commit is contained in:
@@ -19,6 +19,10 @@ class Player < Trainer
|
||||
attr_accessor :unlocked_hairstyles
|
||||
attr_accessor :unlocked_card_backgrounds
|
||||
|
||||
attr_accessor :dyed_hats
|
||||
attr_accessor :dyed_clothes
|
||||
|
||||
|
||||
attr_accessor :last_worn_outfit
|
||||
attr_accessor :last_worn_hat
|
||||
|
||||
@@ -121,6 +125,19 @@ class Player < Trainer
|
||||
refreshPlayerOutfit()
|
||||
end
|
||||
|
||||
def clothes_color=(value)
|
||||
@clothes_color=value
|
||||
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
|
||||
$Trainer.dyed_clothes[@clothes] = value
|
||||
refreshPlayerOutfit()
|
||||
end
|
||||
def hat_color=(value)
|
||||
@hat_color=value
|
||||
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
|
||||
$Trainer.dyed_hats[@hat] = value
|
||||
refreshPlayerOutfit()
|
||||
end
|
||||
|
||||
|
||||
def unlock_clothes(outfitID,silent=false)
|
||||
update_global_clothes_list()
|
||||
@@ -265,6 +282,10 @@ class Player < Trainer
|
||||
@last_worn_outfit = nil
|
||||
@last_worn_hat = nil
|
||||
|
||||
@dyed_hats = {}
|
||||
@dyed_clothes = {}
|
||||
|
||||
|
||||
@card_background = Settings::DEFAULT_TRAINER_CARD_BG
|
||||
@unlocked_card_backgrounds = [@card_background]
|
||||
end
|
||||
|
||||
@@ -155,7 +155,6 @@ end
|
||||
|
||||
def get_clothes_by_id(id)
|
||||
update_global_outfit_lists()
|
||||
echoln $PokemonGlobal.clothes_data
|
||||
return $PokemonGlobal.clothes_data.has_key?(id) ? $PokemonGlobal.clothes_data[id] : nil
|
||||
end
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -49,22 +49,37 @@ def obtainNewHairstyle(full_outfit_id)
|
||||
end
|
||||
|
||||
def putOnClothes(outfit_id, silent = false)
|
||||
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
|
||||
$Trainer.last_worn_outfit = $Trainer.clothes
|
||||
outfit = get_clothes_by_id(outfit_id)
|
||||
$Trainer.clothes = outfit_id
|
||||
$Trainer.clothes_color = nil
|
||||
|
||||
dye_color = $Trainer.dyed_clothes[outfit_id]
|
||||
if dye_color
|
||||
$Trainer.clothes_color = dye_color
|
||||
else
|
||||
$Trainer.clothes_color = nil
|
||||
end
|
||||
|
||||
$game_map.update
|
||||
refreshPlayerOutfit()
|
||||
putOnOutfitMessage(outfit) if !silent
|
||||
end
|
||||
|
||||
def putOnHat(outfit_id, silent = false)
|
||||
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
|
||||
$Trainer.last_worn_hat = $Trainer.hat
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
$Trainer.hat = outfit_id
|
||||
$Trainer.hat_color = nil
|
||||
$game_map.
|
||||
refreshPlayerOutfit()
|
||||
|
||||
dye_color = $Trainer.dyed_clothes[outfit_id]
|
||||
if dye_color
|
||||
$Trainer.clothes_color = dye_color
|
||||
else
|
||||
$Trainer.clothes_color = nil
|
||||
end
|
||||
|
||||
$game_map.refreshPlayerOutfit()
|
||||
putOnOutfitMessage(outfit) if !silent
|
||||
end
|
||||
|
||||
|
||||
@@ -1489,6 +1489,8 @@ def isPlayerFemale()
|
||||
return pbGet(VAR_TRAINER_GENDER) == GENDER_FEMALE
|
||||
end
|
||||
|
||||
|
||||
|
||||
def optionsMenu(options = [], cmdIfCancel = -1, startingOption = 0)
|
||||
cmdIfCancel = -1 if !cmdIfCancel
|
||||
result = pbShowCommands(nil, options, cmdIfCancel, startingOption)
|
||||
|
||||
Reference in New Issue
Block a user