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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -9,8 +9,8 @@ class Sprite_Player < Sprite_Character
hatFilename = "" hatFilename = ""
hairFilename = "" hairFilename = ""
@hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport) @hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport)
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport) @hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,3)
@hat2 = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,3) @hat2 = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,2)
@previous_skinTone = 0 @previous_skinTone = 0
@@ -63,11 +63,11 @@ class Sprite_Player < Sprite_Character
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename) outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
hairFilename = getOverworldHairFilename($Trainer.hair) hairFilename = getOverworldHairFilename($Trainer.hair)
hatFilename = getOverworldHatFilename($Trainer.hat) hatFilename = getOverworldHatFilename($Trainer.hat)
hat2Filename = getOverworldHatFilename($Trainer.hat2) hat2Filename = getOverworldHatFilename($Trainer.hat(true))
hair_color_shift = $Trainer.hair_color hair_color_shift = $Trainer.hair_color
hat_color_shift = $Trainer.hat_color hat_color_shift = $Trainer.hat_color
hat2_color_shift = $Trainer.hat2_color hat2_color_shift = $Trainer.hat_color(true)
clothes_color_shift = $Trainer.clothes_color clothes_color_shift = $Trainer.clothes_color

View File

@@ -27,10 +27,13 @@ class Player < Trainer
attr_accessor :dyed_clothes attr_accessor :dyed_clothes
attr_accessor :favorite_hat attr_accessor :favorite_hat
attr_accessor :favorite_hat2
attr_accessor :favorite_clothes attr_accessor :favorite_clothes
attr_accessor :last_worn_outfit attr_accessor :last_worn_outfit
attr_accessor :last_worn_hat attr_accessor :last_worn_hat
attr_accessor :last_worn_hat2
attr_accessor :surfing_pokemon attr_accessor :surfing_pokemon
@@ -94,8 +97,22 @@ class Player < Trainer
end end
def last_worn_hat def last_worn_hat(is_secondary=false)
return @last_worn_hat return is_secondary ? @last_worn_hat2 : @last_worn_hat
end
def set_last_worn_hat(value, is_secondary=false)
if is_secondary
@last_worn_hat = value
else
@last_worn_hat = value
end
end
def last_worn_hat2
return @last_worn_hat2
end end
# Sets the player's coins amount. It can not exceed {Settings::MAX_COINS}. # Sets the player's coins amount. It can not exceed {Settings::MAX_COINS}.
@@ -109,6 +126,41 @@ class Player < Trainer
@outfit=value @outfit=value
end end
def favorite_hat(is_secondary=false)
return is_secondary ? @favorite_hat2 : @favorite_hat
end
#todo change to set_favorite_hat(value,is_secondary=false)
def set_favorite_hat(value,is_secondary=false)
if is_secondary
@favorite_hat=value
else
@favorite_hat2=value
end
end
def hat_color(is_secondary=false)
return is_secondary ? @hat2_color : @hat_color
end
def hat(is_secondary=false)
return is_secondary ? @hat2 : @hat
end
def set_hat(value, is_secondary=false)
if value.is_a?(Symbol)
value = HATS[value].id
end
if is_secondary
@hat2= value
else
@hat=value
end
refreshPlayerOutfit()
end
#todo : refactor to always use set_hat instead
def hat=(value) def hat=(value)
if value.is_a?(Symbol) if value.is_a?(Symbol)
value = HATS[value].id value = HATS[value].id
@@ -117,6 +169,7 @@ class Player < Trainer
refreshPlayerOutfit() refreshPlayerOutfit()
end end
#todo : refactor to always use set_hat instead
def hat2=(value) def hat2=(value)
if value.is_a?(Symbol) if value.is_a?(Symbol)
value = HATS[value].id value = HATS[value].id
@@ -152,13 +205,34 @@ class Player < Trainer
$Trainer.dyed_clothes[@clothes] = value if value $Trainer.dyed_clothes[@clothes] = value if value
refreshPlayerOutfit() refreshPlayerOutfit()
end end
#todo change to set_hat_color(value,is_secondary)
def set_hat_color(value, is_secondary=false)
if is_secondary
@hat2_color=value
else
@hat_color=value
end
$Trainer.dyed_hats= {} if !$Trainer.dyed_hats
worn_hat = is_secondary ? @hat2 : @hat
$Trainer.dyed_hats[worn_hat] = value if value
refreshPlayerOutfit()
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 if value worn_hat = @hat
$Trainer.dyed_hats[worn_hat] = value if value
refreshPlayerOutfit() refreshPlayerOutfit()
end end
def hat2_color=(value)
@hat2_color=value
$Trainer.dyed_hats= {} if !$Trainer.dyed_hats
worn_hat = @hat2
$Trainer.dyed_hats[worn_hat] = value if value
refreshPlayerOutfit()
end
def unlock_clothes(outfitID,silent=false) def unlock_clothes(outfitID,silent=false)
update_global_clothes_list() update_global_clothes_list()
@@ -304,6 +378,7 @@ class Player < Trainer
@surfing_pokemon = nil @surfing_pokemon = nil
@last_worn_outfit = nil @last_worn_outfit = nil
@last_worn_hat = nil @last_worn_hat = nil
@last_worn_hat2 = nil
@dyed_hats = {} @dyed_hats = {}
@dyed_clothes = {} @dyed_clothes = {}

