Remove Scripts folder to convert to submodule

This commit is contained in:
chardub
2025-04-19 15:43:57 -04:00
parent 0807a7ea79
commit 58da1023c1
429 changed files with 0 additions and 165507 deletions

View File

@@ -1,159 +0,0 @@
class OutfitsMartAdapter < PokemonMartAdapter
attr_accessor :worn_clothes
attr_accessor :is_secondary_hat
attr_accessor :items
WORN_ITEM_BASE_COLOR = MessageConfig::BLUE_TEXT_MAIN_COLOR
WORN_ITEM_SHADOW_COLOR = MessageConfig::BLUE_TEXT_SHADOW_COLOR
REGIONAL_SET_BASE_COLOR = Color.new(76,72,104)
REGIONAL_SET_SHADOW_COLOR = Color.new(173,165,189)
CITY_EXCLUSIVE_BASE_COLOR = Color.new(61 , 125, 70) #Color.new(72 , 104, 83)
CITY_EXCLUSIVE_SHADOW_COLOR = Color.new(165, 189, 178)
def initialize(stock = [], isShop = true, isSecondaryHat = false)
@is_secondary_hat = isSecondaryHat
@items = stock
@worn_clothes = get_current_clothes()
@isShop = isShop
@version = nil
$Trainer.dyed_hats = {} if !$Trainer.dyed_hats
$Trainer.dyed_clothes = {} if !$Trainer.dyed_clothes
#todo: refactor to get the list from the first search when
# setting the stock instead of searching twice
@regional_set_items = @isShop ? list_regional_set_items : []
@city_exclusive_items = @isShop ? list_city_exclusive_items : []
end
def list_regional_set_items()
return []
end
def list_city_exclusive_items()
return []
end
def getDisplayName(item)
return getName(item) if !item.name
name = item.name
name = "* #{name}" if is_wearing_clothes(item.id)
return name
end
def is_wearing_clothes(outfit_id)
return outfit_id == @worn_clothes
end
def player_changed_clothes?()
return false
#implement in inheriting classes
end
def toggleText()
return ""
end
def switchVersion(item,delta=1)
return
end
def toggleEvent(item)
return
end
def isWornItem?(item)
return false
end
def isShop?()
return @isShop
end
def getPrice(item, selling = nil)
return 0 if !@isShop
return nil if itemOwned(item)
return item.price.to_i
end
def getDisplayPrice(item, selling = nil)
return "" if !@isShop
return "-" if itemOwned(item)
super
end
def updateStock()
updated_items = []
for item in @items
updated_items << item if !get_unlocked_items_list().include?(item.id)
end
@items = updated_items
end
def removeItem(item)
super
end
def itemOwned(item)
owned_list = get_unlocked_items_list()
return owned_list.include?(item.id)
end
def canSell?(item)
super
end
def isItemInRegionalSet(item)
return @regional_set_items.include?(item.id)
end
def isItemCityExclusive(item)
return @city_exclusive_items.include?(item.id)
end
def getBaseColorOverride(item)
return REGIONAL_SET_BASE_COLOR if isItemInRegionalSet(item)
return CITY_EXCLUSIVE_BASE_COLOR if isItemCityExclusive(item)
return nil
end
def getShadowColorOverride(item)
return REGIONAL_SET_SHADOW_COLOR if isItemInRegionalSet(item)
return CITY_EXCLUSIVE_SHADOW_COLOR if isItemCityExclusive(item)
return nil
end
def getMoney
super
end
def getMoneyString
super
end
def setMoney(value)
super
end
def getItemIconRect(_item)
super
end
def getQuantity(item)
super
end
def showQuantity?(item)
super
end
def updateVersion(item)
@version = 1 if !currentVersionExists?(item)
end
def currentVersionExists?(item)
return true
end
end

View File

@@ -1,116 +0,0 @@
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 list_regional_set_items()
return list_regional_clothes
end
def list_city_exclusive_items
return list_city_exclusive_clothes
end
def initialize(stock = nil, isShop = nil)
super
end
def getName(item)
name= item.id
name = "* #{name}" if is_wearing_clothes(item.id)
return name
end
def getDescription(item)
return DEFAULT_DESCRIPTION if !item.description
return item.description
end
def getItemIcon(item)
return Settings::BACK_ITEM_ICON_PATH if !item
return getOverworldOutfitFilename(item.id)
end
def updateTrainerPreview(item, previewWindow)
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_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]
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
else
$Trainer.clothes_color=0
previewWindow.clothes_color=0
end
end
def addItem(item)
changed_clothes = obtainClothes(item.id)
if changed_clothes
@worn_clothes = item.id
end
end
def get_current_clothes()
return $Trainer.clothes
end
def player_changed_clothes?()
$Trainer.clothes != @worn_clothes
end
def putOnSelectedOutfit()
putOnClothes($Trainer.clothes)
@worn_clothes = $Trainer.clothes
end
def putOnOutfit(item)
putOnClothes(item.id) if item
@worn_clothes = item.id if item
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]
end
def get_unlocked_items_list()
return $Trainer.unlocked_clothes
end
def isWornItem?(item)
super
end
end

