Renames $Trainer to $player

This commit is contained in:
chardub
2025-04-24 19:57:12 -04:00
parent 95ef337de8
commit 7de024dafd
34 changed files with 391 additions and 391 deletions

View File

@@ -19,8 +19,8 @@ class OutfitsMartAdapter < PokemonMartAdapter
@worn_clothes = get_current_clothes()
@isShop = isShop
@version = nil
$Trainer.dyed_hats = {} if !$Trainer.dyed_hats
$Trainer.dyed_clothes = {} if !$Trainer.dyed_clothes
$player.dyed_hats = {} if !$player.dyed_hats
$player.dyed_clothes = {} if !$player.dyed_clothes
#todo: refactor to get the list from the first search when
# setting the stock instead of searching twice

View File

@@ -3,9 +3,9 @@ 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 !isShop? && $player.clothes_color != 0
if pbConfirmMessage(_INTL("Would you like to remove the dye?"))
$Trainer.clothes_color = 0
$player.clothes_color = 0
end
end
end
@@ -41,7 +41,7 @@ class ClothesMartAdapter < OutfitsMartAdapter
def updateTrainerPreview(item, previewWindow)
return if !item
previewWindow.clothes = item.id
$Trainer.clothes = item.id
$player.clothes = item.id
set_dye_color(item,previewWindow)
pbRefreshSceneMap
@@ -50,26 +50,26 @@ class ClothesMartAdapter < OutfitsMartAdapter
def get_dye_color(item_id)
return 0 if isShop?
$Trainer.dyed_clothes= {} if ! $Trainer.dyed_clothes
if $Trainer.dyed_clothes.include?(item_id)
return $Trainer.dyed_clothes[item_id]
$player.dyed_clothes= {} if ! $player.dyed_clothes
if $player.dyed_clothes.include?(item_id)
return $player.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
$player.dyed_clothes= {} if ! $player.dyed_clothes
if $player.dyed_clothes.include?(item.id)
dye_color = $player.dyed_clothes[item.id]
$player.clothes_color = dye_color
previewWindow.clothes_color = dye_color
else
$Trainer.clothes_color=0
$player.clothes_color=0
previewWindow.clothes_color=0
end
else
$Trainer.clothes_color=0
$player.clothes_color=0
previewWindow.clothes_color=0
end
end
@@ -82,16 +82,16 @@ class ClothesMartAdapter < OutfitsMartAdapter
end
def get_current_clothes()
return $Trainer.clothes
return $player.clothes
end
def player_changed_clothes?()
$Trainer.clothes != @worn_clothes
$player.clothes != @worn_clothes
end
def putOnSelectedOutfit()
putOnClothes($Trainer.clothes)
@worn_clothes = $Trainer.clothes
putOnClothes($player.clothes)
@worn_clothes = $player.clothes
end
def putOnOutfit(item)
@@ -100,12 +100,12 @@ class ClothesMartAdapter < OutfitsMartAdapter
end
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]
$player.clothes = @worn_clothes
$player.clothes_color = $player.dyed_clothes[@worn_clothes] if $player.dyed_clothes && $player.dyed_clothes[@worn_clothes]
end
def get_unlocked_items_list()
return $Trainer.unlocked_clothes
return $player.unlocked_clothes
end
def isWornItem?(item)

View File

