mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-28 01:06:00 +00:00
6.4 update (minus sprites)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user