View File

@@ -143,10 +143,9 @@ def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil,
clothes_id = nil, hat_id = nil, hat2_id=nil, hair_id = nil, clothes_id = nil, hat_id = nil, hat2_id=nil, hair_id = nil,
skin_tone_id = nil, hair_color = nil, hat_color = nil, clothes_color = nil, skin_tone_id = nil, hair_color = nil, hat_color = nil, clothes_color = nil,
hat2_color = nil) hat2_color = nil)
echoln hat_id
clothes_id = $Trainer.clothes if !clothes_id clothes_id = $Trainer.clothes if !clothes_id
hat_id = $Trainer.hat if !hat_id hat_id = $Trainer.hat if !hat_id
hat2_id = $Trainer.hat if !hat2_id hat2_id = $Trainer.hat2 if !hat2_id
hair_id = $Trainer.hair if !hair_id hair_id = $Trainer.hair if !hair_id
skin_tone_id = $Trainer.skin_tone if !skin_tone_id skin_tone_id = $Trainer.skin_tone if !skin_tone_id
@@ -202,8 +201,8 @@ def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil,
baseBitmap.bitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) baseBitmap.bitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect)
end end
baseBitmap.bitmap.blt(0, 0, hairBitmapWrapper.bitmap, hairBitmapWrapper.bitmap.rect) if hairBitmapWrapper baseBitmap.bitmap.blt(0, 0, hairBitmapWrapper.bitmap, hairBitmapWrapper.bitmap.rect) if hairBitmapWrapper
baseBitmap.bitmap.blt(0, 0, hatBitmap.bitmap, hatBitmap.bitmap.rect) if hatBitmap
baseBitmap.bitmap.blt(0, 0, hat2Bitmap.bitmap, hat2Bitmap.bitmap.rect) if hat2Bitmap baseBitmap.bitmap.blt(0, 0, hat2Bitmap.bitmap, hat2Bitmap.bitmap.rect) if hat2Bitmap
baseBitmap.bitmap.blt(0, 0, hatBitmap.bitmap, hatBitmap.bitmap.rect) if hatBitmap
baseBitmap.bitmap.blt(44, 42, ballBitmap, ballBitmap.rect) if ballBitmap baseBitmap.bitmap.blt(44, 42, ballBitmap, ballBitmap.rect) if ballBitmap
return baseBitmap return baseBitmap

View File

