mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Refactor: double hats
This commit is contained in:
@@ -9,8 +9,8 @@ class Sprite_Player < Sprite_Character
|
||||
hatFilename = ""
|
||||
hairFilename = ""
|
||||
@hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport)
|
||||
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport)
|
||||
@hat2 = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,3)
|
||||
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,3)
|
||||
@hat2 = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,2)
|
||||
|
||||
@previous_skinTone = 0
|
||||
|
||||
@@ -63,11 +63,11 @@ class Sprite_Player < Sprite_Character
|
||||
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
|
||||
hairFilename = getOverworldHairFilename($Trainer.hair)
|
||||
hatFilename = getOverworldHatFilename($Trainer.hat)
|
||||
hat2Filename = getOverworldHatFilename($Trainer.hat2)
|
||||
hat2Filename = getOverworldHatFilename($Trainer.hat(true))
|
||||
|
||||
hair_color_shift = $Trainer.hair_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
|
||||
|
||||
|
||||
@@ -27,10 +27,13 @@ class Player < Trainer
|
||||
attr_accessor :dyed_clothes
|
||||
|
||||
attr_accessor :favorite_hat
|
||||
attr_accessor :favorite_hat2
|
||||
|
||||
attr_accessor :favorite_clothes
|
||||
|
||||
attr_accessor :last_worn_outfit
|
||||
attr_accessor :last_worn_hat
|
||||
attr_accessor :last_worn_hat2
|
||||
|
||||
attr_accessor :surfing_pokemon
|
||||
|
||||
@@ -94,8 +97,22 @@ class Player < Trainer
|
||||
end
|
||||
|
||||
|
||||
def last_worn_hat
|
||||
return @last_worn_hat
|
||||
def last_worn_hat(is_secondary=false)
|
||||
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
|
||||
|
||||
# Sets the player's coins amount. It can not exceed {Settings::MAX_COINS}.
|
||||
@@ -109,6 +126,41 @@ class Player < Trainer
|
||||
@outfit=value
|
||||
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)
|
||||
if value.is_a?(Symbol)
|
||||
value = HATS[value].id
|
||||
@@ -117,6 +169,7 @@ class Player < Trainer
|
||||
refreshPlayerOutfit()
|
||||
end
|
||||
|
||||
#todo : refactor to always use set_hat instead
|
||||
def hat2=(value)
|
||||
if value.is_a?(Symbol)
|
||||
value = HATS[value].id
|
||||
@@ -152,13 +205,34 @@ class Player < Trainer
|
||||
$Trainer.dyed_clothes[@clothes] = value if value
|
||||
refreshPlayerOutfit()
|
||||
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)
|
||||
@hat_color=value
|
||||
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
|
||||
$Trainer.dyed_hats[@hat] = value if value
|
||||
$Trainer.dyed_hats= {} if !$Trainer.dyed_hats
|
||||
worn_hat = @hat
|
||||
$Trainer.dyed_hats[worn_hat] = value if value
|
||||
refreshPlayerOutfit()
|
||||
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)
|
||||
update_global_clothes_list()
|
||||
@@ -304,6 +378,7 @@ class Player < Trainer
|
||||
@surfing_pokemon = nil
|
||||
@last_worn_outfit = nil
|
||||
@last_worn_hat = nil
|
||||
@last_worn_hat2 = nil
|
||||
|
||||
@dyed_hats = {}
|
||||
@dyed_clothes = {}
|
||||
|
||||
@@ -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,
|
||||
skin_tone_id = nil, hair_color = nil, hat_color = nil, clothes_color = nil,
|
||||
hat2_color = nil)
|
||||
echoln hat_id
|
||||
clothes_id = $Trainer.clothes if !clothes_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
|
||||
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)
|
||||
end
|
||||
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, hatBitmap.bitmap, hatBitmap.bitmap.rect) if hatBitmap
|
||||
baseBitmap.bitmap.blt(44, 42, ballBitmap, ballBitmap.rect) if ballBitmap
|
||||
|
||||
return baseBitmap
|
||||
|
||||
@@ -27,12 +27,12 @@ def getPresenter(itemType, view, stock, adapter, versions)
|
||||
end
|
||||
end
|
||||
|
||||
def getAdapter(itemType, stock, isShop)
|
||||
def getAdapter(itemType, stock, isShop, is_secondary=false)
|
||||
case itemType
|
||||
when :CLOTHES
|
||||
return ClothesMartAdapter.new(stock, isShop)
|
||||
when :HAT
|
||||
return HatsMartAdapter.new(stock, isShop)
|
||||
return HatsMartAdapter.new(stock, isShop,is_secondary)
|
||||
when :HAIR
|
||||
return HairMartAdapter.new(stock, isShop)
|
||||
end
|
||||
@@ -71,38 +71,45 @@ def hairShop(outfits_list = [],free=false, customMessage=nil)
|
||||
genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage)
|
||||
end
|
||||
|
||||
def switchHatsPosition()
|
||||
hat1 = $Trainer.hat
|
||||
hat2 = $Trainer.hat2
|
||||
hat1_color = $Trainer.hat_color
|
||||
hat2_color = $Trainer.hat2_color
|
||||
|
||||
$Trainer.hat = hat2
|
||||
$Trainer.hat2 = hat1
|
||||
$Trainer.hat_color = hat1_color
|
||||
$Trainer.hat_color = hat2_color
|
||||
|
||||
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
|
||||
hat2 = $Trainer.hat2
|
||||
$Trainer.hat = hat2
|
||||
$Trainer.hat2 = hat1
|
||||
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
|
||||
pbSEPlay("GUI naming tab swap start")
|
||||
end
|
||||
|
||||
def openSelectOutfitMenu(stock = [], itemType)
|
||||
adapter = getAdapter(itemType, stock, false)
|
||||
if adapter.is_a?(HatsMartAdapter)
|
||||
adapter = set_hat_adapter_options(adapter)
|
||||
return if !adapter
|
||||
end
|
||||
SWAP_HAT_POSITIONS_CAPTION = "Switch hats position"
|
||||
|
||||
#unused
|
||||
# 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
|
||||
# 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()
|
||||
presenter = ClothesShopPresenter.new(view, stock, adapter)
|
||||
presenter.pbBuyScreen
|
||||
@@ -117,30 +124,42 @@ def changeClothesMenu()
|
||||
openSelectOutfitMenu(stock, :CLOTHES)
|
||||
end
|
||||
|
||||
def changeHatMenu()
|
||||
def changeHatMenu(is_secondary_hat = false)
|
||||
stock = []
|
||||
$Trainer.unlocked_hats.each { |outfit_id|
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
stock << :REMOVE_HAT
|
||||
openSelectOutfitMenu(stock, :HAT)
|
||||
openSelectOutfitMenu(stock, :HAT, is_secondary_hat)
|
||||
end
|
||||
|
||||
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[cmdHat = commands.length] = _INTL("Change hat")
|
||||
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")
|
||||
|
||||
cmd = pbMessage(_INTL("What would you like to do?"), commands, cmdQuit + 1)
|
||||
#TODO change this into a graphical menu with icons
|
||||
loop do
|
||||
cmd = pbMessage(_INTL("What would you like to do?"), commands, cmdQuit + 1)
|
||||
if cmd == cmdClothes
|
||||
changeClothesMenu()
|
||||
break
|
||||
elsif cmd == cmdHat
|
||||
changeHatMenu()
|
||||
break
|
||||
elsif cmd == cmdHat2
|
||||
changeHatMenu(true)
|
||||
break
|
||||
elsif cmd == switchHats
|
||||
switchHatsPosition()
|
||||
break
|
||||
else
|
||||
break
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
@scene.pbEndBuyScene
|
||||
end
|
||||
|
||||
def playerHatActionsMenu(item)
|
||||
def playerHatActionsMenu(item, is_secondary=false)
|
||||
is_player_hat = item.id == @adapter.worn_clothes
|
||||
options = []
|
||||
if is_player_hat
|
||||
@@ -22,10 +22,10 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
options << "Wear"
|
||||
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 << "Mark as favorite" if $Trainer.favorite_hat != item.id
|
||||
options << "Unmark 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(@adapter.is_secondary_hat) == item.id
|
||||
|
||||
options << "Cancel"
|
||||
# if $Trainer.hat_color != 0
|
||||
@@ -38,21 +38,22 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
else
|
||||
# wear
|
||||
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
|
||||
end
|
||||
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
|
||||
$Trainer.set_hat_color(0,@adapter.is_secondary_hat)
|
||||
end
|
||||
return true
|
||||
elsif options[choice] == "Mark as favorite"
|
||||
$Trainer.favorite_hat = item.id
|
||||
pbSEPlay("GUI storage show party panel")
|
||||
pbMessage("The #{item.name} is now your favorite!")
|
||||
echoln "marked #{item.id} as favorite hat"
|
||||
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")
|
||||
pbMessage("The #{item.name} is now your favorite (#{slot})!")
|
||||
echoln "marked #{item.id} as favorite hat"
|
||||
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")
|
||||
pbMessage("The #{item.name} is no longer marked as your favorite!")
|
||||
end
|
||||
@@ -80,9 +81,9 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
$Trainer.clothes_color = 0
|
||||
end
|
||||
elsif options[choice] == "Mark as favorite"
|
||||
$Trainer.favorite_clothes = item.id
|
||||
pbSEPlay("GUI storage show party panel")
|
||||
pbMessage("The #{item.name} is now your favorite!")
|
||||
$Trainer.favorite_clothes = item.id
|
||||
pbSEPlay("GUI storage show party panel")
|
||||
pbMessage("The #{item.name} is now your favorite!")
|
||||
elsif options[choice] == "Unmark favorite"
|
||||
$Trainer.favorite_clothes = nil
|
||||
pbSEPlay("GUI storage show party panel")
|
||||
|
||||
@@ -3,34 +3,23 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
DEFAULT_DESCRIPTION = "A headgear that trainers can wear."
|
||||
|
||||
def initialize(stock = nil, isShop = nil, isSecondaryHat = false)
|
||||
super(stock,isShop)
|
||||
@is_secondary_hat = isSecondaryHat
|
||||
super(stock,isShop,isSecondaryHat)
|
||||
end
|
||||
|
||||
def toggleEvent(item)
|
||||
if !@isShop
|
||||
if @is_secondary_hat
|
||||
$Trainer.hat2 = nil
|
||||
$Trainer.set_hat(nil,@is_secondary_hat)
|
||||
@worn_clothes = nil
|
||||
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
$Trainer.set_hat(nil,@is_secondary_hat)
|
||||
@worn_clothes = nil
|
||||
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
$Trainer.hat2 = nil
|
||||
@worn_clothes = nil
|
||||
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
|
||||
|
||||
def set_secondary_hat(value)
|
||||
echoln "WOWOWO setting secondary hat value"
|
||||
@is_secondary_hat = value
|
||||
end
|
||||
|
||||
@@ -48,7 +37,7 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
def getDisplayName(item)
|
||||
return getName(item) if !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
|
||||
end
|
||||
|
||||
@@ -63,24 +52,13 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
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
|
||||
if item.is_a?(Outfit)
|
||||
previewWindow.hat = item.id
|
||||
$Trainer.set_hat(item.id,@is_secondary_hat)# unless $Trainer.hat==nil
|
||||
set_dye_color(item,previewWindow)
|
||||
else
|
||||
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
|
||||
end
|
||||
$Trainer.set_hat(nil,@is_secondary_hat)
|
||||
previewWindow.hat= nil
|
||||
end
|
||||
|
||||
|
||||
@@ -100,18 +78,18 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def set_dye_color(item,previewWindow)
|
||||
if !isShop?
|
||||
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
|
||||
$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
|
||||
$Trainer.set_hat_color(dye_color,@is_secondary_hat)
|
||||
previewWindow.hat_color = dye_color
|
||||
else
|
||||
$Trainer.hat_color=0
|
||||
$Trainer.set_hat_color(0,@is_secondary_hat)
|
||||
previewWindow.hat_color=0
|
||||
end
|
||||
#echoln $Trainer.dyed_hats
|
||||
else
|
||||
$Trainer.hat_color=0
|
||||
$Trainer.set_hat_color(0,@is_secondary_hat)
|
||||
previewWindow.hat_color=0
|
||||
end
|
||||
end
|
||||
@@ -126,28 +104,18 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def get_current_clothes()
|
||||
return $Trainer.hat
|
||||
return $Trainer.hat(@is_secondary_hat)
|
||||
end
|
||||
|
||||
def putOnOutfit(item)
|
||||
return unless item.is_a?(Outfit)
|
||||
if @is_secondary_hat
|
||||
echoln "broder"
|
||||
putOnSecondaryHat(item.id)
|
||||
else
|
||||
putOnHat(item.id)
|
||||
end
|
||||
putOnHat(item.id,false,@is_secondary_hat)
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
if @is_secondary_hat
|
||||
$Trainer.hat2 = @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
|
||||
$Trainer.set_hat(@worn_clothes,@is_secondary_hat)
|
||||
$Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes],@is_secondary_hat) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
|
||||
end
|
||||
|
||||
def get_unlocked_items_list()
|
||||
|
||||
@@ -16,8 +16,8 @@ def obtainHat(outfit_id,secondary=false)
|
||||
$Trainer.unlocked_hats << outfit_id if !$Trainer.unlocked_hats.include?(outfit_id)
|
||||
obtainOutfitMessage(outfit)
|
||||
if pbConfirmMessage("Would you like to put it on right now?")
|
||||
putOnHat(outfit_id, false, ) if !secondary
|
||||
putOnSecondaryHat(outfit_id, false, ) if secondary
|
||||
putOnHat(outfit_id, false, false) if !secondary
|
||||
putOnHat(outfit_id, false, true) if secondary
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@@ -67,12 +67,12 @@ def putOnClothes(outfit_id, silent = false)
|
||||
putOnOutfitMessage(outfit) if !silent
|
||||
end
|
||||
|
||||
def putOnHat(outfit_id, silent = false)
|
||||
def putOnHat(outfit_id, silent = false, is_secondary=false)
|
||||
$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)
|
||||
|
||||
$Trainer.hat = outfit_id
|
||||
$Trainer.set_hat(outfit_id,is_secondary)
|
||||
|
||||
dye_color = $Trainer.dyed_hats[outfit_id]
|
||||
if dye_color
|
||||
@@ -85,24 +85,6 @@ def putOnHat(outfit_id, silent = false)
|
||||
putOnOutfitMessage(outfit) if !silent
|
||||
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)
|
||||
outfit_id = getSplitHairFilenameAndVersionFromID(full_outfit_id)[1]
|
||||
@@ -193,7 +175,7 @@ def isWearingClothes(outfitId)
|
||||
end
|
||||
|
||||
def isWearingHat(outfitId)
|
||||
return $Trainer.hat == outfitId
|
||||
return $Trainer.hat == outfitId || $Trainer.hat2 == outfitId
|
||||
end
|
||||
|
||||
def isWearingHairstyle(outfitId, version = nil)
|
||||
@@ -309,13 +291,18 @@ end
|
||||
|
||||
def randomizePlayerOutfitUnlocked()
|
||||
$Trainer.hat = $Trainer.unlocked_hats.sample
|
||||
$Trainer.hat2 = $Trainer.unlocked_hats.sample
|
||||
$Trainer.clothes = $Trainer.unlocked_clothes.sample
|
||||
|
||||
dye_hat = rand(2)==0
|
||||
dye_hat2 = rand(2)==0
|
||||
dye_clothes = rand(2)==0
|
||||
dye_hair = rand(2)==0
|
||||
$Trainer.hat2 = nil if rand(3)==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.hair_color = dye_hair ? rand(255) : 0
|
||||
|
||||
@@ -328,8 +315,12 @@ end
|
||||
def randomizePlayerOutfit()
|
||||
$Trainer.hat = $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.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.hair_color = rand(2)==0 ? rand(255) : 0
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle|
|
||||
battle.decision = 3
|
||||
battle.pbDisplayPaused(_INTL("Got away safely!"))
|
||||
@@ -93,8 +91,6 @@ def useTeleporter()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle|
|
||||
battle.decision = 3
|
||||
battle.pbDisplayPaused(_INTL("Got away safely!"))
|
||||
@@ -378,19 +374,24 @@ ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item|
|
||||
})
|
||||
|
||||
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!"))
|
||||
return 0
|
||||
end
|
||||
|
||||
if isWearingFavoriteOutfit()
|
||||
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()
|
||||
end
|
||||
playOutfitChangeAnimation()
|
||||
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
|
||||
return 0
|
||||
end
|
||||
@@ -399,7 +400,8 @@ def useFavoriteOutfit()
|
||||
if (Kernel.pbConfirmMessage("Put on your favorite outfit?"))
|
||||
playOutfitChangeAnimation()
|
||||
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
|
||||
return 0
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user