View File

@@ -1,146 +0,0 @@
def genericOutfitsShopMenu(stock = [], itemType = nil, versions = false, isShop=true, message=nil)
commands = []
commands[cmdBuy = commands.length] = _INTL("Buy")
commands[cmdQuit = commands.length] = _INTL("Quit")
message = _INTL("Welcome! How may I serve you?") if !message
cmd = pbMessage(message, commands, cmdQuit + 1)
loop do
if cmdBuy >= 0 && cmd == cmdBuy
adapter = getAdapter(itemType, stock, isShop)
view = ClothesShopView.new()
presenter = getPresenter(itemType, view, stock, adapter, versions)
presenter.pbBuyScreen
break
else
pbMessage(_INTL("Please come again!"))
break
end
end
end
def getPresenter(itemType, view, stock, adapter, versions)
case itemType
when :HAIR
return HairShopPresenter.new(view, stock, adapter, versions)
else
return ClothesShopPresenter.new(view, stock, adapter, versions)
end
end
def getAdapter(itemType, stock, isShop, is_secondary=false)
case itemType
when :CLOTHES
return ClothesMartAdapter.new(stock, isShop)
when :HAT
return HatsMartAdapter.new(stock, isShop,is_secondary)
when :HAIR
return HairMartAdapter.new(stock, isShop)
end
end
def list_all_possible_outfits() end
def clothesShop(outfits_list = [], free=false,customMessage=nil)
stock = []
outfits_list.each { |outfit_id|
outfit = get_clothes_by_id(outfit_id)
stock << outfit if outfit
}
genericOutfitsShopMenu(stock, :CLOTHES,false,!free,customMessage)
end
def hatShop(outfits_list = [], free=false, customMessage=nil)
stock = []
outfits_list.each { |outfit_id|
outfit = get_hat_by_id(outfit_id)
stock << outfit if outfit
}
genericOutfitsShopMenu(stock, :HAT,false,!free,customMessage)
end
def hairShop(outfits_list = [],free=false, customMessage=nil)
currentHair = getSimplifiedHairIdFromFullID($Trainer.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
outfits_list.each { |outfit_id|
next if outfit_id == currentHair
outfit = get_hair_by_id(outfit_id)
stock << outfit if outfit
}
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
pbSEPlay("GUI naming tab swap start")
end
SWAP_HAT_POSITIONS_CAPTION = "Switch hats position"
#is_secondary only used for hats
def openSelectOutfitMenu(stock = [], itemType =nil, is_secondary=false)
adapter = getAdapter(itemType, stock, false, is_secondary)
view = getView(itemType)
presenter = ClothesShopPresenter.new(view, stock, adapter)
presenter.pbBuyScreen
end
def getView(itemType)
case itemType
when :HAT
return HatShopView.new
else
return ClothesShopView.new
end
end
def changeClothesMenu()
stock = []
$Trainer.unlocked_clothes.each { |outfit_id|
outfit = get_clothes_by_id(outfit_id)
stock << outfit if outfit
}
openSelectOutfitMenu(stock, :CLOTHES)
end
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, is_secondary_hat)
end
def changeOutfit()
commands = []
commands[cmdHat = commands.length] = _INTL("Change hat")
commands[cmdClothes = commands.length] = _INTL("Change clothes")
commands[cmdQuit = commands.length] = _INTL("Quit")
cmd = pbMessage(_INTL("What would you like to do?"), commands, cmdQuit + 1)
loop do
if cmd == cmdClothes
changeClothesMenu()
break
elsif cmd == cmdHat
changeHatMenu()
break
else
break
end
end
end

View File

@@ -1,163 +0,0 @@
class ClothesShopPresenter < PokemonMartScreen
def pbChooseBuyItem
end
def initialize(scene, stock, adapter = nil, versions = false)
super(scene, stock, adapter)
@use_versions = versions
end
def putOnClothes(item,end_scene=true)
@adapter.putOnOutfit(item) if item
@scene.pbEndBuyScene if end_scene
end
def dyeClothes()
original_color = $Trainer.clothes_color
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
previous_input = 0
ret = false
while (true)
choice = pbShowCommands(nil, options, options.length, previous_input,200)
previous_input = choice
case choice
when 0 #NEXT
pbSEPlay("GUI storage pick up", 80, 100)
shiftClothesColor(10)
ret = true
when 1 #PREVIOUS
pbSEPlay("GUI storage pick up", 80, 100)
shiftClothesColor(-10)
ret = true
when 2 #Reset
pbSEPlay("GUI storage pick up", 80, 100)
$Trainer.clothes_color = 0
ret = false
when 3 #Confirm
break
else
$Trainer.clothes_color = original_color
ret = false
break
end
@scene.updatePreviewWindow
end
return ret
end
# returns true if should stay in the menu
def playerClothesActionsMenu(item)
cmd_wear = "Wear"
cmd_dye = "Dye Kit"
options = []
options << cmd_wear
options << cmd_dye if $PokemonBag.pbHasItem?(:CLOTHESDYEKIT)
options << "Cancel"
choice = pbMessage("What would you like to do?", options, -1)
if options[choice] == cmd_wear
putOnClothes(item,false)
$Trainer.clothes_color = @adapter.get_dye_color(item.id)
return true
elsif options[choice] == cmd_dye
dyeClothes()
end
return true
end
def confirmPutClothes(item)
putOnClothes(item)
end
def quitMenuPrompt()
return true if !(@adapter.is_a?(HatsMartAdapter) || @adapter.is_a?(ClothesMartAdapter))
boolean_changes_detected = @adapter.player_changed_clothes?
return true if !boolean_changes_detected
pbPlayCancelSE
cmd_confirm = "Set outfit"
cmd_discard = "Discard changes"
cmd_cancel = "Cancel"
options = [cmd_discard,cmd_confirm,cmd_cancel]
choice = pbMessage("You have unsaved changes!",options,3)
case options[choice]
when cmd_confirm
@adapter.putOnSelectedOutfit
pbPlayDecisionSE
return true
when cmd_discard
pbPlayCloseMenuSE
return true
else
return false
end
end
def pbBuyScreen
@scene.pbStartBuyScene(@stock, @adapter)
@scene.select_specific_item(@adapter.worn_clothes) if !@adapter.isShop?
item = nil
loop do
item = @scene.pbChooseBuyItem
if !item
break if @adapter.isShop?
#quit_menu_choice = quitMenuPrompt()
#break if quit_menu_choice
break
next
end
if !@adapter.isShop?
if @adapter.is_a?(ClothesMartAdapter)
stay_in_menu = playerClothesActionsMenu(item)
next if stay_in_menu
return
elsif @adapter.is_a?(HatsMartAdapter)
echoln pbGet(1)
stay_in_menu = playerHatActionsMenu(item)
echoln pbGet(1)
next if stay_in_menu
return
else
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
confirmPutClothes(item)
return
end
next
end
next
end
itemname = @adapter.getDisplayName(item)
price = @adapter.getPrice(item)
if !price.is_a?(Integer)
pbDisplayPaused(_INTL("You already own this item!"))
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
@adapter.putOnOutfit(item)
end
next
end
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
itemname, price.to_s_formatted))
next
end
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
@adapter.setMoney(@adapter.getMoney - price)
@stock.compact!
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
@adapter.addItem(item)
end
@scene.pbEndBuyScene
end
end

View File