@@ -27,12 +27,12 @@ def getPresenter(itemType, view, stock, adapter, versions)
end end
end end
def getAdapter(itemType, stock, isShop) def getAdapter(itemType, stock, isShop, is_secondary=false)
case itemType case itemType
when :CLOTHES when :CLOTHES
return ClothesMartAdapter.new(stock, isShop) return ClothesMartAdapter.new(stock, isShop)
when :HAT when :HAT
return HatsMartAdapter.new(stock, isShop) return HatsMartAdapter.new(stock, isShop,is_secondary)
when :HAIR when :HAIR
return HairMartAdapter.new(stock, isShop) return HairMartAdapter.new(stock, isShop)
end end
@@ -71,38 +71,45 @@ def hairShop(outfits_list = [],free=false, customMessage=nil)
genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage) genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage)
end end
def switchHatsPosition()
SWAP_HAT_POSITIONS_CAPTION = "Switch hats position"
def set_hat_adapter_options(adapter)
slot1_hat = $Trainer.hat ? "Swap #{get_hat_by_id($Trainer.hat).name}" : "(Empty slot)"
slot2_hat = $Trainer.hat2 ? "Swap #{get_hat_by_id($Trainer.hat2).name}" : "(Empty slot)"
options = [slot1_hat,slot2_hat]
options << SWAP_HAT_POSITIONS_CAPTION if $Trainer.hat && $Trainer.hat2
options << "Cancel"
hat_options_choice = optionsMenu(options)
if options[hat_options_choice] == SWAP_HAT_POSITIONS_CAPTION
hat1 = $Trainer.hat hat1 = $Trainer.hat
hat2 = $Trainer.hat2 hat2 = $Trainer.hat2
hat1_color = $Trainer.hat_color
hat2_color = $Trainer.hat2_color
$Trainer.hat = hat2 $Trainer.hat = hat2
$Trainer.hat2 = hat1 $Trainer.hat2 = hat1
$Trainer.hat_color = hat1_color
$Trainer.hat_color = hat2_color
pbSEPlay("GUI naming tab swap start") pbSEPlay("GUI naming tab swap start")
return set_hat_adapter_options(adapter)
end
if hat_options_choice == options.length #cancel
return nil
end
is_secondary = hat_options_choice ==1
adapter.set_secondary_hat(is_secondary)
return adapter
end end
def openSelectOutfitMenu(stock = [], itemType) SWAP_HAT_POSITIONS_CAPTION = "Switch hats position"
adapter = getAdapter(itemType, stock, false)
if adapter.is_a?(HatsMartAdapter) #unused
adapter = set_hat_adapter_options(adapter) # def set_hat_adapter_options(adapter)
return if !adapter # slot1_hat = $Trainer.hat ? "Swap #{get_hat_by_id($Trainer.hat).name}" : "(Empty slot)"
end # slot2_hat = $Trainer.hat2 ? "Swap #{get_hat_by_id($Trainer.hat2).name}" : "(Empty slot)"
# options = [slot1_hat,slot2_hat]
# options << SWAP_HAT_POSITIONS_CAPTION if $Trainer.hat && $Trainer.hat2
# options << "Cancel"
# hat_options_choice = optionsMenu(options)
# if options[hat_options_choice] == SWAP_HAT_POSITIONS_CAPTION
# switchHatsPosition()
# return nil
# end
# if hat_options_choice == options.length #cancel
# return nil
# end
# is_secondary = hat_options_choice ==1
# adapter.set_secondary_hat(is_secondary)
# return adapter
# end
#is_secondary only used for hats
def openSelectOutfitMenu(stock = [], itemType =nil, is_secondary=false)
adapter = getAdapter(itemType, stock, false, is_secondary)
view = ClothesShopView.new() view = ClothesShopView.new()
presenter = ClothesShopPresenter.new(view, stock, adapter) presenter = ClothesShopPresenter.new(view, stock, adapter)
presenter.pbBuyScreen presenter.pbBuyScreen
@@ -117,30 +124,42 @@ def changeClothesMenu()
openSelectOutfitMenu(stock, :CLOTHES) openSelectOutfitMenu(stock, :CLOTHES)
end end
def changeHatMenu() def changeHatMenu(is_secondary_hat = false)
stock = [] stock = []
$Trainer.unlocked_hats.each { |outfit_id| $Trainer.unlocked_hats.each { |outfit_id|
outfit = get_hat_by_id(outfit_id) outfit = get_hat_by_id(outfit_id)
stock << outfit if outfit stock << outfit if outfit
} }
stock << :REMOVE_HAT stock << :REMOVE_HAT
openSelectOutfitMenu(stock, :HAT) openSelectOutfitMenu(stock, :HAT, is_secondary_hat)
end end
def changeOutfit() def changeOutfit()
hat1_name = get_hat_by_id($Trainer.hat) ? get_hat_by_id($Trainer.hat).name : "(Empty)"
hat2_name = get_hat_by_id($Trainer.hat2) ? get_hat_by_id($Trainer.hat2).name : "(Empty)"
commands = [] commands = []
commands[cmdHat = commands.length] = _INTL("Change hat")
commands[cmdClothes = commands.length] = _INTL("Change clothes") commands[cmdClothes = commands.length] = _INTL("Change clothes")
commands[cmdHat = commands.length] = _INTL("Change hat 1 (#{hat1_name})")
commands[cmdHat2 = commands.length] = _INTL("Change hat 2 (#{hat2_name})")
commands[switchHats = commands.length] = _INTL("Switch hat positions")
commands[cmdQuit = commands.length] = _INTL("Quit") commands[cmdQuit = commands.length] = _INTL("Quit")
cmd = pbMessage(_INTL("What would you like to do?"), commands, cmdQuit + 1) #TODO change this into a graphical menu with icons
loop do loop do
cmd = pbMessage(_INTL("What would you like to do?"), commands, cmdQuit + 1)
if cmd == cmdClothes if cmd == cmdClothes
changeClothesMenu() changeClothesMenu()
break break
elsif cmd == cmdHat elsif cmd == cmdHat
changeHatMenu() changeHatMenu()
break break
elsif cmd == cmdHat2
changeHatMenu(true)
break
elsif cmd == switchHats
switchHatsPosition()
break
else else
break break
end end

