#============================================================================== # Script de "Tienda Expandida", para hacer la tienda del casino más facil de manejar. # Para llamar la tienda de Fichas debes llamarla así. # pbPokemonMart([ # :LINKINGCORD,:PEATBLOCK,], # nil,true,1) # Para cambiar y ajustar los precios a las monedas, usa setPrice. Ejemplo: # setPrice(:LINKINGCORD,1400,0) # Tambien sirve para hacer tiendas de PB, cambiando el 1 al final de la llamada por un 2. # Pero CRASHEARA si no tienes el script correspondiente: # https://www.pokecommunity.com/threads/battle-points.341608/ #============================================================================== class PokemonMartAdapter def getDisplayPrice(item,selling=false) price=getPrice(item,selling) coin=getCurrencySymbol return _ISPRINTF("{2:s} {1:d}",price,coin) end def getCurrencySymbol return "$" end def getCurrency return _INTL("Dinero") end end class PokemonMartAdapterCoins < PokemonMartAdapter def getMoney return $PokemonGlobal.coins end def setMoney(value) $PokemonGlobal.coins=value end def getCurrencySymbol return _INTL("") end def getCurrency return _INTL("Fichas") end end class PokemonMartAdapterPB < PokemonMartAdapter def getMoney $PokemonGlobal.bpoints ||= 0 if !$PokemonGlobal.bpoints return $PokemonGlobal.bpoints end def setMoney(value) $PokemonGlobal.bpoints=value end def getCurrencySymbol return _INTL("") end def getCurrency return _INTL("PB") end end #=============================================================================== class PokemonMartScene def pbRefresh if !@subscene itemwindow=@sprites["itemwindow"] @sprites["icon"].item=itemwindow.item @sprites["itemtextwindow"].text=(itemwindow.item==0) ? _INTL("Salir de la tienda.") : @adapter.getDescription(itemwindow.item) itemwindow.refresh end @sprites["moneywindow"].text=_INTL("{2}:\n{3}{1}",@adapter.getMoney,@adapter.getCurrency,@adapter.getCurrencySymbol) end end ####################################################### class PokemonMartScreen def initialize(scene,stock,currency=nil) @scene=scene @stock=stock if currency == 1 @adapter=PokemonMartAdapterCoins.new elsif currency == 2 @adapter=PokemonMartAdapterPB.new else @adapter=PokemonMartAdapter.new end end def pbBuyScreen @scene.pbStartBuyScene(@stock,@adapter) item=0 loop do item=@scene.pbChooseBuyItem quantity=0 break if item==0 itemname=@adapter.getDisplayName(item) price=@adapter.getPrice(item) if @adapter.getMoney()BAGMAXPERSLOT quantity=@scene.pbChooseNumber( _INTL("¿{1}? Buena elección.\r\n¿Cuántas unidades quieres?",itemname),item,maxafford) if quantity==0 next end price*=quantity if !pbConfirm(_INTL("{1}... Y quieres {2}.\r\nTe costará {4}{3}. ¿De acuerdo?",itemname,quantity,price,@adapter.getCurrencySymbol)) next end end if @adapter.getMoney()0 @stock[i]=nil end end @stock.compact! pbSEPlay("SlotsCoin") pbDisplayPaused(_INTL("¡Aquí tienes!\r\n¡Gracias!")) if $PokemonBag if quantity>=10 && pbIsPokeBall?(item) && hasConst?(PBItems,:PREMIERBALL) if @adapter.addItem(getConst(PBItems,:PREMIERBALL)) pbDisplayPaused(_INTL("También recibes una Honor Ball extra.")) end end end end end @scene.pbEndBuyScene end def pbSellScreen item=@scene.pbStartSellScene(@adapter.getInventory,@adapter) loop do item=@scene.pbChooseSellItem break if item==0 itemname=@adapter.getDisplayName(item) price=@adapter.getPrice(item,true) if !@adapter.canSell?(item) pbDisplayPaused(_INTL("¿{1}? ¡Oh, no!\r\nNo puedo comprar eso.",itemname)) next end qty=@adapter.getQuantity(item) next if qty==0 @scene.pbShowMoney if qty>1 qty=@scene.pbChooseNumber( _INTL("¿{1}?\r\n¿Cuántas unidades quieres vender?",itemname),item,qty) end if qty==0 @scene.pbHideMoney next end price/=defined?(SELL_ITEMPRICE) ? SELL_ITEMPRICE : 2 price*=qty if pbConfirm(_INTL("Puedo pagarte {2}{1}.\r\n¿Te parece bien?",price,@adapter.getCurrencySymbol)) @adapter.setMoney(@adapter.getMoney()+price) for i in 0...qty @adapter.removeItem(item) end pbSEPlay("SlotsCoin") pbDisplayPaused(_INTL("Entregaste {1}.\nRecibiste {3}{2} por la venta.",itemname,price,@adapter.getCurrencySymbol)) @scene.pbRefresh end @scene.pbHideMoney end @scene.pbEndSellScene end end def pbPokemonMart(stock,speech=nil,cantsell=false,currency=nil) for i in 0...stock.length stock[i]=getID(PBItems,stock[i]) if !stock[i].is_a?(Integer) if !stock[i] || stock[i]==0 || (pbIsImportantItem?(stock[i]) && $PokemonBag.pbQuantity(stock[i])>0) stock[i]=nil end end stock.compact! commands=[] cmdBuy=-1 cmdSell=-1 cmdQuit=-1 commands[cmdBuy=commands.length]=_INTL("Me gustaría comprar algo") commands[cmdSell=commands.length]=_INTL("Me gustaría vender algo") if !cantsell commands[cmdQuit=commands.length]=_INTL("Solo estoy mirando") if cantsell Kernel.pbMessage(speech) if speech cmd = 0 else cmd=Kernel.pbMessage( speech ? speech : _INTL("¡Bienvenido!\r\n¿En qué puedo ayudarte?"), commands,cmdQuit+1) end loop do if cmdBuy>=0 && cmd==cmdBuy scene=PokemonMartScene.new screen=PokemonMartScreen.new(scene,stock,currency) screen.pbBuyScreen break if cantsell elsif cmdSell>=0 && cmd==cmdSell scene=PokemonMartScene.new screen=PokemonMartScreen.new(scene,stock,currency) screen.pbSellScreen else Kernel.pbMessage(_INTL("¡Vuelve cuando quieras!")) break end cmd=Kernel.pbMessage(_INTL("¿En qué más puedo ayudarte?"),commands,cmdQuit+1) end $game_temp.clear_mart_prices end