@@ -1,154 +0,0 @@
class ClothesShopPresenter < PokemonMartScreen
def removeHat(item)
pbSEPlay("GUI storage put down")
@adapter.toggleEvent(item)
@scene.select_specific_item(nil,true)
end
def wearAsHat1(item)
@adapter.set_secondary_hat(false)
putOnClothes(item)
$Trainer.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)
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)
end
end
def swapHats()
echoln "hat 1: #{$Trainer.hat}"
echoln "hat 2: #{$Trainer.hat2}"
$Trainer.hat, $Trainer.hat2 = $Trainer.hat2, $Trainer.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}"
echoln "new selected hat: #{new_selected_hat}"
@scene.select_specific_item(new_selected_hat,true)
@scene.updatePreviewWindow
end
def build_options_menu(item,cmd_confirm,cmd_remove,cmd_dye,cmd_swap,cmd_cancel)
options = []
options << cmd_confirm
options << cmd_remove
options << cmd_swap
options << cmd_dye if $PokemonBag.pbHasItem?(:HATSDYEKIT)
options << cmd_cancel
end
def build_wear_options(cmd_wear_hat1,cmd_wear_hat2,cmd_replace_hat1,cmd_replace_hat2)
options = []
primary_hat, secondary_hat = @adapter.worn_clothes, @adapter.worn_clothes2
primary_cmds = primary_hat ? cmd_replace_hat1 : cmd_wear_hat1
secondary_cmds = secondary_hat ? cmd_replace_hat2 : cmd_wear_hat2
if @adapter.is_secondary_hat
options << secondary_cmds
options << primary_cmds
else
options << primary_cmds
options << secondary_cmds
end
return options
end
def putOnHats()
@adapter.worn_clothes = $Trainer.hat
@adapter.worn_clothes2 = $Trainer.hat2
putOnHat($Trainer.hat,true,false)
putOnHat($Trainer.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
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
previous_input = 0
while (true)
choice = pbShowCommands(nil, options, options.length, previous_input,200)
previous_input = choice
case choice
when 0 #NEXT
pbSEPlay("GUI storage pick up", 80, 100)
shiftHatColor(10,secondary_hat)
ret = true
when 1 #PREVIOUS
pbSEPlay("GUI storage pick up", 80, 100)
shiftHatColor(-10,secondary_hat)
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
ret = false
when 3 #Confirm
break
else
$Trainer.hat_color = original_color if !secondary_hat
$Trainer.hat2_color = original_color if secondary_hat
ret = false
break
end
@scene.updatePreviewWindow
@scene.displayLayerIcons(item)
end
return ret
end
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)
else
putOnClothes(item,false)
end
end
def playerHatActionsMenu(item)
cmd_confirm = "Confirm"
cmd_remove = "Remove hat"
cmd_cancel = "Cancel"
cmd_dye = "Dye Kit"
cmd_swap = "Swap hat positions"
options = build_options_menu(item,cmd_confirm,cmd_remove,cmd_dye,cmd_swap,cmd_cancel)
choice = pbMessage("What would you like to do?", options, -1,nil,0)
if options[choice] == cmd_remove
removeHat(item)
return true
elsif options[choice] == cmd_confirm
confirmPutClothes(nil)
return true
elsif options[choice] == cmd_dye
dyeOptions(@adapter.is_secondary_hat,item)
return true
elsif options[choice] == cmd_swap
swapHats()
return true
elsif options[choice] == "dye"
selectHatColor
end
@scene.updatePreviewWindow
return true
end
end

View File

