Advertisement
LiTTleDRAgo

[RGSS] DRG - Limited Shop

Mar 17th, 2013
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 23.21 KB | None | 0 0
  1. #==============================================================================
  2. # ** DRG - Limited Shop
  3. # Version : 1.36
  4. # Author : LiTTleDRAgo
  5. #==============================================================================
  6. #
  7. # How To Use :
  8. #
  9. # Use Script Command :
  10. #
  11. # Script :
  12. #  Script :
  13. #    $limited_shop = {
  14. #      0 => ['i1','i2','i3','i4'], # This means item 1,2,3,4 didn't have limit
  15. #      1 => ['w1','w2','a1'],      # This means weapon 1,2 and armor 1 can only
  16. #                                  # bought 1 times
  17. #      2 => ['a2']                 # This means armor 2 can be bought 2 times
  18. #  
  19. #      # This option won't do anything if SHOP_HAS_GOLD is false
  20. #      "G" => 3000                 # This means the shop is have 3000 gold
  21. #                                  # you can't sell anything if shop have 0 gold
  22. #                                  # if ommitted, the shop gold is set as 0
  23. #    }
  24. #
  25. #  To change the item inside the shop
  26. # Script :
  27. #    shop = [@map_id, @event_id]
  28. #    item = $data_items[x]         # set 'Gold' to change the shop gold
  29. #    limit = 90                    # set '-' for unlimited
  30. #    limit_shop_item(shop,item,limit)
  31. #
  32. #==============================================================================
  33. module LiTTleDRAgo
  34.  
  35.   SHOP_HAS_GOLD = true
  36.   # basically if false, you can sell anything as you please
  37.   GET_SOLD_ITEM = 1
  38.   # 0 : Item sold won't be added into buy list
  39.   # 1 : Item sold will added into buy list
  40.   #     (you sold x items outside the list and that item will appeared in the
  41.   #      buy list with limit of x)
  42.   # 2 : Item sold will added into buy list unlimitedly
  43.   #     (you sold  at least 1 items outside the list and that item will appeared
  44.   #      in the buy list without limit and can be bought as many as possible)
  45.  
  46. end
  47. #==============================================================================
  48. # ** Scene_Shop
  49. #------------------------------------------------------------------------------
  50. #  This class performs shop screen processing.
  51. #==============================================================================
  52.  
  53. class Scene_LimitedShop
  54.   #--------------------------------------------------------------------------
  55.   # * Main Processing
  56.   #--------------------------------------------------------------------------
  57.   def main
  58.     @all_windows = [ @help_window = Window_Help.new,
  59.       @command_window = Window_ShopCommand.new,
  60.       @gold_window = Window_Gold.new,
  61.       @dummy_window = Window_Base.new(0, 128, 640, 352),
  62.       @buy_window = Window_ShopBuyLimited.new,
  63.       @sell_window = Window_ShopSellLimited.new,
  64.       @number_window = Window_ShopNumber.new,
  65.       @status_window = Window_ShopStatusLimited.new]
  66.     @gold_window.x = 480
  67.     @gold_window.y = 64
  68.     @all_windows.each_with_index {|s,i|
  69.       s.active = s.visible = false if [4,5,6].include?(i)}
  70.     @status_window.visible = false
  71.     @buy_window.help_window = @help_window
  72.     @sell_window.help_window = @help_window
  73.     Graphics.transition
  74.     update while $scene == self
  75.     Graphics.freeze
  76.     @all_windows.flatten.each {|s| s.dispose}
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # * Frame Update
  80.   #--------------------------------------------------------------------------
  81.   def update
  82.     [Graphics,Input].each {|s|s.update}
  83.     @all_windows.flatten.each {|s| s.update}
  84.     return update_command if @command_window.active
  85.     return update_buy     if @buy_window.active
  86.     return update_sell    if @sell_window.active
  87.     return update_number  if @number_window.active
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # * Frame Update (when command window is active)
  91.   #--------------------------------------------------------------------------
  92.   def update_command
  93.     if Input.trigger?(Input::B)
  94.       $game_system.se_play($data_system.cancel_se)
  95.       $limited_shop = nil
  96.       $scene = Scene_Map.new
  97.       return
  98.     end
  99.     if Input.trigger?(Input::C)
  100.       case @command_window.index
  101.       when 0  # buy
  102.         $game_system.se_play($data_system.decision_se)
  103.         @command_window.active = false
  104.         @dummy_window.visible = false
  105.         @buy_window.active = true
  106.         @buy_window.visible = true
  107.         @buy_window.refresh
  108.         @status_window.visible = true
  109.       when 1  # sell
  110.         $game_system.se_play($data_system.decision_se)
  111.         @command_window.active = false
  112.         @dummy_window.visible = false
  113.         @sell_window.active = true
  114.         @sell_window.visible = true
  115.         @sell_window.refresh
  116.       when 2  # quit
  117.         $game_system.se_play($data_system.decision_se)
  118.         $limited_shop = nil
  119.         $scene = Scene_Map.new
  120.       end
  121.       return
  122.     end
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # * Frame Update (when buy window is active)
  126.   #--------------------------------------------------------------------------
  127.   def update_buy
  128.     @status_window.item = @buy_window.item
  129.     if Input.trigger?(Input::B)
  130.       $game_system.se_play($data_system.cancel_se)
  131.       @command_window.active = true
  132.       @dummy_window.visible = true
  133.       @buy_window.active = false
  134.       @buy_window.visible = false
  135.       @status_window.visible = false
  136.       @status_window.item = nil
  137.       @help_window.set_text("")
  138.       return
  139.     end
  140.     if Input.trigger?(Input::C)
  141.       @item = @buy_window.item
  142.       price = @item.is_a?(RPG::Skill) ? @item.sp_cost : @item.price if !@item.nil?
  143.       if @item.nil? or price > $game_party.gold
  144.         return $game_system.se_play($data_system.buzzer_se)
  145.       end
  146.       number = case @item
  147.       when RPG::Item then $game_party.item_number(@item.id)
  148.       when RPG::Weapon then $game_party.weapon_number(@item.id)
  149.       when RPG::Armor then $game_party.armor_number(@item.id)
  150.       end || 0
  151.       return $game_system.se_play($data_system.buzzer_se) if number == 99
  152.       $game_system.se_play($data_system.decision_se)
  153.       t = @item.is_a?(RPG::Weapon) ? 1 : @item.is_a?(RPG::Armor) ? 2 :
  154.              @item.is_a?(RPG::Item) ? 0 : -1    
  155.       lim = @buy_window.item_bought(@item)
  156.       d = (@buy_window.limited_shopping["#{t} #{@item.id}"]||{})['#3x53d323']||0
  157.       s = (!d.nil? && lim.nil? ? d - lim : d) || 99
  158.       max = price == 0 ? s : $game_party.gold / price
  159.       max =  [max, s].min if d.abs != 999999999
  160.       max = [max, 99 - number].min
  161.       max = 1 if @item.is_a?(RPG::Skill)
  162.       @buy_window.active = false
  163.       @buy_window.visible = false
  164.       @number_window.set(@item, max, price)
  165.       @number_window.active = true
  166.       @number_window.visible = true
  167.     end
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # * Frame Update (when sell window is active)
  171.   #--------------------------------------------------------------------------
  172.   def update_sell
  173.     if Input.trigger?(Input::B)
  174.       $game_system.se_play($data_system.cancel_se)
  175.       @command_window.active = true
  176.       @dummy_window.visible = true
  177.       @sell_window.active = false
  178.       @sell_window.visible = false
  179.       @status_window.item = nil
  180.       @help_window.set_text("")
  181.       @sell_window.instance_variable_set(:@gold, '')
  182.       return
  183.     end
  184.     if Input.trigger?(Input::C)
  185.       @item = @sell_window.item
  186.       @status_window.item = @item
  187.       gold = @buy_window.item_bought('Gold')
  188.       price = @item.nil? ? 0 : @item.price / 2
  189.       cond = LiTTleDRAgo::SHOP_HAS_GOLD ? gold < price : false
  190.       if @item == nil or @item.price == 0 || cond
  191.         return $game_system.se_play($data_system.buzzer_se)
  192.       end
  193.       $game_system.se_play($data_system.decision_se)
  194.       number = case @item
  195.       when RPG::Item then $game_party.item_number(@item.id)
  196.       when RPG::Weapon then $game_party.weapon_number(@item.id)
  197.       when RPG::Armor then $game_party.armor_number(@item.id)
  198.       end
  199.       max = number
  200.       @sell_window.active = false
  201.       @sell_window.visible = false
  202.       (0..max).each  {|s| @can_sell = s if s*price <= gold  }
  203.       max = [max, @can_sell].min if LiTTleDRAgo::SHOP_HAS_GOLD
  204.       @number_window.set(@item, max, price)
  205.       @number_window.active = true
  206.       @number_window.visible = true
  207.       @status_window.visible = true
  208.     end
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # * Frame Update (when quantity input window is active)
  212.   #--------------------------------------------------------------------------
  213.   def update_number
  214.     if Input.trigger?(Input::B)
  215.       $game_system.se_play($data_system.cancel_se)
  216.       @number_window.active = false
  217.       @number_window.visible = false
  218.       case @command_window.index
  219.       when 0  # buy
  220.         @buy_window.active = true
  221.         @buy_window.visible = true
  222.       when 1  # sell
  223.         @sell_window.active = true
  224.         @sell_window.visible = true
  225.         @status_window.visible = false
  226.       end
  227.       return
  228.     end
  229.     if Input.trigger?(Input::C)
  230.       $game_system.se_play($data_system.shop_se)
  231.       @number_window.active = false
  232.       @number_window.visible = false
  233.       number = @number_window.number
  234.       case @command_window.index
  235.       when 0  # buy
  236.         price = @item.is_a?(RPG::Skill) ? @item.sp_cost : @item.price if !@item.nil?
  237.         $game_party.lose_gold(number * price)
  238.         case @item
  239.         when RPG::Item : $game_party.gain_item(@item.id, number)
  240.         when RPG::Weapon : $game_party.gain_weapon(@item.id, number)
  241.         when RPG::Armor : $game_party.gain_armor(@item.id, number)
  242.         when RPG::Skill : $game_party.actors[0].learn_skill(@item.id)
  243.         end
  244.         t = @item.is_a?(RPG::Weapon) ? 1 : @item.is_a?(RPG::Armor) ? 2 :
  245.                @item.is_a?(RPG::Item) ? 0 : -1
  246.         d = (@buy_window.limited_shopping["#{t} #{@item.id}"]||{})['#3x53d323']||0
  247.         number.times {@buy_window.item_bought(@item,1)} if  d != -999999999
  248.         @buy_window.item_bought('Gold',number*price)
  249.         @gold_window.refresh
  250.         @buy_window.refresh
  251.         @status_window.refresh
  252.         @buy_window.active = true
  253.         @buy_window.visible = true
  254.       when 1  # sell
  255.         $game_party.gain_gold(number * (@item.price / 2))
  256.         case @item
  257.         when RPG::Item : $game_party.lose_item(@item.id, number)
  258.         when RPG::Weapon : $game_party.lose_weapon(@item.id, number)
  259.         when RPG::Armor : $game_party.lose_armor(@item.id, number)
  260.         end
  261.         t = @item.is_a?(RPG::Weapon) ? 1 : @item.is_a?(RPG::Armor) ? 2 :
  262.                @item.is_a?(RPG::Item) ? 0 : -1
  263.         d = (@buy_window.limited_shopping["#{t} #{@item.id}"]||{})['#3x53d323']||0
  264.         number.times {@buy_window.item_bought(@item,-1)} if  d != -999999999
  265.         @buy_window.item_bought('Gold',-number*@item.price/2)
  266.         @gold_window.refresh
  267.         @sell_window.refresh
  268.         @status_window.refresh
  269.         @sell_window.active = true
  270.         @sell_window.visible = true
  271.         @status_window.visible = false
  272.       end
  273.       return
  274.     end
  275.   end
  276. end
  277. #==============================================================================
  278. # ** Scene_Map
  279. #------------------------------------------------------------------------------
  280. #  This class performs map screen processing.
  281. #==============================================================================
  282.  
  283. class Scene_Map
  284.   alias drg1732013_update update
  285.   def update
  286.     drg1732013_update
  287.     unless $game_player.moving?
  288.       if !$limited_shop.nil?
  289.         all = []
  290.         $game_system.class.send(:attr_accessor ,:limited_shop)
  291.          $limited_shop.dup.each_pair {|t,i|
  292.            r = []
  293.            i = i.split(/,/) if i.is_a?(String)
  294.            i.collect.each {|s|
  295.               d = s[/i(\d+)/i] ? $data_items[$1.to_i]  :
  296.               s[/w(\d+)/i] ? $data_weapons[$1.to_i] :
  297.               s[/a(\d+)/i] ? $data_armors[$1.to_i] :
  298.               s[/s(\d+)/i] ? $data_skills[$1.to_i] : 0
  299.               r << d} if i.is_a?(Array)
  300.           all << r.unshift (t)}
  301.         $limited_shop_process = all
  302.         $scene = Scene_LimitedShop.new
  303.       end
  304.     end
  305.   end
  306. end
  307. #==============================================================================
  308. # ** Interpreter
  309. #------------------------------------------------------------------------------
  310. #  This interpreter runs event commands. This class is used within the
  311. #  Game_System class and the Game_Event class.
  312. #==============================================================================
  313.  
  314. class Interpreter
  315.   #--------------------------------------------------------------------------
  316.   # * limit_shop_item
  317.   #--------------------------------------------------------------------------
  318.   def limit_shop_item(shop,item,limit=nil)
  319.     $game_system.class.send(:attr_accessor ,:limited_shop)
  320.     map = [[@map_id, @event_id]]
  321.     map = shop if shop.is_a?(Array)
  322.     t = item.is_a?(RPG::Weapon) ? 1 : item.is_a?(RPG::Armor) ? 2 :
  323.         item.is_a?(RPG::Item)   ? 0 : -1
  324.     t = item.is_a?(String)     ? item : "#{t} #{item.id}"
  325.     $game_system.limited_shop = {} if $game_system.limited_shop.nil?
  326.     $game_system.limited_shop[map] = {} if $game_system.limited_shop[map].nil?
  327.     $game_system.limited_shop[map]["#{t}"] = {} if
  328.       $game_system.limited_shop[map]["#{t}"].nil?
  329.     result = $game_system.limited_shop[map]["#{t}"]
  330.     return result['Get']||0 if limit.nil?
  331.     return result['Get'] = -limit if limit.is_a?(Integer)
  332.     return result['Get'] = 999999999
  333.   end
  334. end
  335. #==============================================================================
  336. # ** Window_ShopStatus
  337. #------------------------------------------------------------------------------
  338. #  This window displays number of items in possession and the actor's equipment
  339. #  on the shop screen.
  340. #==============================================================================
  341.  
  342. class Window_ShopStatusLimited < Window_ShopStatus
  343.   #--------------------------------------------------------------------------
  344.   # * Refresh
  345.   #--------------------------------------------------------------------------
  346.   define_method(:refresh) {
  347.      @item.nil?||@item.is_a?(RPG::Skill) ? self.contents.clear : super}
  348. end
  349. #==============================================================================
  350. # ** Window_ShopBuyLimited
  351. #------------------------------------------------------------------------------
  352. #  This window displays buyable goods on the shop screen.
  353. #==============================================================================
  354.  
  355. class Window_ShopBuyLimited < Window_Selectable
  356.   #--------------------------------------------------------------------------
  357.   # * Object Initialization
  358.   #     shop_goods : goods
  359.   #--------------------------------------------------------------------------
  360.   def initialize
  361.     super(0, 128, 368, 352)
  362.     @shop_goods = $limited_shop_process.dup
  363.     @get_sold = LiTTleDRAgo::GET_SOLD_ITEM
  364.     @shop_goods.each {|s| t = s[0]
  365.       next if limited_shopping['#3x53d324']
  366.       if t == 'G'
  367.         limited_shopping['#3x53d324'] = true
  368.         item_bought('Gold',$limited_shop[t])
  369.         next
  370.       end
  371.       s.each {|i| next if i.is_a?(Integer) || !t.is_a?(Integer)
  372.         d = i.is_a?(RPG::Weapon) ? 1 :  i.is_a?(RPG::Armor) ? 2 :
  373.                i.is_a?(RPG::Item) ? 0 : -1
  374.         limited_shopping["#{d} #{i.id}"] = {} if limited_shopping["#{d} #{i.id}"].nil?
  375.         limited_shopping["#{d} #{i.id}"]['Get'] = -t
  376.         limited_shopping["#{d} #{i.id}"]['Get'] = 999999999 if t == 0}}
  377.     refresh
  378.     self.index = 0
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # * Item Acquisition
  382.   #--------------------------------------------------------------------------
  383.   def item
  384.     return @data[self.index]
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # * update_item
  388.   #--------------------------------------------------------------------------
  389.   def item_bought(item,val=nil)
  390.     t = item.is_a?(RPG::Weapon) ? 1 : item.is_a?(RPG::Armor) ? 2 :
  391.         item.is_a?(RPG::Item) ? 0 : -1
  392.     t = item.is_a?(String) ? item : "#{t} #{item.id}"
  393.     limited_shopping[t] = {} if limited_shopping[t].nil?
  394.     limited_shopping[t]['Get'] = 0 if limited_shopping[t]['Get'].nil?
  395.     return limited_shopping[t]['Get'] += val if !val.nil?
  396.     return limited_shopping[t]['Get']
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # * limited_shopping
  400.   #--------------------------------------------------------------------------
  401.   def limited_shopping
  402.     int = $game_system.map_interpreter.instance_variable_get(:@event_id)
  403.     map = $game_system.map_interpreter.instance_variable_get(:@map_id)
  404.     lin = [map,int]#,"#{$limited_shop}"]
  405.     $game_system.limited_shop = {} if $game_system.limited_shop.nil?
  406.     lim = $game_system.limited_shop[lin]
  407.     $game_system.limited_shop[lin] = {} if lim.nil?
  408.     return $game_system.limited_shop[lin]
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # * Refresh
  412.   #--------------------------------------------------------------------------
  413.   def refresh
  414.     if self.contents != nil
  415.       self.contents.dispose
  416.       self.contents = nil
  417.     end
  418.     @data = Array.new(4){[]}
  419.     limited_shopping.each_pair {|k,r| d = k.split(' ')
  420.         d.size != 2 ? next : d.map! {|s| s.to_i}
  421.         i = d[0] == 0 ? $data_items[d[1]]  : d[0] == 1 ? $data_weapons[d[1]] :
  422.             d[0] == 2 ? $data_armors[d[1]] : $data_skills[d[1]]
  423.         r.each_pair {|m,v|
  424.           next if m != 'Get' || i.nil? || (v.to_i >= 0 && v != 999999999)
  425.             r['#3x53d323']= -v    
  426.             r['#3x53d323']= -999999999 if v == 999999999 || @get_sold == 2  
  427.           @data[d[0]+1] << i }} if @get_sold != 0
  428.     @data = @data.each {|s|s.sort!{|b,c|b.id<=>c.id}}.flatten.collect {|s|s}
  429.     @item_max = @data.size
  430.     return unless @item_max > 0
  431.     self.contents = Bitmap.new(width - 32, row_max * 32)
  432.     @data.each_index {|i| draw_item(i)}
  433.   end
  434.   #--------------------------------------------------------------------------
  435.   # * Draw Item
  436.   #     index : item number
  437.   #--------------------------------------------------------------------------
  438.   def draw_item(index)
  439.     item = @data[index]
  440.     t = item.is_a?(RPG::Weapon) ? 1 : item.is_a?(RPG::Armor) ? 2 :
  441.         item.is_a?(RPG::Item)   ? 0 : -1
  442.     number = case t
  443.     when 0 : $game_party.item_number(item.id)
  444.     when 1 : $game_party.weapon_number(item.id)
  445.     when 2 : $game_party.armor_number(item.id)
  446.     end || 0
  447.     can_buy = (limited_shopping["#{t} #{item.id}"]||{})['#3x53d323']||0
  448.     can_buy = '-' if can_buy <= 0
  449.     price = item.is_a?(RPG::Skill) ? item.sp_cost : item.price
  450.     s = (price <= $game_party.gold && number < 99)
  451.     self.contents.font.color = s ? normal_color : disabled_color
  452.     pos = [4,index * 32]
  453.     rect = Rect.new(pos[0],pos[1], self.width - 32, 32)
  454.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  455.     bit = RPG::Cache.icon(item.icon_name)
  456.     opc = self.contents.font.color == normal_color ? 255 : 128
  457.     self.contents.blt(pos[0], pos[1]+4, bit, Rect.new(0, 0, 24, 24), opc)
  458.     self.contents.draw_text(pos[0]+28, pos[1], 212, 32, item.name, 0)
  459.     self.contents.draw_text(pos[0]+240, pos[1], 88, 32, price.to_s, 2)
  460.     self.contents.draw_text(pos[0]+180, pos[1], 88, 32, can_buy.to_s, 2)
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # * Help Text Update
  464.   #--------------------------------------------------------------------------
  465.   def update_help
  466.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  467.   end
  468. end
  469. #==============================================================================
  470. # ** Window_ShopSellLimited
  471. #------------------------------------------------------------------------------
  472. #  This window displays items in possession for selling on the shop screen.
  473. #==============================================================================
  474.  
  475. class Window_ShopSellLimited < Window_ShopSell
  476.   #--------------------------------------------------------------------------
  477.   # * update_item
  478.   #--------------------------------------------------------------------------
  479.   def item_bought(item,val=nil)
  480.     t = item.is_a?(RPG::Weapon) ? 1 : item.is_a?(RPG::Armor) ? 2 :
  481.         item.is_a?(RPG::Item) ? 0 : -1
  482.     t = item.is_a?(String) ? item : "#{t} #{item.id}"
  483.     limited_shopping[t] = {} if limited_shopping[t].nil?
  484.     limited_shopping[t]['Get'] = 0 if limited_shopping[t].nil?
  485.     return limited_shopping[t]['Get'] += val if !val.nil?
  486.     return limited_shopping[t]['Get']
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # * limited_shopping
  490.   #--------------------------------------------------------------------------
  491.   def limited_shopping
  492.     int = $game_system.map_interpreter.instance_variable_get(:@event_id)
  493.     map = $game_system.map_interpreter.instance_variable_get(:@map_id)
  494.     lin = [map,int]#,"#{$limited_shop}"]
  495.     $game_system.limited_shop = {} if $game_system.limited_shop.nil?
  496.     lim = $game_system.limited_shop[lin]
  497.     $game_system.limited_shop[lin] = {} if lim.nil?
  498.     return $game_system.limited_shop[lin]
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # * Draw Item
  502.   #     index : item number
  503.   #--------------------------------------------------------------------------
  504.   def draw_item(index)
  505.     item = @data[index]
  506.     t = item.is_a?(RPG::Weapon) ? 1 : item.is_a?(RPG::Armor) ? 2 :
  507.            item.is_a?(RPG::Item) ? 0 : -1
  508.     number = case t
  509.     when 0 : $game_party.item_number(item.id)
  510.     when 1 : $game_party.weapon_number(item.id)
  511.     when 2 : $game_party.armor_number(item.id)
  512.     end || 0
  513.     gold = item_bought('Gold')
  514.     gold = gold >= item.price/2 if LiTTleDRAgo::SHOP_HAS_GOLD
  515.     gold = (item.price>0&&gold)
  516.     self.contents.font.color = gold ? normal_color : disabled_color
  517.     pos = [4 + index % 2 * (288 + 32),index / 2 * 32]
  518.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  519.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  520.     bit = RPG::Cache.icon(item.icon_name)
  521.     opc = self.contents.font.color == normal_color ? 255 : 128
  522.     self.contents.blt(pos[0], pos[1]+4, bit, Rect.new(0, 0, 24, 24), opc)
  523.     self.contents.draw_text(pos[0]+28, pos[1], 212, 32, item.name, 0)
  524.     self.contents.draw_text(pos[0]+240, pos[1], 16, 32, ":", 1)
  525.     self.contents.draw_text(pos[0]+256, pos[1], 24, 32, number.to_s, 2)
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # * Help Text Update
  529.   #--------------------------------------------------------------------------
  530.   def update_help
  531.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  532.     return if @gold == item_bought('Gold') && @old_item == self.item
  533.     return unless LiTTleDRAgo::SHOP_HAS_GOLD
  534.     @old_item = self.item
  535.     @gold = item_bought('Gold')
  536.     s = @help_window.width - 40
  537.     @help_window.contents.fill_rect(Rect.new(420,0,s,32),Color.new(0,0,0,0))
  538.     @help_window.contents.font.size -= 4
  539.     @help_window.contents.draw_text(420, 0, s, 32, "Shop's Gold", 0)
  540.     @help_window.contents.draw_text(4, 0, s, 32, item_bought('Gold').to_s, 2)
  541.     @help_window.contents.font.size += 4
  542.   end
  543. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement