mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
6.4 update (minus sprites)
This commit is contained in:
@@ -35,7 +35,7 @@ class ClothesMartAdapter < OutfitsMartAdapter
|
||||
|
||||
|
||||
def addItem(item)
|
||||
changed_clothes = obtainNewClothes(item.id)
|
||||
changed_clothes = obtainClothes(item.id)
|
||||
if changed_clothes
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
def genericOutfitsShopMenu(stock = [], itemType = nil, versions = false)
|
||||
def genericOutfitsShopMenu(stock = [], itemType = nil, versions = false, isShop=true, message=nil)
|
||||
commands = []
|
||||
commands[cmdBuy = commands.length] = _INTL("Buy")
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
cmd = pbMessage(_INTL("Welcome! How may I serve you?"), commands, cmdQuit + 1)
|
||||
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, true)
|
||||
adapter = getAdapter(itemType, stock, isShop)
|
||||
view = ClothesShopView.new()
|
||||
presenter = getPresenter(itemType, view, stock, adapter, versions)
|
||||
presenter.pbBuyScreen
|
||||
@@ -14,8 +15,6 @@ def genericOutfitsShopMenu(stock = [], itemType = nil, versions = false)
|
||||
pbMessage(_INTL("Please come again!"))
|
||||
break
|
||||
end
|
||||
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
|
||||
commands, cmdQuit + 1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,32 +40,35 @@ end
|
||||
|
||||
def list_all_possible_outfits() end
|
||||
|
||||
def clothesShop(outfits_list = [])
|
||||
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)
|
||||
genericOutfitsShopMenu(stock, :CLOTHES,false,!free,customMessage)
|
||||
end
|
||||
|
||||
def hatShop(outfits_list = [])
|
||||
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)
|
||||
genericOutfitsShopMenu(stock, :HAT,false,!free,customMessage)
|
||||
end
|
||||
|
||||
def hairShop(outfits_list = [])
|
||||
stock = []
|
||||
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|
|
||||
echoln outfit_id
|
||||
next if outfit_id == currentHair
|
||||
outfit = get_hair_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
genericOutfitsShopMenu(stock, :HAIR, true)
|
||||
genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage)
|
||||
end
|
||||
|
||||
def openSelectOutfitMenu(stock = [], itemType)
|
||||
@@ -91,13 +93,14 @@ def changeHatMenu()
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
stock << :REMOVE_HAT
|
||||
openSelectOutfitMenu(stock, :HAT)
|
||||
end
|
||||
|
||||
def changeOutfit()
|
||||
commands = []
|
||||
commands[cmdClothes = commands.length] = _INTL("Change clothes")
|
||||
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)
|
||||
@@ -112,4 +115,7 @@ def changeOutfit()
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -44,14 +44,10 @@ class ClothesShopPresenter < PokemonMartScreen
|
||||
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") }
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
class ClothesShopView < PokemonMart_Scene
|
||||
|
||||
|
||||
def initialize(currency_name="Money")
|
||||
def initialize(currency_name = "Money")
|
||||
@currency_name = currency_name
|
||||
end
|
||||
|
||||
def pbStartBuyOrSellScene(buying, stock, adapter)
|
||||
super(buying, stock, adapter)
|
||||
@initial_direction = $game_player.direction
|
||||
@sprites["icon"].visible=false
|
||||
@sprites["icon"].visible = false
|
||||
if @adapter.isShop?
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/martScreenOutfit")
|
||||
else
|
||||
@@ -16,7 +14,7 @@ class ClothesShopView < PokemonMart_Scene
|
||||
end
|
||||
|
||||
preview_y = @adapter.isShop? ? 80 : 0
|
||||
@sprites["trainerPreview"] = TrainerClothesPreview.new(0, preview_y, true,"WALLET")
|
||||
@sprites["trainerPreview"] = TrainerClothesPreview.new(0, preview_y, true, "WALLET")
|
||||
|
||||
@sprites["trainerPreview"].show()
|
||||
@sprites["moneywindow"].visible = false if !@adapter.isShop?
|
||||
@@ -26,18 +24,21 @@ class ClothesShopView < PokemonMart_Scene
|
||||
end
|
||||
|
||||
def scroll_map
|
||||
pbScrollMap(DIRECTION_UP, 5, 5)
|
||||
pbScrollMap(DIRECTION_RIGHT, 7, 5)
|
||||
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, 5)
|
||||
pbScrollMap(DIRECTION_DOWN, 5, 5)
|
||||
pbScrollMap(DIRECTION_LEFT, 7, 6)
|
||||
pbScrollMap(DIRECTION_DOWN, 5, 6)
|
||||
$game_player.turn_generic(@initial_direction)
|
||||
pbRefreshSceneMap
|
||||
#$scene.reset_map(true)
|
||||
#pbRefreshSceneMap
|
||||
# $scene.reset_map(false)
|
||||
end
|
||||
|
||||
def refreshStock(adapter)
|
||||
@@ -54,11 +55,21 @@ class ClothesShopView < PokemonMart_Scene
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
#@sprites["icon"].item = itemwindow.item
|
||||
#@sprites["icon"].item = itemwindow.item
|
||||
@sprites["itemtextwindow"].text =
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit.")
|
||||
|
||||
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)
|
||||
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString, @currency_name)
|
||||
end
|
||||
|
||||
def updateTrainerPreview()
|
||||
@@ -66,13 +77,20 @@ class ClothesShopView < PokemonMart_Scene
|
||||
end
|
||||
|
||||
def displayNewItem(itemwindow)
|
||||
@adapter.updateTrainerPreview(itemwindow.item,@sprites["trainerPreview"])
|
||||
@sprites["itemtextwindow"].text =
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit.")
|
||||
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"])
|
||||
else
|
||||
description = _INTL("Quit.")
|
||||
end
|
||||
@sprites["itemtextwindow"].text = description
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbChooseBuyItem
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
displayNewItem(itemwindow)
|
||||
@@ -87,25 +105,27 @@ class ClothesShopView < PokemonMart_Scene
|
||||
if itemwindow.item != olditem
|
||||
displayNewItem(itemwindow)
|
||||
end
|
||||
if Input.trigger?(Input::AUX1)#L button
|
||||
@adapter.switchVersion(itemwindow.item,-1)
|
||||
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) #R button
|
||||
@adapter.switchVersion(itemwindow.item, 1)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
if Input.trigger?(Input::AUX2)#R button
|
||||
@adapter.switchVersion(itemwindow.item,1)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
if Input.trigger?(Input::SPECIAL)#R button
|
||||
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.index < @stock.length
|
||||
if itemwindow.item.is_a?(Symbol)
|
||||
@adapter.doSpecialItemAction(itemwindow.item)
|
||||
updateTrainerPreview()
|
||||
elsif itemwindow.index < @stock.length
|
||||
pbRefresh
|
||||
return @stock[itemwindow.index]
|
||||
else
|
||||
@@ -130,10 +150,9 @@ class ClothesShopView < PokemonMart_Scene
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def pbEndBuyScene
|
||||
@sprites["trainerPreview"].erase()
|
||||
@sprites["trainerPreview"]=nil
|
||||
@sprites["trainerPreview"] = nil
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
Kernel.pbClearText()
|
||||
|
||||
@@ -6,21 +6,37 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def initialize(stock = nil, isShop = nil)
|
||||
super
|
||||
|
||||
@version = getCurrentHairVersion().to_i
|
||||
@worn_hair = $Trainer.hair
|
||||
@worn_hat = $Trainer.hat
|
||||
@hat_visible=false
|
||||
@hat_visible = false
|
||||
@removable = true
|
||||
@previous_item= find_first_item()
|
||||
end
|
||||
|
||||
def switchVersion(item, delta=1)
|
||||
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
|
||||
newVersion = @version + delta
|
||||
lastVersion = findLastHairVersion(item.id)
|
||||
newVersion = lastVersion if newVersion <= 0
|
||||
newVersion = 1 if newVersion > lastVersion
|
||||
@version = newVersion
|
||||
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 toggleEvent(item)
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
toggleHatVisibility()
|
||||
@@ -28,8 +44,8 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def toggleText()
|
||||
text = ""
|
||||
text << "Color: L / R\n"
|
||||
text << "Hat: D\n"
|
||||
#text << "Color: R, \n"
|
||||
text << "Toggle Hat: D\n"
|
||||
|
||||
end
|
||||
|
||||
@@ -39,15 +55,16 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def getPrice(item, selling = nil)
|
||||
return 0 if !@isShop
|
||||
trainerStyleID = getSplitHairFilenameAndVersionFromID($Trainer.hair)[0]
|
||||
return 0 if item == trainerStyleID
|
||||
return nil if itemOwned(item)
|
||||
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($Trainer.hair)[0]
|
||||
return "-" if item == trainerStyleID
|
||||
trainerStyleID = getSplitHairFilenameAndVersionFromID(@worn_hair)[1]
|
||||
return "-" if item.id == trainerStyleID
|
||||
super
|
||||
end
|
||||
|
||||
@@ -64,6 +81,7 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def getName(item)
|
||||
echoln $Trainer.hair
|
||||
return item.id
|
||||
end
|
||||
|
||||
@@ -84,12 +102,13 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
return if !item
|
||||
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
|
||||
previewWindow.hat=displayed_hat
|
||||
previewWindow.hat = displayed_hat
|
||||
$Trainer.hat = displayed_hat
|
||||
itemId = getCurrentHairId(item.id)
|
||||
echoln itemId
|
||||
previewWindow.hair = itemId
|
||||
$Trainer.hair = itemId
|
||||
pbRefreshSceneMap
|
||||
@@ -99,10 +118,8 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
def addItem(item)
|
||||
itemId = getCurrentHairId(item.id)
|
||||
|
||||
changed_clothes = obtainNewHairstyle(itemId)
|
||||
if changed_clothes
|
||||
@worn_clothes = itemId
|
||||
end
|
||||
obtainNewHairstyle(itemId)
|
||||
@worn_hair = itemId
|
||||
end
|
||||
|
||||
def get_current_clothes()
|
||||
@@ -112,15 +129,57 @@ class HairMartAdapter < OutfitsMartAdapter
|
||||
def putOnOutfit(item)
|
||||
itemFullId = getCurrentHairId(item.id)
|
||||
putOnHair(item.id, @version)
|
||||
@worn_clothes = itemFullId
|
||||
@worn_hair = itemFullId
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
$Trainer.hair = @worn_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
|
||||
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
|
||||
|
||||
end
|
||||
|
||||
@@ -28,9 +28,11 @@ class HairShopPresenter < PokemonMartScreen
|
||||
|
||||
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!"))
|
||||
@adapter.putOnOutfit(item)
|
||||
next
|
||||
end
|
||||
if @adapter.getMoney < price
|
||||
|
||||
@@ -8,6 +8,9 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
|
||||
def toggleEvent(item)
|
||||
if !@isShop
|
||||
$Trainer.hat = nil
|
||||
@worn_clothes = nil
|
||||
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
$Trainer.hat = nil
|
||||
@worn_clothes = nil
|
||||
@@ -17,9 +20,10 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def toggleText()
|
||||
return if @isShop
|
||||
toggleKey = "D"#getMappedKeyFor(Input::SPECIAL)
|
||||
return "Remove hat: #{toggleKey}"
|
||||
return
|
||||
# return if @isShop
|
||||
# toggleKey = "D"#getMappedKeyFor(Input::SPECIAL)
|
||||
# return "Remove hat: #{toggleKey}"
|
||||
end
|
||||
|
||||
def getName(item)
|
||||
@@ -42,15 +46,20 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
return if !item
|
||||
previewWindow.hat = item.id
|
||||
$Trainer.hat = item.id unless $Trainer.hat==nil
|
||||
if item.is_a?(Outfit)
|
||||
previewWindow.hat = item.id
|
||||
$Trainer.hat = item.id# unless $Trainer.hat==nil
|
||||
else
|
||||
$Trainer.hat=nil
|
||||
previewWindow.hat= nil
|
||||
end
|
||||
pbRefreshSceneMap
|
||||
previewWindow.updatePreview()
|
||||
end
|
||||
|
||||
def addItem(item)
|
||||
changed_clothes = obtainNewHat(item.id)
|
||||
return unless item.is_a?(Outfit)
|
||||
changed_clothes = obtainHat(item.id)
|
||||
if changed_clothes
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
@@ -61,6 +70,7 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
end
|
||||
|
||||
def putOnOutfit(item)
|
||||
return unless item.is_a?(Outfit)
|
||||
putOnHat(item.id)
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
@@ -72,4 +82,38 @@ class HatsMartAdapter < OutfitsMartAdapter
|
||||
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)
|
||||
echoln $Trainer.hair
|
||||
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)
|
||||
toggleEvent(nil)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user