@@ -1,205 +0,0 @@
class ClothesShopView < PokemonMart_Scene
def initialize(currency_name = "Money")
@currency_name = currency_name
end
def pbStartBuyOrSellScene(buying, stock, adapter)
super(buying, stock, adapter)
@sprites["icon"].visible = false
if @adapter.isShop?
@sprites["background"].setBitmap("Graphics/Pictures/Outfits/martScreenOutfit")
else
@sprites["background"].setBitmap("Graphics/Pictures/Outfits/changeOutfitScreen")
end
preview_y = @adapter.isShop? ? 80 : 0
@sprites["trainerPreview"] = TrainerClothesPreview.new(0, preview_y, true, "WALLET")
@sprites["trainerPreview"].show()
@sprites["moneywindow"].visible = false if !@adapter.isShop?
Kernel.pbDisplayText(@adapter.toggleText, 80, 200, 99999) if @adapter.toggleText
end
def select_specific_item(scroll_to_item_id,go_to_end_of_list_if_nil=false)
itemwindow = @sprites["itemwindow"]
if !scroll_to_item_id && go_to_end_of_list_if_nil
itemwindow.index=@adapter.items.length-1
itemwindow.refresh
end
i=0
for item in @adapter.items
next if !item.is_a?(Outfit)
if item.id == scroll_to_item_id
itemwindow.index=i
itemwindow.refresh
end
i+=1
end
end
def scroll_map
pbScrollMap(DIRECTION_UP, 5, 6)
pbScrollMap(DIRECTION_RIGHT, 7, 6)
@initial_direction = $game_player.direction
$game_player.turn_down
pbRefreshSceneMap
end
def scroll_back_map
@adapter.reset_player_clothes()
pbScrollMap(DIRECTION_LEFT, 7, 6)
pbScrollMap(DIRECTION_DOWN, 5, 6)
$game_player.turn_generic(@initial_direction)
end
def refreshStock(adapter)
@adapter = adapter
@sprites["itemwindow"].dispose if !@sprites
@sprites["itemwindow"] = Window_PokemonMart.new(@stock, BuyAdapter.new(adapter),
Graphics.width - 316 - 16, 12, 330 + 16, Graphics.height - 126)
end
def pbRefresh
if @subscene
@subscene.pbRefresh
else
itemwindow = @sprites["itemwindow"]
item = itemwindow.item
if itemwindow.item
if itemwindow.item.is_a?(Symbol)
text = @adapter.getSpecialItemCaption(item)
else
text = @adapter.getDescription(item)
end
else
text = _INTL("Quit.")
end
@sprites["itemtextwindow"].text = text
itemwindow.refresh
end
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString, @currency_name)
end
def updateTrainerPreview()
displayNewItem(@sprites["itemwindow"])
end
def displayNewItem(itemwindow)
item = itemwindow.item
if item
if item.is_a?(Symbol)
description = @adapter.getSpecialItemDescription(itemwindow.item)
else
description = @adapter.getDescription(itemwindow.item)
@adapter.updateVersion(itemwindow.item)
end
@adapter.updateTrainerPreview(itemwindow.item, @sprites["trainerPreview"])
else
description = _INTL("Quit.")
end
@sprites["itemtextwindow"].text = description
end
def updatePreviewWindow
itemwindow= @sprites["itemwindow"]
@adapter.updateTrainerPreview(itemwindow.item, @sprites["trainerPreview"])
end
def pbChooseBuyItem
itemwindow = @sprites["itemwindow"]
refreshStock(@adapter) if !itemwindow
displayNewItem(itemwindow)
@sprites["helpwindow"].visible = false
pbActivateWindow(@sprites, "itemwindow") {
pbRefresh
loop do
Graphics.update
Input.update
olditem = itemwindow.item
self.update
if itemwindow.item != olditem
displayNewItem(itemwindow)
end
if Input.trigger?(Input::AUX1) #L button - disabled because same key as speed up...
#@adapter.switchVersion(itemwindow.item, -1)
#updateTrainerPreview()
end
if Input.trigger?(Input::AUX2) || Input.trigger?(Input::SHIFT) #R button
switchItemVersion(itemwindow)
end
if Input.trigger?(Input::SPECIAL) #R button
@adapter.toggleEvent(itemwindow.item)
updateTrainerPreview()
end
if Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
return nil
elsif Input.trigger?(Input::USE)
if itemwindow.item.is_a?(Symbol)
ret = onSpecialActionTrigger(itemwindow)
return ret if ret
elsif itemwindow.index < @stock.length
pbRefresh
return @stock[itemwindow.index]
else
return nil
end
end
end
}
end
def onSpecialActionTrigger(itemwindow)
@adapter.doSpecialItemAction(itemwindow.item)
updateTrainerPreview()
return nil
end
def onItemClick(itemwindow)
if itemwindow.item.is_a?(Symbol)
@adapter.doSpecialItemAction(itemwindow.item)
updateTrainerPreview()
elsif itemwindow.index < @stock.length
pbRefresh
return @stock[itemwindow.index]
else
return nil
end
end
def switchItemVersion(itemwindow)
@adapter.switchVersion(itemwindow.item, 1)
updateTrainerPreview()
end
def update
if Input.trigger?(Input::LEFT)
pbSEPlay("GUI party switch", 80, 100)
$game_player.turn_right_90
pbRefreshSceneMap
end
if Input.trigger?(Input::RIGHT)
pbSEPlay("GUI party switch", 80, 100)
$game_player.turn_left_90
pbRefreshSceneMap
end
super
end
def pbEndBuyScene
if !@sprites.empty?
@sprites["trainerPreview"].erase()
@sprites["trainerPreview"] = nil
end
pbDisposeSpriteHash(@sprites)
@viewport.dispose
Kernel.pbClearText()
# Scroll left after showing screen
scroll_back_map()
end
end

View File