View File

@@ -13,7 +13,7 @@ class ClothesShopPresenter < PokemonMartScreen
@scene.pbEndBuyScene @scene.pbEndBuyScene
end end
def playerHatActionsMenu(item) def playerHatActionsMenu(item, is_secondary=false)
is_player_hat = item.id == @adapter.worn_clothes is_player_hat = item.id == @adapter.worn_clothes
options = [] options = []
if is_player_hat if is_player_hat
@@ -22,10 +22,10 @@ class ClothesShopPresenter < PokemonMartScreen
options << "Wear" options << "Wear"
end 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 << "Remove dye" if remove_dye_option_available
options << "Mark 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 == item.id options << "Unmark as favorite" if $Trainer.favorite_hat(@adapter.is_secondary_hat) == item.id
options << "Cancel" options << "Cancel"
# if $Trainer.hat_color != 0 # if $Trainer.hat_color != 0
@@ -38,21 +38,22 @@ class ClothesShopPresenter < PokemonMartScreen
else else
# wear # wear
putOnClothes(item) 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 return false
end end
elsif choice == 1 && remove_dye_option_available elsif choice == 1 && remove_dye_option_available
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.hat_color = 0 $Trainer.set_hat_color(0,@adapter.is_secondary_hat)
end end
return true return true
elsif options[choice] == "Mark as favorite" elsif options[choice] == "Mark as favorite"
$Trainer.favorite_hat = item.id 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") pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is now your favorite!") pbMessage("The #{item.name} is now your favorite (#{slot})!")
echoln "marked #{item.id} as favorite hat" echoln "marked #{item.id} as favorite hat"
elsif options[choice] == "Unmark as favorite" 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") pbSEPlay("GUI storage show party panel")
pbMessage("The #{item.name} is no longer marked as your favorite!") pbMessage("The #{item.name} is no longer marked as your favorite!")
end end

View File

