#===============================================================================
# Battle Point Shops Plugin
#to call the shop, just place it in an event: pbOpenBPShop(shopid)
#example: pbOpenBPShop(1)
#===============================================================================
# Defines the items available in each store
BATTLE_POINT_SHOPS = {
1 => [
:POTION, :GREATBALL, :SUPERPOTION, :ANTIDOTE, :PARALYZEHEAL, :AWAKENING,
:HYPERPOTION, :SUPERREPEL, :REVIVE,
:ULTRABALL, :FULLHEAL, :MAXREPEL, :ZINC, :CARBOS, :PPUP, :PPMAX,
:MAXPOTION, :FULLRESTORE
],
2 => [
:POTION,
:TM01,:TM02,:TM03,:TM04,
:TM05,:TM06,:TM07,:TM08,
:TM09,:TM10,:TM11,:TM12,
:TM13,:TM14,:TM15,:TM16,
:TM17,:TM18,:TM19,:TM20,
:TM21,:TM22,:TM23,:TM24,
:TM25,:TM26,:TM27,:TM28,
:TM29,:TM30,:TM31,:TM32,
:TM33,:TM34,:TM35,:TM36
]
}
# Define the badges required to access items
BadgesForItems = {
1 => [:GREATBALL, :SUPERPOTION, :ANTIDOTE, :PARALYZEHEAL, :AWAKENING],
3 => [:HYPERPOTION, :SUPERREPEL, :REVIVE],
5 => [:ULTRABALL, :FULLHEAL, :MAXREPEL, :ZINC, :CARBOS, :PPUP, :PPMAX],
7 => [:MAXPOTION, :ZINC, :CARBOS, :PPUP, :PPMAX],
8 => [:FULLRESTORE]
}
# Function to open a Battle Points store based on an ID
def pbOpenBPShop(shop_id)
items = BATTLE_POINT_SHOPS[shop_id]
if items.nil?
pbMessage(_INTL("Shop not found."))
return
end
# Filter items based on player badges
items_to_display = items.select do |item|
# Verifica se o item é válido
next false unless GameData::Item.exists?(item)
# Checks if the item has an associated badge
badge_id = BadgesForItems.keys.find do |key|
BadgesForItems[key].include?(item)
end
If the item is not associated with a badge or the player has the required badge, the item will be displayed
badge_id.nil? || ($player.badge_count >= badge_id)
end
if items_to_display.empty?
pbMessage(_INTL("No items available for you at this shop."))
return
end
pbMessage(_INTL("Welcome to the BP Exchange Service!"))
pbMessage(_INTL("We can exchange your BP for amazing items."))
scene = BattlePointShop_Scene.new
screen = BattlePointShopScreen.new(scene, items_to_display)
screen.pbBuyScreen
pbMessage(_INTL("Thank you for visiting."))
pbMessage(_INTL("Come back when you have more BP to spend."))
$game_temp.clear_mart_prices
end