@@ -1,209 +0,0 @@
class HairMartAdapter < OutfitsMartAdapter
DEFAULT_NAME = "[unknown]"
DEFAULT_DESCRIPTION = "A hairstyle for trainers."
POSSIBLE_VERSIONS = (1..9).to_a
def initialize(stock = nil, isShop = nil)
super
@version = getCurrentHairVersion().to_i
@worn_hair = $Trainer.hair
@worn_hat = $Trainer.hat
@worn_hat2 = $Trainer.hat2
@hat_visible = false
@removable = true
@previous_item= find_first_item()
end
def find_first_item()
return @items.find { |item| item.is_a?(Outfit) }
end
def switchVersion(item, delta = 1)
if !item.is_a?(Outfit)
item = @previous_item
end
pbSEPlay("GUI party switch", 80, 100)
newVersion = @version + delta
lastVersion = findLastHairVersion(item.id)
newVersion = lastVersion if newVersion <= 0
newVersion = 1 if newVersion > lastVersion
@version = newVersion
end
def player_changed_clothes?()
$Trainer.hairstyle != @worn_hair
end
#player can't "own" hairstyles
# if you want to go back one you had before, you have to pay again
def itemOwned(item)
return false
end
def list_regional_set_items()
return list_regional_hairstyles
end
def list_city_exclusive_items
return list_city_exclusive_hairstyles
end
def toggleEvent(item)
pbSEPlay("GUI storage put down", 80, 100)
toggleHatVisibility()
end
def toggleText()
text = ""
#text << "Color: R, \n"
text << "Toggle Hat: D\n"
end
def toggleHatVisibility()
@hat_visible = !@hat_visible
end
def getPrice(item, selling = nil)
return 0 if !@isShop
trainer_hair_id = getSplitHairFilenameAndVersionFromID(@worn_hair)[1]
return nil if item.id == trainer_hair_id
return item.price.to_i
end
def getDisplayPrice(item, selling = nil)
trainerStyleID = getSplitHairFilenameAndVersionFromID(@worn_hair)[1]
return "-" if item.id == trainerStyleID
super
end
def getCurrentHairVersion()
begin
return getSplitHairFilenameAndVersionFromID($Trainer.hair)[0]
rescue
return 1
end
end
def getCurrentHairId(itemId)
return getFullHairId(itemId, @version)
end
def getName(item)
echoln $Trainer.hair
return item.id
end
def getDescription(item)
return DEFAULT_DESCRIPTION if !item.description
return item.description
end
def getItemIcon(item)
return Settings::BACK_ITEM_ICON_PATH if !item
return getOverworldHatFilename(item.id)
end
def updateTrainerPreview(item, previewWindow)
item = @previous_item if !item
item = @previous_item if item.is_a?(Symbol)
@previous_item = find_first_item() if !item.is_a?(Symbol)
displayed_hat = @hat_visible ? @worn_hat : nil
displayed_hat2 = @hat_visible ? @worn_hat2 : nil
previewWindow.hat = displayed_hat
previewWindow.hat2 = displayed_hat2
$Trainer.hat = displayed_hat
$Trainer.hat2 = displayed_hat2
itemId = getCurrentHairId(item.id)
previewWindow.hair = itemId
$Trainer.hair = itemId
pbRefreshSceneMap
previewWindow.updatePreview()
end
def addItem(item)
itemId = getCurrentHairId(item.id)
obtainNewHairstyle(itemId)
@worn_hair = itemId
end
def get_current_clothes()
return $Trainer.hair
end
def putOnOutfit(item)
itemFullId = getCurrentHairId(item.id)
putOnHair(item.id, @version)
@worn_hair = itemFullId
end
def reset_player_clothes()
# 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
@worn_hair = getFullHairId(worn_id,@version)
end
end
$Trainer.hair = @worn_hair
$Trainer.hat = @worn_hat
$Trainer.hat2 = @worn_hat2
end
def get_unlocked_items_list()
return $Trainer.unlocked_hairstyles
end
def getSpecialItemCaption(specialType)
case specialType
when :SWAP_COLOR
return "Swap Color"
end
return nil
end
def getSpecialItemBaseColor(specialType)
case specialType
when :SWAP_COLOR
return MessageConfig::BLUE_TEXT_MAIN_COLOR
end
return nil
end
def getSpecialItemShadowColor(specialType)
case specialType
when :SWAP_COLOR
return MessageConfig::BLUE_TEXT_SHADOW_COLOR
end
return nil
end
def getSpecialItemDescription(specialType)
return "Swap to the next base hair color."
end
def doSpecialItemAction(specialType)
switchVersion(nil,1)
end
def currentVersionExists?(item)
hairId = getCurrentHairId(item.id)
filename = getOverworldHairFilename(hairId)
return pbResolveBitmap(filename)
end
end

View File

@@ -1,68 +0,0 @@
class HairShopPresenter < PokemonMartScreen
def pbChooseBuyItem
end
def initialize(scene, stock, adapter = nil, versions=false)
super(scene,stock,adapter)
@use_versions = versions
end
def pbBuyScreen
@scene.pbStartBuyScene(@stock, @adapter)
item = nil
loop do
item = @scene.pbChooseBuyItem
break if !item
if !@adapter.isShop?
if pbConfirm(_INTL("Would you like to purchase {1}?", item.name))
@adapter.putOnOutfit(item)
@scene.pbEndBuyScene
return
end
next
end
itemname = @adapter.getDisplayName(item)
price = @adapter.getPrice(item)
echoln price
if !price.is_a?(Integer)
#@adapter.switchVersion(item,1)
pbDisplayPaused(_INTL("This is your current hairstyle!"))
next
end
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
itemname, price.to_s_formatted))
next
end
quantity = 1
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
added = 0
@adapter.setMoney(@adapter.getMoney - price)
@stock.compact!
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
@adapter.addItem(item)
#break
end
@scene.pbEndBuyScene
end
def isWornItem?(item)
super
end
end