@@ -3,34 +3,23 @@ class HatsMartAdapter < OutfitsMartAdapter
DEFAULT_DESCRIPTION = "A headgear that trainers can wear." DEFAULT_DESCRIPTION = "A headgear that trainers can wear."
def initialize(stock = nil, isShop = nil, isSecondaryHat = false) def initialize(stock = nil, isShop = nil, isSecondaryHat = false)
super(stock,isShop) super(stock,isShop,isSecondaryHat)
@is_secondary_hat = isSecondaryHat
end end
def toggleEvent(item) def toggleEvent(item)
if !@isShop if !@isShop
if @is_secondary_hat $Trainer.set_hat(nil,@is_secondary_hat)
$Trainer.hat2 = nil
@worn_clothes = nil @worn_clothes = nil
if pbConfirmMessage(_INTL("Do you want to take off your hat?")) if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
$Trainer.hat2 = nil $Trainer.set_hat(nil,@is_secondary_hat)
@worn_clothes = nil @worn_clothes = nil
end end
else
$Trainer.hat = nil
@worn_clothes = nil
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
$Trainer.hat = nil
@worn_clothes = nil
end
end
end end
end end
def set_secondary_hat(value) def set_secondary_hat(value)
echoln "WOWOWO setting secondary hat value"
@is_secondary_hat = value @is_secondary_hat = value
end end
@@ -48,7 +37,7 @@ class HatsMartAdapter < OutfitsMartAdapter
def getDisplayName(item) def getDisplayName(item)
return getName(item) if !item.name return getName(item) if !item.name
name = item.name name = item.name
name = "* #{name}" if item.id == $Trainer.favorite_hat name = "* #{name}" if item.id == $Trainer.favorite_hat(@is_secondary_hat)
return name return name
end end
@@ -63,25 +52,14 @@ class HatsMartAdapter < OutfitsMartAdapter
end end
def updateTrainerPreview(item, previewWindow) def updateTrainerPreview(item, previewWindow)
if @is_secondary_hat
if item.is_a?(Outfit)
previewWindow.hat2 = item.id
$Trainer.hat2 = item.id# unless $Trainer.hat==nil
set_dye_color(item,previewWindow)
else
$Trainer.hat2=nil
previewWindow.hat2= nil
end
else
if item.is_a?(Outfit) if item.is_a?(Outfit)
previewWindow.hat = item.id previewWindow.hat = item.id
$Trainer.hat = item.id# unless $Trainer.hat==nil $Trainer.set_hat(item.id,@is_secondary_hat)# unless $Trainer.hat==nil
set_dye_color(item,previewWindow) set_dye_color(item,previewWindow)
else else
$Trainer.hat=nil $Trainer.set_hat(nil,@is_secondary_hat)
previewWindow.hat= nil previewWindow.hat= nil
end end
end
pbRefreshSceneMap pbRefreshSceneMap
@@ -100,18 +78,18 @@ class HatsMartAdapter < OutfitsMartAdapter
def set_dye_color(item,previewWindow) def set_dye_color(item,previewWindow)
if !isShop? 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)
dye_color = $Trainer.dyed_hats[item.id] dye_color = $Trainer.dyed_hats[item.id]
$Trainer.hat_color = dye_color $Trainer.set_hat_color(dye_color,@is_secondary_hat)
previewWindow.hat_color = dye_color previewWindow.hat_color = dye_color
else else
$Trainer.hat_color=0 $Trainer.set_hat_color(0,@is_secondary_hat)
previewWindow.hat_color=0 previewWindow.hat_color=0
end end
#echoln $Trainer.dyed_hats #echoln $Trainer.dyed_hats
else else
$Trainer.hat_color=0 $Trainer.set_hat_color(0,@is_secondary_hat)
previewWindow.hat_color=0 previewWindow.hat_color=0
end end
end end
@@ -126,28 +104,18 @@ class HatsMartAdapter < OutfitsMartAdapter
end end
def get_current_clothes() def get_current_clothes()
return $Trainer.hat return $Trainer.hat(@is_secondary_hat)
end end
def putOnOutfit(item) def putOnOutfit(item)
return unless item.is_a?(Outfit) return unless item.is_a?(Outfit)
if @is_secondary_hat putOnHat(item.id,false,@is_secondary_hat)
echoln "broder"
putOnSecondaryHat(item.id)
else
putOnHat(item.id)
end
@worn_clothes = item.id @worn_clothes = item.id
end end
def reset_player_clothes() def reset_player_clothes()
if @is_secondary_hat $Trainer.set_hat(@worn_clothes,@is_secondary_hat)
$Trainer.hat2 = @worn_clothes $Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes],@is_secondary_hat) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
$Trainer.hat2_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
else
$Trainer.hat = @worn_clothes
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
end
end end
def get_unlocked_items_list() def get_unlocked_items_list()

View File