@@ -61,10 +61,10 @@ def hatShop(outfits_list = [], free=false, customMessage=nil)
end
def hairShop(outfits_list = [],free=false, customMessage=nil)
currentHair = getSimplifiedHairIdFromFullID($Trainer.hair)
currentHair = getSimplifiedHairIdFromFullID($player.hair)
stock = [:SWAP_COLOR]
#always add current hairstyle as first option (in case the player just wants to swap the color)
stock << get_hair_by_id(currentHair) if $Trainer.hair
stock << get_hair_by_id(currentHair) if $player.hair
outfits_list.each { |outfit_id|
next if outfit_id == currentHair
outfit = get_hair_by_id(outfit_id)
@@ -74,15 +74,15 @@ def hairShop(outfits_list = [],free=false, customMessage=nil)
end
def switchHatsPosition()
hat1 = $Trainer.hat
hat2 = $Trainer.hat2
hat1_color = $Trainer.hat_color
hat2_color = $Trainer.hat2_color
hat1 = $player.hat
hat2 = $player.hat2
hat1_color = $player.hat_color
hat2_color = $player.hat2_color
$Trainer.hat = hat2
$Trainer.hat2 = hat1
$Trainer.hat_color = hat1_color
$Trainer.hat_color = hat2_color
$player.hat = hat2
$player.hat2 = hat1
$player.hat_color = hat1_color
$player.hat_color = hat2_color
pbSEPlay("GUI naming tab swap start")
end
@@ -108,7 +108,7 @@ end
def changeClothesMenu()
stock = []
$Trainer.unlocked_clothes.each { |outfit_id|
$player.unlocked_clothes.each { |outfit_id|
outfit = get_clothes_by_id(outfit_id)
stock << outfit if outfit
}
@@ -117,7 +117,7 @@ end
def changeHatMenu(is_secondary_hat = false)
stock = []
$Trainer.unlocked_hats.each { |outfit_id|
$player.unlocked_hats.each { |outfit_id|
outfit = get_hat_by_id(outfit_id)
stock << outfit if outfit
}

View File

@@ -15,7 +15,7 @@ class ClothesShopPresenter < PokemonMartScreen
def dyeClothes()
original_color = $Trainer.clothes_color
original_color = $player.clothes_color
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
previous_input = 0
ret = false
@@ -33,12 +33,12 @@ class ClothesShopPresenter < PokemonMartScreen
ret = true
when 2 #Reset
pbSEPlay("GUI storage pick up", 80, 100)
$Trainer.clothes_color = 0
$player.clothes_color = 0
ret = false
when 3 #Confirm
break
else
$Trainer.clothes_color = original_color
$player.clothes_color = original_color
ret = false
break
end
@@ -60,7 +60,7 @@ class ClothesShopPresenter < PokemonMartScreen
if options[choice] == cmd_wear
putOnClothes(item,false)
$Trainer.clothes_color = @adapter.get_dye_color(item.id)
$player.clothes_color = @adapter.get_dye_color(item.id)
return true
elsif options[choice] == cmd_dye
dyeClothes()

View File

@@ -9,31 +9,31 @@ class ClothesShopPresenter < PokemonMartScreen
def wearAsHat1(item)
@adapter.set_secondary_hat(false)
putOnClothes(item)
$Trainer.set_hat_color(@adapter.get_dye_color(item.id),false)
$player.set_hat_color(@adapter.get_dye_color(item.id),false)
end
def wearAsHat2(item)
@adapter.set_secondary_hat(true)
putOnClothes(item)
$Trainer.set_hat_color(@adapter.get_dye_color(item.id),true)
$player.set_hat_color(@adapter.get_dye_color(item.id),true)
end
def removeDye(item)
if pbConfirm(_INTL("Are you sure you want to remove the dye from the {1}?", item.name))
$Trainer.set_hat_color(0,@adapter.is_secondary_hat)
$player.set_hat_color(0,@adapter.is_secondary_hat)
end
end
def swapHats()
echoln "hat 1: #{$Trainer.hat}"
echoln "hat 2: #{$Trainer.hat2}"
echoln "hat 1: #{$player.hat}"
echoln "hat 2: #{$player.hat2}"
$Trainer.hat, $Trainer.hat2 = $Trainer.hat2, $Trainer.hat
$player.hat, $player.hat2 = $player.hat2, $player.hat
pbSEPlay("GUI naming tab swap start")
new_selected_hat = @adapter.is_secondary_hat ? $Trainer.hat2 : $Trainer.hat
echoln "hat 1: #{$Trainer.hat}"
echoln "hat 2: #{$Trainer.hat2}"
new_selected_hat = @adapter.is_secondary_hat ? $player.hat2 : $player.hat
echoln "hat 1: #{$player.hat}"
echoln "hat 2: #{$player.hat2}"
echoln "new selected hat: #{new_selected_hat}"
@scene.select_specific_item(new_selected_hat,true)
@@ -69,18 +69,18 @@ class ClothesShopPresenter < PokemonMartScreen
def putOnHats()
@adapter.worn_clothes = $Trainer.hat
@adapter.worn_clothes2 = $Trainer.hat2
@adapter.worn_clothes = $player.hat
@adapter.worn_clothes2 = $player.hat2
putOnHat($Trainer.hat,true,false)
putOnHat($Trainer.hat2,true,true)
putOnHat($player.hat,true,false)
putOnHat($player.hat2,true,true)
playOutfitChangeAnimation()
pbMessage(_INTL("You put on the hat(s)!\\wtnp[30]"))
end
def dyeOptions(secondary_hat=false,item)
original_color = secondary_hat ? $Trainer.hat2_color : $Trainer.hat_color
original_color = secondary_hat ? $player.hat2_color : $player.hat_color
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
previous_input = 0
while (true)
@@ -97,14 +97,14 @@ class ClothesShopPresenter < PokemonMartScreen
ret = true
when 2 #Reset
pbSEPlay("GUI storage put down", 80, 100)
$Trainer.hat_color = 0 if !secondary_hat
$Trainer.hat2_color = 0 if secondary_hat
$player.hat_color = 0 if !secondary_hat
$player.hat2_color = 0 if secondary_hat
ret = false
when 3 #Confirm
break
else
$Trainer.hat_color = original_color if !secondary_hat
$Trainer.hat2_color = original_color if secondary_hat
$player.hat_color = original_color if !secondary_hat
$player.hat2_color = original_color if secondary_hat
ret = false
break
end
@@ -117,8 +117,8 @@ class ClothesShopPresenter < PokemonMartScreen
def confirmPutClothes(item)
if @adapter.is_a?(HatsMartAdapter)
putOnHats()
$Trainer.hat_color = @adapter.get_dye_color($Trainer.hat)
$Trainer.hat2_color = @adapter.get_dye_color($Trainer.hat2)
$player.hat_color = @adapter.get_dye_color($player.hat)
$player.hat2_color = @adapter.get_dye_color($player.hat2)
else
putOnClothes(item,false)
end

View File

@@ -8,9 +8,9 @@ class HairMartAdapter < OutfitsMartAdapter
super
@version = getCurrentHairVersion().to_i
@worn_hair = $Trainer.hair
@worn_hat = $Trainer.hat
@worn_hat2 = $Trainer.hat2
@worn_hair = $player.hair
@worn_hat = $player.hat
@worn_hat2 = $player.hat2
@hat_visible = false
@removable = true
@@ -34,7 +34,7 @@ class HairMartAdapter < OutfitsMartAdapter
end
def player_changed_clothes?()
$Trainer.hairstyle != @worn_hair
$player.hairstyle != @worn_hair
end
#player can't "own" hairstyles
@@ -85,7 +85,7 @@ class HairMartAdapter < OutfitsMartAdapter
def getCurrentHairVersion()
begin
return getSplitHairFilenameAndVersionFromID($Trainer.hair)[0]
return getSplitHairFilenameAndVersionFromID($player.hair)[0]
rescue
return 1
end
@@ -96,7 +96,7 @@ class HairMartAdapter < OutfitsMartAdapter
end
def getName(item)
echoln $Trainer.hair
echoln $player.hair
return item.id
end
@@ -121,12 +121,12 @@ class HairMartAdapter < OutfitsMartAdapter
previewWindow.hat = displayed_hat
previewWindow.hat2 = displayed_hat2
$Trainer.hat = displayed_hat
$Trainer.hat2 = displayed_hat2
$player.hat = displayed_hat
$player.hat2 = displayed_hat2
itemId = getCurrentHairId(item.id)
previewWindow.hair = itemId
$Trainer.hair = itemId
$player.hair = itemId
pbRefreshSceneMap
previewWindow.updatePreview()
end
@@ -139,7 +139,7 @@ class HairMartAdapter < OutfitsMartAdapter
end
def get_current_clothes()
return $Trainer.hair
return $player.hair
end
def putOnOutfit(item)
@@ -152,19 +152,19 @@ class HairMartAdapter < OutfitsMartAdapter
# can change hair color for free if not changing the style
if getVersionFromFullID(@worn_hair) != @version
worn_id = getSimplifiedHairIdFromFullID(@worn_hair)
if getSimplifiedHairIdFromFullID($Trainer.hair) == worn_id
if getSimplifiedHairIdFromFullID($player.hair) == worn_id
@worn_hair = getFullHairId(worn_id,@version)
end
end
$Trainer.hair = @worn_hair
$Trainer.hat = @worn_hat
$Trainer.hat2 = @worn_hat2
$player.hair = @worn_hair
$player.hat = @worn_hat
$player.hat2 = @worn_hat2
end
def get_unlocked_items_list()
return $Trainer.unlocked_hairstyles
return $player.unlocked_hairstyles
end

View File

@@ -27,7 +27,7 @@ class HatShopView < ClothesShopView
def switchItemVersion(itemwindow)
@adapter.switchVersion(itemwindow.item, 1)
new_selected_hat = @adapter.is_secondary_hat ? $Trainer.hat2 : $Trainer.hat
new_selected_hat = @adapter.is_secondary_hat ? $player.hat2 : $player.hat
select_specific_item(new_selected_hat,true)
updateTrainerPreview()
end
@@ -39,7 +39,7 @@ class HatShopView < ClothesShopView
end
def handleHatlessLayerIcons(selected_item)
other_hat = @adapter.is_secondary_hat ? $Trainer.hat : $Trainer.hat2
other_hat = @adapter.is_secondary_hat ? $player.hat : $player.hat2
if !selected_item.is_a?(Hat)
if @adapter.is_secondary_hat
@sprites["wornHat_layer2"].bitmap=nil
@@ -59,12 +59,12 @@ class HatShopView < ClothesShopView
def displayLayerIcons(selected_item=nil)
handleHatlessLayerIcons(selected_item)
hat1Filename = getOverworldHatFilename($Trainer.hat)
hat2Filename = getOverworldHatFilename($Trainer.hat2)
hat1Filename = getOverworldHatFilename($player.hat)
hat2Filename = getOverworldHatFilename($player.hat2)
hat_color_shift = $Trainer.dyed_hats[$Trainer.hat]
hat2_color_shift = $Trainer.dyed_hats[$Trainer.hat2]
hat_color_shift = $player.dyed_hats[$player.hat]
hat2_color_shift = $player.dyed_hats[$player.hat2]
hatBitmapWrapper = AnimatedBitmap.new(hat1Filename, hat_color_shift) if pbResolveBitmap(hat1Filename)
hat2BitmapWrapper = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename)

View File

@@ -7,22 +7,22 @@ class HatsMartAdapter < OutfitsMartAdapter
def initialize(stock = nil, isShop = nil, isSecondaryHat = false)
super(stock,isShop,isSecondaryHat)
@worn_clothes = $Trainer.hat
@worn_clothes2 = $Trainer.hat2
@worn_clothes = $player.hat
@worn_clothes2 = $player.hat2
@second_hat_visible = true
end
#Used in shops only
def toggleSecondHat()
@second_hat_visible = !@second_hat_visible
$Trainer.hat2 = @second_hat_visible ? @worn_clothes2 : nil
$player.hat2 = @second_hat_visible ? @worn_clothes2 : nil
end
def toggleEvent(item)
if isShop?
toggleSecondHat
else
$Trainer.set_hat(nil,@is_secondary_hat)
$player.set_hat(nil,@is_secondary_hat)
@worn_clothes = nil
end
end
@@ -72,8 +72,8 @@ class HatsMartAdapter < OutfitsMartAdapter
def updateTrainerPreview(item, previewWindow)
if item.is_a?(Outfit)
hat1 = @is_secondary_hat ? get_hat_by_id($Trainer.hat) : item
hat2 = @is_secondary_hat ? item : get_hat_by_id($Trainer.hat2)
hat1 = @is_secondary_hat ? get_hat_by_id($player.hat) : item
hat2 = @is_secondary_hat ? item : get_hat_by_id($player.hat2)
previewWindow.set_hat(hat1.id,false) if hat1
previewWindow.set_hat(hat2.id,true) if hat2
@@ -81,18 +81,18 @@ class HatsMartAdapter < OutfitsMartAdapter
hat1_color=0
hat2_color=0
hat1_color = $Trainer.dyed_hats[hat1.id] if hat1 && $Trainer.dyed_hats.include?(hat1.id)
hat2_color = $Trainer.dyed_hats[hat2.id] if hat2 && $Trainer.dyed_hats.include?(hat2.id)
hat1_color = $player.dyed_hats[hat1.id] if hat1 && $player.dyed_hats.include?(hat1.id)
hat2_color = $player.dyed_hats[hat2.id] if hat2 && $player.dyed_hats.include?(hat2.id)
previewWindow.hat_color = hat1_color
previewWindow.hat2_color = hat2_color
$Trainer.hat = hat1&.id
$Trainer.hat2 = hat2&.id
$Trainer.hat_color = hat1_color
$Trainer.hat2_color = hat2_color
$player.hat = hat1&.id
$player.hat2 = hat2&.id
$player.hat_color = hat1_color
$player.hat2_color = hat2_color
else
$Trainer.set_hat(nil,@is_secondary_hat)
$player.set_hat(nil,@is_secondary_hat)
previewWindow.set_hat(nil,@is_secondary_hat)
end
@@ -104,9 +104,9 @@ class HatsMartAdapter < OutfitsMartAdapter
def get_dye_color(item_id)
return if !item_id
return 0 if isShop?
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
if $Trainer.dyed_hats.include?(item_id)
return $Trainer.dyed_hats[item_id]
$player.dyed_hats= {} if ! $player.dyed_hats
if $player.dyed_hats.include?(item_id)
return $player.dyed_hats[item_id]
end
return 0
end
@@ -117,7 +117,7 @@ class HatsMartAdapter < OutfitsMartAdapter
if !isShop?
else
$Trainer.set_hat_color(0,is_secondary_hat)
$player.set_hat_color(0,is_secondary_hat)
previewWindow.hat_color=0
end
end
@@ -125,23 +125,23 @@ class HatsMartAdapter < OutfitsMartAdapter
# def set_dye_color(item,previewWindow,is_secondary_hat=false)
# return if !item
# if !isShop?
# $Trainer.dyed_hats= {} if !$Trainer.dyed_hats
# $player.dyed_hats= {} if !$player.dyed_hats
#
# echoln item.id
# echoln $Trainer.dyed_hats.include?(item.id)
# echoln $Trainer.dyed_hats[item.id]
# echoln $player.dyed_hats.include?(item.id)
# echoln $player.dyed_hats[item.id]
#
# if $Trainer.dyed_hats.include?(item.id)
# dye_color = $Trainer.dyed_hats[item.id]
# $Trainer.set_hat_color(dye_color,is_secondary_hat)
# if $player.dyed_hats.include?(item.id)
# dye_color = $player.dyed_hats[item.id]
# $player.set_hat_color(dye_color,is_secondary_hat)
# previewWindow.hat_color = dye_color
# else
# $Trainer.set_hat_color(0,is_secondary_hat)
# $player.set_hat_color(0,is_secondary_hat)
# previewWindow.hat_color=0
# end
# #echoln $Trainer.dyed_hats
# #echoln $player.dyed_hats
# else
# $Trainer.set_hat_color(0,is_secondary_hat)
# $player.set_hat_color(0,is_secondary_hat)
# previewWindow.hat_color=0
# end
# end
@@ -156,22 +156,22 @@ class HatsMartAdapter < OutfitsMartAdapter
end
def get_current_clothes()
return $Trainer.hat(@is_secondary_hat)
return $player.hat(@is_secondary_hat)
end
def player_changed_clothes?()
echoln("Trainer hat: #{$Trainer.hat}, Worn hat: #{@worn_clothes}")
echoln("Trainer hat2: #{$Trainer.hat2}, Worn hat2: #{@worn_clothes2}")
$Trainer.hat != @worn_clothes || $Trainer.hat2 != @worn_clothes2
echoln("Trainer hat: #{$player.hat}, Worn hat: #{@worn_clothes}")
echoln("Trainer hat2: #{$player.hat2}, Worn hat2: #{@worn_clothes2}")
$player.hat != @worn_clothes || $player.hat2 != @worn_clothes2
end
def putOnSelectedOutfit()
putOnHat($Trainer.hat,true,false) if $Trainer.hat
putOnHat($Trainer.hat2,true,true) if $Trainer.hat2
putOnHat($player.hat,true,false) if $player.hat
putOnHat($player.hat2,true,true) if $player.hat2
@worn_clothes = $Trainer.hat
@worn_clothes2 = $Trainer.hat2
@worn_clothes = $player.hat
@worn_clothes2 = $player.hat2
playOutfitChangeAnimation()
pbMessage(_INTL("You put on the hat(s)!\\wtnp[30]"))
@@ -184,15 +184,15 @@ class HatsMartAdapter < OutfitsMartAdapter
end
def reset_player_clothes()
$Trainer.set_hat(@worn_clothes,false)
$Trainer.set_hat(@worn_clothes2,true)
$player.set_hat(@worn_clothes,false)
$player.set_hat(@worn_clothes2,true)
$Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes],false) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
$Trainer.set_hat_color($Trainer.dyed_hats[@worn_clothes2],true) if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes2]
$player.set_hat_color($player.dyed_hats[@worn_clothes],false) if $player.dyed_hats && $player.dyed_hats[@worn_clothes]
$player.set_hat_color($player.dyed_hats[@worn_clothes2],true) if $player.dyed_hats && $player.dyed_hats[@worn_clothes2]
end
def get_unlocked_items_list()
return $Trainer.unlocked_hats
return $player.unlocked_hats
end
def getSpecialItemCaption(specialType)
@@ -220,7 +220,7 @@ class HatsMartAdapter < OutfitsMartAdapter
end
def getSpecialItemDescription(specialType)
hair_situation = !$Trainer.hair || getSimplifiedHairIdFromFullID($Trainer.hair) == HAIR_BALD ? "bald head" : "fabulous hair"
hair_situation = !$player.hair || getSimplifiedHairIdFromFullID($player.hair) == HAIR_BALD ? "bald head" : "fabulous hair"
return "Go without a hat and show off your #{hair_situation}!"
end