View File

@@ -1,110 +0,0 @@
# frozen_string_literal: true
class HatShopView < ClothesShopView
def initialize(currency_name = "Money")
@currency_name = currency_name
end
def pbStartBuyOrSellScene(buying, stock, adapter)
super(buying, stock, adapter)
if !@adapter.isShop?
@sprites["hatLayer_selected1"] = IconSprite.new(0, 0, @viewport)
@sprites["hatLayer_selected2"] = IconSprite.new(0, 0, @viewport)
@sprites["hatLayer_selected1"].setBitmap("Graphics/Pictures/Outfits/hatLayer_selected1")
@sprites["hatLayer_selected2"].setBitmap("Graphics/Pictures/Outfits/hatLayer_selected2")
updateSelectedLayerGraphicsVisibility
@sprites["wornHat_layer1"] = IconSprite.new(25, 200, @viewport)
@sprites["wornHat_layer2"] = IconSprite.new(95, 200, @viewport)
displayLayerIcons
end
end
def switchItemVersion(itemwindow)
@adapter.switchVersion(itemwindow.item, 1)
new_selected_hat = @adapter.is_secondary_hat ? $Trainer.hat2 : $Trainer.hat
select_specific_item(new_selected_hat,true)
updateTrainerPreview()
end
def onSpecialActionTrigger(itemwindow)
#@adapter.doSpecialItemAction(itemwindow.item)
#updateTrainerPreview()
return @stock[itemwindow.index]
end
def handleHatlessLayerIcons(selected_item)
other_hat = @adapter.is_secondary_hat ? $Trainer.hat : $Trainer.hat2
if !selected_item.is_a?(Hat)
if @adapter.is_secondary_hat
@sprites["wornHat_layer2"].bitmap=nil
else
@sprites["wornHat_layer1"].bitmap=nil
end
end
if !other_hat.is_a?(Hat)
if @adapter.is_secondary_hat
@sprites["wornHat_layer1"].bitmap=nil
else
@sprites["wornHat_layer2"].bitmap=nil
end
end
end
def displayLayerIcons(selected_item=nil)
handleHatlessLayerIcons(selected_item)
hat1Filename = getOverworldHatFilename($Trainer.hat)
hat2Filename = getOverworldHatFilename($Trainer.hat2)
hat_color_shift = $Trainer.dyed_hats[$Trainer.hat]
hat2_color_shift = $Trainer.dyed_hats[$Trainer.hat2]
hatBitmapWrapper = AnimatedBitmap.new(hat1Filename, hat_color_shift) if pbResolveBitmap(hat1Filename)
hat2BitmapWrapper = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename)
@sprites["wornHat_layer1"].bitmap = hatBitmapWrapper.bitmap if hatBitmapWrapper
@sprites["wornHat_layer2"].bitmap = hat2BitmapWrapper.bitmap if hat2BitmapWrapper
frame_width=80
frame_height=80
@sprites["wornHat_layer1"].src_rect.set(0, 0, frame_width, frame_height) if hatBitmapWrapper
@sprites["wornHat_layer2"].src_rect.set(0, 0, frame_width, frame_height) if hat2BitmapWrapper
end
def updateSelectedLayerGraphicsVisibility()
@sprites["hatLayer_selected1"].visible = !@adapter.is_secondary_hat
@sprites["hatLayer_selected2"].visible = @adapter.is_secondary_hat
end
def displayNewItem(itemwindow)
item = itemwindow.item
if item
if item.is_a?(Symbol)
description = @adapter.getSpecialItemDescription(itemwindow.item)
else
description = @adapter.getDescription(itemwindow.item)
end
@adapter.updateTrainerPreview(itemwindow.item, @sprites["trainerPreview"])
displayLayerIcons(item)
else
description = _INTL("Quit.")
end
@sprites["itemtextwindow"].text = description
end
def updateTrainerPreview()
super
updateSelectedLayerGraphicsVisibility
end
end

View File