@@ -16,8 +16,8 @@ def obtainHat(outfit_id,secondary=false)
$Trainer.unlocked_hats << outfit_id if !$Trainer.unlocked_hats.include?(outfit_id) $Trainer.unlocked_hats << outfit_id if !$Trainer.unlocked_hats.include?(outfit_id)
obtainOutfitMessage(outfit) obtainOutfitMessage(outfit)
if pbConfirmMessage("Would you like to put it on right now?") if pbConfirmMessage("Would you like to put it on right now?")
putOnHat(outfit_id, false, ) if !secondary putOnHat(outfit_id, false, false) if !secondary
putOnSecondaryHat(outfit_id, false, ) if secondary putOnHat(outfit_id, false, true) if secondary
return true return true
end end
return false return false
@@ -67,12 +67,12 @@ def putOnClothes(outfit_id, silent = false)
putOnOutfitMessage(outfit) if !silent putOnOutfitMessage(outfit) if !silent
end end
def putOnHat(outfit_id, silent = false) def putOnHat(outfit_id, silent = false, is_secondary=false)
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats $Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
$Trainer.last_worn_hat = $Trainer.hat $Trainer.set_last_worn_hat($Trainer.hat,is_secondary)
outfit = get_hat_by_id(outfit_id) outfit = get_hat_by_id(outfit_id)
$Trainer.hat = outfit_id $Trainer.set_hat(outfit_id,is_secondary)
dye_color = $Trainer.dyed_hats[outfit_id] dye_color = $Trainer.dyed_hats[outfit_id]
if dye_color if dye_color
@@ -85,24 +85,6 @@ def putOnHat(outfit_id, silent = false)
putOnOutfitMessage(outfit) if !silent putOnOutfitMessage(outfit) if !silent
end end
def putOnSecondaryHat(outfit_id, silent = false)
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
$Trainer.last_worn_hat = $Trainer.hat2
outfit = get_hat_by_id(outfit_id)
$Trainer.hat2 = outfit_id
dye_color = $Trainer.dyed_hats[outfit_id]
if dye_color
$Trainer.hat2_color = dye_color
else
$Trainer.hat2_color = nil
end
$game_map.refreshPlayerOutfit()
putOnOutfitMessage(outfit) if !silent
end
def putOnHairFullId(full_outfit_id) def putOnHairFullId(full_outfit_id)
outfit_id = getSplitHairFilenameAndVersionFromID(full_outfit_id)[1] outfit_id = getSplitHairFilenameAndVersionFromID(full_outfit_id)[1]
@@ -193,7 +175,7 @@ def isWearingClothes(outfitId)
end end
def isWearingHat(outfitId) def isWearingHat(outfitId)
return $Trainer.hat == outfitId return $Trainer.hat == outfitId || $Trainer.hat2 == outfitId
end end
def isWearingHairstyle(outfitId, version = nil) def isWearingHairstyle(outfitId, version = nil)
@@ -309,13 +291,18 @@ end
def randomizePlayerOutfitUnlocked() def randomizePlayerOutfitUnlocked()
$Trainer.hat = $Trainer.unlocked_hats.sample $Trainer.hat = $Trainer.unlocked_hats.sample
$Trainer.hat2 = $Trainer.unlocked_hats.sample
$Trainer.clothes = $Trainer.unlocked_clothes.sample $Trainer.clothes = $Trainer.unlocked_clothes.sample
dye_hat = rand(2)==0 dye_hat = rand(2)==0
dye_hat2 = rand(2)==0
dye_clothes = rand(2)==0 dye_clothes = rand(2)==0
dye_hair = rand(2)==0 dye_hair = rand(2)==0
$Trainer.hat2 = nil if rand(3)==0
$Trainer.hat_color = dye_hat ? rand(255) : 0 $Trainer.hat_color = dye_hat ? rand(255) : 0
$Trainer.hat2_color = dye_hat2 ? rand(255) : 0
$Trainer.clothes_color = dye_clothes ? rand(255) : 0 $Trainer.clothes_color = dye_clothes ? rand(255) : 0
$Trainer.hair_color = dye_hair ? rand(255) : 0 $Trainer.hair_color = dye_hair ? rand(255) : 0
@@ -328,8 +315,12 @@ end
def randomizePlayerOutfit() def randomizePlayerOutfit()
$Trainer.hat = $PokemonGlobal.hats_data.keys.sample $Trainer.hat = $PokemonGlobal.hats_data.keys.sample
$Trainer.hat2 = $PokemonGlobal.hats_data.keys.sample $Trainer.hat2 = $PokemonGlobal.hats_data.keys.sample
$Trainer.hat2 = nil if(rand(3)==0)
$Trainer.clothes = $PokemonGlobal.clothes_data.keys.sample $Trainer.clothes = $PokemonGlobal.clothes_data.keys.sample
$Trainer.hat_color = rand(2)==0 ? rand(255) : 0 $Trainer.hat_color = rand(2)==0 ? rand(255) : 0
$Trainer.hat2_color = rand(2)==0 ? rand(255) : 0
$Trainer.clothes_color = rand(2)==0 ? rand(255) : 0 $Trainer.clothes_color = rand(2)==0 ? rand(255) : 0
$Trainer.hair_color = rand(2)==0 ? rand(255) : 0 $Trainer.hair_color = rand(2)==0 ? rand(255) : 0

