def convertberry
vitamin||= nil
@conversion_hash = {
:POMEGBERRY => :HPUP,
:KELPSYBERRY => :PROTEIN,
:QUALOTBERRY => :IRON,
:HONDEWBERRY => :CALCIUM,
:GREPABERRY => :ZINC,
:TAMATOBERRY => :CARBOS
}
pbMessage(_INTL("I can trade berries for vitamins"))
berry = pbChooseItemFromList(_I("Choose an berry"), 1, :POMEGBERRY, :KELPSYBERRY, :QUALOTBERRY, :HONDEWBERRY, :GREPABERRY, :TAMATOBERRY)
if pbGet(1) == :NONE
else
vitamin = @conversion_hash[berry]
ret = pbConfirmMessage(_INTL("Do you want to change your #{berry.name} into a #{vitamin.name}?"))
if ret
$bag.remove(berry)
pbMessage(_INTL("Okay. I'll turn your #{berry.name} into a #{vitamin.name} for you."))
pbReceiveItem(vitamin)
else
return nil
end
end
pbMessage(_INTL("Come back with a berry"))
end
def converttreasure
bettertreasure||= nil
@conversion_hash = {
:NUGGET => :BIGNUGGET,
:PEARL => :BIGPEARL,
:BIGPEARL => :PEARLSTRING,
:TINYMUSHROOM => :BIGMUSHROOM,
:BIGMUSHROOM => :BALMMUSHROOM,
:STARDUST => :STARPIECE,
:STARPIECE => :COMETSHARD
#:TINYBAMBOOSHOOT => :BIGBAMBOOSHOOT
}
pbMessage(_INTL("I can trade treasures for better treasures you need at least 3"))
treasure = pbChooseItemFromList(_I("Choose an item"), 1, :NUGGET, :PEARL, :BIGPEARL, :TINYMUSHROOM, :BIGMUSHROOM, :STARDUST, :STARPIECE) #,:TINYBAMBOOSHOOT)
if pbGet(1) == :NONE||
if $bag.quantity(treasure) < 2
pbMessage(_INTL("You need more"))
else
bettertreasure = @conversion_hash[treasure]
ret = pbConfirmMessage(_INTL("Do you want to change you #{treasure.name} into a #{bettertreasure.name}."))
if ret
$bag.remove(treasure,3)
pbMessage(_INTL("Okay. I'll turn your #{treasure.name} into a #{bettertreasure.name} for you."))
pbReceiveItem(bettertreasure)
else
return nil
end
end
pbMessage(_INTL("Come back with treasure"))
end
end
#Custom convertors
#Fell free to add anything under here
#here is a expample
#def healingitems
#berry||= nil
#@conversion_hash = {
# :PECHABERRY => :ANTIDOTE}
#pbMessage(_INTL("I can trade berries for healing items"))
#berry = pbChooseItemFromList(_I("Choose an berry"), 1, :PECHABERRY)
# if pbGet(1) == :NONE
#else
#healing = @conversion_hash[berry]
# ret = pbConfirmMessage(_INTL("Do you want to change your #{berry.name} into a #{healing.name}?"))
# if ret
# $bag.remove(berry)
# pbMessage(_INTL("Okay. I'll turn your #{berry.name} into a #{vitamin.name} for you."))
# pbReceiveItem(healing)
#else
#return nil
#end
#end
#pbMessage(_INTL("Come back with a berry"))
#end
if defined?(PluginManager) && !PluginManager.installed?("Item Convertor")
PluginManager.register({
:name => "Item Convertor",
:version => "1.0",
:credits => "Derek"
})
end