@@ -1,230 +0,0 @@
class HatsMartAdapter < OutfitsMartAdapter
attr_accessor :worn_clothes
attr_accessor :worn_clothes2
DEFAULT_NAME = "[unknown]"
DEFAULT_DESCRIPTION = "A headgear that trainers can wear."
def initialize(stock = nil, isShop = nil, isSecondaryHat = false)
super(stock,isShop,isSecondaryHat)
@worn_clothes = $Trainer.hat
@worn_clothes2 = $Trainer.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
end
def toggleEvent(item)
if isShop?
toggleSecondHat
else
$Trainer.set_hat(nil,@is_secondary_hat)
@worn_clothes = nil
end
end
def list_regional_set_items()
return list_regional_hats
end
def list_city_exclusive_items
return list_city_exclusive_hats
end
def set_secondary_hat(value)
@is_secondary_hat = value
end
def is_wearing_clothes(outfit_id)
return outfit_id == @worn_clothes || outfit_id == @worn_clothes2
end
def toggleText()
return
# return if @isShop
# toggleKey = "D"#getMappedKeyFor(Input::SPECIAL)
# return "Remove hat: #{toggleKey}"
end
def switchVersion(item,delta=1)
pbSEPlay("GUI storage put down", 80, 100)
return toggleSecondHat if isShop?
@is_secondary_hat = !@is_secondary_hat
end
def getName(item)
return item.id
end
def getDescription(item)
return DEFAULT_DESCRIPTION if !item.description
return item.description
end
def getItemIcon(item)
return Settings::BACK_ITEM_ICON_PATH if !item
return getOverworldHatFilename(item.id)
end
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)
previewWindow.set_hat(hat1.id,false) if hat1
previewWindow.set_hat(hat2.id,true) if hat2
previewWindow.set_hat(nil,true) if !@second_hat_visible #for toggling in shops
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)
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
else
$Trainer.set_hat(nil,@is_secondary_hat)
previewWindow.set_hat(nil,@is_secondary_hat)
end
pbRefreshSceneMap
previewWindow.updatePreview()
end
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]
end
return 0
end
def set_dye_color(item,previewWindow,is_secondary_hat=false)
return if !item
if !isShop?
else
$Trainer.set_hat_color(0,is_secondary_hat)
previewWindow.hat_color=0
end
end
# def set_dye_color(item,previewWindow,is_secondary_hat=false)
# return if !item
# if !isShop?
# $Trainer.dyed_hats= {} if !$Trainer.dyed_hats
#
# echoln item.id
# echoln $Trainer.dyed_hats.include?(item.id)
# echoln $Trainer.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)
# previewWindow.hat_color = dye_color
# else
# $Trainer.set_hat_color(0,is_secondary_hat)
# previewWindow.hat_color=0
# end
# #echoln $Trainer.dyed_hats
# else
# $Trainer.set_hat_color(0,is_secondary_hat)
# previewWindow.hat_color=0
# end
# end
def addItem(item)
return unless item.is_a?(Outfit)
changed_clothes = obtainHat(item.id,@is_secondary_hat)
if changed_clothes
@worn_clothes = item.id
end
end
def get_current_clothes()
return $Trainer.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
end
def putOnSelectedOutfit()
putOnHat($Trainer.hat,true,false) if $Trainer.hat
putOnHat($Trainer.hat2,true,true) if $Trainer.hat2
@worn_clothes = $Trainer.hat
@worn_clothes2 = $Trainer.hat2
playOutfitChangeAnimation()
pbMessage(_INTL("You put on the hat(s)!\\wtnp[30]"))
end
def putOnOutfit(item)
return unless item.is_a?(Outfit)
putOnHat(item.id,false,@is_secondary_hat)
@worn_clothes = item.id
end
def reset_player_clothes()
$Trainer.set_hat(@worn_clothes,false)
$Trainer.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]
end
def get_unlocked_items_list()
return $Trainer.unlocked_hats
end
def getSpecialItemCaption(specialType)
case specialType
when :REMOVE_HAT
return "Remove hat"
end
return nil
end
def getSpecialItemBaseColor(specialType)
case specialType
when :REMOVE_HAT
return MessageConfig::BLUE_TEXT_MAIN_COLOR
end
return nil
end
def getSpecialItemShadowColor(specialType)
case specialType
when :REMOVE_HAT
return MessageConfig::BLUE_TEXT_SHADOW_COLOR
end
return nil
end
def getSpecialItemDescription(specialType)
hair_situation = !$Trainer.hair || getSimplifiedHairIdFromFullID($Trainer.hair) == HAIR_BALD ? "bald head" : "fabulous hair"
return "Go without a hat and show off your #{hair_situation}!"
end
def doSpecialItemAction(specialType,item=nil)
toggleEvent(item)
end
end