View File

@@ -1,5 +1,3 @@
ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle| ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle|
battle.decision = 3 battle.decision = 3
battle.pbDisplayPaused(_INTL("Got away safely!")) battle.pbDisplayPaused(_INTL("Got away safely!"))
@@ -93,8 +91,6 @@ def useTeleporter()
end end
end end
ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle| ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle|
battle.decision = 3 battle.decision = 3
battle.pbDisplayPaused(_INTL("Got away safely!")) battle.pbDisplayPaused(_INTL("Got away safely!"))
@@ -378,19 +374,24 @@ ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item|
}) })
def useFavoriteOutfit() def useFavoriteOutfit()
if !$Trainer.favorite_clothes && !$Trainer.favorite_hat if !$Trainer.favorite_clothes && !$Trainer.favorite_hat && !$Trainer.favorite_hat2
pbMessage(_INTL("You can mark clothes and hats as your favorites in the outfits menu and use this to quickly switch to them!")) pbMessage(_INTL("You can mark clothes and hats as your favorites in the outfits menu and use this to quickly switch to them!"))
return 0 return 0
end end
if isWearingFavoriteOutfit() if isWearingFavoriteOutfit()
if (Kernel.pbConfirmMessage("Remove your favorite outfit?")) if (Kernel.pbConfirmMessage("Remove your favorite outfit?"))
if ($Trainer.last_worn_outfit == $Trainer.favorite_clothes && $Trainer.last_worn_hat == $Trainer.favorite_hat) last_worn_clothes_is_favorite = $Trainer.last_worn_outfit == $Trainer.favorite_clothes
last_worn_hat_is_favorite = $Trainer.last_worn_hat == $Trainer.favorite_hat
last_worn_hat2_is_favorite = $Trainer.last_worn_hat2 == $Trainer.favorite_hat2
if (last_worn_clothes_is_favorite && last_worn_hat_is_favorite && last_worn_hat2_is_favorite)
$Trainer.last_worn_outfit = getDefaultClothes() $Trainer.last_worn_outfit = getDefaultClothes()
end end
playOutfitChangeAnimation() playOutfitChangeAnimation()
putOnClothes($Trainer.last_worn_outfit, true) if $Trainer.favorite_clothes putOnClothes($Trainer.last_worn_outfit, true) if $Trainer.favorite_clothes
putOnHat($Trainer.last_worn_hat, true) if $Trainer.favorite_hat putOnHat($Trainer.last_worn_hat, true,false) if $Trainer.favorite_hat
putOnHat($Trainer.last_worn_hat2, true,true) if $Trainer.favorite_hat2
else else
return 0 return 0
end end
@@ -399,7 +400,8 @@ def useFavoriteOutfit()
if (Kernel.pbConfirmMessage("Put on your favorite outfit?")) if (Kernel.pbConfirmMessage("Put on your favorite outfit?"))
playOutfitChangeAnimation() playOutfitChangeAnimation()
putOnClothes($Trainer.favorite_clothes, true) if $Trainer.favorite_clothes putOnClothes($Trainer.favorite_clothes, true) if $Trainer.favorite_clothes
putOnHat($Trainer.favorite_hat, true) if $Trainer.favorite_hat putOnHat($Trainer.favorite_hat, true, false) if $Trainer.favorite_hat
putOnHat($Trainer.favorite_hat2, true, true) if $Trainer.favorite_hat2
else else
return 0 return 0
end end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -319,6 +319,10 @@
"price": 3000, "price": 3000,
"tags": "special" "tags": "special"
}, },
{
"id": "lyra",
"name": "Springy Pigtails"
},
{ {
"id": "mawile", "id": "mawile",
"name": "Long Teethed Ponytail", "name": "Long Teethed Ponytail",

View File

@@ -1,2 +1,4 @@
1739937414 1740086845
1739937415 1740086846
1740086849
1740086850